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);
1791 First, Count, StartLoc, LParenLoc, FirstLoc, CountLoc, EndLoc);
1827 Kind, KindKwLoc, VCKind, VCLoc, StartLoc, LParenLoc, EndLoc);
1840 Kind, KindKwLoc, StartLoc, LParenLoc, EndLoc);
1853 M1, M2, Kind, ChunkSize, StartLoc, LParenLoc, M1Loc, M2Loc, KindLoc,
1904 VarList, LPKind, LPKindLoc, ColonLoc, StartLoc, LParenLoc, EndLoc);
1932 VarList, {Modifier, OriginalSharingModifier}, StartLoc, LParenLoc,
1933 ModifierLoc, ColonLoc, EndLoc, ReductionIdScopeSpec, ReductionId,
1934 UnresolvedReductions);
1948 VarList, StartLoc, LParenLoc, ColonLoc, EndLoc, ReductionIdScopeSpec,
1949 ReductionId, UnresolvedReductions);
1964 VarList, StartLoc, LParenLoc, ColonLoc, EndLoc, ReductionIdScopeSpec,
1965 ReductionId, UnresolvedReductions);
1978 VarList, Step, StartLoc, LParenLoc, Modifier, ModifierLoc, ColonLoc,
1979 StepModifierLoc, EndLoc);
1992 VarList, Alignment, StartLoc, LParenLoc, ColonLoc, EndLoc);
2052 Data, DepModifier, VarList, StartLoc, LParenLoc, EndLoc);
2065 Modifier,
Device, StartLoc, LParenLoc, ModifierLoc, EndLoc);
2080 IteratorModifier, MapTypeModifiers, MapTypeModifiersLoc,
2081 MapperIdScopeSpec, MapperId, MapType, IsMapTypeImplicit, MapLoc,
2082 ColonLoc, VarList, Locs,
2083 false, UnresolvedMappers);
2100 Allocate, Alignment, FirstModifier, FirstModifierLoc, SecondModifier,
2101 SecondModifierLoc, VarList, StartLoc, LParenLoc, ColonLoc, EndLoc);
2149 Modifier,
Device, StartLoc, LParenLoc, ModifierLoc, EndLoc);
2162 Modifier, NumTasks, StartLoc, LParenLoc, ModifierLoc, EndLoc);
2197 Kind, ChunkSize, StartLoc, LParenLoc, KindLoc, CommaLoc, EndLoc);
2212 MotionModifiers, MotionModifiersLoc, MapperIdScopeSpec, MapperId,
2213 ColonLoc, VarList, Locs, UnresolvedMappers);
2228 MotionModifiers, MotionModifiersLoc, MapperIdScopeSpec, MapperId,
2229 ColonLoc, VarList, Locs, UnresolvedMappers);
2280 M, Kind, StartLoc, LParenLoc, MLoc, KindLoc, EndLoc);
2327 StartLoc, LParenLoc, EndLoc,
Data);
2340 StartLoc, LParenLoc, ColonLoc, EndLoc, Modifier, Locators);
2352 Modifier, Kind, StartLoc, LParenLoc, ModifierKwLoc, KindKwLoc, EndLoc);
2365 InteropVar, InteropInfo, StartLoc, LParenLoc, VarLoc, EndLoc);
2376 LParenLoc, VarLoc, EndLoc);
2388 InteropVar, StartLoc, LParenLoc, VarLoc, EndLoc);
2527 DepType, DepLoc, ColonLoc, VarList, StartLoc, LParenLoc, EndLoc);
2575 ForLoc, Element, Collection, RParenLoc);
2593 StartLoc, IdLoc, Id);
2630 if (
DeclStmt *RangeStmt = dyn_cast<DeclStmt>(Range)) {
2631 if (RangeStmt->isSingleDecl()) {
2632 if (
VarDecl *RangeVar = dyn_cast<VarDecl>(RangeStmt->getSingleDecl())) {
2633 if (RangeVar->isInvalidDecl())
2636 Expr *RangeExpr = RangeVar->getInit();
2643 diag::err_objc_for_range_init_stmt)
2644 <<
Init->getSourceRange();
2647 ForLoc, LoopVar, RangeExpr, RParenLoc);
2654 ForLoc, CoawaitLoc,
Init, ColonLoc, Range, Begin, End,
Cond, Inc,
2668 QualifierLoc, NameInfo, Nested);
2730 SS.
Adopt(QualifierLoc);
2842 if (IsOMPArraySection)
2844 Base, LBracketLoc, LowerBound, ColonLocFirst, ColonLocSecond, Length,
2845 Stride, RBracketLoc);
2847 assert(Stride ==
nullptr && !ColonLocSecond.
isValid() &&
2848 "Stride/second colon not allowed for OpenACC");
2851 Base, LBracketLoc, LowerBound, ColonLocFirst, Length, RBracketLoc);
2863 Base, LParenLoc, RParenLoc, Dims, BracketsRanges);
2875 nullptr, IteratorKwLoc, LLoc, RLoc,
Data);
2885 Expr *ExecConfig =
nullptr) {
2887 nullptr, Callee, LParenLoc, Args, RParenLoc, ExecConfig);
2894 nullptr, Callee, LParenLoc, Args, RParenLoc);
2912 if (!
Member->getDeclName()) {
2916 assert(
Member->getType()->isRecordType() &&
2917 "unnamed member not of record type?");
2930 if (!isArrow &&
Base->isPRValue()) {
2945 SS.
Adopt(QualifierLoc);
2948 if (
Base->containsErrors())
2953 if (isArrow && !BaseType->isPointerType())
2962 if (
getSema().isUnevaluatedContext() &&
Base->isImplicitCXXThis() &&
2967 ->getAsCXXRecordDecl()) {
2971 if (!ThisClass->Equals(
Class) && !ThisClass->isDerivedFrom(
Class))
2979 FirstQualifierInScope,
2980 R, ExplicitTemplateArgs,
2990 bool ForFoldExpression =
false) {
3068 return SemaRef.BuildInitList(LBraceLoc, Inits, RBraceLoc);
3081 =
SemaRef.ActOnDesignatedInitializer(Desig, EqualOrColonLoc, GNUSyntax,
3121 unsigned NumUserSpecifiedExprs,
3126 InitLoc, LParenLoc, RParenLoc);
3156 return SemaRef.ActOnChooseExpr(BuiltinLoc,
3168 Expr *ControllingExpr,
3173 ControllingExpr, Types, Exprs);
3188 ControllingType, Types, Exprs);
3221 case Stmt::CXXStaticCastExprClass:
3222 return getDerived().RebuildCXXStaticCastExpr(OpLoc, LAngleLoc, TInfo,
3223 RAngleLoc, LParenLoc,
3224 SubExpr, RParenLoc);
3226 case Stmt::CXXDynamicCastExprClass:
3227 return getDerived().RebuildCXXDynamicCastExpr(OpLoc, LAngleLoc, TInfo,
3228 RAngleLoc, LParenLoc,
3229 SubExpr, RParenLoc);
3231 case Stmt::CXXReinterpretCastExprClass:
3232 return getDerived().RebuildCXXReinterpretCastExpr(OpLoc, LAngleLoc, TInfo,
3233 RAngleLoc, LParenLoc,
3237 case Stmt::CXXConstCastExprClass:
3238 return getDerived().RebuildCXXConstCastExpr(OpLoc, LAngleLoc, TInfo,
3239 RAngleLoc, LParenLoc,
3240 SubExpr, RParenLoc);
3242 case Stmt::CXXAddrspaceCastExprClass:
3243 return getDerived().RebuildCXXAddrspaceCastExpr(
3244 OpLoc, LAngleLoc, TInfo, RAngleLoc, LParenLoc, SubExpr, RParenLoc);
3247 llvm_unreachable(
"Invalid C++ named cast");
3325 OpLoc, tok::kw_addrspace_cast, TInfo, SubExpr,
3337 bool ListInitialization) {
3341 if (
auto *PLE = dyn_cast<ParenListExpr>(Sub))
3343 TInfo, LParenLoc,
MultiExprArg(PLE->getExprs(), PLE->getNumExprs()),
3344 RParenLoc, ListInitialization);
3346 if (
auto *PLE = dyn_cast<CXXParenListInitExpr>(Sub))
3348 TInfo, LParenLoc, PLE->getInitExprs(), RParenLoc, ListInitialization);
3352 ListInitialization);
3416 if (
getSema().CheckCXXThisType(ThisLoc, ThisType))
3426 bool IsThrownVariableInScope) {
3436 Expr *RewrittenExpr) {
3438 RewrittenExpr,
getSema().CurContext);
3472 std::optional<Expr *> ArraySize,
3491 bool IsGlobalDelete,
3542 bool IsAddressOfOperand,
3545 SS.
Adopt(QualifierLoc);
3547 if (TemplateArgs || TemplateKWLoc.
isValid())
3549 SS, TemplateKWLoc, NameInfo, TemplateArgs, IsAddressOfOperand);
3552 SS, NameInfo, IsAddressOfOperand, RecoveryTSI);
3574 bool IsElidable,
MultiExprArg Args,
bool HadMultipleCandidates,
3575 bool ListInitialization,
bool StdInitListInitialization,
3582 FoundCtor =
Constructor->getInheritedConstructor().getConstructor();
3585 if (
getSema().CompleteConstructorCall(FoundCtor,
T, Args, Loc,
3592 HadMultipleCandidates,
3594 StdInitListInitialization,
3595 RequiresZeroInit, ConstructKind,
3603 bool ConstructsVBase,
3604 bool InheritedFromVBase) {
3606 Loc,
T,
Constructor, ConstructsVBase, InheritedFromVBase);
3617 bool ListInitialization) {
3619 TSInfo, LParenOrBraceLoc, Args, RParenOrBraceLoc, ListInitialization);
3630 bool ListInitialization) {
3632 RParenLoc, ListInitialization);
3649 SS.
Adopt(QualifierLoc);
3651 return SemaRef.BuildMemberReferenceExpr(BaseE, BaseType,
3652 OperatorLoc, IsArrow,
3654 FirstQualifierInScope,
3656 TemplateArgs,
nullptr);
3672 SS.
Adopt(QualifierLoc);
3674 return SemaRef.BuildMemberReferenceExpr(BaseE, BaseType,
3675 OperatorLoc, IsArrow,
3677 FirstQualifierInScope,
3678 R, TemplateArgs,
nullptr);
3686 return SemaRef.BuildCXXNoexceptExpr(Range.getBegin(), Arg, Range.getEnd());
3699 RParenLoc, Length, PartialArgs);
3704 Expr *PackIdExpression,
Expr *IndexExpr,
3706 bool FullySubstituted =
false) {
3708 IndexExpr, RSquareLoc, ExpandedExprs,
3734 NamedConcept, TALI);
3752 LocalParameters, RParenLoc, Requirements,
3759 return SemaRef.BuildTypeRequirement(SubstDiag);
3763 return SemaRef.BuildTypeRequirement(
T);
3771 return SemaRef.BuildExprRequirement(SubstDiag, IsSimple, NoexceptLoc,
3778 return SemaRef.BuildExprRequirement(E, IsSimple, NoexceptLoc,
3785 return SemaRef.BuildNestedRequirement(InvalidConstraintEntity,
3790 return SemaRef.BuildNestedRequirement(Constraint);
3806 Expr **Elements,
unsigned NumElements) {
3816 RB,
Base, Key, getterMethod, setterMethod);
3835 return SemaRef.ObjC().BuildObjCEncodeExpression(AtLoc, EncodeTypeInfo,
3847 return SemaRef.ObjC().BuildClassMessage(
3848 ReceiverTypeInfo, ReceiverTypeInfo->
getType(),
3861 return SemaRef.ObjC().BuildInstanceMessage(Receiver, Receiver->
getType(),
3864 SelectorLocs, RBracLoc, Args);
3876 return Method->isInstanceMethod()
3877 ?
SemaRef.ObjC().BuildInstanceMessage(
3878 nullptr, SuperType, SuperLoc, Sel,
Method, LBracLoc,
3879 SelectorLocs, RBracLoc, Args)
3880 :
SemaRef.ObjC().BuildClassMessage(
nullptr, SuperType, SuperLoc,
3882 SelectorLocs, RBracLoc, Args);
3891 bool IsArrow,
bool IsFreeIvar) {
3900 if (IsFreeIvar &&
Result.isUsable())
3937 PropertyLoc,
Base));
3966 =
SemaRef.Context.Idents.get(
"__builtin_shufflevector");
3969 assert(!Lookup.
empty() &&
"No __builtin_shufflevector?");
3977 Callee =
SemaRef.ImpCastExprToType(Callee, CalleePtrTy,
3978 CK_BuiltinFnToFnPtr).get();
3994 return SemaRef.ConvertVectorExpr(SrcExpr, DstTInfo, BuiltinLoc, RParenLoc);
4009 EllipsisLoc, NumExpansions);
4033 llvm_unreachable(
"Pack expansion pattern has no parameter packs");
4069 EllipsisLoc, RHS, RParenLoc,
4078 Init->containsUnexpandedParameterPack();
4079 else if (PVD->hasUninstantiatedDefaultArg())
4081 PVD->getUninstantiatedDefaultArg()
4082 ->containsUnexpandedParameterPack();
4236 Exprs.push_back(DevNumExpr);
4237 llvm::append_range(Exprs, QueueIdExprs);
4281 ObjectType, FirstQualifierInScope);
4287 QualType TransformDependentNameType(TypeLocBuilder &TLB,
4288 DependentNameTypeLoc TL,
4289 bool DeducibleTSTContext,
4290 QualType ObjectType = QualType(),
4291 NamedDecl *UnqualLookup =
nullptr);
4294 TransformOpenACCClauseList(OpenACCDirectiveKind DirKind,
4299 OpenACCDirectiveKind DirKind,
4300 const OpenACCClause *OldClause);
4303template <
typename Derived>
4313#define STMT(Node, Parent) \
4314 case Stmt::Node##Class: return getDerived().Transform##Node(cast<Node>(S));
4315#define VALUESTMT(Node, Parent) \
4316 case Stmt::Node##Class: \
4317 return getDerived().Transform##Node(cast<Node>(S), SDK);
4318#define ABSTRACT_STMT(Node)
4319#define EXPR(Node, Parent)
4320#include "clang/AST/StmtNodes.inc"
4323#define STMT(Node, Parent)
4324#define ABSTRACT_STMT(Stmt)
4325#define EXPR(Node, Parent) case Stmt::Node##Class:
4326#include "clang/AST/StmtNodes.inc"
4331 E =
getSema().ActOnStmtExprResult(E);
4339template<
typename Derived>
4347#define GEN_CLANG_CLAUSE_CLASS
4348#define CLAUSE_CLASS(Enum, Str, Class) \
4350 return getDerived().Transform##Class(cast<Class>(S));
4351#include "llvm/Frontend/OpenMP/OMP.inc"
4358template<
typename Derived>
4365#define STMT(Node, Parent) case Stmt::Node##Class: break;
4366#define ABSTRACT_STMT(Stmt)
4367#define EXPR(Node, Parent) \
4368 case Stmt::Node##Class: return getDerived().Transform##Node(cast<Node>(E));
4369#include "clang/AST/StmtNodes.inc"
4375template<
typename Derived>
4383 if (
auto *FE = dyn_cast<FullExpr>(
Init))
4384 Init = FE->getSubExpr();
4386 if (
auto *AIL = dyn_cast<ArrayInitLoopExpr>(
Init)) {
4392 Init = MTE->getSubExpr();
4395 Init = Binder->getSubExpr();
4398 Init = ICE->getSubExprAsWritten();
4401 dyn_cast<CXXStdInitializerListExpr>(
Init))
4438 getSema().currentEvaluationContext().InLifetimeExtendingContext =
4439 getSema().parentEvaluationContext().InLifetimeExtendingContext;
4440 getSema().currentEvaluationContext().RebuildDefaultArgOrDefaultInit =
4441 getSema().parentEvaluationContext().RebuildDefaultArgOrDefaultInit;
4443 bool ArgChanged =
false;
4445 true, NewArgs, &ArgChanged))
4455 if (
Parens.isInvalid()) {
4458 assert(NewArgs.empty() &&
4459 "no parens or braces but have direct init with arguments?");
4466template<
typename Derived>
4472 for (
unsigned I = 0; I != NumInputs; ++I) {
4482 Expr *Pattern = Expansion->getPattern();
4485 getSema().collectUnexpandedParameterPacks(Pattern, Unexpanded);
4486 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
4491 bool RetainExpansion =
false;
4492 UnsignedOrNone OrigNumExpansions = Expansion->getNumExpansions();
4496 Unexpanded,
true, Expand,
4497 RetainExpansion, NumExpansions))
4510 Expansion->getEllipsisLoc(),
4512 if (Out.isInvalid())
4517 Outputs.push_back(Out.get());
4523 if (ArgChanged) *ArgChanged =
true;
4527 for (
unsigned I = 0; I != *NumExpansions; ++I) {
4530 if (Out.isInvalid())
4533 if (Out.get()->containsUnexpandedParameterPack()) {
4535 Out.get(), Expansion->getEllipsisLoc(), OrigNumExpansions);
4536 if (Out.isInvalid())
4540 Outputs.push_back(Out.get());
4545 if (RetainExpansion) {
4546 ForgetPartiallySubstitutedPackRAII Forget(
getDerived());
4549 if (Out.isInvalid())
4553 Out.get(), Expansion->getEllipsisLoc(), OrigNumExpansions);
4554 if (Out.isInvalid())
4557 Outputs.push_back(Out.get());
4564 IsCall ?
getDerived().TransformInitializer(Inputs[I],
false)
4569 if (
Result.get() != Inputs[I] && ArgChanged)
4572 Outputs.push_back(
Result.get());
4578template <
typename Derived>
4589 VarDecl *ConditionVar = cast_or_null<VarDecl>(
4595 return getSema().ActOnConditionVariable(ConditionVar, Loc, Kind);
4604 return getSema().ActOnCondition(
nullptr, Loc, CondExpr.
get(), Kind,
4611template <
typename Derived>
4619 Qualifier = Qualifier.getAsNamespaceAndPrefix().Prefix)
4631 llvm_unreachable(
"unexpected null nested name specifier");
4662 QualifierLoc =
getDerived().TransformNestedNameSpecifierLoc(
4663 QualifierLoc, ObjectType, FirstQualifierInScope);
4667 FirstQualifierInScope =
nullptr;
4669 SS.
Adopt(QualifierLoc);
4673 if (
SemaRef.BuildCXXNestedNameSpecifier(
nullptr, IdInfo,
4675 FirstQualifierInScope,
false))
4683 T = TransformTypeInObjectScope(TLB, TL, ObjectType,
4684 FirstQualifierInScope);
4690 if (
T->isDependentType() ||
T->isRecordType() ||
4691 (
SemaRef.getLangOpts().CPlusPlus11 &&
T->isEnumeralType())) {
4692 if (
T->isEnumeralType())
4694 diag::warn_cxx98_compat_enum_nested_name_spec);
4701 if (!TTL || !TTL.
getDecl()->isInvalidDecl()) {
4725template<
typename Derived>
4745 TemplateDecl *NewTemplate = cast_or_null<TemplateDecl>(
4752 SemaRef.Context.DeclarationNames.getCXXDeductionGuideName(NewTemplate));
4762 NewTInfo =
getDerived().TransformType(OldTInfo);
4765 NewCanTy =
SemaRef.Context.getCanonicalType(NewTInfo->
getType());
4773 NewCanTy =
SemaRef.Context.getCanonicalType(NewT);
4786 llvm_unreachable(
"Unknown name kind.");
4789template <
typename Derived>
4793 QualType ObjectType,
bool AllowInjectedClassName) {
4795 return getDerived().RebuildTemplateName(SS, TemplateKWLoc, *II, NameLoc,
4796 ObjectType, AllowInjectedClassName);
4798 NameLoc, ObjectType,
4799 AllowInjectedClassName);
4802template <
typename Derived>
4806 NamedDecl *FirstQualifierInScope,
bool AllowInjectedClassName) {
4808 TemplateName UnderlyingName = QTN->getUnderlyingTemplate();
4811 QualifierLoc =
getDerived().TransformNestedNameSpecifierLoc(
4812 QualifierLoc, ObjectType, FirstQualifierInScope);
4819 UnderlyingQualifier, TemplateKWLoc, UnderlyingName, NameLoc, ObjectType,
4820 FirstQualifierInScope, AllowInjectedClassName);
4821 if (NewUnderlyingName.
isNull())
4823 assert(!UnderlyingQualifier &&
"unexpected qualifier");
4827 NewUnderlyingName == UnderlyingName)
4830 SS.
Adopt(QualifierLoc);
4831 return getDerived().RebuildTemplateName(SS, QTN->hasTemplateKeyword(),
4837 QualifierLoc =
getDerived().TransformNestedNameSpecifierLoc(
4838 QualifierLoc, ObjectType, FirstQualifierInScope);
4852 SS.
Adopt(QualifierLoc);
4853 return getDerived().RebuildTemplateName(SS, TemplateKWLoc, DTN->getName(),
4854 NameLoc, ObjectType,
4855 AllowInjectedClassName);
4860 assert(!QualifierLoc &&
"Unexpected qualified SubstTemplateTemplateParm");
4867 ReplacementQualifierLoc = Builder.getWithLocInContext(
SemaRef.Context);
4871 ReplacementQualifierLoc, TemplateKWLoc, ReplacementName, NameLoc,
4872 ObjectType, FirstQualifierInScope, AllowInjectedClassName);
4875 Decl *AssociatedDecl =
4876 getDerived().TransformDecl(NameLoc, S->getAssociatedDecl());
4878 AssociatedDecl == S->getAssociatedDecl())
4880 return SemaRef.Context.getSubstTemplateTemplateParm(
4881 NewName, AssociatedDecl, S->getIndex(), S->getPackIndex(),
4886 "DeducedTemplateName should not escape partial ordering");
4890 assert(!QualifierLoc &&
"Unexpected qualifier");
4897 assert(!QualifierLoc &&
4898 "Unexpected qualified SubstTemplateTemplateParmPack");
4900 SubstPack->getArgumentPack(), SubstPack->getAssociatedDecl(),
4901 SubstPack->getIndex(), SubstPack->getFinal());
4905 llvm_unreachable(
"overloaded function decl survived to here");
4908template <
typename Derived>
4913 QualifierLoc, TemplateKeywordLoc, Name, NameLoc);
4919template<
typename Derived>
4923 Output =
getSema().getTrivialTemplateArgumentLoc(
4927template <
typename Derived>
4935 llvm_unreachable(
"Unexpected TemplateArgument");
4958 if (NewT ==
T && D == NewD)
4975 llvm_unreachable(
"unexpected template argument kind");
5007 llvm_unreachable(
"Caller should expand pack expansions");
5023 E =
SemaRef.ActOnConstantExpression(E);
5038template<
typename Derived,
typename InputIterator>
5046 typedef typename std::iterator_traits<InputIterator>::difference_type
5061 : Self(Self), Iter(Iter) { }
5076 Self.InventTemplateArgumentLoc(*Iter,
Result);
5084 return X.Iter == Y.Iter;
5089 return X.Iter != Y.Iter;
5093template<
typename Derived>
5094template<
typename InputIterator>
5114 PackLocIterator(*
this, In.getArgument().pack_begin()),
5115 PackLocIterator(*
this, In.getArgument().pack_end()), *PackOutput,
5122 if (In.getArgument().isPackExpansion()) {
5134 std::optional<ForgetSubstitutionRAII> ForgetSubst;
5144 if (Out.getArgument().containsUnexpandedParameterPack()) {
5147 if (Out.getArgument().isNull())
5157 ForgetPartiallySubstitutedPackRAII Forget(
getDerived());
5165 if (Out.getArgument().isNull())
5185template <
typename Derived>
5196 Pattern =
getSema().getTemplateArgumentPackExpansionPattern(
5199 getSema().collectUnexpandedParameterPacks(Pattern, Unexpanded);
5200 if (IsLateExpansionAttempt) {
5205 return P.first.dyn_cast<
const SubstBuiltinTemplatePackType *>();
5207 if (!SawPackTypes) {
5212 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
5220 Info.
Ellipsis, Pattern.getSourceRange(), Unexpanded,
5226 if (ComputeInfo(In,
false, Info, Pattern))
5238 std::optional<Sema::ArgPackSubstIndexRAII> SubstIndex(
5239 std::in_place,
getSema(), std::nullopt);
5245 if (Out.getArgument().isNull())
5282 ForgetSubstitutionRAII ForgetSubst(
getDerived());
5283 if (ComputeInfo(Out,
true, Info, OutPattern))
5296template<
typename Derived>
5314template<
typename Derived>
5334template<
typename Derived>
5337 switch (
T.getTypeLocClass()) {
5338#define ABSTRACT_TYPELOC(CLASS, PARENT)
5339#define TYPELOC(CLASS, PARENT) \
5340 case TypeLoc::CLASS: \
5341 return getDerived().Transform##CLASS##Type(TLB, \
5342 T.castAs<CLASS##TypeLoc>());
5343#include "clang/AST/TypeLocNodes.def"
5346 llvm_unreachable(
"unhandled type loc!");
5349template<
typename Derived>
5362template<
typename Derived>
5400template<
typename Derived>
5405 TypeLoc UnqualTL =
T.getUnqualifiedLoc();
5406 auto SuppressObjCLifetime =
5407 T.getType().getLocalQualifiers().hasObjCLifetime();
5409 Result = getDerived().TransformTemplateTypeParmType(TLB, TTP,
5410 SuppressObjCLifetime);
5411 }
else if (
auto STTP = UnqualTL.
getAs<SubstTemplateTypeParmPackTypeLoc>()) {
5412 Result = getDerived().TransformSubstTemplateTypeParmPackType(
5413 TLB, STTP, SuppressObjCLifetime);
5415 Result = getDerived().TransformType(TLB, UnqualTL);
5434template <
typename Derived>
5444 SemaRef.Diag(Loc, diag::err_address_space_mismatch_templ_inst)
5451 if (
T.getPointerAuth().isPresent()) {
5452 SemaRef.Diag(Loc, diag::err_ptrauth_qualifier_redundant) << TL.
getType();
5455 if (!
T->isDependentType()) {
5456 if (!
T->isSignableType(
SemaRef.getASTContext())) {
5457 SemaRef.Diag(Loc, diag::err_ptrauth_qualifier_invalid_target) <<
T;
5465 if (
T->isFunctionType()) {
5466 T =
SemaRef.getASTContext().getAddrSpaceQualType(
T,
5476 if (
T->isReferenceType()) {
5486 if (!
T->isObjCLifetimeType() && !
T->isDependentType())
5488 else if (
T.getObjCLifetime()) {
5492 const AutoType *AutoTy;
5493 if ((AutoTy = dyn_cast<AutoType>(
T)) && AutoTy->isDeduced()) {
5495 QualType Deduced = AutoTy->getDeducedType();
5500 T =
SemaRef.Context.getAutoType(Deduced, AutoTy->getKeyword(),
5503 AutoTy->getTypeConstraintConcept(),
5504 AutoTy->getTypeConstraintArguments());
5509 SemaRef.Diag(Loc, diag::err_attr_objc_ownership_redundant) <<
T;
5515 return SemaRef.BuildQualifiedType(
T, Loc, Quals);
5518template <
typename Derived>
5519QualType TreeTransform<Derived>::TransformTypeInObjectScope(
5522 assert(!getDerived().AlreadyTransformed(TL.
getType()));
5525 case TypeLoc::TemplateSpecialization:
5526 return getDerived().TransformTemplateSpecializationType(
5528 FirstQualifierInScope,
true);
5529 case TypeLoc::DependentName:
5530 return getDerived().TransformDependentNameType(
5532 ObjectType, FirstQualifierInScope);
5536 return getDerived().TransformType(TLB, TL);
5540template <
class TyLoc>
static inline
5542 TyLoc NewT = TLB.
push<TyLoc>(
T.getType());
5543 NewT.setNameLoc(
T.getNameLoc());
5547template<
typename Derived>
5548QualType TreeTransform<Derived>::TransformBuiltinType(TypeLocBuilder &TLB,
5550 BuiltinTypeLoc NewT = TLB.push<BuiltinTypeLoc>(T.getType());
5551 NewT.setBuiltinLoc(T.getBuiltinLoc());
5552 if (T.needsExtraLocalData())
5553 NewT.getWrittenBuiltinSpecs() = T.getWrittenBuiltinSpecs();
5557template<
typename Derived>
5564template <
typename Derived>
5568 return getDerived().
TransformType(TLB, TL.getOriginalLoc());
5571template<
typename Derived>
5574 QualType OriginalType = getDerived().TransformType(TLB, TL.getOriginalLoc());
5575 if (OriginalType.isNull())
5579 if (getDerived().AlwaysRebuild() ||
5580 OriginalType != TL.getOriginalLoc().getType())
5587template <
typename Derived>
5591 QualType OriginalType = getDerived().TransformType(TLB, TL.getElementLoc());
5592 if (OriginalType.isNull())
5596 if (getDerived().AlwaysRebuild() ||
5597 OriginalType != TL.getElementLoc().getType())
5604template<
typename Derived>
5608 = getDerived().TransformType(TLB, TL.getPointeeLoc());
5609 if (PointeeType.isNull())
5613 if (PointeeType->getAs<ObjCObjectType>()) {
5625 if (getDerived().AlwaysRebuild() ||
5626 PointeeType != TL.getPointeeLoc().getType()) {
5627 Result = getDerived().RebuildPointerType(PointeeType, TL.getSigilLoc());
5634 TLB.TypeWasModifiedSafely(
Result->getPointeeType());
5641template<
typename Derived>
5646 = getDerived().TransformType(TLB, TL.getPointeeLoc());
5647 if (PointeeType.isNull())
5651 if (getDerived().AlwaysRebuild() ||
5652 PointeeType != TL.getPointeeLoc().getType()) {
5653 Result = getDerived().RebuildBlockPointerType(PointeeType,
5668template<
typename Derived>
5676 if (PointeeType.
isNull())
5681 PointeeType !=
T->getPointeeTypeAsWritten()) {
5683 T->isSpelledAsLValue(),
5705template<
typename Derived>
5709 return TransformReferenceType(TLB, TL);
5712template<
typename Derived>
5714TreeTransform<Derived>::TransformRValueReferenceType(TypeLocBuilder &TLB,
5715 RValueReferenceTypeLoc TL) {
5716 return TransformReferenceType(TLB, TL);
5719template<
typename Derived>
5723 QualType PointeeType = getDerived().TransformType(TLB, TL.getPointeeLoc());
5724 if (PointeeType.isNull())
5731 getDerived().TransformNestedNameSpecifierLoc(OldQualifierLoc);
5732 if (!NewQualifierLoc)
5735 CXXRecordDecl *OldCls =
T->getMostRecentCXXRecordDecl(), *NewCls =
nullptr;
5737 NewCls = cast_or_null<CXXRecordDecl>(
5738 getDerived().TransformDecl(TL.getStarLoc(), OldCls));
5744 if (getDerived().AlwaysRebuild() || PointeeType !=
T->getPointeeType() ||
5745 NewQualifierLoc.getNestedNameSpecifier() !=
5746 OldQualifierLoc.getNestedNameSpecifier() ||
5749 SS.
Adopt(NewQualifierLoc);
5750 Result = getDerived().RebuildMemberPointerType(PointeeType, SS, NewCls,
5759 if (MPT && PointeeType != MPT->getPointeeType()) {
5766 NewTL.setQualifierLoc(NewQualifierLoc);
5771template<
typename Derived>
5776 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
5777 if (ElementType.isNull())
5781 Expr *OldSize = TL.getSizeExpr();
5783 OldSize =
const_cast<Expr*
>(
T->getSizeExpr());
5784 Expr *NewSize =
nullptr;
5788 NewSize = getDerived().TransformExpr(OldSize).template getAs<Expr>();
5793 if (getDerived().AlwaysRebuild() ||
5794 ElementType !=
T->getElementType() ||
5795 (
T->getSizeExpr() && NewSize != OldSize)) {
5796 Result = getDerived().RebuildConstantArrayType(ElementType,
5797 T->getSizeModifier(),
5798 T->getSize(), NewSize,
5799 T->getIndexTypeCVRQualifiers(),
5800 TL.getBracketsRange());
5811 NewTL.setRBracketLoc(TL.getRBracketLoc());
5812 NewTL.setSizeExpr(NewSize);
5817template<
typename Derived>
5822 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
5823 if (ElementType.isNull())
5827 if (getDerived().AlwaysRebuild() ||
5828 ElementType !=
T->getElementType()) {
5829 Result = getDerived().RebuildIncompleteArrayType(ElementType,
5830 T->getSizeModifier(),
5831 T->getIndexTypeCVRQualifiers(),
5832 TL.getBracketsRange());
5839 NewTL.setRBracketLoc(TL.getRBracketLoc());
5840 NewTL.setSizeExpr(
nullptr);
5845template<
typename Derived>
5850 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
5851 if (ElementType.isNull())
5858 SizeResult = getDerived().TransformExpr(
T->getSizeExpr());
5860 if (SizeResult.isInvalid())
5864 if (SizeResult.isInvalid())
5870 if (getDerived().AlwaysRebuild() ||
5871 ElementType !=
T->getElementType() ||
5872 Size !=
T->getSizeExpr()) {
5873 Result = getDerived().RebuildVariableArrayType(ElementType,
5874 T->getSizeModifier(),
5876 T->getIndexTypeCVRQualifiers(),
5877 TL.getBracketsRange());
5886 NewTL.setRBracketLoc(TL.getRBracketLoc());
5887 NewTL.setSizeExpr(Size);
5892template<
typename Derived>
5897 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
5898 if (ElementType.isNull())
5906 SemaRef.
ExprEvalContexts.back().InConditionallyConstantEvaluateContext =
true;
5909 Expr *origSize = TL.getSizeExpr();
5910 if (!origSize) origSize =
T->getSizeExpr();
5913 = getDerived().TransformExpr(origSize);
5915 if (sizeResult.isInvalid())
5918 Expr *size = sizeResult.get();
5921 if (getDerived().AlwaysRebuild() ||
5922 ElementType !=
T->getElementType() ||
5924 Result = getDerived().RebuildDependentSizedArrayType(ElementType,
5925 T->getSizeModifier(),
5927 T->getIndexTypeCVRQualifiers(),
5928 TL.getBracketsRange());
5937 NewTL.setRBracketLoc(TL.getRBracketLoc());
5938 NewTL.setSizeExpr(size);
5943template <
typename Derived>
5947 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
5948 if (ElementType.isNull())
5956 if (
Size.isInvalid())
5960 if (getDerived().AlwaysRebuild() || ElementType !=
T->getElementType() ||
5961 Size.get() !=
T->getSizeExpr()) {
5962 Result = getDerived().RebuildDependentVectorType(
5963 ElementType,
Size.get(),
T->getAttributeLoc(),
T->getVectorKind());
5981template<
typename Derived>
5988 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
5989 if (ElementType.isNull())
5998 if (
Size.isInvalid())
6002 if (getDerived().AlwaysRebuild() ||
6003 ElementType !=
T->getElementType() ||
6004 Size.get() !=
T->getSizeExpr()) {
6005 Result = getDerived().RebuildDependentSizedExtVectorType(ElementType,
6007 T->getAttributeLoc());
6025template <
typename Derived>
6030 QualType ElementType = getDerived().TransformType(
T->getElementType());
6031 if (ElementType.isNull())
6035 if (getDerived().AlwaysRebuild() || ElementType !=
T->getElementType()) {
6036 Result = getDerived().RebuildConstantMatrixType(
6037 ElementType,
T->getNumRows(),
T->getNumColumns());
6044 NewTL.setAttrOperandParensRange(TL.getAttrOperandParensRange());
6045 NewTL.setAttrRowOperand(TL.getAttrRowOperand());
6046 NewTL.setAttrColumnOperand(TL.getAttrColumnOperand());
6051template <
typename Derived>
6056 QualType ElementType = getDerived().TransformType(
T->getElementType());
6057 if (ElementType.isNull()) {
6065 Expr *origRows = TL.getAttrRowOperand();
6067 origRows =
T->getRowExpr();
6068 Expr *origColumns = TL.getAttrColumnOperand();
6070 origColumns =
T->getColumnExpr();
6072 ExprResult rowResult = getDerived().TransformExpr(origRows);
6074 if (rowResult.isInvalid())
6077 ExprResult columnResult = getDerived().TransformExpr(origColumns);
6079 if (columnResult.isInvalid())
6082 Expr *rows = rowResult.get();
6083 Expr *columns = columnResult.get();
6086 if (getDerived().AlwaysRebuild() || ElementType !=
T->getElementType() ||
6087 rows != origRows || columns != origColumns) {
6088 Result = getDerived().RebuildDependentSizedMatrixType(
6089 ElementType, rows, columns,
T->getAttributeLoc());
6099 NewTL.setAttrOperandParensRange(TL.getAttrOperandParensRange());
6100 NewTL.setAttrRowOperand(rows);
6101 NewTL.setAttrColumnOperand(columns);
6105template <
typename Derived>
6111 getDerived().TransformType(TLB, TL.getPointeeTypeLoc());
6113 if (pointeeType.isNull())
6120 ExprResult AddrSpace = getDerived().TransformExpr(
T->getAddrSpaceExpr());
6122 if (AddrSpace.isInvalid())
6126 if (getDerived().AlwaysRebuild() || pointeeType !=
T->getPointeeType() ||
6127 AddrSpace.get() !=
T->getAddrSpaceExpr()) {
6128 Result = getDerived().RebuildDependentAddressSpaceType(
6129 pointeeType, AddrSpace.get(),
T->getAttributeLoc());
6140 NewTL.setAttrExprOperand(TL.getAttrExprOperand());
6141 NewTL.setAttrNameLoc(TL.getAttrNameLoc());
6144 TLB.TypeWasModifiedSafely(
Result);
6150template <
typename Derived>
6154 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
6155 if (ElementType.isNull())
6159 if (getDerived().AlwaysRebuild() ||
6160 ElementType !=
T->getElementType()) {
6161 Result = getDerived().RebuildVectorType(ElementType,
T->getNumElements(),
6162 T->getVectorKind());
6173template<
typename Derived>
6177 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
6178 if (ElementType.isNull())
6182 if (getDerived().AlwaysRebuild() ||
6183 ElementType !=
T->getElementType()) {
6184 Result = getDerived().RebuildExtVectorType(ElementType,
6185 T->getNumElements(),
6197template <
typename Derived>
6200 bool ExpectParameterPack) {
6235 if (NewDI == OldDI && indexAdjustment == 0)
6249 getDerived().transformedLocalDecl(OldParm, {newParm});
6253template <
typename Derived>
6261 unsigned *LastParamTransformed) {
6262 int indexAdjustment = 0;
6264 unsigned NumParams = Params.size();
6265 for (
unsigned i = 0; i != NumParams; ++i) {
6266 if (LastParamTransformed)
6267 *LastParamTransformed = i;
6269 assert(OldParm->getFunctionScopeIndex() == i);
6273 if (OldParm->isParameterPack()) {
6278 TypeLoc TL = OldParm->getTypeSourceInfo()->getTypeLoc();
6281 SemaRef.collectUnexpandedParameterPacks(Pattern, Unexpanded);
6284 bool ShouldExpand =
false;
6285 bool RetainExpansion =
false;
6287 if (Unexpanded.size() > 0) {
6288 OrigNumExpansions = ExpansionTL.
getTypePtr()->getNumExpansions();
6289 NumExpansions = OrigNumExpansions;
6293 ShouldExpand, RetainExpansion, NumExpansions)) {
6298 const AutoType *AT =
6299 Pattern.getType().getTypePtr()->getContainedAutoType();
6300 assert((AT && (!AT->isDeduced() || AT->getDeducedType().isNull())) &&
6301 "Could not find parameter packs or undeduced auto type!");
6308 getDerived().ExpandingFunctionParameterPack(OldParm);
6309 for (
unsigned I = 0; I != *NumExpansions; ++I) {
6312 =
getDerived().TransformFunctionTypeParam(OldParm,
6320 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6321 OutParamTypes.push_back(NewParm->
getType());
6323 PVars->push_back(NewParm);
6328 if (RetainExpansion) {
6329 ForgetPartiallySubstitutedPackRAII Forget(
getDerived());
6331 =
getDerived().TransformFunctionTypeParam(OldParm,
6339 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6340 OutParamTypes.push_back(NewParm->
getType());
6342 PVars->push_back(NewParm);
6358 NewParm =
getDerived().TransformFunctionTypeParam(OldParm,
6363 "Parameter pack no longer a parameter pack after "
6366 NewParm =
getDerived().TransformFunctionTypeParam(
6367 OldParm, indexAdjustment, std::nullopt,
6375 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6376 OutParamTypes.push_back(NewParm->
getType());
6378 PVars->push_back(NewParm);
6386 bool IsPackExpansion =
false;
6389 if (
const PackExpansionType *Expansion
6390 = dyn_cast<PackExpansionType>(OldType)) {
6392 QualType Pattern = Expansion->getPattern();
6394 getSema().collectUnexpandedParameterPacks(Pattern, Unexpanded);
6397 bool ShouldExpand =
false;
6398 bool RetainExpansion =
false;
6402 RetainExpansion, NumExpansions)) {
6409 for (
unsigned I = 0; I != *NumExpansions; ++I) {
6416 NewType =
getSema().getASTContext().getPackExpansionType(
6417 NewType, std::nullopt);
6424 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6425 OutParamTypes.push_back(NewType);
6427 PVars->push_back(
nullptr);
6436 if (RetainExpansion) {
6437 ForgetPartiallySubstitutedPackRAII Forget(
getDerived());
6443 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6444 OutParamTypes.push_back(NewType);
6446 PVars->push_back(
nullptr);
6451 OldType = Expansion->getPattern();
6452 IsPackExpansion =
true;
6454 NewType =
getDerived().TransformType(OldType);
6456 NewType =
getDerived().TransformType(OldType);
6462 if (IsPackExpansion)
6463 NewType =
getSema().Context.getPackExpansionType(NewType,
6467 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6468 OutParamTypes.push_back(NewType);
6470 PVars->push_back(
nullptr);
6475 for (
unsigned i = 0, e = PVars->size(); i != e; ++i)
6477 assert(parm->getFunctionScopeIndex() == i);
6484template<
typename Derived>
6489 return getDerived().TransformFunctionProtoType(
6493 ExceptionStorage, Changed);
6497template<
typename Derived>
template<
typename Fn>
6516 if (
T->hasTrailingReturn()) {
6520 T->getExtParameterInfosOrNull(),
6521 ParamTypes, &ParamDecls, ExtParamInfos))
6531 auto *RD = dyn_cast<CXXRecordDecl>(
SemaRef.getCurLexicalContext());
6533 SemaRef, !ThisContext && RD ? RD : ThisContext, ThisTypeQuals);
6548 T->getExtParameterInfosOrNull(),
6549 ParamTypes, &ParamDecls, ExtParamInfos))
6555 bool EPIChanged =
false;
6560 if (
auto NewExtParamInfos =
6576 std::optional<FunctionEffectSet> NewFX;
6588 std::optional<FunctionEffectMode> Mode =
6608 "FunctionEffectMode::None shouldn't be possible here");
6611 if (!
SemaRef.diagnoseConflictingFunctionEffect(*NewFX, NewEC,
6614 NewFX->insert(NewEC, Errs);
6615 assert(Errs.empty());
6625 Result =
getDerived().RebuildFunctionProtoType(ResultType, ParamTypes, EPI);
6636 for (
unsigned i = 0, e = NewTL.
getNumParams(); i != e; ++i)
6642template<
typename Derived>
6665 getSema().ActOnNoexceptSpec(NoexceptExpr.
get(), EST);
6680 if (
const PackExpansionType *PackExpansion =
6681 T->getAs<PackExpansionType>()) {
6686 SemaRef.collectUnexpandedParameterPacks(PackExpansion->getPattern(),
6688 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
6693 bool Expand =
false;
6694 bool RetainExpansion =
false;
6695 UnsignedOrNone NumExpansions = PackExpansion->getNumExpansions();
6700 true, Expand, RetainExpansion,
6713 U =
SemaRef.Context.getPackExpansionType(
U, NumExpansions);
6714 Exceptions.push_back(
U);
6720 for (
unsigned ArgIdx = 0; ArgIdx != *NumExpansions; ++ArgIdx) {
6724 if (
U.isNull() ||
SemaRef.CheckSpecifiedExceptionType(
U, Loc))
6727 Exceptions.push_back(
U);
6731 if (
U.isNull() ||
SemaRef.CheckSpecifiedExceptionType(
U, Loc))
6736 Exceptions.push_back(
U);
6746template<
typename Derived>
6756 if (getDerived().AlwaysRebuild() || ResultType !=
T->getReturnType())
6757 Result = getDerived().RebuildFunctionNoProtoType(ResultType);
6768template <
typename Derived>
6769QualType TreeTransform<Derived>::TransformUnresolvedUsingType(
6770 TypeLocBuilder &TLB, UnresolvedUsingTypeLoc TL) {
6772 const UnresolvedUsingType *T = TL.getTypePtr();
6773 bool Changed =
false;
6775 NestedNameSpecifierLoc QualifierLoc = TL.getQualifierLoc();
6776 if (NestedNameSpecifierLoc OldQualifierLoc = QualifierLoc) {
6777 QualifierLoc = getDerived().TransformNestedNameSpecifierLoc(QualifierLoc);
6780 Changed |= QualifierLoc != OldQualifierLoc;
6783 auto *D = getDerived().TransformDecl(TL.getNameLoc(),
T->getDecl());
6789 if (getDerived().AlwaysRebuild() || Changed) {
6790 Result = getDerived().RebuildUnresolvedUsingType(
6791 T->getKeyword(), QualifierLoc.getNestedNameSpecifier(), TL.getNameLoc(),
6799 QualifierLoc, TL.getNameLoc());
6802 QualifierLoc, TL.getNameLoc());
6806template <
typename Derived>
6814 QualifierLoc = getDerived().TransformNestedNameSpecifierLoc(QualifierLoc);
6817 Changed |= QualifierLoc != OldQualifierLoc;
6820 auto *D = cast_or_null<UsingShadowDecl>(
6821 getDerived().TransformDecl(TL.getNameLoc(),
T->getDecl()));
6826 QualType UnderlyingType = getDerived().TransformType(
T->desugar());
6827 if (UnderlyingType.isNull())
6829 Changed |= UnderlyingType !=
T->desugar();
6832 if (getDerived().AlwaysRebuild() || Changed) {
6833 Result = getDerived().RebuildUsingType(
6834 T->getKeyword(), QualifierLoc.getNestedNameSpecifier(), D,
6844template<
typename Derived>
6852 QualifierLoc = getDerived().TransformNestedNameSpecifierLoc(QualifierLoc);
6855 Changed |= QualifierLoc != OldQualifierLoc;
6858 auto *
Typedef = cast_or_null<TypedefNameDecl>(
6859 getDerived().TransformDecl(TL.getNameLoc(),
T->getDecl()));
6867 if (getDerived().AlwaysRebuild() || Changed) {
6868 Result = getDerived().RebuildTypedefType(
6869 T->getKeyword(), QualifierLoc.getNestedNameSpecifier(),
Typedef);
6875 QualifierLoc, TL.getNameLoc());
6879template<
typename Derived>
6887 ExprResult E = getDerived().TransformExpr(TL.getUnderlyingExpr());
6897 if (getDerived().AlwaysRebuild() || E.get() != TL.getUnderlyingExpr()) {
6899 getDerived().RebuildTypeOfExprType(E.get(), TL.getTypeofLoc(), Kind);
6906 NewTL.setLParenLoc(TL.getLParenLoc());
6907 NewTL.setRParenLoc(TL.getRParenLoc());
6912template<
typename Derived>
6916 TypeSourceInfo* New_Under_TI = getDerived().TransformType(Old_Under_TI);
6922 if (getDerived().AlwaysRebuild() || New_Under_TI != Old_Under_TI) {
6923 Result = getDerived().RebuildTypeOfType(New_Under_TI->getType(), Kind);
6930 NewTL.setLParenLoc(TL.getLParenLoc());
6931 NewTL.setRParenLoc(TL.getRParenLoc());
6932 NewTL.setUnmodifiedTInfo(New_Under_TI);
6937template<
typename Derived>
6940 const DecltypeType *
T = TL.getTypePtr();
6947 ExprResult E = getDerived().TransformExpr(
T->getUnderlyingExpr());
6951 E = getSema().ActOnDecltypeExpression(E.get());
6956 if (getDerived().AlwaysRebuild() ||
6957 E.get() !=
T->getUnderlyingExpr()) {
6958 Result = getDerived().RebuildDecltypeType(E.get(), TL.getDecltypeLoc());
6966 NewTL.setRParenLoc(TL.getRParenLoc());
6970template <
typename Derived>
6980 IndexExpr = getDerived().TransformExpr(TL.getIndexExpr());
6981 if (IndexExpr.isInvalid())
6984 QualType Pattern = TL.getPattern();
6986 const PackIndexingType *PIT = TL.
getTypePtr();
6990 bool NotYetExpanded = Types.empty();
6991 bool FullySubstituted =
true;
6993 if (Types.empty() && !PIT->expandsToEmptyPack())
6997 if (!
T->containsUnexpandedParameterPack()) {
6998 QualType Transformed = getDerived().TransformType(
T);
6999 if (Transformed.isNull())
7001 SubtitutedTypes.push_back(Transformed);
7006 getSema().collectUnexpandedParameterPacks(
T, Unexpanded);
7007 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
7010 bool ShouldExpand =
true;
7011 bool RetainExpansion =
false;
7013 if (getDerived().TryExpandParameterPacks(
7016 RetainExpansion, NumExpansions))
7018 if (!ShouldExpand) {
7024 QualType Pack = getDerived().TransformType(TLB, TI->getTypeLoc());
7027 if (NotYetExpanded) {
7028 FullySubstituted =
false;
7029 QualType Out = getDerived().RebuildPackIndexingType(
7039 SubtitutedTypes.push_back(Pack);
7042 for (
unsigned I = 0; I != *NumExpansions; ++I) {
7047 SubtitutedTypes.push_back(Out);
7048 FullySubstituted &= !
Out->containsUnexpandedParameterPack();
7052 if (RetainExpansion) {
7053 FullySubstituted =
false;
7054 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
7058 SubtitutedTypes.push_back(Out);
7066 QualType Result = getDerived().TransformType(TLB, TL.getPatternLoc());
7068 QualType Out = getDerived().RebuildPackIndexingType(
7070 FullySubstituted, SubtitutedTypes);
7079template<
typename Derived>
7085 if (
Result->isDependentType()) {
7086 const UnaryTransformType *
T = TL.getTypePtr();
7088 NewBaseTSI = getDerived().TransformType(TL.getUnderlyingTInfo());
7091 QualType NewBase = NewBaseTSI->getType();
7093 Result = getDerived().RebuildUnaryTransformType(NewBase,
7102 NewTL.setParensRange(TL.getParensRange());
7103 NewTL.setUnderlyingTInfo(NewBaseTSI);
7107template<
typename Derived>
7110 const DeducedTemplateSpecializationType *
T = TL.getTypePtr();
7115 TL.getTemplateNameLoc());
7119 QualType OldDeduced =
T->getDeducedType();
7121 if (!OldDeduced.isNull()) {
7122 NewDeduced = getDerived().TransformType(OldDeduced);
7123 if (NewDeduced.isNull())
7127 QualType Result = getDerived().RebuildDeducedTemplateSpecializationType(
7134 NewTL.setTemplateNameLoc(TL.getTemplateNameLoc());
7135 NewTL.setQualifierLoc(QualifierLoc);
7139template <
typename Derived>
7146 QualifierLoc =
getDerived().TransformNestedNameSpecifierLoc(QualifierLoc);
7151 auto *TD = cast_or_null<TagDecl>(
7158 TD !=
T->getOriginalDecl()) {
7159 if (
T->isCanonicalUnqualified())
7176template <
typename Derived>
7182template <
typename Derived>
7183QualType TreeTransform<Derived>::TransformRecordType(TypeLocBuilder &TLB,
7185 return getDerived().TransformTagType(TLB, TL);
7188template<
typename Derived>
7195template<
typename Derived>
7199 return getDerived().TransformTemplateTypeParmType(
7204template <
typename Derived>
7210template<
typename Derived>
7211QualType TreeTransform<Derived>::TransformSubstTemplateTypeParmType(
7212 TypeLocBuilder &TLB,
7213 SubstTemplateTypeParmTypeLoc TL) {
7214 const SubstTemplateTypeParmType *T = TL.getTypePtr();
7217 getDerived().TransformDecl(TL.getNameLoc(), T->getAssociatedDecl());
7222 TemporaryBase Rebase(*
this, TL.getNameLoc(), DeclarationName());
7223 QualType Replacement = getDerived().TransformType(T->getReplacementType());
7224 if (Replacement.isNull())
7228 Replacement, NewReplaced, T->getIndex(), T->getPackIndex(),
7232 SubstTemplateTypeParmTypeLoc NewTL
7233 = TLB.push<SubstTemplateTypeParmTypeLoc>(Result);
7234 NewTL.setNameLoc(TL.getNameLoc());
7238template <
typename Derived>
7244template<
typename Derived>
7248 return getDerived().TransformSubstTemplateTypeParmPackType(
7252template <
typename Derived>
7258template<
typename Derived>
7259QualType TreeTransform<Derived>::TransformAtomicType(TypeLocBuilder &TLB,
7261 QualType ValueType = getDerived().TransformType(TLB, TL.getValueLoc());
7262 if (ValueType.isNull())
7265 QualType Result = TL.getType();
7266 if (getDerived().AlwaysRebuild() ||
7267 ValueType != TL.getValueLoc().getType()) {
7268 Result = getDerived().RebuildAtomicType(ValueType, TL.getKWLoc());
7269 if (Result.isNull())
7275 NewTL.setLParenLoc(TL.getLParenLoc());
7276 NewTL.setRParenLoc(TL.getRParenLoc());
7281template <
typename Derived>
7284 QualType ValueType = getDerived().TransformType(TLB, TL.getValueLoc());
7285 if (ValueType.isNull())
7289 if (getDerived().AlwaysRebuild() || ValueType != TL.getValueLoc().getType()) {
7292 Result = getDerived().RebuildPipeType(ValueType, TL.getKWLoc(), isReadPipe);
7303template <
typename Derived>
7309 if (getDerived().AlwaysRebuild()) {
7310 Result = getDerived().RebuildBitIntType(EIT->isUnsigned(),
7311 EIT->getNumBits(), TL.getNameLoc());
7321template <
typename Derived>
7328 ExprResult BitsExpr = getDerived().TransformExpr(EIT->getNumBitsExpr());
7331 if (BitsExpr.isInvalid())
7336 if (getDerived().AlwaysRebuild() || BitsExpr.get() != EIT->getNumBitsExpr()) {
7337 Result = getDerived().RebuildDependentBitIntType(
7338 EIT->isUnsigned(), BitsExpr.get(), TL.getNameLoc());
7354template <
typename Derived>
7357 llvm_unreachable(
"This type does not need to be transformed.");
7365 template<
typename ArgLocContainer>
7367 ArgLocContainer *Container;
7392 : Container(&Container), Index(Index) { }
7406 return Container->getArgLoc(Index);
7410 return pointer(Container->getArgLoc(Index));
7415 return X.Container == Y.Container &&
X.Index == Y.Index;
7424template<
typename Derived>
7425QualType TreeTransform<Derived>::TransformAutoType(TypeLocBuilder &TLB,
7427 const AutoType *T = TL.getTypePtr();
7428 QualType OldDeduced = T->getDeducedType();
7429 QualType NewDeduced;
7430 if (!OldDeduced.isNull()) {
7431 NewDeduced = getDerived().TransformType(OldDeduced);
7432 if (NewDeduced.isNull())
7439 if (
T->isConstrained()) {
7440 assert(TL.getConceptReference());
7441 NewCD = cast_or_null<ConceptDecl>(getDerived().TransformDecl(
7442 TL.getConceptNameLoc(),
T->getTypeConstraintConcept()));
7444 NewTemplateArgs.setLAngleLoc(TL.getLAngleLoc());
7445 NewTemplateArgs.setRAngleLoc(TL.getRAngleLoc());
7447 if (getDerived().TransformTemplateArguments(
7448 ArgIterator(TL, 0), ArgIterator(TL, TL.getNumArgs()),
7452 if (TL.getNestedNameSpecifierLoc()) {
7454 = getDerived().TransformNestedNameSpecifierLoc(
7455 TL.getNestedNameSpecifierLoc());
7456 if (!NewNestedNameSpec)
7462 if (getDerived().AlwaysRebuild() || NewDeduced != OldDeduced ||
7463 T->isDependentType() ||
T->isConstrained()) {
7466 NewArgList.reserve(NewTemplateArgs.size());
7467 for (
const auto &ArgLoc : NewTemplateArgs.arguments())
7468 NewArgList.push_back(ArgLoc.getArgument());
7469 Result = getDerived().RebuildAutoType(NewDeduced,
T->getKeyword(), NewCD,
7477 NewTL.setRParenLoc(TL.getRParenLoc());
7478 NewTL.setConceptReference(
nullptr);
7480 if (
T->isConstrained()) {
7482 TL.getTypePtr()->getTypeConstraintConcept()->getDeclName(),
7483 TL.getConceptNameLoc(),
7484 TL.getTypePtr()->getTypeConstraintConcept()->getDeclName());
7486 SemaRef.
Context, NewNestedNameSpec, TL.getTemplateKWLoc(), DNI,
7487 TL.getFoundDecl(), TL.getTypePtr()->getTypeConstraintConcept(),
7489 NewTL.setConceptReference(CR);
7495template <
typename Derived>
7498 return getDerived().TransformTemplateSpecializationType(
7503template <
typename Derived>
7506 NamedDecl *FirstQualifierInScope,
bool AllowInjectedClassName) {
7507 const TemplateSpecializationType *
T = TL.
getTypePtr();
7513 AllowInjectedClassName);
7522 if (getDerived().TransformTemplateArguments(ArgIterator(TL, 0),
7531 QualType Result = getDerived().RebuildTemplateSpecializationType(
7544template <
typename Derived>
7548 QualType modifiedType = getDerived().TransformType(TLB, TL.getModifiedLoc());
7549 if (modifiedType.isNull())
7553 const Attr *oldAttr = TL.getAttr();
7554 const Attr *newAttr = oldAttr ? getDerived().TransformAttr(oldAttr) :
nullptr;
7555 if (oldAttr && !newAttr)
7561 if (getDerived().AlwaysRebuild() ||
7562 modifiedType != oldType->getModifiedType()) {
7575 QualType equivalentType = modifiedType;
7576 if (TL.getModifiedLoc().getType() != TL.getEquivalentTypeLoc().getType()) {
7578 AuxiliaryTLB.
reserve(TL.getFullDataSize());
7580 getDerived().TransformType(AuxiliaryTLB, TL.getEquivalentTypeLoc());
7581 if (equivalentType.isNull())
7587 if (
auto nullability = oldType->getImmediateNullability()) {
7588 if (!modifiedType->canHaveNullability()) {
7589 SemaRef.
Diag((TL.getAttr() ? TL.getAttr()->getLocation()
7590 : TL.getModifiedLoc().getBeginLoc()),
7591 diag::err_nullability_nonpointer)
7608template <
typename Derived>
7612 QualType InnerTy = getDerived().TransformType(TLB, TL.getInnerLoc());
7613 if (InnerTy.isNull())
7616 Expr *OldCount = TL.getCountExpr();
7617 Expr *NewCount =
nullptr;
7619 ExprResult CountResult = getDerived().TransformExpr(OldCount);
7620 if (CountResult.isInvalid())
7622 NewCount = CountResult.get();
7626 if (getDerived().AlwaysRebuild() || InnerTy != OldTy->desugar() ||
7627 OldCount != NewCount) {
7630 InnerTy, NewCount, OldTy->isCountInBytes(), OldTy->isOrNull());
7637template <
typename Derived>
7641 llvm_unreachable(
"Unexpected TreeTransform for BTFTagAttributedType");
7644template <
typename Derived>
7648 const HLSLAttributedResourceType *oldType = TL.getTypePtr();
7650 QualType WrappedTy = getDerived().TransformType(TLB, TL.getWrappedLoc());
7651 if (WrappedTy.isNull())
7655 QualType OldContainedTy = oldType->getContainedType();
7656 if (!OldContainedTy.isNull()) {
7657 TypeSourceInfo *oldContainedTSI = TL.getContainedTypeSourceInfo();
7658 if (!oldContainedTSI)
7659 oldContainedTSI = getSema().getASTContext().getTrivialTypeSourceInfo(
7661 TypeSourceInfo *ContainedTSI = getDerived().TransformType(oldContainedTSI);
7664 ContainedTy = ContainedTSI->getType();
7668 if (getDerived().AlwaysRebuild() || WrappedTy != oldType->getWrappedType() ||
7669 ContainedTy != oldType->getContainedType()) {
7671 WrappedTy, ContainedTy, oldType->getAttrs());
7678template <
typename Derived>
7682 return TL.getType();
7685template<
typename Derived>
7689 QualType Inner = getDerived().TransformType(TLB, TL.getInnerLoc());
7694 if (getDerived().AlwaysRebuild() ||
7695 Inner != TL.getInnerLoc().getType()) {
7696 Result = getDerived().RebuildParenType(Inner);
7703 NewTL.setRParenLoc(TL.getRParenLoc());
7707template <
typename Derived>
7711 QualType Inner = getDerived().TransformType(TLB, TL.getInnerLoc());
7716 if (getDerived().AlwaysRebuild() || Inner != TL.getInnerLoc().getType()) {
7718 getDerived().RebuildMacroQualifiedType(Inner, TL.getMacroIdentifier());
7728template<
typename Derived>
7729QualType TreeTransform<Derived>::TransformDependentNameType(
7731 return TransformDependentNameType(TLB, TL,
false);
7734template <
typename Derived>
7735QualType TreeTransform<Derived>::TransformDependentNameType(
7738 const DependentNameType *
T = TL.getTypePtr();
7742 QualifierLoc = getDerived().TransformNestedNameSpecifierLoc(
7743 QualifierLoc, ObjectType, UnqualLookup);
7747 assert((ObjectType.isNull() && !UnqualLookup) &&
7748 "must be transformed by TransformNestedNameSpecifierLoc");
7752 = getDerived().RebuildDependentNameType(
T->getKeyword(),
7753 TL.getElaboratedKeywordLoc(),
7764 NewTL.setQualifierLoc(QualifierLoc);
7765 NewTL.setNameLoc(TL.getNameLoc());
7769 NewTL.setTemplateNameLoc(TL.getNameLoc());
7770 NewTL.setQualifierLoc(QualifierLoc);
7773 QualifierLoc, TL.getNameLoc());
7776 NewTL.
set(TL.getElaboratedKeywordLoc(), QualifierLoc, TL.getNameLoc());
7780 NewTL.setQualifierLoc(QualifierLoc);
7781 NewTL.setNameLoc(TL.getNameLoc());
7786template<
typename Derived>
7790 = getDerived().TransformType(TLB, TL.getPatternLoc());
7791 if (Pattern.isNull())
7795 if (getDerived().AlwaysRebuild() ||
7796 Pattern != TL.getPatternLoc().getType()) {
7797 Result = getDerived().RebuildPackExpansionType(Pattern,
7798 TL.getPatternLoc().getSourceRange(),
7799 TL.getEllipsisLoc(),
7800 TL.getTypePtr()->getNumExpansions());
7810template<
typename Derived>
7815 TLB.pushFullCopy(TL);
7816 return TL.getType();
7819template<
typename Derived>
7823 const ObjCTypeParamType *
T = TL.getTypePtr();
7825 getDerived().TransformDecl(
T->getDecl()->getLocation(),
T->getDecl()));
7830 if (getDerived().AlwaysRebuild() ||
7831 OTP !=
T->getDecl()) {
7832 Result = getDerived().RebuildObjCTypeParamType(
7833 OTP, TL.getProtocolLAngleLoc(),
7834 llvm::ArrayRef(TL.getTypePtr()->qual_begin(), TL.getNumProtocols()),
7835 TL.getProtocolLocs(), TL.getProtocolRAngleLoc());
7841 if (TL.getNumProtocols()) {
7842 NewTL.setProtocolLAngleLoc(TL.getProtocolLAngleLoc());
7843 for (
unsigned i = 0, n = TL.getNumProtocols(); i != n; ++i)
7844 NewTL.setProtocolLoc(i, TL.getProtocolLoc(i));
7845 NewTL.setProtocolRAngleLoc(TL.getProtocolRAngleLoc());
7850template<
typename Derived>
7855 QualType BaseType = getDerived().TransformType(TLB, TL.getBaseLoc());
7856 if (BaseType.isNull())
7859 bool AnyChanged = BaseType != TL.getBaseLoc().getType();
7863 for (
unsigned i = 0, n = TL.getNumTypeArgs(); i != n; ++i) {
7865 TypeLoc TypeArgLoc = TypeArgInfo->getTypeLoc();
7866 QualType TypeArg = TypeArgInfo->getType();
7871 const auto *PackExpansion = PackExpansionLoc.getType()
7872 ->castAs<PackExpansionType>();
7876 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
7880 TypeLoc PatternLoc = PackExpansionLoc.getPatternLoc();
7881 bool Expand =
false;
7882 bool RetainExpansion =
false;
7883 UnsignedOrNone NumExpansions = PackExpansion->getNumExpansions();
7884 if (getDerived().TryExpandParameterPacks(
7885 PackExpansionLoc.getEllipsisLoc(), PatternLoc.getSourceRange(),
7886 Unexpanded,
true, Expand,
7887 RetainExpansion, NumExpansions))
7897 TypeArgBuilder.
reserve(PatternLoc.getFullDataSize());
7898 QualType NewPatternType = getDerived().TransformType(TypeArgBuilder,
7900 if (NewPatternType.isNull())
7904 NewPatternType, NumExpansions);
7906 NewExpansionLoc.
setEllipsisLoc(PackExpansionLoc.getEllipsisLoc());
7907 NewTypeArgInfos.push_back(
7908 TypeArgBuilder.getTypeSourceInfo(SemaRef.
Context, NewExpansionType));
7914 for (
unsigned ArgIdx = 0; ArgIdx != *NumExpansions; ++ArgIdx) {
7918 TypeArgBuilder.
reserve(PatternLoc.getFullDataSize());
7920 QualType NewTypeArg = getDerived().TransformType(TypeArgBuilder,
7922 if (NewTypeArg.isNull())
7925 NewTypeArgInfos.push_back(
7926 TypeArgBuilder.getTypeSourceInfo(SemaRef.
Context, NewTypeArg));
7933 TypeArgBuilder.
reserve(TypeArgLoc.getFullDataSize());
7935 getDerived().TransformType(TypeArgBuilder, TypeArgLoc);
7936 if (NewTypeArg.isNull())
7940 if (NewTypeArg == TypeArg) {
7941 NewTypeArgInfos.push_back(TypeArgInfo);
7945 NewTypeArgInfos.push_back(
7946 TypeArgBuilder.getTypeSourceInfo(SemaRef.
Context, NewTypeArg));
7951 if (getDerived().AlwaysRebuild() || AnyChanged) {
7953 Result = getDerived().RebuildObjCObjectType(
7954 BaseType, TL.getBeginLoc(), TL.getTypeArgsLAngleLoc(), NewTypeArgInfos,
7955 TL.getTypeArgsRAngleLoc(), TL.getProtocolLAngleLoc(),
7956 llvm::ArrayRef(TL.getTypePtr()->qual_begin(), TL.getNumProtocols()),
7957 TL.getProtocolLocs(), TL.getProtocolRAngleLoc());
7965 NewT.setTypeArgsLAngleLoc(TL.getTypeArgsLAngleLoc());
7966 for (
unsigned i = 0, n = TL.getNumTypeArgs(); i != n; ++i)
7967 NewT.setTypeArgTInfo(i, NewTypeArgInfos[i]);
7968 NewT.setTypeArgsRAngleLoc(TL.getTypeArgsRAngleLoc());
7969 NewT.setProtocolLAngleLoc(TL.getProtocolLAngleLoc());
7970 for (
unsigned i = 0, n = TL.getNumProtocols(); i != n; ++i)
7971 NewT.setProtocolLoc(i, TL.getProtocolLoc(i));
7972 NewT.setProtocolRAngleLoc(TL.getProtocolRAngleLoc());
7976template<
typename Derived>
7980 QualType PointeeType = getDerived().TransformType(TLB, TL.getPointeeLoc());
7981 if (PointeeType.isNull())
7985 if (getDerived().AlwaysRebuild() ||
7986 PointeeType != TL.getPointeeLoc().getType()) {
7987 Result = getDerived().RebuildObjCObjectPointerType(PointeeType,
8001template<
typename Derived>
8007template<
typename Derived>
8010 return getDerived().TransformCompoundStmt(S,
false);
8013template<
typename Derived>
8020 getSema().resetFPOptions(
8024 bool SubStmtInvalid =
false;
8025 bool SubStmtChanged =
false;
8027 for (
auto *B : S->
body()) {
8029 B, IsStmtExpr && B ==
ExprResult ? StmtDiscardKind::StmtExprResult
8030 : StmtDiscardKind::Discarded);
8032 if (
Result.isInvalid()) {
8039 SubStmtInvalid =
true;
8043 SubStmtChanged = SubStmtChanged || Result.get() != B;
8044 Statements.push_back(Result.getAs<Stmt>());
8050 if (!getDerived().AlwaysRebuild() &&
8054 return getDerived().RebuildCompoundStmt(S->
getLBracLoc(),
8060template<
typename Derived>
8069 LHS = getDerived().TransformExpr(S->getLHS());
8071 if (LHS.isInvalid())
8075 RHS = getDerived().TransformExpr(S->getRHS());
8077 if (RHS.isInvalid())
8084 StmtResult Case = getDerived().RebuildCaseStmt(S->getCaseLoc(),
8086 S->getEllipsisLoc(),
8089 if (Case.isInvalid())
8094 getDerived().TransformStmt(S->getSubStmt());
8095 if (SubStmt.isInvalid())
8099 return getDerived().RebuildCaseStmtBody(Case.get(), SubStmt.get());
8102template <
typename Derived>
8106 getDerived().TransformStmt(S->getSubStmt());
8107 if (SubStmt.isInvalid())
8111 return getDerived().RebuildDefaultStmt(S->getDefaultLoc(), S->getColonLoc(),
8115template<
typename Derived>
8118 StmtResult SubStmt = getDerived().TransformStmt(S->getSubStmt(), SDK);
8119 if (SubStmt.isInvalid())
8122 Decl *LD = getDerived().TransformDecl(S->getDecl()->getLocation(),
8130 if (LD == S->getDecl())
8131 S->getDecl()->setStmt(
nullptr);
8134 return getDerived().RebuildLabelStmt(S->getIdentLoc(),
8139template <
typename Derived>
8148 return getDerived().Transform##X##Attr(cast<X##Attr>(R));
8149#include "clang/Basic/AttrList.inc"
8154template <
typename Derived>
8165 return getDerived().TransformStmt##X##Attr(OrigS, InstS, cast<X##Attr>(R));
8166#include "clang/Basic/AttrList.inc"
8171template <
typename Derived>
8174 StmtDiscardKind SDK) {
8179 bool AttrsChanged =
false;
8183 for (
const auto *I : S->
getAttrs()) {
8185 getDerived().TransformStmtAttr(S->
getSubStmt(), SubStmt.
get(), I);
8186 AttrsChanged |= (I != R);
8199 return getDerived().RebuildAttributedStmt(S->
getAttrLoc(), Attrs,
8203template<
typename Derived>
8208 if (
Init.isInvalid())
8212 if (!S->isConsteval()) {
8214 Cond = getDerived().TransformCondition(
8215 S->getIfLoc(), S->getConditionVariable(), S->getCond(),
8218 if (
Cond.isInvalid())
8223 std::optional<bool> ConstexprConditionValue;
8224 if (S->isConstexpr())
8225 ConstexprConditionValue =
Cond.getKnownValue();
8229 if (!ConstexprConditionValue || *ConstexprConditionValue) {
8233 S->isNonNegatedConsteval());
8235 Then = getDerived().TransformStmt(S->getThen());
8236 if (Then.isInvalid())
8242 Then =
new (getSema().Context)
8243 CompoundStmt(S->getThen()->getBeginLoc(), S->getThen()->getEndLoc());
8248 if (!ConstexprConditionValue || !*ConstexprConditionValue) {
8252 S->isNegatedConsteval());
8254 Else = getDerived().TransformStmt(S->getElse());
8255 if (Else.isInvalid())
8257 }
else if (S->getElse() && ConstexprConditionValue &&
8258 *ConstexprConditionValue) {
8262 Else =
new (getSema().Context)
8263 CompoundStmt(S->getElse()->getBeginLoc(), S->getElse()->getEndLoc());
8266 if (!getDerived().AlwaysRebuild() &&
8267 Init.get() == S->getInit() &&
8268 Cond.get() == std::make_pair(S->getConditionVariable(), S->getCond()) &&
8269 Then.get() == S->getThen() &&
8270 Else.get() == S->getElse())
8273 return getDerived().RebuildIfStmt(
8274 S->getIfLoc(), S->getStatementKind(), S->getLParenLoc(),
Cond,
8275 S->getRParenLoc(),
Init.get(), Then.get(), S->getElseLoc(), Else.get());
8278template<
typename Derived>
8283 if (
Init.isInvalid())
8288 S->getSwitchLoc(), S->getConditionVariable(), S->getCond(),
8290 if (
Cond.isInvalid())
8295 getDerived().RebuildSwitchStmtStart(S->getSwitchLoc(), S->getLParenLoc(),
8296 Init.get(),
Cond, S->getRParenLoc());
8301 StmtResult Body = getDerived().TransformStmt(S->getBody());
8302 if (Body.isInvalid())
8306 return getDerived().RebuildSwitchStmtBody(S->getSwitchLoc(),
Switch.get(),
8310template<
typename Derived>
8315 S->getWhileLoc(), S->getConditionVariable(), S->getCond(),
8317 if (
Cond.isInvalid())
8326 StmtResult Body = getDerived().TransformStmt(S->getBody());
8327 if (Body.isInvalid())
8330 if (!getDerived().AlwaysRebuild() &&
8331 Cond.get() == std::make_pair(S->getConditionVariable(), S->getCond()) &&
8332 Body.get() == S->getBody())
8335 return getDerived().RebuildWhileStmt(S->getWhileLoc(), S->getLParenLoc(),
8336 Cond, S->getRParenLoc(), Body.get());
8339template<
typename Derived>
8348 StmtResult Body = getDerived().TransformStmt(S->getBody());
8349 if (Body.isInvalid())
8354 if (
Cond.isInvalid())
8357 if (!getDerived().AlwaysRebuild() &&
8358 Cond.get() == S->getCond() &&
8359 Body.get() == S->getBody())
8362 return getDerived().RebuildDoStmt(S->getDoLoc(), Body.get(), S->getWhileLoc(),
8363 S->getWhileLoc(),
Cond.get(),
8367template<
typename Derived>
8370 if (getSema().getLangOpts().OpenMP)
8371 getSema().OpenMP().startOpenMPLoop();
8375 if (
Init.isInvalid())
8380 if (getSema().getLangOpts().OpenMP &&
Init.isUsable())
8381 getSema().OpenMP().ActOnOpenMPLoopInitialization(S->getForLoc(),
8386 S->getForLoc(), S->getConditionVariable(), S->getCond(),
8388 if (
Cond.isInvalid())
8393 if (
Inc.isInvalid())
8397 if (S->getInc() && !FullInc.get())
8404 S->getBeginLoc(), S->getInit(),
Init.get(), S->getCond(),
8405 Cond.get().second, S->getInc(),
Inc.get());
8408 StmtResult Body = getDerived().TransformStmt(S->getBody());
8409 if (Body.isInvalid())
8414 if (!getDerived().AlwaysRebuild() &&
8415 Init.get() == S->getInit() &&
8416 Cond.get() == std::make_pair(S->getConditionVariable(), S->getCond()) &&
8417 Inc.get() == S->getInc() &&
8418 Body.get() == S->getBody())
8421 return getDerived().RebuildForStmt(S->getForLoc(), S->getLParenLoc(),
8423 S->getRParenLoc(), Body.get());
8426template<
typename Derived>
8429 Decl *LD = getDerived().TransformDecl(S->getLabel()->getLocation(),
8435 return getDerived().RebuildGotoStmt(S->getGotoLoc(), S->getLabelLoc(),
8439template<
typename Derived>
8447 if (!getDerived().AlwaysRebuild() &&
8448 Target.get() == S->getTarget())
8451 return getDerived().RebuildIndirectGotoStmt(S->getGotoLoc(), S->getStarLoc(),
8455template<
typename Derived>
8458 if (!S->hasLabelTarget())
8461 Decl *LD = getDerived().TransformDecl(S->getLabelDecl()->getLocation(),
8470template<
typename Derived>
8473 if (!S->hasLabelTarget())
8476 Decl *LD = getDerived().TransformDecl(S->getLabelDecl()->getLocation(),
8485template<
typename Derived>
8495 return getDerived().RebuildReturnStmt(S->getReturnLoc(),
Result.get());
8498template<
typename Derived>
8501 bool DeclChanged =
false;
8504 for (
auto *D : S->decls()) {
8505 Decl *Transformed = getDerived().TransformDefinition(D->getLocation(), D);
8509 if (Transformed != D)
8513 if (
auto *TD = dyn_cast<TypeDecl>(Transformed)) {
8514 if (
auto *TN = dyn_cast<TypedefNameDecl>(TD)) {
8515 LSI->ContainsUnexpandedParameterPack |=
8516 TN->getUnderlyingType()->containsUnexpandedParameterPack();
8518 LSI->ContainsUnexpandedParameterPack |=
8521 .getTypeDeclType(TD)
8522 ->containsUnexpandedParameterPack();
8525 if (
auto *VD = dyn_cast<VarDecl>(Transformed))
8526 LSI->ContainsUnexpandedParameterPack |=
8527 VD->getType()->containsUnexpandedParameterPack();
8530 Decls.push_back(Transformed);
8533 if (!getDerived().AlwaysRebuild() && !DeclChanged)
8536 return getDerived().RebuildDeclStmt(Decls, S->getBeginLoc(), S->getEndLoc());
8539template<
typename Derived>
8549 bool ExprsChanged =
false;
8551 auto RebuildString = [&](
Expr *E) {
8556 ExprsChanged =
true;
8563 for (
unsigned I = 0, E = S->getNumOutputs(); I != E; ++I) {
8564 Names.push_back(S->getOutputIdentifier(I));
8570 Constraints.push_back(
Result.get());
8573 Expr *OutputExpr = S->getOutputExpr(I);
8574 Result = getDerived().TransformExpr(OutputExpr);
8578 ExprsChanged |=
Result.get() != OutputExpr;
8580 Exprs.push_back(
Result.get());
8584 for (
unsigned I = 0, E = S->getNumInputs(); I != E; ++I) {
8585 Names.push_back(S->getInputIdentifier(I));
8591 Constraints.push_back(
Result.get());
8594 Expr *InputExpr = S->getInputExpr(I);
8595 Result = getDerived().TransformExpr(InputExpr);
8599 ExprsChanged |=
Result.get() != InputExpr;
8601 Exprs.push_back(
Result.get());
8605 for (
unsigned I = 0, E = S->getNumLabels(); I != E; ++I) {
8606 Names.push_back(S->getLabelIdentifier(I));
8611 ExprsChanged |=
Result.get() != S->getLabelExpr(I);
8612 Exprs.push_back(
Result.get());
8616 for (
unsigned I = 0, E = S->getNumClobbers(); I != E; ++I) {
8620 Clobbers.push_back(
Result.get());
8623 ExprResult AsmString = RebuildString(S->getAsmStringExpr());
8624 if (AsmString.isInvalid())
8627 if (!getDerived().AlwaysRebuild() && !ExprsChanged)
8630 return getDerived().RebuildGCCAsmStmt(S->getAsmLoc(), S->isSimple(),
8631 S->isVolatile(), S->getNumOutputs(),
8632 S->getNumInputs(), Names.data(),
8633 Constraints, Exprs, AsmString.get(),
8634 Clobbers, S->getNumLabels(),
8638template<
typename Derived>
8643 bool HadError =
false, HadChange =
false;
8647 TransformedExprs.reserve(SrcExprs.size());
8648 for (
unsigned i = 0, e = SrcExprs.size(); i != e; ++i) {
8650 if (!
Result.isUsable()) {
8653 HadChange |= (
Result.get() != SrcExprs[i]);
8654 TransformedExprs.push_back(
Result.get());
8659 if (!HadChange && !getDerived().AlwaysRebuild())
8662 return getDerived().RebuildMSAsmStmt(S->getAsmLoc(), S->getLBraceLoc(),
8663 AsmToks, S->getAsmString(),
8664 S->getNumOutputs(), S->getNumInputs(),
8665 S->getAllConstraints(), S->getClobbers(),
8666 TransformedExprs, S->getEndLoc());
8670template<
typename Derived>
8675 assert(FD && ScopeInfo && !ScopeInfo->CoroutinePromise &&
8676 ScopeInfo->NeedsCoroutineSuspends &&
8677 ScopeInfo->CoroutineSuspends.first ==
nullptr &&
8678 ScopeInfo->CoroutineSuspends.second ==
nullptr &&
8679 "expected clean scope info");
8683 ScopeInfo->setNeedsCoroutineSuspends(
false);
8696 getDerived().transformedLocalDecl(S->getPromiseDecl(), {Promise});
8697 ScopeInfo->CoroutinePromise = Promise;
8702 StmtResult InitSuspend = getDerived().TransformStmt(S->getInitSuspendStmt());
8703 if (InitSuspend.isInvalid())
8706 getDerived().TransformStmt(S->getFinalSuspendStmt());
8707 if (FinalSuspend.isInvalid() ||
8710 ScopeInfo->setCoroutineSuspends(InitSuspend.get(), FinalSuspend.get());
8713 StmtResult BodyRes = getDerived().TransformStmt(S->getBody());
8714 if (BodyRes.isInvalid())
8718 if (Builder.isInvalid())
8721 Expr *ReturnObject = S->getReturnValueInit();
8722 assert(ReturnObject &&
"the return object is expected to be valid");
8723 ExprResult Res = getDerived().TransformInitializer(ReturnObject,
8725 if (Res.isInvalid())
8727 Builder.ReturnValue = Res.get();
8732 if (S->hasDependentPromiseType()) {
8735 if (!Promise->getType()->isDependentType()) {
8736 assert(!S->getFallthroughHandler() && !S->getExceptionHandler() &&
8737 !S->getReturnStmtOnAllocFailure() && !S->getDeallocate() &&
8738 "these nodes should not have been built yet");
8739 if (!Builder.buildDependentStatements())
8743 if (
auto *OnFallthrough = S->getFallthroughHandler()) {
8744 StmtResult Res = getDerived().TransformStmt(OnFallthrough);
8745 if (Res.isInvalid())
8747 Builder.OnFallthrough = Res.get();
8750 if (
auto *OnException = S->getExceptionHandler()) {
8751 StmtResult Res = getDerived().TransformStmt(OnException);
8752 if (Res.isInvalid())
8754 Builder.OnException = Res.get();
8757 if (
auto *OnAllocFailure = S->getReturnStmtOnAllocFailure()) {
8758 StmtResult Res = getDerived().TransformStmt(OnAllocFailure);
8759 if (Res.isInvalid())
8761 Builder.ReturnStmtOnAllocFailure = Res.get();
8765 assert(S->getAllocate() && S->getDeallocate() &&
8766 "allocation and deallocation calls must already be built");
8767 ExprResult AllocRes = getDerived().TransformExpr(S->getAllocate());
8768 if (AllocRes.isInvalid())
8770 Builder.Allocate = AllocRes.get();
8772 ExprResult DeallocRes = getDerived().TransformExpr(S->getDeallocate());
8773 if (DeallocRes.isInvalid())
8775 Builder.Deallocate = DeallocRes.get();
8777 if (
auto *ResultDecl = S->getResultDecl()) {
8778 StmtResult Res = getDerived().TransformStmt(ResultDecl);
8779 if (Res.isInvalid())
8781 Builder.ResultDecl = Res.get();
8786 if (Res.isInvalid())
8788 Builder.ReturnStmt = Res.get();
8792 return getDerived().RebuildCoroutineBodyStmt(Builder);
8795template<
typename Derived>
8805 return getDerived().RebuildCoreturnStmt(S->getKeywordLoc(),
Result.get(),
8809template <
typename Derived>
8822 ExprResult Lookup = getSema().BuildOperatorCoawaitLookupExpr(
8823 getSema().getCurScope(), E->getKeywordLoc());
8827 return getDerived().RebuildCoawaitExpr(
8828 E->getKeywordLoc(),
Operand.get(),
8832template <
typename Derived>
8835 ExprResult OperandResult = getDerived().TransformInitializer(E->getOperand(),
8837 if (OperandResult.isInvalid())
8841 E->getOperatorCoawaitLookup());
8848 return getDerived().RebuildDependentCoawaitExpr(
8849 E->getKeywordLoc(), OperandResult.get(),
8853template<
typename Derived>
8863 return getDerived().RebuildCoyieldExpr(E->getKeywordLoc(),
Result.get());
8868template<
typename Derived>
8872 StmtResult TryBody = getDerived().TransformStmt(S->getTryBody());
8873 if (TryBody.isInvalid())
8877 bool AnyCatchChanged =
false;
8879 for (
unsigned I = 0, N = S->getNumCatchStmts(); I != N; ++I) {
8880 StmtResult Catch = getDerived().TransformStmt(S->getCatchStmt(I));
8881 if (Catch.isInvalid())
8883 if (Catch.get() != S->getCatchStmt(I))
8884 AnyCatchChanged =
true;
8885 CatchStmts.push_back(Catch.get());
8890 if (S->getFinallyStmt()) {
8891 Finally = getDerived().TransformStmt(S->getFinallyStmt());
8892 if (Finally.isInvalid())
8897 if (!getDerived().AlwaysRebuild() &&
8898 TryBody.get() == S->getTryBody() &&
8900 Finally.get() == S->getFinallyStmt())
8904 return getDerived().RebuildObjCAtTryStmt(S->getAtTryLoc(), TryBody.get(),
8905 CatchStmts, Finally.get());
8908template<
typename Derived>
8913 if (
VarDecl *FromVar = S->getCatchParamDecl()) {
8915 if (FromVar->getTypeSourceInfo()) {
8916 TSInfo = getDerived().TransformType(FromVar->getTypeSourceInfo());
8923 T = TSInfo->getType();
8925 T = getDerived().TransformType(FromVar->getType());
8930 Var = getDerived().RebuildObjCExceptionDecl(FromVar, TSInfo,
T);
8935 StmtResult Body = getDerived().TransformStmt(S->getCatchBody());
8936 if (Body.isInvalid())
8939 return getDerived().RebuildObjCAtCatchStmt(S->getAtCatchLoc(),
8944template<
typename Derived>
8948 StmtResult Body = getDerived().TransformStmt(S->getFinallyBody());
8949 if (Body.isInvalid())
8953 if (!getDerived().AlwaysRebuild() &&
8954 Body.get() == S->getFinallyBody())
8958 return getDerived().RebuildObjCAtFinallyStmt(S->getAtFinallyLoc(),
8962template<
typename Derived>
8966 if (S->getThrowExpr()) {
8967 Operand = getDerived().TransformExpr(S->getThrowExpr());
8972 if (!getDerived().AlwaysRebuild() &&
8973 Operand.get() == S->getThrowExpr())
8976 return getDerived().RebuildObjCAtThrowStmt(S->getThrowLoc(),
Operand.get());
8979template<
typename Derived>
8988 getDerived().RebuildObjCAtSynchronizedOperand(S->getAtSynchronizedLoc(),
8994 StmtResult Body = getDerived().TransformStmt(S->getSynchBody());
8995 if (Body.isInvalid())
8999 if (!getDerived().AlwaysRebuild() &&
9000 Object.get() == S->getSynchExpr() &&
9001 Body.get() == S->getSynchBody())
9005 return getDerived().RebuildObjCAtSynchronizedStmt(S->getAtSynchronizedLoc(),
9006 Object.get(), Body.get());
9009template<
typename Derived>
9014 StmtResult Body = getDerived().TransformStmt(S->getSubStmt());
9015 if (Body.isInvalid())
9019 if (!getDerived().AlwaysRebuild() &&
9020 Body.get() == S->getSubStmt())
9024 return getDerived().RebuildObjCAutoreleasePoolStmt(
9025 S->getAtLoc(), Body.get());
9028template<
typename Derived>
9033 StmtResult Element = getDerived().TransformStmt(
9034 S->getElement(), StmtDiscardKind::NotDiscarded);
9035 if (Element.isInvalid())
9039 ExprResult Collection = getDerived().TransformExpr(S->getCollection());
9040 if (Collection.isInvalid())
9044 StmtResult Body = getDerived().TransformStmt(S->getBody());
9045 if (Body.isInvalid())
9049 if (!getDerived().AlwaysRebuild() &&
9050 Element.get() == S->getElement() &&
9051 Collection.get() == S->getCollection() &&
9052 Body.get() == S->getBody())
9056 return getDerived().RebuildObjCForCollectionStmt(S->getForLoc(),
9063template <
typename Derived>
9067 if (
VarDecl *ExceptionDecl = S->getExceptionDecl()) {
9069 getDerived().TransformType(ExceptionDecl->getTypeSourceInfo());
9073 Var = getDerived().RebuildExceptionDecl(
9074 ExceptionDecl,
T, ExceptionDecl->getInnerLocStart(),
9075 ExceptionDecl->getLocation(), ExceptionDecl->getIdentifier());
9076 if (!Var || Var->isInvalidDecl())
9081 StmtResult Handler = getDerived().TransformStmt(S->getHandlerBlock());
9082 if (Handler.isInvalid())
9085 if (!getDerived().AlwaysRebuild() && !Var &&
9086 Handler.get() == S->getHandlerBlock())
9089 return getDerived().RebuildCXXCatchStmt(S->getCatchLoc(), Var, Handler.get());
9092template <
typename Derived>
9095 StmtResult TryBlock = getDerived().TransformCompoundStmt(S->getTryBlock());
9096 if (TryBlock.isInvalid())
9100 bool HandlerChanged =
false;
9102 for (
unsigned I = 0, N = S->getNumHandlers(); I != N; ++I) {
9103 StmtResult Handler = getDerived().TransformCXXCatchStmt(S->getHandler(I));
9104 if (Handler.isInvalid())
9107 HandlerChanged = HandlerChanged || Handler.get() != S->getHandler(I);
9108 Handlers.push_back(Handler.getAs<
Stmt>());
9111 getSema().DiagnoseExceptionUse(S->getTryLoc(),
true);
9113 if (!getDerived().AlwaysRebuild() && TryBlock.get() == S->getTryBlock() &&
9117 return getDerived().RebuildCXXTryStmt(S->getTryLoc(), TryBlock.get(),
9121template<
typename Derived>
9132 auto &LastRecord = getSema().currentEvaluationContext();
9133 LastRecord.InLifetimeExtendingContext =
true;
9134 LastRecord.RebuildDefaultArgOrDefaultInit =
true;
9137 S->getInit() ? getDerived().TransformStmt(S->getInit()) :
StmtResult();
9138 if (
Init.isInvalid())
9142 if (
Range.isInvalid())
9147 getSema().ExprEvalContexts.back().ForRangeLifetimeExtendTemps.empty());
9148 auto ForRangeLifetimeExtendTemps =
9149 getSema().ExprEvalContexts.back().ForRangeLifetimeExtendTemps;
9151 StmtResult Begin = getDerived().TransformStmt(S->getBeginStmt());
9152 if (Begin.isInvalid())
9154 StmtResult End = getDerived().TransformStmt(S->getEndStmt());
9155 if (End.isInvalid())
9159 if (
Cond.isInvalid())
9163 if (
Cond.isInvalid())
9169 if (
Inc.isInvalid())
9174 StmtResult LoopVar = getDerived().TransformStmt(S->getLoopVarStmt());
9175 if (LoopVar.isInvalid())
9179 if (getDerived().AlwaysRebuild() ||
9180 Init.get() != S->getInit() ||
9181 Range.get() != S->getRangeStmt() ||
9182 Begin.get() != S->getBeginStmt() ||
9183 End.get() != S->getEndStmt() ||
9184 Cond.get() != S->getCond() ||
9185 Inc.get() != S->getInc() ||
9186 LoopVar.get() != S->getLoopVarStmt()) {
9187 NewStmt = getDerived().RebuildCXXForRangeStmt(
9188 S->getForLoc(), S->getCoawaitLoc(),
Init.get(), S->getColonLoc(),
9189 Range.get(), Begin.get(), End.get(),
Cond.get(),
Inc.get(),
9190 LoopVar.get(), S->getRParenLoc(), ForRangeLifetimeExtendTemps);
9191 if (NewStmt.isInvalid() && LoopVar.get() != S->getLoopVarStmt()) {
9193 getSema().ActOnInitializerError(
9204 StmtResult Body = getDerived().TransformStmt(S->getBody());
9205 if (Body.isInvalid())
9212 if (Body.get() != S->getBody() && NewStmt.get() == S) {
9213 NewStmt = getDerived().RebuildCXXForRangeStmt(
9214 S->getForLoc(), S->getCoawaitLoc(),
Init.get(), S->getColonLoc(),
9215 Range.get(), Begin.get(), End.get(),
Cond.get(),
Inc.get(),
9216 LoopVar.get(), S->getRParenLoc(), ForRangeLifetimeExtendTemps);
9217 if (NewStmt.isInvalid())
9221 if (NewStmt.get() == S)
9224 return FinishCXXForRangeStmt(NewStmt.get(), Body.get());
9227template<
typename Derived>
9233 if (S->getQualifierLoc()) {
9235 = getDerived().TransformNestedNameSpecifierLoc(S->getQualifierLoc());
9242 if (NameInfo.getName()) {
9243 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
9244 if (!NameInfo.getName())
9249 if (!getDerived().AlwaysRebuild() &&
9250 QualifierLoc == S->getQualifierLoc() &&
9251 NameInfo.getName() == S->getNameInfo().getName())
9256 SS.
Adopt(QualifierLoc);
9258 switch (getSema().CheckMicrosoftIfExistsSymbol(
nullptr, SS, NameInfo)) {
9260 if (S->isIfExists())
9263 return new (getSema().Context)
NullStmt(S->getKeywordLoc());
9266 if (S->isIfNotExists())
9269 return new (getSema().Context)
NullStmt(S->getKeywordLoc());
9280 StmtResult SubStmt = getDerived().TransformCompoundStmt(S->getSubStmt());
9281 if (SubStmt.isInvalid())
9289 return getDerived().RebuildMSDependentExistsStmt(S->getKeywordLoc(),
9296template<
typename Derived>
9300 if (E->getQualifierLoc()) {
9302 = getDerived().TransformNestedNameSpecifierLoc(E->getQualifierLoc());
9308 getDerived().TransformDecl(E->getMemberLoc(), E->getPropertyDecl()));
9313 if (
Base.isInvalid())
9319 QualifierLoc, E->getMemberLoc());
9322template <
typename Derived>
9326 if (BaseRes.isInvalid())
9328 auto IdxRes = getDerived().TransformExpr(E->getIdx());
9329 if (IdxRes.isInvalid())
9332 if (!getDerived().AlwaysRebuild() &&
9333 BaseRes.get() == E->getBase() &&
9334 IdxRes.get() == E->getIdx())
9337 return getDerived().RebuildArraySubscriptExpr(
9338 BaseRes.get(),
SourceLocation(), IdxRes.get(), E->getRBracketLoc());
9341template <
typename Derived>
9343 StmtResult TryBlock = getDerived().TransformCompoundStmt(S->getTryBlock());
9344 if (TryBlock.isInvalid())
9347 StmtResult Handler = getDerived().TransformSEHHandler(S->getHandler());
9348 if (Handler.isInvalid())
9351 if (!getDerived().AlwaysRebuild() && TryBlock.get() == S->getTryBlock() &&
9352 Handler.get() == S->getHandler())
9355 return getDerived().RebuildSEHTryStmt(S->getIsCXXTry(), S->getTryLoc(),
9356 TryBlock.get(), Handler.get());
9359template <
typename Derived>
9362 if (
Block.isInvalid())
9365 return getDerived().RebuildSEHFinallyStmt(S->getFinallyLoc(),
Block.get());
9368template <
typename Derived>
9370 ExprResult FilterExpr = getDerived().TransformExpr(S->getFilterExpr());
9371 if (FilterExpr.isInvalid())
9375 if (
Block.isInvalid())
9378 return getDerived().RebuildSEHExceptStmt(S->getExceptLoc(), FilterExpr.get(),
9382template <
typename Derived>
9390template<
typename Derived>
9400template <
typename Derived>
9402TreeTransform<Derived>::TransformOMPCanonicalLoop(OMPCanonicalLoop *L) {
9406 return getDerived().TransformStmt(L->getLoopStmt());
9409template <
typename Derived>
9416 TClauses.reserve(Clauses.size());
9420 getDerived().getSema().OpenMP().StartOpenMPClause((*I)->getClauseKind());
9422 getDerived().getSema().OpenMP().EndOpenMPClause();
9424 TClauses.push_back(Clause);
9426 TClauses.push_back(
nullptr);
9430 if (D->hasAssociatedStmt() && D->getAssociatedStmt()) {
9431 getDerived().getSema().OpenMP().ActOnOpenMPRegionStart(
9432 D->getDirectiveKind(),
9438 if (D->getDirectiveKind() == OMPD_atomic ||
9439 D->getDirectiveKind() == OMPD_critical ||
9440 D->getDirectiveKind() == OMPD_section ||
9441 D->getDirectiveKind() == OMPD_master)
9442 CS = D->getAssociatedStmt();
9444 CS = D->getRawStmt();
9447 getSema().getLangOpts().OpenMPIRBuilder)
9451 getDerived().getSema().OpenMP().ActOnOpenMPRegionEnd(Body, TClauses);
9456 if (TClauses.size() != Clauses.size()) {
9462 if (D->getDirectiveKind() == OMPD_critical) {
9464 DirName =
getDerived().TransformDeclarationNameInfo(DirName);
9467 if (D->getDirectiveKind() == OMPD_cancellation_point) {
9469 }
else if (D->getDirectiveKind() == OMPD_cancel) {
9473 return getDerived().RebuildOMPExecutableDirective(
9474 D->getDirectiveKind(), DirName, CancelRegion, TClauses,
9475 AssociatedStmt.
get(), D->getBeginLoc(), D->getEndLoc());
9483template <
typename Derived>
9490 TClauses.reserve(Clauses.size());
9493 getDerived().getSema().OpenMP().StartOpenMPClause(
C->getClauseKind());
9495 getDerived().getSema().OpenMP().EndOpenMPClause();
9497 TClauses.push_back(Clause);
9499 TClauses.push_back(
nullptr);
9503 if (D->hasAssociatedStmt() && D->getAssociatedStmt()) {
9504 getDerived().getSema().OpenMP().ActOnOpenMPRegionStart(
9505 D->getDirectiveKind(),
9510 assert(D->getDirectiveKind() == OMPD_assume &&
9511 "Unexpected informational directive");
9512 Stmt *CS = D->getAssociatedStmt();
9516 getDerived().getSema().OpenMP().ActOnOpenMPRegionEnd(Body, TClauses);
9520 if (TClauses.size() != Clauses.size())
9525 return getDerived().RebuildOMPInformationalDirective(
9526 D->getDirectiveKind(), DirName, TClauses, AssociatedStmt.
get(),
9527 D->getBeginLoc(), D->getEndLoc());
9530template <
typename Derived>
9535 SemaRef.
Diag(D->getBeginLoc(), diag::err_omp_instantiation_not_supported)
9536 << getOpenMPDirectiveName(D->getDirectiveKind(), OMPVersion);
9540template <
typename Derived>
9542TreeTransform<Derived>::TransformOMPParallelDirective(OMPParallelDirective *D) {
9543 DeclarationNameInfo DirName;
9544 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9545 OMPD_parallel, DirName,
nullptr, D->getBeginLoc());
9546 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9547 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9551template <
typename Derived>
9555 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9556 OMPD_simd, DirName,
nullptr, D->getBeginLoc());
9557 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9558 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9562template <
typename Derived>
9566 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9567 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
9568 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9569 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9573template <
typename Derived>
9577 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9578 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
9579 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9580 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9584template <
typename Derived>
9588 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9589 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
9590 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9591 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9595template <
typename Derived>
9599 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9600 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
9601 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9602 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9606template <
typename Derived>
9608 OMPInterchangeDirective *D) {
9610 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9611 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
9612 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9613 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9617template <
typename Derived>
9621 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9622 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
9623 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9624 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9628template <
typename Derived>
9632 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9633 OMPD_for, DirName,
nullptr, D->getBeginLoc());
9634 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9635 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9639template <
typename Derived>
9643 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9644 OMPD_for_simd, DirName,
nullptr, D->getBeginLoc());
9645 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9646 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9650template <
typename Derived>
9654 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9655 OMPD_sections, DirName,
nullptr, D->getBeginLoc());
9656 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9657 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9661template <
typename Derived>
9665 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9666 OMPD_section, DirName,
nullptr, D->getBeginLoc());
9667 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9668 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9672template <
typename Derived>
9676 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9677 OMPD_scope, DirName,
nullptr, D->getBeginLoc());
9678 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9679 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9683template <
typename Derived>
9687 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9688 OMPD_single, DirName,
nullptr, D->getBeginLoc());
9689 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9690 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9694template <
typename Derived>
9698 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9699 OMPD_master, DirName,
nullptr, D->getBeginLoc());
9700 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9701 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9705template <
typename Derived>
9709 OMPD_critical, D->getDirectiveName(),
nullptr, D->getBeginLoc());
9710 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9711 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9715template <
typename Derived>
9717 OMPParallelForDirective *D) {
9719 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9720 OMPD_parallel_for, DirName,
nullptr, D->getBeginLoc());
9721 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9722 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9726template <
typename Derived>
9728 OMPParallelForSimdDirective *D) {
9730 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9731 OMPD_parallel_for_simd, DirName,
nullptr, D->getBeginLoc());
9732 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9733 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9737template <
typename Derived>
9739 OMPParallelMasterDirective *D) {
9741 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9742 OMPD_parallel_master, DirName,
nullptr, D->getBeginLoc());
9743 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9744 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9748template <
typename Derived>
9750 OMPParallelMaskedDirective *D) {
9752 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9753 OMPD_parallel_masked, DirName,
nullptr, D->getBeginLoc());
9754 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9755 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9759template <
typename Derived>
9761 OMPParallelSectionsDirective *D) {
9763 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9764 OMPD_parallel_sections, DirName,
nullptr, D->getBeginLoc());
9765 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9766 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9770template <
typename Derived>
9774 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9775 OMPD_task, DirName,
nullptr, D->getBeginLoc());
9776 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9777 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9781template <
typename Derived>
9783 OMPTaskyieldDirective *D) {
9785 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9786 OMPD_taskyield, DirName,
nullptr, D->getBeginLoc());
9787 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9788 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9792template <
typename Derived>
9796 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9797 OMPD_barrier, DirName,
nullptr, D->getBeginLoc());
9798 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9799 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9803template <
typename Derived>
9807 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9808 OMPD_taskwait, DirName,
nullptr, D->getBeginLoc());
9809 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9810 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9814template <
typename Derived>
9818 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9819 OMPD_assume, DirName,
nullptr, D->getBeginLoc());
9820 StmtResult Res = getDerived().TransformOMPInformationalDirective(D);
9821 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9825template <
typename Derived>
9829 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9830 OMPD_error, DirName,
nullptr, D->getBeginLoc());
9831 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9832 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9836template <
typename Derived>
9838 OMPTaskgroupDirective *D) {
9840 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9841 OMPD_taskgroup, DirName,
nullptr, D->getBeginLoc());
9842 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9843 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9847template <
typename Derived>
9851 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9852 OMPD_flush, DirName,
nullptr, D->getBeginLoc());
9853 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9854 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9858template <
typename Derived>
9862 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9863 OMPD_depobj, DirName,
nullptr, D->getBeginLoc());
9864 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9865 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9869template <
typename Derived>
9873 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9874 OMPD_scan, DirName,
nullptr, D->getBeginLoc());
9875 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9876 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9880template <
typename Derived>
9884 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9885 OMPD_ordered, DirName,
nullptr, D->getBeginLoc());
9886 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9887 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9891template <
typename Derived>
9895 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9896 OMPD_atomic, DirName,
nullptr, D->getBeginLoc());
9897 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9898 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9902template <
typename Derived>
9906 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9907 OMPD_target, DirName,
nullptr, D->getBeginLoc());
9908 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9909 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9913template <
typename Derived>
9915 OMPTargetDataDirective *D) {
9917 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9918 OMPD_target_data, DirName,
nullptr, D->getBeginLoc());
9919 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9920 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9924template <
typename Derived>
9926 OMPTargetEnterDataDirective *D) {
9928 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9929 OMPD_target_enter_data, DirName,
nullptr, D->getBeginLoc());
9930 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9931 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9935template <
typename Derived>
9937 OMPTargetExitDataDirective *D) {
9939 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9940 OMPD_target_exit_data, DirName,
nullptr, D->getBeginLoc());
9941 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9942 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9946template <
typename Derived>
9948 OMPTargetParallelDirective *D) {
9950 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9951 OMPD_target_parallel, DirName,
nullptr, D->getBeginLoc());
9952 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9953 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9957template <
typename Derived>
9959 OMPTargetParallelForDirective *D) {
9961 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9962 OMPD_target_parallel_for, DirName,
nullptr, D->getBeginLoc());
9963 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9964 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9968template <
typename Derived>
9970 OMPTargetUpdateDirective *D) {
9972 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9973 OMPD_target_update, DirName,
nullptr, D->getBeginLoc());
9974 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9975 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9979template <
typename Derived>
9983 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9984 OMPD_teams, DirName,
nullptr, D->getBeginLoc());
9985 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9986 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9990template <
typename Derived>
9992 OMPCancellationPointDirective *D) {
9994 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9995 OMPD_cancellation_point, DirName,
nullptr, D->getBeginLoc());
9996 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9997 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10001template <
typename Derived>
10005 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10006 OMPD_cancel, DirName,
nullptr, D->getBeginLoc());
10007 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10008 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10012template <
typename Derived>
10016 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10017 OMPD_taskloop, DirName,
nullptr, D->getBeginLoc());
10018 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10019 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10023template <
typename Derived>
10025 OMPTaskLoopSimdDirective *D) {
10027 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10028 OMPD_taskloop_simd, DirName,
nullptr, D->getBeginLoc());
10029 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10030 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10034template <
typename Derived>
10036 OMPMasterTaskLoopDirective *D) {
10038 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10039 OMPD_master_taskloop, DirName,
nullptr, D->getBeginLoc());
10040 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10041 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10045template <
typename Derived>
10047 OMPMaskedTaskLoopDirective *D) {
10049 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10050 OMPD_masked_taskloop, DirName,
nullptr, D->getBeginLoc());
10051 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10052 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10056template <
typename Derived>
10058 OMPMasterTaskLoopSimdDirective *D) {
10060 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10061 OMPD_master_taskloop_simd, DirName,
nullptr, D->getBeginLoc());
10062 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10063 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10067template <
typename Derived>
10069 OMPMaskedTaskLoopSimdDirective *D) {
10071 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10072 OMPD_masked_taskloop_simd, DirName,
nullptr, D->getBeginLoc());
10073 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10074 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10078template <
typename Derived>
10080 OMPParallelMasterTaskLoopDirective *D) {
10082 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10083 OMPD_parallel_master_taskloop, DirName,
nullptr, D->getBeginLoc());
10084 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10085 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10089template <
typename Derived>
10091 OMPParallelMaskedTaskLoopDirective *D) {
10093 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10094 OMPD_parallel_masked_taskloop, DirName,
nullptr, D->getBeginLoc());
10095 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10096 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10100template <
typename Derived>
10103 OMPParallelMasterTaskLoopSimdDirective *D) {
10105 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10106 OMPD_parallel_master_taskloop_simd, DirName,
nullptr, D->getBeginLoc());
10107 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10108 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10112template <
typename Derived>
10115 OMPParallelMaskedTaskLoopSimdDirective *D) {
10117 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10118 OMPD_parallel_masked_taskloop_simd, DirName,
nullptr, D->getBeginLoc());
10119 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10120 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10124template <
typename Derived>
10126 OMPDistributeDirective *D) {
10128 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10129 OMPD_distribute, DirName,
nullptr, D->getBeginLoc());
10130 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10131 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10135template <
typename Derived>
10137 OMPDistributeParallelForDirective *D) {
10139 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10140 OMPD_distribute_parallel_for, DirName,
nullptr, D->getBeginLoc());
10141 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10142 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10146template <
typename Derived>
10149 OMPDistributeParallelForSimdDirective *D) {
10151 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10152 OMPD_distribute_parallel_for_simd, DirName,
nullptr, D->getBeginLoc());
10153 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10154 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10158template <
typename Derived>
10160 OMPDistributeSimdDirective *D) {
10162 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10163 OMPD_distribute_simd, DirName,
nullptr, D->getBeginLoc());
10164 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10165 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10169template <
typename Derived>
10171 OMPTargetParallelForSimdDirective *D) {
10173 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10174 OMPD_target_parallel_for_simd, DirName,
nullptr, D->getBeginLoc());
10175 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10176 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10180template <
typename Derived>
10182 OMPTargetSimdDirective *D) {
10184 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10185 OMPD_target_simd, DirName,
nullptr, D->getBeginLoc());
10186 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10187 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10191template <
typename Derived>
10193 OMPTeamsDistributeDirective *D) {
10195 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10196 OMPD_teams_distribute, DirName,
nullptr, D->getBeginLoc());
10197 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10198 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10202template <
typename Derived>
10204 OMPTeamsDistributeSimdDirective *D) {
10206 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10207 OMPD_teams_distribute_simd, DirName,
nullptr, D->getBeginLoc());
10208 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10209 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10213template <
typename Derived>
10215 OMPTeamsDistributeParallelForSimdDirective *D) {
10217 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10218 OMPD_teams_distribute_parallel_for_simd, DirName,
nullptr,
10220 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10221 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10225template <
typename Derived>
10227 OMPTeamsDistributeParallelForDirective *D) {
10229 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10230 OMPD_teams_distribute_parallel_for, DirName,
nullptr, D->getBeginLoc());
10231 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10232 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10236template <
typename Derived>
10238 OMPTargetTeamsDirective *D) {
10240 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10241 OMPD_target_teams, DirName,
nullptr, D->getBeginLoc());
10242 auto Res = getDerived().TransformOMPExecutableDirective(D);
10243 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10247template <
typename Derived>
10249 OMPTargetTeamsDistributeDirective *D) {
10251 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10252 OMPD_target_teams_distribute, DirName,
nullptr, D->getBeginLoc());
10253 auto Res = getDerived().TransformOMPExecutableDirective(D);
10254 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10258template <
typename Derived>
10261 OMPTargetTeamsDistributeParallelForDirective *D) {
10263 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10264 OMPD_target_teams_distribute_parallel_for, DirName,
nullptr,
10266 auto Res = getDerived().TransformOMPExecutableDirective(D);
10267 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10271template <
typename Derived>
10274 OMPTargetTeamsDistributeParallelForSimdDirective *D) {
10276 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10277 OMPD_target_teams_distribute_parallel_for_simd, DirName,
nullptr,
10279 auto Res = getDerived().TransformOMPExecutableDirective(D);
10280 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10284template <
typename Derived>
10287 OMPTargetTeamsDistributeSimdDirective *D) {
10289 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10290 OMPD_target_teams_distribute_simd, DirName,
nullptr, D->getBeginLoc());
10291 auto Res = getDerived().TransformOMPExecutableDirective(D);
10292 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10296template <
typename Derived>
10300 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10301 OMPD_interop, DirName,
nullptr, D->getBeginLoc());
10302 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10303 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10307template <
typename Derived>
10311 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10312 OMPD_dispatch, DirName,
nullptr, D->getBeginLoc());
10313 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10314 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10318template <
typename Derived>
10322 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10323 OMPD_masked, DirName,
nullptr, D->getBeginLoc());
10324 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10325 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10329template <
typename Derived>
10331 OMPGenericLoopDirective *D) {
10333 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10334 OMPD_loop, DirName,
nullptr, D->getBeginLoc());
10335 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10336 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10340template <
typename Derived>
10342 OMPTeamsGenericLoopDirective *D) {
10344 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10345 OMPD_teams_loop, DirName,
nullptr, D->getBeginLoc());
10346 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10347 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10351template <
typename Derived>
10353 OMPTargetTeamsGenericLoopDirective *D) {
10355 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10356 OMPD_target_teams_loop, DirName,
nullptr, D->getBeginLoc());
10357 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10358 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10362template <
typename Derived>
10364 OMPParallelGenericLoopDirective *D) {
10366 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10367 OMPD_parallel_loop, DirName,
nullptr, D->getBeginLoc());
10368 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10369 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10373template <
typename Derived>
10376 OMPTargetParallelGenericLoopDirective *D) {
10378 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10379 OMPD_target_parallel_loop, DirName,
nullptr, D->getBeginLoc());
10380 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10381 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10388template <
typename Derived>
10391 if (
Cond.isInvalid())
10393 return getDerived().RebuildOMPIfClause(
10394 C->getNameModifier(),
Cond.get(),
C->getBeginLoc(),
C->getLParenLoc(),
10395 C->getNameModifierLoc(),
C->getColonLoc(),
C->getEndLoc());
10398template <
typename Derived>
10401 if (
Cond.isInvalid())
10403 return getDerived().RebuildOMPFinalClause(
Cond.get(),
C->getBeginLoc(),
10404 C->getLParenLoc(),
C->getEndLoc());
10407template <
typename Derived>
10410 ExprResult NumThreads = getDerived().TransformExpr(
C->getNumThreads());
10411 if (NumThreads.isInvalid())
10413 return getDerived().RebuildOMPNumThreadsClause(
10414 C->getModifier(), NumThreads.get(),
C->getBeginLoc(),
C->getLParenLoc(),
10415 C->getModifierLoc(),
C->getEndLoc());
10418template <
typename Derived>
10421 ExprResult E = getDerived().TransformExpr(
C->getSafelen());
10424 return getDerived().RebuildOMPSafelenClause(
10425 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10428template <
typename Derived>
10431 ExprResult E = getDerived().TransformExpr(
C->getAllocator());
10434 return getDerived().RebuildOMPAllocatorClause(
10435 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10438template <
typename Derived>
10441 ExprResult E = getDerived().TransformExpr(
C->getSimdlen());
10444 return getDerived().RebuildOMPSimdlenClause(
10445 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10448template <
typename Derived>
10451 TransformedSizes.reserve(
C->getNumSizes());
10453 for (
Expr *E :
C->getSizesRefs()) {
10455 TransformedSizes.push_back(
nullptr);
10464 TransformedSizes.push_back(
T.get());
10467 if (!Changed && !getDerived().AlwaysRebuild())
10469 return RebuildOMPSizesClause(TransformedSizes,
C->getBeginLoc(),
10470 C->getLParenLoc(),
C->getEndLoc());
10473template <
typename Derived>
10477 TransformedArgs.reserve(
C->getNumLoops());
10479 for (
Expr *E :
C->getArgsRefs()) {
10481 TransformedArgs.push_back(
nullptr);
10490 TransformedArgs.push_back(
T.get());
10493 if (!Changed && !getDerived().AlwaysRebuild())
10495 return RebuildOMPPermutationClause(TransformedArgs,
C->getBeginLoc(),
10496 C->getLParenLoc(),
C->getEndLoc());
10499template <
typename Derived>
10501 if (!getDerived().AlwaysRebuild())
10503 return RebuildOMPFullClause(
C->getBeginLoc(),
C->getEndLoc());
10506template <
typename Derived>
10509 ExprResult T = getDerived().TransformExpr(
C->getFactor());
10512 Expr *Factor =
T.get();
10513 bool Changed = Factor !=
C->getFactor();
10515 if (!Changed && !getDerived().AlwaysRebuild())
10517 return RebuildOMPPartialClause(Factor,
C->getBeginLoc(),
C->getLParenLoc(),
10521template <
typename Derived>
10524 ExprResult F = getDerived().TransformExpr(
C->getFirst());
10528 ExprResult Cn = getDerived().TransformExpr(
C->getCount());
10529 if (Cn.isInvalid())
10533 Expr *Count = Cn.get();
10535 bool Changed = (
First !=
C->getFirst()) || (Count !=
C->getCount());
10538 if (!Changed && !getDerived().AlwaysRebuild())
10541 return RebuildOMPLoopRangeClause(
First, Count,
C->getBeginLoc(),
10542 C->getLParenLoc(),
C->getFirstLoc(),
10543 C->getCountLoc(),
C->getEndLoc());
10546template <
typename Derived>
10549 ExprResult E = getDerived().TransformExpr(
C->getNumForLoops());
10552 return getDerived().RebuildOMPCollapseClause(
10553 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10556template <
typename Derived>
10560 C->getDefaultKind(),
C->getDefaultKindKwLoc(),
C->getDefaultVC(),
10561 C->getDefaultVCLoc(),
C->getBeginLoc(),
C->getLParenLoc(),
10565template <
typename Derived>
10569 C->getProcBindKind(),
C->getProcBindKindKwLoc(),
C->getBeginLoc(),
10570 C->getLParenLoc(),
C->getEndLoc());
10573template <
typename Derived>
10576 ExprResult E = getDerived().TransformExpr(
C->getChunkSize());
10579 return getDerived().RebuildOMPScheduleClause(
10580 C->getFirstScheduleModifier(),
C->getSecondScheduleModifier(),
10581 C->getScheduleKind(), E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
10582 C->getFirstScheduleModifierLoc(),
C->getSecondScheduleModifierLoc(),
10583 C->getScheduleKindLoc(),
C->getCommaLoc(),
C->getEndLoc());
10586template <
typename Derived>
10590 if (
auto *
Num =
C->getNumForLoops()) {
10591 E = getDerived().TransformExpr(
Num);
10595 return getDerived().RebuildOMPOrderedClause(
C->getBeginLoc(),
C->getEndLoc(),
10596 C->getLParenLoc(), E.get());
10599template <
typename Derived>
10603 if (
Expr *Evt =
C->getEventHandler()) {
10604 E = getDerived().TransformExpr(Evt);
10608 return getDerived().RebuildOMPDetachClause(E.get(),
C->getBeginLoc(),
10609 C->getLParenLoc(),
C->getEndLoc());
10612template <
typename Derived>
10619template <
typename Derived>
10626template <
typename Derived>
10633template <
typename Derived>
10639template <
typename Derived>
10645template <
typename Derived>
10652template <
typename Derived>
10659template <
typename Derived>
10666template <
typename Derived>
10672template <
typename Derived>
10678template <
typename Derived>
10680 ExprResult E = getDerived().TransformExpr(
C->getExpr());
10683 return getDerived().RebuildOMPHoldsClause(E.get(),
C->getBeginLoc(),
10684 C->getLParenLoc(),
C->getEndLoc());
10687template <
typename Derived>
10693template <
typename Derived>
10698template <
typename Derived>
10703template <
typename Derived>
10708template <
typename Derived>
10714template <
typename Derived>
10721template <
typename Derived>
10728template <
typename Derived>
10735template <
typename Derived>
10742template <
typename Derived>
10749template <
typename Derived>
10755template <
typename Derived>
10762template <
typename Derived>
10768template <
typename Derived>
10775template <
typename Derived>
10777 ExprResult IVR = getDerived().TransformExpr(
C->getInteropVar());
10778 if (IVR.isInvalid())
10782 InteropInfo.PreferTypes.reserve(
C->varlist_size() - 1);
10783 for (
Expr *E : llvm::drop_begin(
C->varlist())) {
10785 if (ER.isInvalid())
10787 InteropInfo.PreferTypes.push_back(ER.get());
10789 return getDerived().RebuildOMPInitClause(IVR.get(), InteropInfo,
10790 C->getBeginLoc(),
C->getLParenLoc(),
10791 C->getVarLoc(),
C->getEndLoc());
10794template <
typename Derived>
10796 ExprResult ER = getDerived().TransformExpr(
C->getInteropVar());
10797 if (ER.isInvalid())
10799 return getDerived().RebuildOMPUseClause(ER.get(),
C->getBeginLoc(),
10800 C->getLParenLoc(),
C->getVarLoc(),
10804template <
typename Derived>
10808 if (
Expr *IV =
C->getInteropVar()) {
10809 ER = getDerived().TransformExpr(IV);
10810 if (ER.isInvalid())
10813 return getDerived().RebuildOMPDestroyClause(ER.get(),
C->getBeginLoc(),
10814 C->getLParenLoc(),
C->getVarLoc(),
10818template <
typename Derived>
10822 if (
Cond.isInvalid())
10824 return getDerived().RebuildOMPNovariantsClause(
10825 Cond.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10828template <
typename Derived>
10832 if (
Cond.isInvalid())
10834 return getDerived().RebuildOMPNocontextClause(
10835 Cond.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10838template <
typename Derived>
10841 ExprResult ThreadID = getDerived().TransformExpr(
C->getThreadID());
10842 if (ThreadID.isInvalid())
10844 return getDerived().RebuildOMPFilterClause(ThreadID.get(),
C->getBeginLoc(),
10845 C->getLParenLoc(),
C->getEndLoc());
10848template <
typename Derived>
10850 ExprResult E = getDerived().TransformExpr(
C->getAlignment());
10853 return getDerived().RebuildOMPAlignClause(E.get(),
C->getBeginLoc(),
10854 C->getLParenLoc(),
C->getEndLoc());
10857template <
typename Derived>
10860 llvm_unreachable(
"unified_address clause cannot appear in dependent context");
10863template <
typename Derived>
10867 "unified_shared_memory clause cannot appear in dependent context");
10870template <
typename Derived>
10873 llvm_unreachable(
"reverse_offload clause cannot appear in dependent context");
10876template <
typename Derived>
10880 "dynamic_allocators clause cannot appear in dependent context");
10883template <
typename Derived>
10887 "atomic_default_mem_order clause cannot appear in dependent context");
10890template <
typename Derived>
10893 llvm_unreachable(
"self_maps clause cannot appear in dependent context");
10896template <
typename Derived>
10899 C->getBeginLoc(),
C->getLParenLoc(),
10903template <
typename Derived>
10907 C->getSeverityKind(),
C->getSeverityKindKwLoc(),
C->getBeginLoc(),
10908 C->getLParenLoc(),
C->getEndLoc());
10911template <
typename Derived>
10914 ExprResult E = getDerived().TransformExpr(
C->getMessageString());
10917 return getDerived().RebuildOMPMessageClause(
10918 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10921template <
typename Derived>
10925 Vars.reserve(
C->varlist_size());
10926 for (
auto *
VE :
C->varlist()) {
10928 if (EVar.isInvalid())
10930 Vars.push_back(EVar.get());
10932 return getDerived().RebuildOMPPrivateClause(
10933 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10936template <
typename Derived>
10940 Vars.reserve(
C->varlist_size());
10941 for (
auto *
VE :
C->varlist()) {
10943 if (EVar.isInvalid())
10945 Vars.push_back(EVar.get());
10947 return getDerived().RebuildOMPFirstprivateClause(
10948 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10951template <
typename Derived>
10955 Vars.reserve(
C->varlist_size());
10956 for (
auto *
VE :
C->varlist()) {
10958 if (EVar.isInvalid())
10960 Vars.push_back(EVar.get());
10962 return getDerived().RebuildOMPLastprivateClause(
10963 Vars,
C->getKind(),
C->getKindLoc(),
C->getColonLoc(),
C->getBeginLoc(),
10964 C->getLParenLoc(),
C->getEndLoc());
10967template <
typename Derived>
10971 Vars.reserve(
C->varlist_size());
10972 for (
auto *
VE :
C->varlist()) {
10974 if (EVar.isInvalid())
10976 Vars.push_back(EVar.get());
10978 return getDerived().RebuildOMPSharedClause(Vars,
C->getBeginLoc(),
10979 C->getLParenLoc(),
C->getEndLoc());
10982template <
typename Derived>
10986 Vars.reserve(
C->varlist_size());
10987 for (
auto *
VE :
C->varlist()) {
10989 if (EVar.isInvalid())
10991 Vars.push_back(EVar.get());
10994 ReductionIdScopeSpec.
Adopt(
C->getQualifierLoc());
10997 if (NameInfo.getName()) {
10998 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
10999 if (!NameInfo.getName())
11005 for (
auto *E :
C->reduction_ops()) {
11010 for (
auto *D : ULE->decls()) {
11013 Decls.addDecl(InstD, InstD->getAccess());
11017 ReductionIdScopeSpec.getWithLocInContext(SemaRef.
Context), NameInfo,
11018 true, Decls.begin(), Decls.end(),
11021 UnresolvedReductions.push_back(
nullptr);
11023 return getDerived().RebuildOMPReductionClause(
11024 Vars,
C->getModifier(),
C->getOriginalSharingModifier(),
C->getBeginLoc(),
11025 C->getLParenLoc(),
C->getModifierLoc(),
C->getColonLoc(),
C->getEndLoc(),
11026 ReductionIdScopeSpec, NameInfo, UnresolvedReductions);
11029template <
typename Derived>
11033 Vars.reserve(
C->varlist_size());
11034 for (
auto *
VE :
C->varlist()) {
11036 if (EVar.isInvalid())
11038 Vars.push_back(EVar.get());
11041 ReductionIdScopeSpec.
Adopt(
C->getQualifierLoc());
11044 if (NameInfo.getName()) {
11045 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
11046 if (!NameInfo.getName())
11052 for (
auto *E :
C->reduction_ops()) {
11057 for (
auto *D : ULE->decls()) {
11060 Decls.addDecl(InstD, InstD->getAccess());
11064 ReductionIdScopeSpec.getWithLocInContext(SemaRef.
Context), NameInfo,
11065 true, Decls.begin(), Decls.end(),
11068 UnresolvedReductions.push_back(
nullptr);
11070 return getDerived().RebuildOMPTaskReductionClause(
11071 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getColonLoc(),
11072 C->getEndLoc(), ReductionIdScopeSpec, NameInfo, UnresolvedReductions);
11075template <
typename Derived>
11079 Vars.reserve(
C->varlist_size());
11080 for (
auto *
VE :
C->varlist()) {
11082 if (EVar.isInvalid())
11084 Vars.push_back(EVar.get());
11087 ReductionIdScopeSpec.
Adopt(
C->getQualifierLoc());
11090 if (NameInfo.getName()) {
11091 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
11092 if (!NameInfo.getName())
11098 for (
auto *E :
C->reduction_ops()) {
11103 for (
auto *D : ULE->decls()) {
11106 Decls.addDecl(InstD, InstD->getAccess());
11110 ReductionIdScopeSpec.getWithLocInContext(SemaRef.
Context), NameInfo,
11111 true, Decls.begin(), Decls.end(),
11114 UnresolvedReductions.push_back(
nullptr);
11116 return getDerived().RebuildOMPInReductionClause(
11117 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getColonLoc(),
11118 C->getEndLoc(), ReductionIdScopeSpec, NameInfo, UnresolvedReductions);
11121template <
typename Derived>
11125 Vars.reserve(
C->varlist_size());
11126 for (
auto *
VE :
C->varlist()) {
11128 if (EVar.isInvalid())
11130 Vars.push_back(EVar.get());
11132 ExprResult Step = getDerived().TransformExpr(
C->getStep());
11133 if (Step.isInvalid())
11135 return getDerived().RebuildOMPLinearClause(
11136 Vars, Step.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getModifier(),
11137 C->getModifierLoc(),
C->getColonLoc(),
C->getStepModifierLoc(),
11141template <
typename Derived>
11145 Vars.reserve(
C->varlist_size());
11146 for (
auto *
VE :
C->varlist()) {
11148 if (EVar.isInvalid())
11150 Vars.push_back(EVar.get());
11152 ExprResult Alignment = getDerived().TransformExpr(
C->getAlignment());
11153 if (Alignment.isInvalid())
11155 return getDerived().RebuildOMPAlignedClause(
11156 Vars, Alignment.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11157 C->getColonLoc(),
C->getEndLoc());
11160template <
typename Derived>
11164 Vars.reserve(
C->varlist_size());
11165 for (
auto *
VE :
C->varlist()) {
11167 if (EVar.isInvalid())
11169 Vars.push_back(EVar.get());
11171 return getDerived().RebuildOMPCopyinClause(Vars,
C->getBeginLoc(),
11172 C->getLParenLoc(),
C->getEndLoc());
11175template <
typename Derived>
11179 Vars.reserve(
C->varlist_size());
11180 for (
auto *
VE :
C->varlist()) {
11182 if (EVar.isInvalid())
11184 Vars.push_back(EVar.get());
11186 return getDerived().RebuildOMPCopyprivateClause(
11187 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11190template <
typename Derived>
11193 Vars.reserve(
C->varlist_size());
11194 for (
auto *
VE :
C->varlist()) {
11196 if (EVar.isInvalid())
11198 Vars.push_back(EVar.get());
11200 return getDerived().RebuildOMPFlushClause(Vars,
C->getBeginLoc(),
11201 C->getLParenLoc(),
C->getEndLoc());
11204template <
typename Derived>
11207 ExprResult E = getDerived().TransformExpr(
C->getDepobj());
11210 return getDerived().RebuildOMPDepobjClause(E.get(),
C->getBeginLoc(),
11211 C->getLParenLoc(),
C->getEndLoc());
11214template <
typename Derived>
11218 Expr *DepModifier =
C->getModifier();
11220 ExprResult DepModRes = getDerived().TransformExpr(DepModifier);
11221 if (DepModRes.isInvalid())
11223 DepModifier = DepModRes.get();
11225 Vars.reserve(
C->varlist_size());
11226 for (
auto *
VE :
C->varlist()) {
11228 if (EVar.isInvalid())
11230 Vars.push_back(EVar.get());
11232 return getDerived().RebuildOMPDependClause(
11233 {
C->getDependencyKind(),
C->getDependencyLoc(),
C->getColonLoc(),
11234 C->getOmpAllMemoryLoc()},
11235 DepModifier, Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11238template <
typename Derived>
11241 ExprResult E = getDerived().TransformExpr(
C->getDevice());
11244 return getDerived().RebuildOMPDeviceClause(
11245 C->getModifier(), E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11246 C->getModifierLoc(),
C->getEndLoc());
11249template <
typename Derived,
class T>
11256 Vars.reserve(
C->varlist_size());
11257 for (
auto *
VE :
C->varlist()) {
11261 Vars.push_back(EVar.
get());
11265 if (
C->getMapperQualifierLoc()) {
11266 QualifierLoc = TT.
getDerived().TransformNestedNameSpecifierLoc(
11267 C->getMapperQualifierLoc());
11271 MapperIdScopeSpec.
Adopt(QualifierLoc);
11272 MapperIdInfo =
C->getMapperIdInfo();
11273 if (MapperIdInfo.
getName()) {
11274 MapperIdInfo = TT.
getDerived().TransformDeclarationNameInfo(MapperIdInfo);
11280 for (
auto *E :
C->mapperlists()) {
11285 for (
auto *D : ULE->decls()) {
11288 Decls.addDecl(InstD, InstD->
getAccess());
11293 MapperIdInfo,
true, Decls.begin(), Decls.end(),
11296 UnresolvedMappers.push_back(
nullptr);
11302template <
typename Derived>
11303OMPClause *TreeTransform<Derived>::TransformOMPMapClause(OMPMapClause *
C) {
11304 OMPVarListLocTy Locs(
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11306 Expr *IteratorModifier =
C->getIteratorModifier();
11307 if (IteratorModifier) {
11308 ExprResult MapModRes = getDerived().TransformExpr(IteratorModifier);
11309 if (MapModRes.isInvalid())
11311 IteratorModifier = MapModRes.
get();
11317 *
this,
C, Vars, MapperIdScopeSpec, MapperIdInfo, UnresolvedMappers))
11319 return getDerived().RebuildOMPMapClause(
11320 IteratorModifier,
C->getMapTypeModifiers(),
C->getMapTypeModifiersLoc(),
11321 MapperIdScopeSpec, MapperIdInfo,
C->getMapType(),
C->isImplicitMapType(),
11322 C->getMapLoc(),
C->getColonLoc(), Vars, Locs, UnresolvedMappers);
11325template <
typename Derived>
11328 Expr *Allocator =
C->getAllocator();
11330 ExprResult AllocatorRes = getDerived().TransformExpr(Allocator);
11331 if (AllocatorRes.isInvalid())
11333 Allocator = AllocatorRes.get();
11335 Expr *Alignment =
C->getAlignment();
11337 ExprResult AlignmentRes = getDerived().TransformExpr(Alignment);
11338 if (AlignmentRes.isInvalid())
11340 Alignment = AlignmentRes.get();
11343 Vars.reserve(
C->varlist_size());
11344 for (
auto *
VE :
C->varlist()) {
11346 if (EVar.isInvalid())
11348 Vars.push_back(EVar.get());
11350 return getDerived().RebuildOMPAllocateClause(
11351 Allocator, Alignment,
C->getFirstAllocateModifier(),
11352 C->getFirstAllocateModifierLoc(),
C->getSecondAllocateModifier(),
11353 C->getSecondAllocateModifierLoc(), Vars,
C->getBeginLoc(),
11354 C->getLParenLoc(),
C->getColonLoc(),
C->getEndLoc());
11357template <
typename Derived>
11361 Vars.reserve(
C->varlist_size());
11362 for (
auto *
VE :
C->varlist()) {
11364 if (EVar.isInvalid())
11366 Vars.push_back(EVar.get());
11368 return getDerived().RebuildOMPNumTeamsClause(
11369 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11372template <
typename Derived>
11376 Vars.reserve(
C->varlist_size());
11377 for (
auto *
VE :
C->varlist()) {
11379 if (EVar.isInvalid())
11381 Vars.push_back(EVar.get());
11383 return getDerived().RebuildOMPThreadLimitClause(
11384 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11387template <
typename Derived>
11390 ExprResult E = getDerived().TransformExpr(
C->getPriority());
11393 return getDerived().RebuildOMPPriorityClause(
11394 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11397template <
typename Derived>
11400 ExprResult E = getDerived().TransformExpr(
C->getGrainsize());
11403 return getDerived().RebuildOMPGrainsizeClause(
11404 C->getModifier(), E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11405 C->getModifierLoc(),
C->getEndLoc());
11408template <
typename Derived>
11411 ExprResult E = getDerived().TransformExpr(
C->getNumTasks());
11414 return getDerived().RebuildOMPNumTasksClause(
11415 C->getModifier(), E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11416 C->getModifierLoc(),
C->getEndLoc());
11419template <
typename Derived>
11421 ExprResult E = getDerived().TransformExpr(
C->getHint());
11424 return getDerived().RebuildOMPHintClause(E.get(),
C->getBeginLoc(),
11425 C->getLParenLoc(),
C->getEndLoc());
11428template <
typename Derived>
11431 ExprResult E = getDerived().TransformExpr(
C->getChunkSize());
11434 return getDerived().RebuildOMPDistScheduleClause(
11435 C->getDistScheduleKind(), E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11436 C->getDistScheduleKindLoc(),
C->getCommaLoc(),
C->getEndLoc());
11439template <
typename Derived>
11445 C->getDefaultmapKind(),
11448 C->getDefaultmapModifierLoc(),
11449 C->getDefaultmapKindLoc(),
11453template <
typename Derived>
11461 *
this,
C, Vars, MapperIdScopeSpec, MapperIdInfo, UnresolvedMappers))
11463 return getDerived().RebuildOMPToClause(
11464 C->getMotionModifiers(),
C->getMotionModifiersLoc(), MapperIdScopeSpec,
11465 MapperIdInfo,
C->getColonLoc(), Vars, Locs, UnresolvedMappers);
11468template <
typename Derived>
11476 *
this,
C, Vars, MapperIdScopeSpec, MapperIdInfo, UnresolvedMappers))
11478 return getDerived().RebuildOMPFromClause(
11479 C->getMotionModifiers(),
C->getMotionModifiersLoc(), MapperIdScopeSpec,
11480 MapperIdInfo,
C->getColonLoc(), Vars, Locs, UnresolvedMappers);
11483template <
typename Derived>
11487 Vars.reserve(
C->varlist_size());
11488 for (
auto *
VE :
C->varlist()) {
11490 if (EVar.isInvalid())
11492 Vars.push_back(EVar.get());
11495 return getDerived().RebuildOMPUseDevicePtrClause(Vars, Locs);
11498template <
typename Derived>
11502 Vars.reserve(
C->varlist_size());
11503 for (
auto *
VE :
C->varlist()) {
11505 if (EVar.isInvalid())
11507 Vars.push_back(EVar.get());
11510 return getDerived().RebuildOMPUseDeviceAddrClause(Vars, Locs);
11513template <
typename Derived>
11517 Vars.reserve(
C->varlist_size());
11518 for (
auto *
VE :
C->varlist()) {
11520 if (EVar.isInvalid())
11522 Vars.push_back(EVar.get());
11525 return getDerived().RebuildOMPIsDevicePtrClause(Vars, Locs);
11528template <
typename Derived>
11532 Vars.reserve(
C->varlist_size());
11533 for (
auto *
VE :
C->varlist()) {
11535 if (EVar.isInvalid())
11537 Vars.push_back(EVar.get());
11540 return getDerived().RebuildOMPHasDeviceAddrClause(Vars, Locs);
11543template <
typename Derived>
11547 Vars.reserve(
C->varlist_size());
11548 for (
auto *
VE :
C->varlist()) {
11550 if (EVar.isInvalid())
11552 Vars.push_back(EVar.get());
11554 return getDerived().RebuildOMPNontemporalClause(
11555 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11558template <
typename Derived>
11562 Vars.reserve(
C->varlist_size());
11563 for (
auto *
VE :
C->varlist()) {
11565 if (EVar.isInvalid())
11567 Vars.push_back(EVar.get());
11569 return getDerived().RebuildOMPInclusiveClause(
11570 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11573template <
typename Derived>
11577 Vars.reserve(
C->varlist_size());
11578 for (
auto *
VE :
C->varlist()) {
11580 if (EVar.isInvalid())
11582 Vars.push_back(EVar.get());
11584 return getDerived().RebuildOMPExclusiveClause(
11585 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11588template <
typename Derived>
11592 Data.reserve(
C->getNumberOfAllocators());
11593 for (
unsigned I = 0, E =
C->getNumberOfAllocators(); I < E; ++I) {
11595 ExprResult Allocator = getDerived().TransformExpr(D.Allocator);
11596 if (Allocator.isInvalid())
11599 if (
Expr *AT = D.AllocatorTraits) {
11600 AllocatorTraits = getDerived().TransformExpr(AT);
11601 if (AllocatorTraits.isInvalid())
11605 NewD.Allocator = Allocator.get();
11606 NewD.AllocatorTraits = AllocatorTraits.get();
11607 NewD.LParenLoc = D.LParenLoc;
11608 NewD.RParenLoc = D.RParenLoc;
11610 return getDerived().RebuildOMPUsesAllocatorsClause(
11611 Data,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11614template <
typename Derived>
11618 Locators.reserve(
C->varlist_size());
11620 if (
Expr *Modifier =
C->getModifier()) {
11621 ModifierRes = getDerived().TransformExpr(Modifier);
11622 if (ModifierRes.isInvalid())
11625 for (
Expr *E :
C->varlist()) {
11626 ExprResult Locator = getDerived().TransformExpr(E);
11627 if (Locator.isInvalid())
11629 Locators.push_back(Locator.get());
11631 return getDerived().RebuildOMPAffinityClause(
11632 C->getBeginLoc(),
C->getLParenLoc(),
C->getColonLoc(),
C->getEndLoc(),
11633 ModifierRes.get(), Locators);
11636template <
typename Derived>
11639 C->getKind(),
C->getKindKwLoc(),
C->getBeginLoc(),
C->getLParenLoc(),
11640 C->getEndLoc(),
C->getModifier(),
C->getModifierKwLoc());
11643template <
typename Derived>
11646 C->getBindKind(),
C->getBindKindLoc(),
C->getBeginLoc(),
11647 C->getLParenLoc(),
C->getEndLoc());
11650template <
typename Derived>
11654 if (
Size.isInvalid())
11656 return getDerived().RebuildOMPXDynCGroupMemClause(
11657 Size.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11660template <
typename Derived>
11664 Vars.reserve(
C->varlist_size());
11665 for (
auto *
VE :
C->varlist()) {
11667 if (EVar.isInvalid())
11669 Vars.push_back(EVar.get());
11671 return getDerived().RebuildOMPDoacrossClause(
11672 C->getDependenceType(),
C->getDependenceLoc(),
C->getColonLoc(), Vars,
11673 C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11676template <
typename Derived>
11680 for (
auto *A :
C->getAttrs())
11681 NewAttrs.push_back(getDerived().TransformAttr(A));
11682 return getDerived().RebuildOMPXAttributeClause(
11683 NewAttrs,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11686template <
typename Derived>
11695template <
typename Derived>
11696class OpenACCClauseTransform final
11698 TreeTransform<Derived> &Self;
11699 ArrayRef<const OpenACCClause *> ExistingClauses;
11700 SemaOpenACC::OpenACCParsedClause &ParsedClause;
11701 OpenACCClause *NewClause =
nullptr;
11704 ExprResult Res = Self.TransformExpr(VarRef);
11706 if (!Res.isUsable())
11709 Res = Self.getSema().OpenACC().ActOnVar(ParsedClause.getDirectiveKind(),
11710 ParsedClause.getClauseKind(),
11716 llvm::SmallVector<Expr *> VisitVarList(ArrayRef<Expr *> VarList) {
11717 llvm::SmallVector<Expr *> InstantiatedVarList;
11718 for (Expr *CurVar : VarList) {
11721 if (VarRef.isUsable())
11722 InstantiatedVarList.push_back(VarRef.get());
11725 return InstantiatedVarList;
11729 OpenACCClauseTransform(TreeTransform<Derived> &Self,
11730 ArrayRef<const OpenACCClause *> ExistingClauses,
11731 SemaOpenACC::OpenACCParsedClause &PC)
11732 : Self(Self), ExistingClauses(ExistingClauses), ParsedClause(PC) {}
11734 OpenACCClause *CreatedClause()
const {
return NewClause; }
11736#define VISIT_CLAUSE(CLAUSE_NAME) \
11737 void Visit##CLAUSE_NAME##Clause(const OpenACC##CLAUSE_NAME##Clause &Clause);
11738#include "clang/Basic/OpenACCClauses.def"
11741template <
typename Derived>
11742void OpenACCClauseTransform<Derived>::VisitDefaultClause(
11744 ParsedClause.setDefaultDetails(
C.getDefaultClauseKind());
11747 Self.getSema().getASTContext(), ParsedClause.getDefaultClauseKind(),
11748 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
11749 ParsedClause.getEndLoc());
11752template <
typename Derived>
11753void OpenACCClauseTransform<Derived>::VisitIfClause(
const OpenACCIfClause &
C) {
11755 assert(
Cond &&
"If constructed with invalid Condition");
11759 if (Res.isInvalid() || !Res.get().second)
11762 ParsedClause.setConditionDetails(Res.get().second);
11765 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
11766 ParsedClause.getLParenLoc(), ParsedClause.getConditionExpr(),
11767 ParsedClause.getEndLoc());
11770template <
typename Derived>
11771void OpenACCClauseTransform<Derived>::VisitSelfClause(
11777 for (
Expr *CurVar :
C.getVarList()) {
11780 if (!Res.isUsable())
11783 Res =
Self.getSema().OpenACC().ActOnVar(ParsedClause.getDirectiveKind(),
11784 ParsedClause.getClauseKind(),
11787 if (Res.isUsable())
11788 InstantiatedVarList.push_back(Res.get());
11791 ParsedClause.setVarListDetails(InstantiatedVarList,
11795 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
11796 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
11797 ParsedClause.getEndLoc());
11800 if (
C.hasConditionExpr()) {
11803 Self.TransformCondition(
Cond->getExprLoc(),
nullptr,
Cond,
11806 if (Res.isInvalid() || !Res.get().second)
11809 ParsedClause.setConditionDetails(Res.get().second);
11813 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
11814 ParsedClause.getLParenLoc(), ParsedClause.getConditionExpr(),
11815 ParsedClause.getEndLoc());
11819template <
typename Derived>
11820void OpenACCClauseTransform<Derived>::VisitNumGangsClause(
11824 for (
Expr *CurIntExpr :
C.getIntExprs()) {
11827 if (!Res.isUsable())
11832 C.getBeginLoc(), Res.get());
11833 if (!Res.isUsable())
11836 InstantiatedIntExprs.push_back(Res.get());
11839 ParsedClause.setIntExprDetails(InstantiatedIntExprs);
11841 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
11842 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs(),
11843 ParsedClause.getEndLoc());
11846template <
typename Derived>
11847void OpenACCClauseTransform<Derived>::VisitPrivateClause(
11852 for (
const auto [RefExpr, InitRecipe] :
11853 llvm::zip(
C.getVarList(),
C.getInitRecipes())) {
11856 if (VarRef.isUsable()) {
11857 InstantiatedVarList.push_back(VarRef.get());
11861 if (InitRecipe.isSet())
11862 InitRecipes.push_back(InitRecipe);
11864 InitRecipes.push_back(
11865 Self.getSema().OpenACC().CreatePrivateInitRecipe(VarRef.get()));
11868 ParsedClause.setVarListDetails(InstantiatedVarList,
11872 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
11873 ParsedClause.getLParenLoc(), ParsedClause.getVarList(), InitRecipes,
11874 ParsedClause.getEndLoc());
11877template <
typename Derived>
11878void OpenACCClauseTransform<Derived>::VisitHostClause(
11880 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
11884 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
11885 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
11886 ParsedClause.getEndLoc());
11889template <
typename Derived>
11890void OpenACCClauseTransform<Derived>::VisitDeviceClause(
11892 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
11896 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
11897 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
11898 ParsedClause.getEndLoc());
11901template <
typename Derived>
11902void OpenACCClauseTransform<Derived>::VisitFirstPrivateClause(
11907 for (
const auto [RefExpr, InitRecipe] :
11908 llvm::zip(
C.getVarList(),
C.getInitRecipes())) {
11911 if (VarRef.isUsable()) {
11912 InstantiatedVarList.push_back(VarRef.get());
11916 if (InitRecipe.isSet())
11917 InitRecipes.push_back(InitRecipe);
11919 InitRecipes.push_back(
11920 Self.getSema().OpenACC().CreateFirstPrivateInitRecipe(
11924 ParsedClause.setVarListDetails(InstantiatedVarList,
11928 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
11929 ParsedClause.getLParenLoc(), ParsedClause.getVarList(), InitRecipes,
11930 ParsedClause.getEndLoc());
11933template <
typename Derived>
11934void OpenACCClauseTransform<Derived>::VisitNoCreateClause(
11936 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
11940 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
11941 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
11942 ParsedClause.getEndLoc());
11945template <
typename Derived>
11946void OpenACCClauseTransform<Derived>::VisitPresentClause(
11948 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
11952 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
11953 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
11954 ParsedClause.getEndLoc());
11957template <
typename Derived>
11958void OpenACCClauseTransform<Derived>::VisitCopyClause(
11960 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
11961 C.getModifierList());
11964 Self.getSema().getASTContext(), ParsedClause.getClauseKind(),
11965 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
11966 ParsedClause.getModifierList(), ParsedClause.getVarList(),
11967 ParsedClause.getEndLoc());
11970template <
typename Derived>
11971void OpenACCClauseTransform<Derived>::VisitLinkClause(
11973 llvm_unreachable(
"link clause not valid unless a decl transform");
11976template <
typename Derived>
11977void OpenACCClauseTransform<Derived>::VisitDeviceResidentClause(
11979 llvm_unreachable(
"device_resident clause not valid unless a decl transform");
11981template <
typename Derived>
11982void OpenACCClauseTransform<Derived>::VisitNoHostClause(
11984 llvm_unreachable(
"nohost clause not valid unless a decl transform");
11986template <
typename Derived>
11987void OpenACCClauseTransform<Derived>::VisitBindClause(
11989 llvm_unreachable(
"bind clause not valid unless a decl transform");
11992template <
typename Derived>
11993void OpenACCClauseTransform<Derived>::VisitCopyInClause(
11995 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
11996 C.getModifierList());
11999 Self.getSema().getASTContext(), ParsedClause.getClauseKind(),
12000 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12001 ParsedClause.getModifierList(), ParsedClause.getVarList(),
12002 ParsedClause.getEndLoc());
12005template <
typename Derived>
12006void OpenACCClauseTransform<Derived>::VisitCopyOutClause(
12008 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12009 C.getModifierList());
12012 Self.getSema().getASTContext(), ParsedClause.getClauseKind(),
12013 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12014 ParsedClause.getModifierList(), ParsedClause.getVarList(),
12015 ParsedClause.getEndLoc());
12018template <
typename Derived>
12019void OpenACCClauseTransform<Derived>::VisitCreateClause(
12021 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12022 C.getModifierList());
12025 Self.getSema().getASTContext(), ParsedClause.getClauseKind(),
12026 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12027 ParsedClause.getModifierList(), ParsedClause.getVarList(),
12028 ParsedClause.getEndLoc());
12030template <
typename Derived>
12031void OpenACCClauseTransform<Derived>::VisitAttachClause(
12036 llvm::erase_if(VarList, [&](
Expr *E) {
12037 return Self.getSema().OpenACC().CheckVarIsPointerType(
12043 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12044 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12045 ParsedClause.getEndLoc());
12048template <
typename Derived>
12049void OpenACCClauseTransform<Derived>::VisitDetachClause(
12054 llvm::erase_if(VarList, [&](
Expr *E) {
12055 return Self.getSema().OpenACC().CheckVarIsPointerType(
12061 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12062 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12063 ParsedClause.getEndLoc());
12066template <
typename Derived>
12067void OpenACCClauseTransform<Derived>::VisitDeleteClause(
12069 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12072 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12073 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12074 ParsedClause.getEndLoc());
12077template <
typename Derived>
12078void OpenACCClauseTransform<Derived>::VisitUseDeviceClause(
12080 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12083 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12084 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12085 ParsedClause.getEndLoc());
12088template <
typename Derived>
12089void OpenACCClauseTransform<Derived>::VisitDevicePtrClause(
12094 llvm::erase_if(VarList, [&](
Expr *E) {
12095 return Self.getSema().OpenACC().CheckVarIsPointerType(
12101 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12102 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12103 ParsedClause.getEndLoc());
12106template <
typename Derived>
12107void OpenACCClauseTransform<Derived>::VisitNumWorkersClause(
12109 Expr *IntExpr =
const_cast<Expr *
>(
C.getIntExpr());
12110 assert(IntExpr &&
"num_workers clause constructed with invalid int expr");
12113 if (!Res.isUsable())
12118 C.getBeginLoc(), Res.get());
12119 if (!Res.isUsable())
12122 ParsedClause.setIntExprDetails(Res.get());
12124 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12125 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs()[0],
12126 ParsedClause.getEndLoc());
12129template <
typename Derived>
12130void OpenACCClauseTransform<Derived>::VisitDeviceNumClause (
12132 Expr *IntExpr =
const_cast<Expr *
>(
C.getIntExpr());
12133 assert(IntExpr &&
"device_num clause constructed with invalid int expr");
12136 if (!Res.isUsable())
12141 C.getBeginLoc(), Res.get());
12142 if (!Res.isUsable())
12145 ParsedClause.setIntExprDetails(Res.get());
12147 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12148 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs()[0],
12149 ParsedClause.getEndLoc());
12152template <
typename Derived>
12153void OpenACCClauseTransform<Derived>::VisitDefaultAsyncClause(
12155 Expr *IntExpr =
const_cast<Expr *
>(
C.getIntExpr());
12156 assert(IntExpr &&
"default_async clause constructed with invalid int expr");
12159 if (!Res.isUsable())
12164 C.getBeginLoc(), Res.get());
12165 if (!Res.isUsable())
12168 ParsedClause.setIntExprDetails(Res.get());
12170 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12171 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs()[0],
12172 ParsedClause.getEndLoc());
12175template <
typename Derived>
12176void OpenACCClauseTransform<Derived>::VisitVectorLengthClause(
12178 Expr *IntExpr =
const_cast<Expr *
>(
C.getIntExpr());
12179 assert(IntExpr &&
"vector_length clause constructed with invalid int expr");
12182 if (!Res.isUsable())
12187 C.getBeginLoc(), Res.get());
12188 if (!Res.isUsable())
12191 ParsedClause.setIntExprDetails(Res.get());
12193 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12194 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs()[0],
12195 ParsedClause.getEndLoc());
12198template <
typename Derived>
12199void OpenACCClauseTransform<Derived>::VisitAsyncClause(
12201 if (
C.hasIntExpr()) {
12203 if (!Res.isUsable())
12208 C.getBeginLoc(), Res.get());
12209 if (!Res.isUsable())
12211 ParsedClause.setIntExprDetails(Res.get());
12215 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12216 ParsedClause.getLParenLoc(),
12217 ParsedClause.getNumIntExprs() != 0 ? ParsedClause.getIntExprs()[0]
12219 ParsedClause.getEndLoc());
12222template <
typename Derived>
12223void OpenACCClauseTransform<Derived>::VisitWorkerClause(
12225 if (
C.hasIntExpr()) {
12230 if (!Res.isUsable())
12235 C.getBeginLoc(), Res.get());
12236 if (!Res.isUsable())
12238 ParsedClause.setIntExprDetails(Res.get());
12242 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12243 ParsedClause.getLParenLoc(),
12244 ParsedClause.getNumIntExprs() != 0 ? ParsedClause.getIntExprs()[0]
12246 ParsedClause.getEndLoc());
12249template <
typename Derived>
12250void OpenACCClauseTransform<Derived>::VisitVectorClause(
12252 if (
C.hasIntExpr()) {
12257 if (!Res.isUsable())
12262 C.getBeginLoc(), Res.get());
12263 if (!Res.isUsable())
12265 ParsedClause.setIntExprDetails(Res.get());
12269 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12270 ParsedClause.getLParenLoc(),
12271 ParsedClause.getNumIntExprs() != 0 ? ParsedClause.getIntExprs()[0]
12273 ParsedClause.getEndLoc());
12276template <
typename Derived>
12277void OpenACCClauseTransform<Derived>::VisitWaitClause(
12279 if (
C.hasExprs()) {
12280 Expr *DevNumExpr =
nullptr;
12284 if (
C.getDevNumExpr()) {
12286 if (!Res.isUsable())
12290 C.getBeginLoc(), Res.get());
12291 if (!Res.isUsable())
12294 DevNumExpr = Res.get();
12298 for (
Expr *CurQueueIdExpr :
C.getQueueIdExprs()) {
12300 if (!Res.isUsable())
12304 C.getBeginLoc(), Res.get());
12305 if (!Res.isUsable())
12308 InstantiatedQueueIdExprs.push_back(Res.get());
12311 ParsedClause.setWaitDetails(DevNumExpr,
C.getQueuesLoc(),
12312 std::move(InstantiatedQueueIdExprs));
12316 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12317 ParsedClause.getLParenLoc(), ParsedClause.getDevNumExpr(),
12318 ParsedClause.getQueuesLoc(), ParsedClause.getQueueIdExprs(),
12319 ParsedClause.getEndLoc());
12322template <
typename Derived>
12323void OpenACCClauseTransform<Derived>::VisitDeviceTypeClause(
12327 Self.getSema().getASTContext(),
C.getClauseKind(),
12328 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12329 C.getArchitectures(), ParsedClause.getEndLoc());
12332template <
typename Derived>
12333void OpenACCClauseTransform<Derived>::VisitAutoClause(
12337 ParsedClause.getBeginLoc(),
12338 ParsedClause.getEndLoc());
12341template <
typename Derived>
12342void OpenACCClauseTransform<Derived>::VisitIndependentClause(
12345 ParsedClause.getBeginLoc(),
12346 ParsedClause.getEndLoc());
12349template <
typename Derived>
12350void OpenACCClauseTransform<Derived>::VisitSeqClause(
12353 ParsedClause.getBeginLoc(),
12354 ParsedClause.getEndLoc());
12356template <
typename Derived>
12357void OpenACCClauseTransform<Derived>::VisitFinalizeClause(
12360 ParsedClause.getBeginLoc(),
12361 ParsedClause.getEndLoc());
12364template <
typename Derived>
12365void OpenACCClauseTransform<Derived>::VisitIfPresentClause(
12368 ParsedClause.getBeginLoc(),
12369 ParsedClause.getEndLoc());
12372template <
typename Derived>
12373void OpenACCClauseTransform<Derived>::VisitReductionClause(
12379 for (
const auto [Var, OrigRecipe] :
12380 llvm::zip(TransformedVars,
C.getRecipes())) {
12382 ParsedClause.getDirectiveKind(),
C.getReductionOp(), Var);
12383 if (Res.isUsable()) {
12384 ValidVars.push_back(Res.get());
12386 if (OrigRecipe.isSet())
12387 Recipes.push_back(OrigRecipe);
12389 Recipes.push_back(
Self.getSema().OpenACC().CreateReductionInitRecipe(
12390 C.getReductionOp(), Res.get()));
12394 NewClause =
Self.getSema().OpenACC().CheckReductionClause(
12395 ExistingClauses, ParsedClause.getDirectiveKind(),
12396 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12397 C.getReductionOp(), ValidVars, Recipes, ParsedClause.getEndLoc());
12400template <
typename Derived>
12401void OpenACCClauseTransform<Derived>::VisitCollapseClause(
12403 Expr *LoopCount =
const_cast<Expr *
>(
C.getLoopCount());
12404 assert(LoopCount &&
"collapse clause constructed with invalid loop count");
12408 NewLoopCount =
Self.getSema().OpenACC().ActOnIntExpr(
12410 NewLoopCount.get()->getBeginLoc(), NewLoopCount.get());
12413 Self.getSema().OpenACC().CheckCollapseLoopCount(NewLoopCount.get());
12415 ParsedClause.setCollapseDetails(
C.hasForce(), NewLoopCount.get());
12417 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12418 ParsedClause.getLParenLoc(), ParsedClause.isForce(),
12419 ParsedClause.getLoopCount(), ParsedClause.getEndLoc());
12422template <
typename Derived>
12423void OpenACCClauseTransform<Derived>::VisitTileClause(
12428 for (
Expr *E :
C.getSizeExprs()) {
12431 if (!NewSizeExpr.isUsable())
12434 NewSizeExpr =
Self.getSema().OpenACC().ActOnIntExpr(
12436 NewSizeExpr.get()->getBeginLoc(), NewSizeExpr.get());
12438 NewSizeExpr =
Self.getSema().OpenACC().CheckTileSizeExpr(NewSizeExpr.get());
12440 if (!NewSizeExpr.isUsable())
12442 TransformedExprs.push_back(NewSizeExpr.get());
12445 ParsedClause.setIntExprDetails(TransformedExprs);
12447 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12448 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs(),
12449 ParsedClause.getEndLoc());
12451template <
typename Derived>
12452void OpenACCClauseTransform<Derived>::VisitGangClause(
12457 for (
unsigned I = 0; I <
C.getNumExprs(); ++I) {
12459 if (!ER.isUsable())
12462 ER =
Self.getSema().OpenACC().CheckGangExpr(ExistingClauses,
12463 ParsedClause.getDirectiveKind(),
12464 C.getExpr(I).first, ER.get());
12465 if (!ER.isUsable())
12467 TransformedGangKinds.push_back(
C.getExpr(I).first);
12468 TransformedIntExprs.push_back(ER.get());
12471 NewClause =
Self.getSema().OpenACC().CheckGangClause(
12472 ParsedClause.getDirectiveKind(), ExistingClauses,
12473 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12474 TransformedGangKinds, TransformedIntExprs, ParsedClause.getEndLoc());
12477template <
typename Derived>
12478OpenACCClause *TreeTransform<Derived>::TransformOpenACCClause(
12483 DirKind, OldClause->getClauseKind(), OldClause->getBeginLoc());
12484 ParsedClause.setEndLoc(OldClause->getEndLoc());
12486 if (
const auto *WithParms = dyn_cast<OpenACCClauseWithParams>(OldClause))
12487 ParsedClause.setLParenLoc(WithParms->getLParenLoc());
12489 OpenACCClauseTransform<Derived> Transform{*
this, ExistingClauses,
12491 Transform.Visit(OldClause);
12493 return Transform.CreatedClause();
12496template <
typename Derived>
12498TreeTransform<Derived>::TransformOpenACCClauseList(
12501 for (
const auto *Clause : OldClauses) {
12502 if (
OpenACCClause *TransformedClause = getDerived().TransformOpenACCClause(
12503 TransformedClauses, DirKind, Clause))
12504 TransformedClauses.push_back(TransformedClause);
12506 return TransformedClauses;
12509template <
typename Derived>
12512 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12515 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12518 if (getSema().OpenACC().ActOnStartStmtDirective(
12519 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12524 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
12525 C->clauses(), TransformedClauses);
12526 StmtResult StrBlock = getDerived().TransformStmt(
C->getStructuredBlock());
12527 StrBlock = getSema().OpenACC().ActOnAssociatedStmt(
12528 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses, StrBlock);
12530 return getDerived().RebuildOpenACCComputeConstruct(
12531 C->getDirectiveKind(),
C->getBeginLoc(),
C->getDirectiveLoc(),
12532 C->getEndLoc(), TransformedClauses, StrBlock);
12535template <
typename Derived>
12539 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12542 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12545 if (getSema().OpenACC().ActOnStartStmtDirective(
12546 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12551 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
12552 C->clauses(), TransformedClauses);
12554 Loop = getSema().OpenACC().ActOnAssociatedStmt(
12555 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses,
Loop);
12557 return getDerived().RebuildOpenACCLoopConstruct(
12558 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12559 TransformedClauses,
Loop);
12562template <
typename Derived>
12564 OpenACCCombinedConstruct *
C) {
12565 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12568 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12571 if (getSema().OpenACC().ActOnStartStmtDirective(
12572 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12577 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
12578 C->clauses(), TransformedClauses);
12580 Loop = getSema().OpenACC().ActOnAssociatedStmt(
12581 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses,
Loop);
12583 return getDerived().RebuildOpenACCCombinedConstruct(
12584 C->getDirectiveKind(),
C->getBeginLoc(),
C->getDirectiveLoc(),
12585 C->getEndLoc(), TransformedClauses,
Loop);
12588template <
typename Derived>
12591 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12594 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12596 if (getSema().OpenACC().ActOnStartStmtDirective(
12597 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12601 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
12602 C->clauses(), TransformedClauses);
12603 StmtResult StrBlock = getDerived().TransformStmt(
C->getStructuredBlock());
12604 StrBlock = getSema().OpenACC().ActOnAssociatedStmt(
12605 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses, StrBlock);
12607 return getDerived().RebuildOpenACCDataConstruct(
12608 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12609 TransformedClauses, StrBlock);
12612template <
typename Derived>
12614 OpenACCEnterDataConstruct *
C) {
12615 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12618 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12620 if (getSema().OpenACC().ActOnStartStmtDirective(
12621 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12624 return getDerived().RebuildOpenACCEnterDataConstruct(
12625 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12626 TransformedClauses);
12629template <
typename Derived>
12631 OpenACCExitDataConstruct *
C) {
12632 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12635 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12637 if (getSema().OpenACC().ActOnStartStmtDirective(
12638 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12641 return getDerived().RebuildOpenACCExitDataConstruct(
12642 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12643 TransformedClauses);
12646template <
typename Derived>
12648 OpenACCHostDataConstruct *
C) {
12649 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12652 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12654 if (getSema().OpenACC().ActOnStartStmtDirective(
12655 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12659 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
12660 C->clauses(), TransformedClauses);
12661 StmtResult StrBlock = getDerived().TransformStmt(
C->getStructuredBlock());
12662 StrBlock = getSema().OpenACC().ActOnAssociatedStmt(
12663 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses, StrBlock);
12665 return getDerived().RebuildOpenACCHostDataConstruct(
12666 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12667 TransformedClauses, StrBlock);
12670template <
typename Derived>
12673 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12676 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12678 if (getSema().OpenACC().ActOnStartStmtDirective(
12679 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12682 return getDerived().RebuildOpenACCInitConstruct(
12683 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12684 TransformedClauses);
12687template <
typename Derived>
12689 OpenACCShutdownConstruct *
C) {
12690 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12693 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12695 if (getSema().OpenACC().ActOnStartStmtDirective(
12696 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12699 return getDerived().RebuildOpenACCShutdownConstruct(
12700 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12701 TransformedClauses);
12703template <
typename Derived>
12706 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12709 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12711 if (getSema().OpenACC().ActOnStartStmtDirective(
12712 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12715 return getDerived().RebuildOpenACCSetConstruct(
12716 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12717 TransformedClauses);
12720template <
typename Derived>
12722 OpenACCUpdateConstruct *
C) {
12723 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12726 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12728 if (getSema().OpenACC().ActOnStartStmtDirective(
12729 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12732 return getDerived().RebuildOpenACCUpdateConstruct(
12733 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12734 TransformedClauses);
12737template <
typename Derived>
12740 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12743 if (
C->hasDevNumExpr()) {
12744 DevNumExpr = getDerived().TransformExpr(
C->getDevNumExpr());
12746 if (DevNumExpr.isUsable())
12747 DevNumExpr = getSema().OpenACC().ActOnIntExpr(
12749 C->getBeginLoc(), DevNumExpr.get());
12754 for (
Expr *QE :
C->getQueueIdExprs()) {
12755 assert(QE &&
"Null queue id expr?");
12756 ExprResult NewEQ = getDerived().TransformExpr(QE);
12758 if (!NewEQ.isUsable())
12762 C->getBeginLoc(), NewEQ.get());
12763 if (NewEQ.isUsable())
12764 QueueIdExprs.push_back(NewEQ.get());
12768 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12771 if (getSema().OpenACC().ActOnStartStmtDirective(
12772 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12775 return getDerived().RebuildOpenACCWaitConstruct(
12776 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getLParenLoc(),
12777 DevNumExpr.isUsable() ? DevNumExpr.get() :
nullptr,
C->getQueuesLoc(),
12778 QueueIdExprs,
C->getRParenLoc(),
C->getEndLoc(), TransformedClauses);
12780template <
typename Derived>
12782 OpenACCCacheConstruct *
C) {
12783 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12786 for (
Expr *Var :
C->getVarList()) {
12787 assert(Var &&
"Null var listexpr?");
12789 ExprResult NewVar = getDerived().TransformExpr(Var);
12791 if (!NewVar.isUsable())
12794 NewVar = getSema().OpenACC().ActOnVar(
12796 if (!NewVar.isUsable())
12799 TransformedVarList.push_back(NewVar.get());
12802 if (getSema().OpenACC().ActOnStartStmtDirective(
C->getDirectiveKind(),
12803 C->getBeginLoc(), {}))
12806 return getDerived().RebuildOpenACCCacheConstruct(
12807 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getLParenLoc(),
12808 C->getReadOnlyLoc(), TransformedVarList,
C->getRParenLoc(),
12812template <
typename Derived>
12814 OpenACCAtomicConstruct *
C) {
12815 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12818 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12821 if (getSema().OpenACC().ActOnStartStmtDirective(
C->getDirectiveKind(),
12822 C->getBeginLoc(), {}))
12827 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(), {}, {});
12829 StmtResult AssocStmt = getDerived().TransformStmt(
C->getAssociatedStmt());
12830 AssocStmt = getSema().OpenACC().ActOnAssociatedStmt(
12831 C->getBeginLoc(),
C->getDirectiveKind(),
C->getAtomicKind(), {},
12834 return getDerived().RebuildOpenACCAtomicConstruct(
12835 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getAtomicKind(),
12836 C->getEndLoc(), TransformedClauses, AssocStmt);
12839template <
typename Derived>
12842 if (getDerived().AlwaysRebuild())
12851template<
typename Derived>
12854 return TransformExpr(E->getSubExpr());
12857template <
typename Derived>
12860 if (!E->isTypeDependent())
12863 TypeSourceInfo *NewT = getDerived().TransformType(E->getTypeSourceInfo());
12868 if (!getDerived().AlwaysRebuild() && E->getTypeSourceInfo() == NewT)
12871 return getDerived().RebuildSYCLUniqueStableNameExpr(
12872 E->getLocation(), E->getLParenLocation(), E->getRParenLocation(), NewT);
12875template<
typename Derived>
12878 if (!E->isTypeDependent())
12882 E->getIdentKind());
12885template<
typename Derived>
12889 if (E->getQualifierLoc()) {
12891 = getDerived().TransformNestedNameSpecifierLoc(E->getQualifierLoc());
12897 = cast_or_null<ValueDecl>(getDerived().TransformDecl(E->getLocation(),
12899 if (!ND || ND->isInvalidDecl())
12903 if (E->getFoundDecl() != E->getDecl()) {
12904 Found = cast_or_null<NamedDecl>(
12905 getDerived().TransformDecl(E->getLocation(), E->getFoundDecl()));
12911 if (NameInfo.getName()) {
12912 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
12913 if (!NameInfo.getName())
12917 if (!getDerived().AlwaysRebuild() &&
12918 !E->isCapturedByCopyInLambdaWithExplicitObjectParameter() &&
12919 QualifierLoc == E->getQualifierLoc() && ND == E->getDecl() &&
12920 Found == E->getFoundDecl() &&
12921 NameInfo.getName() == E->getDecl()->getDeclName() &&
12922 !E->hasExplicitTemplateArgs()) {
12932 if (E->hasExplicitTemplateArgs()) {
12933 TemplateArgs = &TransArgs;
12934 TransArgs.setLAngleLoc(E->getLAngleLoc());
12935 TransArgs.setRAngleLoc(E->getRAngleLoc());
12936 if (getDerived().TransformTemplateArguments(E->getTemplateArgs(),
12937 E->getNumTemplateArgs(),
12942 return getDerived().RebuildDeclRefExpr(QualifierLoc, ND, NameInfo,
12943 Found, TemplateArgs);
12946template<
typename Derived>
12952template <
typename Derived>
12958template<
typename Derived>
12964template<
typename Derived>
12970template<
typename Derived>
12976template<
typename Derived>
12982template<
typename Derived>
12985 return getDerived().TransformCallExpr(E);
12988template<
typename Derived>
12993 if (E->isExprPredicate())
12994 ControllingExpr = getDerived().TransformExpr(E->getControllingExpr());
12996 ControllingType = getDerived().TransformType(E->getControllingType());
12998 if (ControllingExpr.isInvalid() && !ControllingType)
13009 AssocTypes.push_back(AssocType);
13011 AssocTypes.push_back(
nullptr);
13015 getDerived().TransformExpr(Assoc.getAssociationExpr());
13016 if (AssocExpr.isInvalid())
13018 AssocExprs.push_back(AssocExpr.get());
13021 if (!ControllingType)
13022 return getDerived().RebuildGenericSelectionExpr(E->getGenericLoc(),
13023 E->getDefaultLoc(),
13025 ControllingExpr.get(),
13028 return getDerived().RebuildGenericSelectionExpr(
13029 E->getGenericLoc(), E->getDefaultLoc(), E->getRParenLoc(),
13030 ControllingType, AssocTypes, AssocExprs);
13033template<
typename Derived>
13036 ExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
13037 if (SubExpr.isInvalid())
13040 if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getSubExpr())
13043 return getDerived().RebuildParenExpr(SubExpr.get(), E->getLParen(),
13050template<
typename Derived>
13054 return getDerived().TransformDependentScopeDeclRefExpr(
13055 DRE,
true,
nullptr);
13057 return getDerived().TransformUnresolvedLookupExpr(
13063template<
typename Derived>
13068 SubExpr = TransformAddressOfOperand(E->
getSubExpr());
13074 if (!getDerived().AlwaysRebuild() && SubExpr.
get() == E->
getSubExpr())
13082template<
typename Derived>
13084TreeTransform<Derived>::TransformOffsetOfExpr(OffsetOfExpr *E) {
13086 TypeSourceInfo *Type = getDerived().TransformType(E->getTypeSourceInfo());
13096 bool ExprChanged =
false;
13097 typedef Sema::OffsetOfComponent Component;
13099 for (
unsigned I = 0, N = E->getNumComponents(); I != N; ++I) {
13100 const OffsetOfNode &ON = E->getComponent(I);
13102 Comp.isBrackets =
true;
13103 Comp.LocStart = ON.getSourceRange().getBegin();
13104 Comp.LocEnd = ON.getSourceRange().getEnd();
13105 switch (ON.getKind()) {
13107 Expr *FromIndex = E->getIndexExpr(ON.getArrayExprIndex());
13108 ExprResult Index = getDerived().TransformExpr(FromIndex);
13109 if (Index.isInvalid())
13112 ExprChanged = ExprChanged || Index.get() != FromIndex;
13113 Comp.isBrackets =
true;
13114 Comp.U.E = Index.get();
13120 Comp.isBrackets =
false;
13121 Comp.U.IdentInfo = ON.getFieldName();
13122 if (!
Comp.U.IdentInfo)
13132 Components.push_back(Comp);
13136 if (!getDerived().AlwaysRebuild() &&
13137 Type == E->getTypeSourceInfo() &&
13142 return getDerived().RebuildOffsetOfExpr(E->getOperatorLoc(),
Type,
13143 Components, E->getRParenLoc());
13146template<
typename Derived>
13149 assert((!E->getSourceExpr() || getDerived().AlreadyTransformed(E->getType())) &&
13150 "opaque value expression requires transformation");
13154template <
typename Derived>
13158 for (
Expr *
C : E->subExpressions()) {
13160 if (NewC.isInvalid())
13166 if (!getDerived().AlwaysRebuild() && !Changed)
13168 return getDerived().RebuildRecoveryExpr(E->getBeginLoc(), E->getEndLoc(),
13172template<
typename Derived>
13182 ExprResult result = getDerived().TransformExpr(newSyntacticForm);
13183 if (result.isInvalid())
return ExprError();
13188 if (result.get()->hasPlaceholderType(BuiltinType::PseudoObject))
13194template<
typename Derived>
13198 if (E->isArgumentType()) {
13205 if (!getDerived().AlwaysRebuild() && OldT == NewT)
13208 return getDerived().RebuildUnaryExprOrTypeTrait(NewT, E->getOperatorLoc(),
13210 E->getSourceRange());
13224 auto *PE = dyn_cast<ParenExpr>(E->getArgumentExpr());
13226 PE ? dyn_cast<DependentScopeDeclRefExpr>(PE->getSubExpr()) :
nullptr)
13227 SubExpr = getDerived().TransformParenDependentScopeDeclRefExpr(
13228 PE, DRE,
false, &RecoveryTSI);
13230 SubExpr = getDerived().TransformExpr(E->getArgumentExpr());
13233 return getDerived().RebuildUnaryExprOrTypeTrait(
13234 RecoveryTSI, E->getOperatorLoc(), E->getKind(), E->getSourceRange());
13235 }
else if (SubExpr.isInvalid())
13238 if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getArgumentExpr())
13241 return getDerived().RebuildUnaryExprOrTypeTrait(SubExpr.get(),
13242 E->getOperatorLoc(),
13244 E->getSourceRange());
13247template<
typename Derived>
13250 ExprResult LHS = getDerived().TransformExpr(E->getLHS());
13251 if (LHS.isInvalid())
13254 ExprResult RHS = getDerived().TransformExpr(E->getRHS());
13255 if (RHS.isInvalid())
13259 if (!getDerived().AlwaysRebuild() &&
13260 LHS.get() == E->getLHS() &&
13261 RHS.get() == E->getRHS())
13264 return getDerived().RebuildArraySubscriptExpr(
13266 E->getLHS()->getBeginLoc(), RHS.get(), E->getRBracketLoc());
13269template <
typename Derived>
13273 if (
Base.isInvalid())
13276 ExprResult RowIdx = getDerived().TransformExpr(E->getRowIdx());
13277 if (RowIdx.isInvalid())
13280 ExprResult ColumnIdx = getDerived().TransformExpr(E->getColumnIdx());
13281 if (ColumnIdx.isInvalid())
13284 if (!getDerived().AlwaysRebuild() &&
Base.get() == E->getBase() &&
13285 RowIdx.get() == E->getRowIdx() && ColumnIdx.get() == E->getColumnIdx())
13288 return getDerived().RebuildMatrixSubscriptExpr(
13289 Base.get(), RowIdx.get(), ColumnIdx.get(), E->getRBracketLoc());
13292template <
typename Derived>
13296 if (
Base.isInvalid())
13300 if (E->getLowerBound()) {
13301 LowerBound = getDerived().TransformExpr(E->getLowerBound());
13302 if (LowerBound.isInvalid())
13307 if (E->getLength()) {
13308 Length = getDerived().TransformExpr(E->getLength());
13309 if (Length.isInvalid())
13314 if (E->isOMPArraySection()) {
13315 if (
Expr *Str = E->getStride()) {
13316 Stride = getDerived().TransformExpr(Str);
13317 if (Stride.isInvalid())
13322 if (!getDerived().AlwaysRebuild() &&
Base.get() == E->getBase() &&
13323 LowerBound.get() == E->getLowerBound() &&
13324 Length.get() == E->getLength() &&
13325 (E->isOpenACCArraySection() || Stride.get() == E->getStride()))
13328 return getDerived().RebuildArraySectionExpr(
13329 E->isOMPArraySection(),
Base.get(), E->getBase()->getEndLoc(),
13330 LowerBound.get(), E->getColonLocFirst(),
13331 E->isOMPArraySection() ? E->getColonLocSecond() :
SourceLocation{},
13332 Length.get(), Stride.get(), E->getRBracketLoc());
13335template <
typename Derived>
13339 if (
Base.isInvalid())
13343 bool ErrorFound =
false;
13344 for (
Expr *
Dim : E->getDimensions()) {
13346 if (DimRes.isInvalid()) {
13350 Dims.push_back(DimRes.get());
13355 return getDerived().RebuildOMPArrayShapingExpr(
Base.get(), E->getLParenLoc(),
13356 E->getRParenLoc(), Dims,
13357 E->getBracketsRanges());
13360template <
typename Derived>
13363 unsigned NumIterators = E->numOfIterators();
13366 bool ErrorFound =
false;
13367 bool NeedToRebuild = getDerived().AlwaysRebuild();
13368 for (
unsigned I = 0; I < NumIterators; ++I) {
13370 Data[I].DeclIdent = D->getIdentifier();
13371 Data[I].DeclIdentLoc = D->getLocation();
13372 if (D->getLocation() == D->getBeginLoc()) {
13374 "Implicit type must be int.");
13376 TypeSourceInfo *TSI = getDerived().TransformType(D->getTypeSourceInfo());
13384 ErrorFound = ErrorFound ||
13385 !(!D->getTypeSourceInfo() || (
Data[I].
Type.getAsOpaquePtr() &&
13386 !
Data[I].Type.get().isNull())) ||
13387 Begin.isInvalid() || End.isInvalid() || Step.isInvalid();
13390 Data[I].Range.Begin = Begin.get();
13391 Data[I].Range.End = End.get();
13392 Data[I].Range.Step = Step.get();
13393 Data[I].AssignLoc = E->getAssignLoc(I);
13394 Data[I].ColonLoc = E->getColonLoc(I);
13395 Data[I].SecColonLoc = E->getSecondColonLoc(I);
13398 (D->getTypeSourceInfo() &&
Data[I].
Type.get().getTypePtrOrNull() !=
13399 D->getType().getTypePtrOrNull()) ||
13405 if (!NeedToRebuild)
13408 ExprResult Res = getDerived().RebuildOMPIteratorExpr(
13409 E->getIteratorKwLoc(), E->getLParenLoc(), E->getRParenLoc(),
Data);
13410 if (!Res.isUsable())
13413 for (
unsigned I = 0; I < NumIterators; ++I)
13414 getDerived().transformedLocalDecl(E->getIteratorDecl(I),
13415 IE->getIteratorDecl(I));
13419template<
typename Derived>
13428 bool ArgChanged =
false;
13430 if (getDerived().TransformExprs(E->getArgs(), E->getNumArgs(),
true, Args,
13434 if (!getDerived().AlwaysRebuild() &&
13435 Callee.get() == E->getCallee() &&
13441 = ((
Expr *)
Callee.get())->getSourceRange().getBegin();
13444 if (E->hasStoredFPFeatures()) {
13446 getSema().CurFPFeatures =
13448 getSema().FpPragmaStack.CurrentValue = NewOverrides;
13451 return getDerived().RebuildCallExpr(
Callee.get(), FakeLParenLoc,
13453 E->getRParenLoc());
13456template<
typename Derived>
13460 if (
Base.isInvalid())
13464 if (E->hasQualifier()) {
13466 = getDerived().TransformNestedNameSpecifierLoc(E->getQualifierLoc());
13474 = cast_or_null<ValueDecl>(getDerived().TransformDecl(E->getMemberLoc(),
13475 E->getMemberDecl()));
13479 NamedDecl *FoundDecl = E->getFoundDecl();
13480 if (FoundDecl == E->getMemberDecl()) {
13483 FoundDecl = cast_or_null<NamedDecl>(
13484 getDerived().TransformDecl(E->getMemberLoc(), FoundDecl));
13489 if (!getDerived().AlwaysRebuild() &&
13490 Base.get() == E->getBase() &&
13491 QualifierLoc == E->getQualifierLoc() &&
13492 Member == E->getMemberDecl() &&
13493 FoundDecl == E->getFoundDecl() &&
13494 !E->hasExplicitTemplateArgs()) {
13499 getSema().OpenMP().isOpenMPRebuildMemberExpr(
13509 if (E->hasExplicitTemplateArgs()) {
13510 TransArgs.setLAngleLoc(E->getLAngleLoc());
13511 TransArgs.setRAngleLoc(E->getRAngleLoc());
13512 if (getDerived().TransformTemplateArguments(E->getTemplateArgs(),
13513 E->getNumTemplateArgs(),
13526 NamedDecl *FirstQualifierInScope =
nullptr;
13528 if (MemberNameInfo.getName()) {
13529 MemberNameInfo = getDerived().TransformDeclarationNameInfo(MemberNameInfo);
13530 if (!MemberNameInfo.getName())
13534 return getDerived().RebuildMemberExpr(
Base.get(), FakeOperatorLoc,
13541 (E->hasExplicitTemplateArgs()
13542 ? &TransArgs :
nullptr),
13543 FirstQualifierInScope);
13546template<
typename Derived>
13549 ExprResult LHS = getDerived().TransformExpr(E->getLHS());
13550 if (LHS.isInvalid())
13554 getDerived().TransformInitializer(E->getRHS(),
false);
13555 if (RHS.isInvalid())
13558 if (!getDerived().AlwaysRebuild() &&
13559 LHS.get() == E->getLHS() &&
13560 RHS.get() == E->getRHS())
13563 if (E->isCompoundAssignmentOp())
13565 return getDerived().RebuildBinaryOperator(
13566 E->getOperatorLoc(), E->getOpcode(), LHS.get(), RHS.get());
13569 getSema().CurFPFeatures =
13570 NewOverrides.applyOverrides(getSema().getLangOpts());
13571 getSema().FpPragmaStack.CurrentValue = NewOverrides;
13572 return getDerived().RebuildBinaryOperator(E->getOperatorLoc(), E->getOpcode(),
13573 LHS.get(), RHS.get());
13576template <
typename Derived>
13581 ExprResult LHS = getDerived().TransformExpr(
const_cast<Expr*
>(Decomp.LHS));
13582 if (LHS.isInvalid())
13585 ExprResult RHS = getDerived().TransformExpr(
const_cast<Expr*
>(Decomp.RHS));
13586 if (RHS.isInvalid())
13592 bool ChangedAnyLookups =
false;
13593 Expr *PossibleBinOps[] = {E->getSemanticForm(),
13594 const_cast<Expr *
>(Decomp.InnerBinOp)};
13595 for (
Expr *PossibleBinOp : PossibleBinOps) {
13596 auto *Op = dyn_cast<CXXOperatorCallExpr>(PossibleBinOp->IgnoreImplicit());
13599 auto *
Callee = dyn_cast<DeclRefExpr>(Op->getCallee()->IgnoreImplicit());
13605 NamedDecl *
Found = cast_or_null<NamedDecl>(getDerived().TransformDecl(
13606 E->getOperatorLoc(),
Callee->getFoundDecl()));
13610 ChangedAnyLookups =
true;
13611 UnqualLookups.addDecl(
Found);
13614 if (!getDerived().AlwaysRebuild() && !ChangedAnyLookups &&
13615 LHS.get() == Decomp.LHS && RHS.get() == Decomp.RHS) {
13621 const Expr *StopAt[] = {Decomp.LHS, Decomp.RHS};
13626 return getDerived().RebuildCXXRewrittenBinaryOperator(
13627 E->getOperatorLoc(), Decomp.Opcode, UnqualLookups, LHS.get(), RHS.get());
13630template<
typename Derived>
13636 getSema().CurFPFeatures =
13637 NewOverrides.applyOverrides(getSema().getLangOpts());
13638 getSema().FpPragmaStack.CurrentValue = NewOverrides;
13639 return getDerived().TransformBinaryOperator(E);
13642template<
typename Derived>
13648 ExprResult commonExpr = getDerived().TransformExpr(e->getCommon());
13649 if (commonExpr.isInvalid())
13652 ExprResult rhs = getDerived().TransformExpr(e->getFalseExpr());
13653 if (rhs.isInvalid())
13656 if (!getDerived().AlwaysRebuild() &&
13657 commonExpr.get() == e->getCommon() &&
13658 rhs.get() == e->getFalseExpr())
13661 return getDerived().RebuildConditionalOperator(commonExpr.get(),
13662 e->getQuestionLoc(),
13668template<
typename Derived>
13672 if (
Cond.isInvalid())
13675 ExprResult LHS = getDerived().TransformExpr(E->getLHS());
13676 if (LHS.isInvalid())
13679 ExprResult RHS = getDerived().TransformExpr(E->getRHS());
13680 if (RHS.isInvalid())
13683 if (!getDerived().AlwaysRebuild() &&
13684 Cond.get() == E->getCond() &&
13685 LHS.get() == E->getLHS() &&
13686 RHS.get() == E->getRHS())
13689 return getDerived().RebuildConditionalOperator(
Cond.get(),
13690 E->getQuestionLoc(),
13696template<
typename Derived>
13701 return getDerived().
TransformExpr(E->getSubExprAsWritten());
13704template<
typename Derived>
13712 = getDerived().TransformExpr(E->getSubExprAsWritten());
13713 if (SubExpr.isInvalid())
13716 if (!getDerived().AlwaysRebuild() &&
13717 Type == E->getTypeInfoAsWritten() &&
13718 SubExpr.get() == E->getSubExpr())
13721 return getDerived().RebuildCStyleCastExpr(E->getLParenLoc(),
13727template<
typename Derived>
13735 ExprResult Init = getDerived().TransformExpr(E->getInitializer());
13736 if (
Init.isInvalid())
13739 if (!getDerived().AlwaysRebuild() &&
13741 Init.get() == E->getInitializer())
13748 return getDerived().RebuildCompoundLiteralExpr(
13749 E->getLParenLoc(), NewT,
13750 E->getInitializer()->getEndLoc(),
Init.get());
13753template<
typename Derived>
13757 if (
Base.isInvalid())
13760 if (!getDerived().AlwaysRebuild() &&
13761 Base.get() == E->getBase())
13767 return getDerived().RebuildExtVectorElementExpr(
13768 Base.get(), FakeOperatorLoc, E->isArrow(), E->getAccessorLoc(),
13772template<
typename Derived>
13778 bool InitChanged =
false;
13784 if (getDerived().TransformExprs(E->getInits(), E->getNumInits(),
false,
13785 Inits, &InitChanged))
13788 if (!getDerived().AlwaysRebuild() && !InitChanged) {
13795 return getDerived().RebuildInitList(E->getLBraceLoc(), Inits,
13796 E->getRBraceLoc());
13799template<
typename Derived>
13806 if (
Init.isInvalid())
13811 bool ExprChanged =
false;
13813 if (D.isFieldDesignator()) {
13814 if (D.getFieldDecl()) {
13816 getDerived().TransformDecl(D.getFieldLoc(), D.getFieldDecl()));
13817 if (Field != D.getFieldDecl())
13820 ExprChanged =
true;
13821 if (
Field->isAnonymousStructOrUnion())
13827 ExprChanged =
true;
13830 D.getFieldName(), D.getDotLoc(), D.getFieldLoc()));
13834 if (D.isArrayDesignator()) {
13835 ExprResult Index = getDerived().TransformExpr(E->getArrayIndex(D));
13836 if (Index.isInvalid())
13839 Desig.AddDesignator(
13842 ExprChanged = ExprChanged || Index.get() != E->getArrayIndex(D);
13843 ArrayExprs.push_back(Index.get());
13847 assert(D.isArrayRangeDesignator() &&
"New kind of designator?");
13849 = getDerived().TransformExpr(E->getArrayRangeStart(D));
13850 if (Start.isInvalid())
13853 ExprResult End = getDerived().TransformExpr(E->getArrayRangeEnd(D));
13854 if (End.isInvalid())
13858 Start.get(), End.get(), D.getLBracketLoc(), D.getEllipsisLoc()));
13860 ExprChanged = ExprChanged || Start.get() != E->getArrayRangeStart(D) ||
13861 End.get() != E->getArrayRangeEnd(D);
13863 ArrayExprs.push_back(Start.get());
13864 ArrayExprs.push_back(End.get());
13867 if (!getDerived().AlwaysRebuild() &&
13868 Init.get() == E->getInit() &&
13872 return getDerived().RebuildDesignatedInitExpr(Desig, ArrayExprs,
13873 E->getEqualOrColonLoc(),
13874 E->usesGNUSyntax(),
Init.get());
13879template<
typename Derived>
13883 llvm_unreachable(
"Unexpected DesignatedInitUpdateExpr in syntactic form of "
13888template<
typename Derived>
13892 llvm_unreachable(
"Unexpected NoInitExpr in syntactic form of initializer");
13896template<
typename Derived>
13899 llvm_unreachable(
"Unexpected ArrayInitLoopExpr outside of initializer");
13903template<
typename Derived>
13906 llvm_unreachable(
"Unexpected ArrayInitIndexExpr outside of initializer");
13910template<
typename Derived>
13918 QualType T = getDerived().TransformType(E->getType());
13922 if (!getDerived().AlwaysRebuild() &&
13926 return getDerived().RebuildImplicitValueInitExpr(
T);
13929template<
typename Derived>
13932 TypeSourceInfo *TInfo = getDerived().TransformType(E->getWrittenTypeInfo());
13936 ExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
13937 if (SubExpr.isInvalid())
13940 if (!getDerived().AlwaysRebuild() &&
13941 TInfo == E->getWrittenTypeInfo() &&
13942 SubExpr.get() == E->getSubExpr())
13945 return getDerived().RebuildVAArgExpr(E->getBuiltinLoc(), SubExpr.get(),
13946 TInfo, E->getRParenLoc());
13949template<
typename Derived>
13952 bool ArgumentChanged =
false;
13954 if (TransformExprs(E->getExprs(), E->getNumExprs(),
true, Inits,
13958 return getDerived().RebuildParenListExpr(E->getLParenLoc(),
13960 E->getRParenLoc());
13968template<
typename Derived>
13971 Decl *LD = getDerived().TransformDecl(E->getLabel()->getLocation(),
13976 return getDerived().RebuildAddrLabelExpr(E->getAmpAmpLoc(), E->getLabelLoc(),
13980template<
typename Derived>
13985 = getDerived().TransformCompoundStmt(E->getSubStmt(),
true);
13986 if (SubStmt.isInvalid()) {
13991 unsigned OldDepth = E->getTemplateDepth();
13992 unsigned NewDepth = getDerived().TransformTemplateDepth(OldDepth);
13994 if (!getDerived().AlwaysRebuild() && OldDepth == NewDepth &&
13995 SubStmt.get() == E->getSubStmt()) {
14001 return getDerived().RebuildStmtExpr(E->getLParenLoc(), SubStmt.get(),
14002 E->getRParenLoc(), NewDepth);
14005template<
typename Derived>
14009 if (
Cond.isInvalid())
14012 ExprResult LHS = getDerived().TransformExpr(E->getLHS());
14013 if (LHS.isInvalid())
14016 ExprResult RHS = getDerived().TransformExpr(E->getRHS());
14017 if (RHS.isInvalid())
14020 if (!getDerived().AlwaysRebuild() &&
14021 Cond.get() == E->getCond() &&
14022 LHS.get() == E->getLHS() &&
14023 RHS.get() == E->getRHS())
14026 return getDerived().RebuildChooseExpr(E->getBuiltinLoc(),
14027 Cond.get(), LHS.get(), RHS.get(),
14028 E->getRParenLoc());
14031template<
typename Derived>
14037template<
typename Derived>
14040 switch (E->getOperator()) {
14044 case OO_Array_Delete:
14045 llvm_unreachable(
"new and delete operators cannot use CXXOperatorCallExpr");
14050 assert(E->getNumArgs() >= 1 &&
"Object call is missing arguments");
14063 if (FakeLParenLoc.isInvalid() && EndLoc.isValid())
14064 FakeLParenLoc = EndLoc;
14068 if (getDerived().TransformExprs(E->getArgs() + 1, E->getNumArgs() - 1,
true,
14072 if (E->getOperator() == OO_Subscript)
14073 return getDerived().RebuildCxxSubscriptExpr(
Object.get(), FakeLParenLoc,
14074 Args, E->getEndLoc());
14076 return getDerived().RebuildCallExpr(
Object.get(), FakeLParenLoc, Args,
14080#define OVERLOADED_OPERATOR(Name, Spelling, Token, Unary, Binary, MemberOnly) \
14084#define OVERLOADED_OPERATOR_MULTI(Name,Spelling,Unary,Binary,MemberOnly)
14085#include "clang/Basic/OperatorKinds.def"
14087 case OO_Conditional:
14088 llvm_unreachable(
"conditional operator is not actually overloadable");
14092 llvm_unreachable(
"not an overloaded operator?");
14096 if (E->getNumArgs() == 1 && E->getOperator() == OO_Amp)
14097 First = getDerived().TransformAddressOfOperand(E->getArg(0));
14099 First = getDerived().TransformExpr(E->getArg(0));
14100 if (
First.isInvalid())
14104 if (E->getNumArgs() == 2) {
14106 getDerived().TransformInitializer(E->getArg(1),
false);
14107 if (Second.isInvalid())
14113 getSema().CurFPFeatures =
14114 NewOverrides.applyOverrides(getSema().getLangOpts());
14115 getSema().FpPragmaStack.CurrentValue = NewOverrides;
14119 LookupResult R(SemaRef, ULE->getName(), ULE->getNameLoc(),
14121 if (getDerived().TransformOverloadExprDecls(ULE, ULE->requiresADL(), R))
14124 return getDerived().RebuildCXXOperatorCallExpr(
14125 E->getOperator(), E->getOperatorLoc(),
Callee->getBeginLoc(),
14126 ULE->requiresADL(), R.asUnresolvedSet(),
First.get(), Second.get());
14131 Callee = ICE->getSubExprAsWritten();
14133 ValueDecl *VD = cast_or_null<ValueDecl>(
14134 getDerived().TransformDecl(DR->getLocation(), DR));
14139 Functions.addDecl(VD);
14141 return getDerived().RebuildCXXOperatorCallExpr(
14142 E->getOperator(), E->getOperatorLoc(),
Callee->getBeginLoc(),
14143 false, Functions,
First.get(), Second.get());
14146template<
typename Derived>
14149 return getDerived().TransformCallExpr(E);
14152template <
typename Derived>
14155 getSema().CurContext != E->getParentContext();
14157 if (!getDerived().AlwaysRebuild() && !NeedRebuildFunc)
14160 return getDerived().RebuildSourceLocExpr(E->getIdentKind(), E->getType(),
14161 E->getBeginLoc(), E->getEndLoc(),
14162 getSema().CurContext);
14165template <
typename Derived>
14170template<
typename Derived>
14179 ExprResult EC = getDerived().TransformCallExpr(E->getConfig());
14180 if (EC.isInvalid())
14184 bool ArgChanged =
false;
14186 if (getDerived().TransformExprs(E->getArgs(), E->getNumArgs(),
true, Args,
14190 if (!getDerived().AlwaysRebuild() &&
14191 Callee.get() == E->getCallee() &&
14197 = ((
Expr *)
Callee.get())->getSourceRange().getBegin();
14198 return getDerived().RebuildCallExpr(
Callee.get(), FakeLParenLoc,
14200 E->getRParenLoc(), EC.get());
14203template<
typename Derived>
14219 return getDerived().RebuildCXXNamedCastExpr(
14226template<
typename Derived>
14235 if (Sub.isInvalid())
14238 return getDerived().RebuildBuiltinBitCastExpr(BCE->
getBeginLoc(), TSI,
14242template<
typename Derived>
14244TreeTransform<Derived>::TransformCXXStaticCastExpr(CXXStaticCastExpr *E) {
14245 return getDerived().TransformCXXNamedCastExpr(E);
14248template<
typename Derived>
14254template<
typename Derived>
14261template<
typename Derived>
14267template<
typename Derived>
14273template<
typename Derived>
14278 getDerived().TransformTypeWithDeducedTST(E->getTypeInfoAsWritten());
14283 = getDerived().TransformExpr(E->getSubExprAsWritten());
14284 if (SubExpr.isInvalid())
14287 if (!getDerived().AlwaysRebuild() &&
14288 Type == E->getTypeInfoAsWritten() &&
14289 SubExpr.get() == E->getSubExpr())
14292 return getDerived().RebuildCXXFunctionalCastExpr(
Type,
14296 E->isListInitialization());
14299template<
typename Derived>
14302 if (E->isTypeOperand()) {
14304 = getDerived().TransformType(E->getTypeOperandSourceInfo());
14308 if (!getDerived().AlwaysRebuild() &&
14309 TInfo == E->getTypeOperandSourceInfo())
14312 return getDerived().RebuildCXXTypeidExpr(E->getType(), E->getBeginLoc(),
14313 TInfo, E->getEndLoc());
14319 Expr *Op = E->getExprOperand();
14321 if (E->isGLValue())
14322 if (
auto *RD = Op->getType()->getAsCXXRecordDecl();
14323 RD && RD->isPolymorphic())
14329 ExprResult SubExpr = getDerived().TransformExpr(Op);
14330 if (SubExpr.isInvalid())
14333 if (!getDerived().AlwaysRebuild() &&
14334 SubExpr.get() == E->getExprOperand())
14337 return getDerived().RebuildCXXTypeidExpr(E->getType(), E->getBeginLoc(),
14338 SubExpr.get(), E->getEndLoc());
14341template<
typename Derived>
14344 if (E->isTypeOperand()) {
14346 = getDerived().TransformType(E->getTypeOperandSourceInfo());
14350 if (!getDerived().AlwaysRebuild() &&
14351 TInfo == E->getTypeOperandSourceInfo())
14354 return getDerived().RebuildCXXUuidofExpr(E->getType(), E->getBeginLoc(),
14355 TInfo, E->getEndLoc());
14361 ExprResult SubExpr = getDerived().TransformExpr(E->getExprOperand());
14362 if (SubExpr.isInvalid())
14365 if (!getDerived().AlwaysRebuild() &&
14366 SubExpr.get() == E->getExprOperand())
14369 return getDerived().RebuildCXXUuidofExpr(E->getType(), E->getBeginLoc(),
14370 SubExpr.get(), E->getEndLoc());
14373template<
typename Derived>
14379template<
typename Derived>
14386template<
typename Derived>
14402 auto &S = getSema();
14403 if (E->isCapturedByCopyInLambdaWithExplicitObjectParameter())
14404 return S.getCurrentThisType();
14405 if (S.getCurLambda())
14406 return getDerived().TransformType(E->getType());
14407 return S.getCurrentThisType();
14410 if (!getDerived().AlwaysRebuild() &&
T == E->getType() &&
14411 !E->isCapturedByCopyInLambdaWithExplicitObjectParameter()) {
14414 getSema().MarkThisReferenced(E);
14418 return getDerived().RebuildCXXThisExpr(E->getBeginLoc(),
T, E->isImplicit());
14421template<
typename Derived>
14424 ExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
14425 if (SubExpr.isInvalid())
14428 getSema().DiagnoseExceptionUse(E->getThrowLoc(),
false);
14430 if (!getDerived().AlwaysRebuild() &&
14431 SubExpr.get() == E->getSubExpr())
14434 return getDerived().RebuildCXXThrowExpr(E->getThrowLoc(), SubExpr.get(),
14435 E->isThrownVariableInScope());
14438template<
typename Derived>
14442 getDerived().TransformDecl(E->getBeginLoc(), E->getParam()));
14447 if (E->hasRewrittenInit()) {
14448 InitRes = getDerived().TransformExpr(E->getRewrittenExpr());
14449 if (InitRes.isInvalid())
14453 if (!getDerived().AlwaysRebuild() && Param == E->getParam() &&
14454 E->getUsedContext() == SemaRef.
CurContext &&
14455 InitRes.get() == E->getRewrittenExpr())
14458 return getDerived().RebuildCXXDefaultArgExpr(E->getUsedLocation(), Param,
14462template<
typename Derived>
14466 getDerived().TransformDecl(E->getBeginLoc(), E->getField()));
14470 if (!getDerived().AlwaysRebuild() && Field == E->getField() &&
14474 return getDerived().RebuildCXXDefaultInitExpr(E->getExprLoc(), Field);
14477template<
typename Derived>
14481 TypeSourceInfo *
T = getDerived().TransformType(E->getTypeSourceInfo());
14485 if (!getDerived().AlwaysRebuild() &&
14486 T == E->getTypeSourceInfo())
14489 return getDerived().RebuildCXXScalarValueInitExpr(
T,
14490 T->getTypeLoc().getEndLoc(),
14491 E->getRParenLoc());
14494template<
typename Derived>
14499 getDerived().TransformTypeWithDeducedTST(E->getAllocatedTypeSourceInfo());
14500 if (!AllocTypeInfo)
14504 std::optional<Expr *> ArraySize;
14505 if (E->isArray()) {
14507 if (std::optional<Expr *> OldArraySize = E->getArraySize()) {
14508 NewArraySize = getDerived().TransformExpr(*OldArraySize);
14509 if (NewArraySize.isInvalid())
14512 ArraySize = NewArraySize.get();
14516 bool ArgumentChanged =
false;
14518 if (getDerived().TransformExprs(E->getPlacementArgs(),
14519 E->getNumPlacementArgs(),
true,
14520 PlacementArgs, &ArgumentChanged))
14524 Expr *OldInit = E->getInitializer();
14527 NewInit = getDerived().TransformInitializer(OldInit,
true);
14528 if (NewInit.isInvalid())
14533 if (E->getOperatorNew()) {
14534 OperatorNew = cast_or_null<FunctionDecl>(
14535 getDerived().TransformDecl(E->getBeginLoc(), E->getOperatorNew()));
14541 if (E->getOperatorDelete()) {
14542 OperatorDelete = cast_or_null<FunctionDecl>(
14543 getDerived().TransformDecl(E->getBeginLoc(), E->getOperatorDelete()));
14544 if (!OperatorDelete)
14548 if (!getDerived().AlwaysRebuild() &&
14549 AllocTypeInfo == E->getAllocatedTypeSourceInfo() &&
14550 ArraySize == E->getArraySize() &&
14551 NewInit.get() == OldInit &&
14552 OperatorNew == E->getOperatorNew() &&
14553 OperatorDelete == E->getOperatorDelete() &&
14554 !ArgumentChanged) {
14559 if (OperatorDelete)
14562 if (E->isArray() && !E->getAllocatedType()->isDependentType()) {
14574 QualType AllocType = AllocTypeInfo->getType();
14585 = dyn_cast<ConstantArrayType>(ArrayT)) {
14589 AllocType = ConsArrayT->getElementType();
14591 = dyn_cast<DependentSizedArrayType>(ArrayT)) {
14592 if (DepArrayT->getSizeExpr()) {
14593 ArraySize = DepArrayT->getSizeExpr();
14594 AllocType = DepArrayT->getElementType();
14599 return getDerived().RebuildCXXNewExpr(
14600 E->getBeginLoc(), E->isGlobalNew(),
14601 E->getBeginLoc(), PlacementArgs,
14602 E->getBeginLoc(), E->getTypeIdParens(), AllocType,
14603 AllocTypeInfo, ArraySize, E->getDirectInitRange(), NewInit.get());
14606template<
typename Derived>
14615 if (E->getOperatorDelete()) {
14616 OperatorDelete = cast_or_null<FunctionDecl>(
14617 getDerived().TransformDecl(E->getBeginLoc(), E->getOperatorDelete()));
14618 if (!OperatorDelete)
14622 if (!getDerived().AlwaysRebuild() &&
14623 Operand.get() == E->getArgument() &&
14624 OperatorDelete == E->getOperatorDelete()) {
14627 if (OperatorDelete)
14630 if (!E->getArgument()->isTypeDependent()) {
14632 E->getDestroyedType());
14633 if (
auto *
Record = Destroyed->getAsCXXRecordDecl())
14641 return getDerived().RebuildCXXDeleteExpr(
14642 E->getBeginLoc(), E->isGlobalDelete(), E->isArrayForm(),
Operand.get());
14645template<
typename Derived>
14650 if (
Base.isInvalid())
14654 bool MayBePseudoDestructor =
false;
14656 E->getOperatorLoc(),
14657 E->isArrow()? tok::arrow : tok::period,
14659 MayBePseudoDestructor);
14660 if (
Base.isInvalid())
14663 QualType ObjectType = ObjectTypePtr.get();
14665 if (QualifierLoc) {
14667 = getDerived().TransformNestedNameSpecifierLoc(QualifierLoc, ObjectType);
14672 SS.
Adopt(QualifierLoc);
14675 if (E->getDestroyedTypeInfo()) {
14676 TypeSourceInfo *DestroyedTypeInfo = getDerived().TransformTypeInObjectScope(
14677 E->getDestroyedTypeInfo(), ObjectType,
14679 if (!DestroyedTypeInfo)
14681 Destroyed = DestroyedTypeInfo;
14682 }
else if (!ObjectType.isNull() && ObjectType->isDependentType()) {
14686 E->getDestroyedTypeLoc());
14690 *E->getDestroyedTypeIdentifier(), E->getDestroyedTypeLoc(),
14691 nullptr, SS, ObjectTypePtr,
false);
14697 E->getDestroyedTypeLoc());
14701 if (E->getScopeTypeInfo()) {
14702 ScopeTypeInfo = getDerived().TransformTypeInObjectScope(
14703 E->getScopeTypeInfo(), ObjectType,
nullptr);
14704 if (!ScopeTypeInfo)
14708 return getDerived().RebuildCXXPseudoDestructorExpr(
Base.get(),
14709 E->getOperatorLoc(),
14713 E->getColonColonLoc(),
14718template <
typename Derived>
14723 bool AllEmptyPacks =
true;
14724 for (
auto *OldD : Old->
decls()) {
14740 if (
auto *UPD = dyn_cast<UsingPackDecl>(InstD))
14741 Decls = UPD->expansions();
14744 for (
auto *D : Decls) {
14745 if (
auto *UD = dyn_cast<UsingDecl>(D)) {
14746 for (
auto *SD : UD->shadows())
14753 AllEmptyPacks &= Decls.empty();
14762 if (AllEmptyPacks && !RequiresADL) {
14774 getSema().FilterAcceptableTemplateNames(R,
14781 diag::err_template_kw_refers_to_non_template)
14785 diag::note_template_kw_refers_to_non_template)
14794template <
typename Derived>
14800template <
typename Derived>
14803 bool IsAddressOfOperand) {
14808 if (TransformOverloadExprDecls(Old, Old->
requiresADL(), R))
14815 = getDerived().TransformNestedNameSpecifierLoc(Old->
getQualifierLoc());
14819 SS.
Adopt(QualifierLoc);
14823 CXXRecordDecl *NamingClass
14824 = cast_or_null<CXXRecordDecl>(getDerived().TransformDecl(
14827 if (!NamingClass) {
14832 R.setNamingClass(NamingClass);
14853 SS, TemplateKWLoc, R,
14860 return getDerived().RebuildDeclarationNameExpr(SS, R, Old->
requiresADL());
14863 return getDerived().RebuildTemplateIdExpr(SS, TemplateKWLoc, R,
14867template<
typename Derived>
14870 bool ArgChanged =
false;
14872 for (
unsigned I = 0, N = E->getNumArgs(); I != N; ++I) {
14874 TypeLoc FromTL = From->getTypeLoc();
14877 TLB.
reserve(FromTL.getFullDataSize());
14878 QualType To = getDerived().TransformType(TLB, FromTL);
14882 if (To == From->getType())
14883 Args.push_back(From);
14885 Args.push_back(TLB.getTypeSourceInfo(SemaRef.
Context, To));
14895 TypeLoc PatternTL = ExpansionTL.getPatternLoc();
14901 bool Expand =
true;
14902 bool RetainExpansion =
false;
14904 ExpansionTL.getTypePtr()->getNumExpansions();
14906 if (getDerived().TryExpandParameterPacks(
14907 ExpansionTL.getEllipsisLoc(), PatternTL.getSourceRange(),
14908 Unexpanded,
true, Expand,
14909 RetainExpansion, NumExpansions))
14919 TLB.
reserve(From->getTypeLoc().getFullDataSize());
14921 QualType To = getDerived().TransformType(TLB, PatternTL);
14925 To = getDerived().RebuildPackExpansionType(To,
14926 PatternTL.getSourceRange(),
14927 ExpansionTL.getEllipsisLoc(),
14935 Args.push_back(TLB.getTypeSourceInfo(SemaRef.
Context, To));
14941 for (
unsigned I = 0; I != *NumExpansions; ++I) {
14944 TLB.
reserve(PatternTL.getFullDataSize());
14945 QualType To = getDerived().TransformType(TLB, PatternTL);
14949 if (To->containsUnexpandedParameterPack()) {
14950 To = getDerived().RebuildPackExpansionType(To,
14951 PatternTL.getSourceRange(),
14952 ExpansionTL.getEllipsisLoc(),
14962 Args.push_back(TLB.getTypeSourceInfo(SemaRef.
Context, To));
14965 if (!RetainExpansion)
14970 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
14973 TLB.
reserve(From->getTypeLoc().getFullDataSize());
14975 QualType To = getDerived().TransformType(TLB, PatternTL);
14979 To = getDerived().RebuildPackExpansionType(To,
14980 PatternTL.getSourceRange(),
14981 ExpansionTL.getEllipsisLoc(),
14989 Args.push_back(TLB.getTypeSourceInfo(SemaRef.
Context, To));
14992 if (!getDerived().AlwaysRebuild() && !ArgChanged)
14995 return getDerived().RebuildTypeTrait(E->getTrait(), E->getBeginLoc(), Args,
14999template<
typename Derived>
15005 if (getDerived().TransformTemplateArguments(Old->getTemplateArgs(),
15006 Old->NumTemplateArgs, TransArgs))
15009 return getDerived().RebuildConceptSpecializationExpr(
15010 E->getNestedNameSpecifierLoc(), E->getTemplateKWLoc(),
15011 E->getConceptNameInfo(), E->getFoundDecl(), E->getNamedConcept(),
15015template<
typename Derived>
15029 getSema().Context, getSema().CurContext,
15030 E->getBody()->getBeginLoc());
15034 ExprResult TypeParamResult = getDerived().TransformRequiresTypeParams(
15035 E->getRequiresKWLoc(), E->getRBraceLoc(), E, Body,
15036 E->getLocalParameters(), TransParamTypes, TransParams, ExtParamInfos);
15040 Param->setDeclContext(Body);
15046 if (!TypeParamResult.isUnset())
15047 return TypeParamResult;
15050 if (getDerived().TransformRequiresExprRequirements(E->getRequirements(),
15055 if (
auto *ER = dyn_cast<concepts::ExprRequirement>(Req)) {
15056 if (ER->getReturnTypeRequirement().isTypeConstraint()) {
15057 ER->getReturnTypeRequirement()
15058 .getTypeConstraintTemplateParameterList()->getParam(0)
15059 ->setDeclContext(Body);
15064 return getDerived().RebuildRequiresExpr(
15065 E->getRequiresKWLoc(), Body, E->getLParenLoc(), TransParams,
15066 E->getRParenLoc(), TransReqs, E->getRBraceLoc());
15069template<
typename Derived>
15075 if (
auto *TypeReq = dyn_cast<concepts::TypeRequirement>(Req))
15076 TransReq =
getDerived().TransformTypeRequirement(TypeReq);
15077 else if (
auto *ExprReq = dyn_cast<concepts::ExprRequirement>(Req))
15078 TransReq =
getDerived().TransformExprRequirement(ExprReq);
15080 TransReq =
getDerived().TransformNestedRequirement(
15084 Transformed.push_back(TransReq);
15089template<
typename Derived>
15102 return getDerived().RebuildTypeRequirement(TransType);
15105template<
typename Derived>
15108 llvm::PointerUnion<Expr *, concepts::Requirement::SubstitutionDiagnostic *> TransExpr;
15114 TransExprRes =
SemaRef.CheckPlaceholderExpr(TransExprRes.
get());
15117 TransExpr = TransExprRes.
get();
15120 std::optional<concepts::ExprRequirement::ReturnTypeRequirement> TransRetReq;
15122 if (RetReq.isEmpty())
15123 TransRetReq.emplace();
15124 else if (RetReq.isSubstitutionFailure())
15125 TransRetReq.emplace(RetReq.getSubstitutionDiagnostic());
15126 else if (RetReq.isTypeConstraint()) {
15128 RetReq.getTypeConstraintTemplateParameterList();
15130 getDerived().TransformTemplateParameterList(OrigTPL);
15133 TransRetReq.emplace(TPL);
15135 assert(TransRetReq &&
"All code paths leading here must set TransRetReq");
15136 if (
Expr *E = dyn_cast<Expr *>(TransExpr))
15139 std::move(*TransRetReq));
15145template<
typename Derived>
15151 return getDerived().RebuildNestedRequirement(
15159 return getDerived().RebuildNestedRequirement(TransConstraint.
get());
15162template<
typename Derived>
15169 if (!getDerived().AlwaysRebuild() &&
15186template<
typename Derived>
15193 SubExpr = getDerived().TransformExpr(E->getQueriedExpression());
15194 if (SubExpr.isInvalid())
15197 if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getQueriedExpression())
15201 return getDerived().RebuildExpressionTrait(E->getTrait(), E->getBeginLoc(),
15202 SubExpr.get(), E->getEndLoc());
15205template <
typename Derived>
15210 DRE, AddrTaken, RecoveryTSI);
15223template <
typename Derived>
15230template <
typename Derived>
15246 getDerived().TransformDeclarationNameInfo(E->
getNameInfo());
15251 if (!getDerived().AlwaysRebuild() && QualifierLoc == E->
getQualifierLoc() &&
15257 return getDerived().RebuildDependentScopeDeclRefExpr(
15258 QualifierLoc, TemplateKWLoc, NameInfo,
nullptr,
15259 IsAddressOfOperand, RecoveryTSI);
15263 if (getDerived().TransformTemplateArguments(
15267 return getDerived().RebuildDependentScopeDeclRefExpr(
15268 QualifierLoc, TemplateKWLoc, NameInfo, &TransArgs, IsAddressOfOperand,
15272template<
typename Derived>
15278 if (getDerived().AllowSkippingCXXConstructExpr() &&
15279 ((E->getNumArgs() == 1 ||
15280 (E->getNumArgs() > 1 && getDerived().DropCallArgument(E->getArg(1)))) &&
15281 (!getDerived().DropCallArgument(E->getArg(0))) &&
15282 !E->isListInitialization()))
15288 QualType T = getDerived().TransformType(E->getType());
15293 getDerived().TransformDecl(E->getBeginLoc(), E->getConstructor()));
15297 bool ArgumentChanged =
false;
15302 E->isListInitialization());
15303 if (getDerived().TransformExprs(E->getArgs(), E->getNumArgs(),
true, Args,
15308 if (!getDerived().AlwaysRebuild() &&
15309 T == E->getType() &&
15311 !ArgumentChanged) {
15318 return getDerived().RebuildCXXConstructExpr(
15319 T, E->getBeginLoc(),
Constructor, E->isElidable(), Args,
15320 E->hadMultipleCandidates(), E->isListInitialization(),
15321 E->isStdInitListInitialization(), E->requiresZeroInitialization(),
15322 E->getConstructionKind(), E->getParenOrBraceRange());
15325template<
typename Derived>
15328 QualType T = getDerived().TransformType(E->getType());
15333 getDerived().TransformDecl(E->getBeginLoc(), E->getConstructor()));
15337 if (!getDerived().AlwaysRebuild() &&
15338 T == E->getType() &&
15346 return getDerived().RebuildCXXInheritedCtorInitExpr(
15348 E->constructsVBase(), E->inheritedFromVBase());
15355template<
typename Derived>
15358 if (
auto *Dtor = E->getTemporary()->getDestructor())
15361 return getDerived().TransformExpr(E->getSubExpr());
15369template<
typename Derived>
15375template<
typename Derived>
15380 getDerived().TransformTypeWithDeducedTST(E->getTypeSourceInfo());
15385 getDerived().TransformDecl(E->getBeginLoc(), E->getConstructor()));
15389 bool ArgumentChanged =
false;
15391 Args.reserve(E->getNumArgs());
15395 E->isListInitialization());
15396 if (TransformExprs(E->getArgs(), E->getNumArgs(),
true, Args,
15400 if (E->isListInitialization() && !E->isStdInitListInitialization()) {
15401 ExprResult Res = RebuildInitList(E->getBeginLoc(), Args, E->getEndLoc());
15402 if (Res.isInvalid())
15404 Args = {Res.get()};
15408 if (!getDerived().AlwaysRebuild() &&
15409 T == E->getTypeSourceInfo() &&
15411 !ArgumentChanged) {
15418 return getDerived().RebuildCXXTemporaryObjectExpr(
15419 T, LParenLoc, Args, E->getEndLoc(), E->isListInitialization());
15422template<
typename Derived>
15427 typedef std::pair<ExprResult, QualType> InitCaptureInfoTy;
15428 struct TransformedInitCapture {
15430 SourceLocation EllipsisLoc;
15432 SmallVector<InitCaptureInfoTy, 4> Expansions;
15435 InitCaptures.resize(E->explicit_capture_end() - E->explicit_capture_begin());
15437 CEnd = E->capture_end();
15439 if (!E->isInitCapture(
C))
15442 TransformedInitCapture &
Result = InitCaptures[
C - E->capture_begin()];
15447 ExprResult NewExprInitResult = getDerived().TransformInitializer(
15450 if (NewExprInitResult.isInvalid()) {
15454 Expr *NewExprInit = NewExprInitResult.get();
15457 getSema().buildLambdaInitCaptureInitialization(
15458 C->getLocation(),
C->getCaptureKind() ==
LCK_ByRef,
15459 EllipsisLoc, NumExpansions, OldVD->getIdentifier(),
15463 Result.Expansions.push_back(
15464 InitCaptureInfoTy(NewExprInit, NewInitCaptureType));
15468 if (OldVD->isParameterPack()) {
15477 bool Expand =
true;
15478 bool RetainExpansion =
false;
15480 ExpansionTL.getTypePtr()->getNumExpansions();
15482 if (getDerived().TryExpandParameterPacks(
15483 ExpansionTL.getEllipsisLoc(), OldVD->getInit()->getSourceRange(),
15484 Unexpanded,
true, Expand,
15485 RetainExpansion, NumExpansions))
15487 assert(!RetainExpansion &&
"Should not need to retain expansion after a "
15488 "capture since it cannot be extended");
15490 for (
unsigned I = 0; I != *NumExpansions; ++I) {
15495 SubstInitCapture(ExpansionTL.getEllipsisLoc(), NumExpansions);
15496 Result.EllipsisLoc = ExpansionTL.getEllipsisLoc();
15533 while (DC->isRequiresExprBody())
15535 if ((getSema().isUnevaluatedContext() ||
15536 getSema().isConstantEvaluatedContext()) &&
15537 (DC->isFileContext() || !DC->getParent()->isDependentContext()))
15542 E->getIntroducerRange(),
nullptr, DependencyKind,
15543 E->getCaptureDefault());
15544 getDerived().transformedLocalDecl(OldClass, {
Class});
15547 getSema().CreateLambdaCallOperator(E->getIntroducerRange(),
Class);
15550 getSema().buildLambdaScope(LSI, NewCallOperator, E->getIntroducerRange(),
15551 E->getCaptureDefault(), E->getCaptureDefaultLoc(),
15552 E->hasExplicitParameters(), E->isMutable());
15562 CEnd = E->capture_end();
15566 if (
C->isImplicit())
15570 if (
C->capturesThis()) {
15578 dyn_cast_if_present<CXXRecordDecl>(
15579 getSema().getFunctionLevelDeclContext()),
15581 getSema().CheckCXXThisCapture(
C->getLocation(),
C->isExplicit(),
15588 if (
C->capturesVLAType())
15592 if (E->isInitCapture(
C)) {
15593 TransformedInitCapture &NewC = InitCaptures[
C - E->capture_begin()];
15598 for (InitCaptureInfoTy &Info : NewC.Expansions) {
15600 QualType InitQualType = Info.second;
15601 if (
Init.isInvalid() || InitQualType.isNull()) {
15605 VarDecl *NewVD = getSema().createLambdaInitCaptureVarDecl(
15606 OldVD->getLocation(), InitQualType, NewC.EllipsisLoc,
15607 OldVD->getIdentifier(), OldVD->getInitStyle(),
Init.get(),
15608 getSema().CurContext);
15613 NewVDs.push_back(NewVD);
15614 getSema().addInitCapture(LSI, NewVD,
C->getCaptureKind() ==
LCK_ByRef);
15619 if (NewC.EllipsisLoc.isInvalid())
15620 LSI->ContainsUnexpandedParameterPack |=
15621 Init.get()->containsUnexpandedParameterPack();
15627 getDerived().transformedLocalDecl(OldVD, NewVDs);
15631 assert(
C->capturesVariable() &&
"unexpected kind of lambda capture");
15639 if (
C->isPackExpansion()) {
15641 bool ShouldExpand =
false;
15642 bool RetainExpansion =
false;
15644 if (getDerived().TryExpandParameterPacks(
15645 C->getEllipsisLoc(),
C->getLocation(), Unexpanded,
15646 true, ShouldExpand,
15647 RetainExpansion, NumExpansions)) {
15652 if (ShouldExpand) {
15657 for (
unsigned I = 0; I != *NumExpansions; ++I) {
15659 ValueDecl *CapturedVar = cast_if_present<ValueDecl>(
15660 getDerived().TransformDecl(
C->getLocation(), Pack));
15661 if (!CapturedVar) {
15667 getSema().tryCaptureVariable(CapturedVar,
C->getLocation(), Kind);
15675 EllipsisLoc =
C->getEllipsisLoc();
15679 auto *CapturedVar = cast_or_null<ValueDecl>(
15680 getDerived().TransformDecl(
C->getLocation(),
C->getCapturedVar()));
15681 if (!CapturedVar || CapturedVar->isInvalidDecl()) {
15688 if (
auto *VD = dyn_cast<VarDecl>(CapturedVar); VD && !
C->isPackExpansion())
15689 LSI->ContainsUnexpandedParameterPack |= VD->isParameterPack();
15692 getSema().tryCaptureVariable(CapturedVar,
C->getLocation(), Kind,
15695 getSema().finishLambdaExplicitCaptures(LSI);
15699 auto TPL = getDerived().TransformTemplateParameterList(
15700 E->getTemplateParameterList());
15701 LSI->GLTemplateParameterList = TPL;
15703 getSema().AddTemplateParametersToLambdaCallOperator(NewCallOperator,
Class,
15705 LSI->ContainsUnexpandedParameterPack |=
15706 TPL->containsUnexpandedParameterPack();
15711 E->getCallOperator()->getTypeSourceInfo()->getTypeLoc();
15713 getDerived().TransformType(NewCallOpTLBuilder, OldCallOpTypeLoc);
15714 if (NewCallOpType.isNull())
15716 LSI->ContainsUnexpandedParameterPack |=
15717 NewCallOpType->containsUnexpandedParameterPack();
15719 NewCallOpTLBuilder.getTypeSourceInfo(getSema().Context, NewCallOpType);
15724 assert(FPTL &&
"Not a FunctionProtoType?");
15727 if (!TRC.ArgPackSubstIndex)
15730 getSema().CompleteLambdaCallOperator(
15731 NewCallOperator, E->getCallOperator()->getLocation(),
15732 E->getCallOperator()->getInnerLocStart(), TRC, NewCallOpTSI,
15733 E->getCallOperator()->getConstexprKind(),
15734 E->getCallOperator()->getStorageClass(), FPTL.getParams(),
15735 E->hasExplicitResultType());
15737 getDerived().transformAttrs(E->getCallOperator(), NewCallOperator);
15738 getDerived().transformedLocalDecl(E->getCallOperator(), {NewCallOperator});
15744 std::optional<CXXRecordDecl::LambdaNumbering> Numbering;
15745 if (getDerived().ReplacingOriginal()) {
15746 Numbering = OldClass->getLambdaNumbering();
15749 getSema().handleLambdaNumbering(
Class, NewCallOperator, Numbering);
15754 getSema().PushExpressionEvaluationContextForFunction(
15756 E->getCallOperator());
15760 C.PointOfInstantiation = E->getBody()->getBeginLoc();
15761 getSema().pushCodeSynthesisContext(
C);
15765 Invalid ?
StmtError() : getDerived().TransformLambdaBody(E, E->getBody());
15767 getSema().popCodeSynthesisContext();
15770 FuncScopeCleanup.disable();
15772 if (Body.isInvalid()) {
15773 SavedContext.pop();
15774 getSema().ActOnLambdaError(E->getBeginLoc(),
nullptr,
15779 getSema().ActOnFinishFunctionBody(NewCallOperator, Body.get(),
15782 SavedContext.pop();
15817 DependencyKind = getDerived().ComputeLambdaDependency(LSI);
15818 Class->setLambdaDependencyKind(DependencyKind);
15820 return getDerived().RebuildLambdaExpr(E->getBeginLoc(),
15821 Body.get()->getEndLoc(), LSI);
15824template<
typename Derived>
15830template<
typename Derived>
15839 if (!
C->isImplicit())
15843 if (
C->capturesThis()) {
15844 getSema().CheckCXXThisCapture(
C->getLocation(),
C->isExplicit(),
15851 if (
C->capturesVLAType())
15854 assert(
C->capturesVariable() &&
"unexpected kind of lambda capture");
15858 VarDecl *CapturedVar = cast_or_null<VarDecl>(
15864 getSema().tryCaptureVariable(CapturedVar,
C->getLocation());
15870template<
typename Derived>
15879 bool ArgumentChanged =
false;
15891 if (!getDerived().AlwaysRebuild() &&
15897 return getDerived().RebuildCXXUnresolvedConstructExpr(
15901template<
typename Derived>
15910 if (!E->isImplicitAccess()) {
15911 OldBase = E->getBase();
15912 Base = getDerived().TransformExpr(OldBase);
15913 if (
Base.isInvalid())
15918 bool MayBePseudoDestructor =
false;
15920 E->getOperatorLoc(),
15921 E->isArrow()? tok::arrow : tok::period,
15923 MayBePseudoDestructor);
15924 if (
Base.isInvalid())
15927 ObjectType = ObjectTy.get();
15928 BaseType = ((
Expr*)
Base.get())->getType();
15931 BaseType = getDerived().TransformType(E->getBaseType());
15938 = getDerived().TransformFirstQualifierInScope(
15939 E->getFirstQualifierFoundInScope(),
15940 E->getQualifierLoc().getBeginLoc());
15943 if (E->getQualifier()) {
15945 = getDerived().TransformNestedNameSpecifierLoc(E->getQualifierLoc(),
15947 FirstQualifierInScope);
15959 = getDerived().TransformDeclarationNameInfo(E->getMemberNameInfo());
15960 if (!NameInfo.getName())
15963 if (!E->hasExplicitTemplateArgs()) {
15966 if (!getDerived().AlwaysRebuild() &&
15967 Base.get() == OldBase &&
15968 BaseType == E->getBaseType() &&
15969 QualifierLoc == E->getQualifierLoc() &&
15970 NameInfo.getName() == E->getMember() &&
15971 FirstQualifierInScope == E->getFirstQualifierFoundInScope())
15974 return getDerived().RebuildCXXDependentScopeMemberExpr(
Base.get(),
15977 E->getOperatorLoc(),
15980 FirstQualifierInScope,
15986 if (getDerived().TransformTemplateArguments(E->getTemplateArgs(),
15987 E->getNumTemplateArgs(),
15991 return getDerived().RebuildCXXDependentScopeMemberExpr(
Base.get(),
15994 E->getOperatorLoc(),
15997 FirstQualifierInScope,
16002template <
typename Derived>
16008 if (!Old->isImplicitAccess()) {
16009 Base = getDerived().TransformExpr(Old->getBase());
16010 if (
Base.isInvalid())
16013 getSema().PerformMemberExprBaseConversion(
Base.get(), Old->isArrow());
16014 if (
Base.isInvalid())
16016 BaseType =
Base.get()->getType();
16018 BaseType = getDerived().TransformType(Old->getBaseType());
16022 if (Old->getQualifierLoc()) {
16024 getDerived().TransformNestedNameSpecifierLoc(Old->getQualifierLoc());
16034 if (TransformOverloadExprDecls(Old,
false, R))
16038 if (Old->getNamingClass()) {
16040 getDerived().TransformDecl(Old->getMemberLoc(), Old->getNamingClass()));
16044 R.setNamingClass(NamingClass);
16048 if (Old->hasExplicitTemplateArgs()) {
16049 TransArgs.setLAngleLoc(Old->getLAngleLoc());
16050 TransArgs.setRAngleLoc(Old->getRAngleLoc());
16051 if (getDerived().TransformTemplateArguments(
16052 Old->getTemplateArgs(), Old->getNumTemplateArgs(), TransArgs))
16060 NamedDecl *FirstQualifierInScope =
nullptr;
16062 return getDerived().RebuildUnresolvedMemberExpr(
16063 Base.get(), BaseType, Old->getOperatorLoc(), Old->isArrow(), QualifierLoc,
16064 TemplateKWLoc, FirstQualifierInScope, R,
16065 (Old->hasExplicitTemplateArgs() ? &TransArgs :
nullptr));
16068template<
typename Derived>
16073 ExprResult SubExpr = getDerived().TransformExpr(E->getOperand());
16074 if (SubExpr.isInvalid())
16077 if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getOperand())
16080 return getDerived().RebuildCXXNoexceptExpr(E->getSourceRange(),SubExpr.get());
16083template<
typename Derived>
16086 ExprResult Pattern = getDerived().TransformExpr(E->getPattern());
16087 if (Pattern.isInvalid())
16090 if (!getDerived().AlwaysRebuild() && Pattern.get() == E->getPattern())
16093 return getDerived().RebuildPackExpansion(Pattern.get(), E->getEllipsisLoc(),
16094 E->getNumExpansions());
16097template <
typename Derived>
16102 if (!Arg.isPackExpansion()) {
16114 getSema().getTemplateArgumentPackExpansionPattern(ArgLoc, Ellipsis,
16115 OrigNumExpansions);
16127 if (!NumExpansions) {
16139template<
typename Derived>
16158 bool ShouldExpand =
false;
16159 bool RetainExpansion =
false;
16160 UnsignedOrNone NumExpansions = std::nullopt;
16161 if (getDerived().TryExpandParameterPacks(
16163 true, ShouldExpand,
16164 RetainExpansion, NumExpansions))
16169 if (ShouldExpand) {
16171 if (
auto *TTPD = dyn_cast<TemplateTypeParmDecl>(Pack)) {
16172 ArgStorage = getSema().Context.getPackExpansionType(
16173 getSema().Context.getTypeDeclType(TTPD), std::nullopt);
16174 }
else if (
auto *TTPD = dyn_cast<TemplateTemplateParmDecl>(Pack)) {
16178 ExprResult DRE = getSema().BuildDeclRefExpr(
16179 VD, VD->getType().getNonLValueExprType(getSema().Context),
16182 if (DRE.isInvalid())
16185 new (getSema().Context)
16189 PackArgs = ArgStorage;
16194 if (!PackArgs.size()) {
16195 auto *Pack = cast_or_null<NamedDecl>(
16199 return getDerived().RebuildSizeOfPackExpr(
16206 getDerived().ComputeSizeOfPackExprWithoutSubstitution(PackArgs);
16218 TemporaryBase Rebase(*
this, E->
getPackLoc(), getBaseEntity());
16221 if (TransformTemplateArguments(PackLocIterator(*
this, PackArgs.begin()),
16222 PackLocIterator(*
this, PackArgs.end()),
16223 TransformedPackArgs,
true))
16230 bool PartialSubstitution =
false;
16231 for (
auto &Loc : TransformedPackArgs.arguments()) {
16232 Args.push_back(Loc.getArgument());
16233 if (Loc.getArgument().isPackExpansion())
16234 PartialSubstitution =
true;
16237 if (PartialSubstitution)
16238 return getDerived().RebuildSizeOfPackExpr(
16240 std::nullopt, Args);
16242 return getDerived().RebuildSizeOfPackExpr(
16244 static_cast<unsigned>(Args.size()),
16248template <
typename Derived>
16251 if (!E->isValueDependent())
16259 IndexExpr = getDerived().TransformExpr(E->getIndexExpr());
16260 if (IndexExpr.isInvalid())
16265 bool FullySubstituted =
true;
16266 if (!E->expandsToEmptyPack() && E->getExpressions().empty()) {
16267 Expr *Pattern = E->getPackIdExpression();
16269 getSema().collectUnexpandedParameterPacks(E->getPackIdExpression(),
16271 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
16275 bool ShouldExpand =
true;
16276 bool RetainExpansion =
false;
16278 NumExpansions = std::nullopt;
16279 if (getDerived().TryExpandParameterPacks(
16280 E->getEllipsisLoc(), Pattern->getSourceRange(), Unexpanded,
16281 true, ShouldExpand,
16282 RetainExpansion, NumExpansions))
16284 if (!ShouldExpand) {
16286 ExprResult Pack = getDerived().TransformExpr(Pattern);
16287 if (Pack.isInvalid())
16289 return getDerived().RebuildPackIndexingExpr(
16290 E->getEllipsisLoc(), E->getRSquareLoc(), Pack.get(), IndexExpr.get(),
16293 for (
unsigned I = 0; I != *NumExpansions; ++I) {
16296 if (
Out.isInvalid())
16298 if (
Out.get()->containsUnexpandedParameterPack()) {
16299 Out = getDerived().RebuildPackExpansion(
Out.get(), E->getEllipsisLoc(),
16300 OrigNumExpansions);
16301 if (
Out.isInvalid())
16303 FullySubstituted =
false;
16305 ExpandedExprs.push_back(
Out.get());
16309 if (RetainExpansion) {
16310 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
16313 if (
Out.isInvalid())
16316 Out = getDerived().RebuildPackExpansion(
Out.get(), E->getEllipsisLoc(),
16317 OrigNumExpansions);
16318 if (
Out.isInvalid())
16320 FullySubstituted =
false;
16321 ExpandedExprs.push_back(
Out.get());
16323 }
else if (!E->expandsToEmptyPack()) {
16324 if (getDerived().TransformExprs(E->getExpressions().data(),
16325 E->getExpressions().size(),
false,
16330 return getDerived().RebuildPackIndexingExpr(
16331 E->getEllipsisLoc(), E->getRSquareLoc(), E->getPackIdExpression(),
16332 IndexExpr.get(), ExpandedExprs, FullySubstituted);
16335template <
typename Derived>
16338 if (!getSema().ArgPackSubstIndex)
16345 E->getAssociatedDecl(), E->getParameterPack(),
16346 E->getParameterPackLocation(), Arg, SemaRef.
getPackIndex(Pack),
16350template <
typename Derived>
16354 ExprResult Replacement = getDerived().TransformExpr(OrigReplacement);
16355 if (Replacement.isInvalid())
16358 Decl *AssociatedDecl =
16359 getDerived().TransformDecl(E->getNameLoc(), E->getAssociatedDecl());
16360 if (!AssociatedDecl)
16363 if (Replacement.get() == OrigReplacement &&
16364 AssociatedDecl == E->getAssociatedDecl())
16372 ->asArray()[E->getIndex()]);
16373 if (
QualType ParamType = Param->getType();
16375 Replacement.get() != OrigReplacement) {
16383 Param, ParamType, Replacement.get(), SugaredConverted,
16384 CanonicalConverted,
16386 if (Replacement.isInvalid())
16390 Replacement = E->getReplacement();
16394 Replacement.get()->getType(), Replacement.get()->getValueKind(),
16395 E->getNameLoc(), Replacement.get(), AssociatedDecl, E->getIndex(),
16396 E->getPackIndex(), E->isReferenceParameter(), E->getFinal());
16399template<
typename Derived>
16406template<
typename Derived>
16413template<
typename Derived>
16417 if (
Expr *OldCallee = E->getCallee()) {
16418 ExprResult CalleeResult = getDerived().TransformExpr(OldCallee);
16419 if (CalleeResult.isInvalid())
16424 Expr *Pattern = E->getPattern();
16427 getSema().collectUnexpandedParameterPacks(Pattern, Unexpanded);
16428 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
16432 bool Expand =
true;
16433 bool RetainExpansion =
false;
16435 NumExpansions = OrigNumExpansions;
16436 if (getDerived().TryExpandParameterPacks(
16437 E->getEllipsisLoc(), Pattern->getSourceRange(), Unexpanded,
16438 true, Expand, RetainExpansion,
16448 E->getLHS() ? getDerived().TransformExpr(E->getLHS()) :
ExprResult();
16449 if (LHS.isInvalid())
16453 E->getRHS() ? getDerived().TransformExpr(E->getRHS()) :
ExprResult();
16454 if (RHS.isInvalid())
16457 if (!getDerived().AlwaysRebuild() &&
16458 LHS.get() == E->getLHS() && RHS.get() == E->getRHS())
16461 return getDerived().RebuildCXXFoldExpr(
16462 Callee, E->getBeginLoc(), LHS.get(), E->getOperator(),
16463 E->getEllipsisLoc(), RHS.get(), E->getEndLoc(), NumExpansions);
16469 if (NumExpansions && SemaRef.
getLangOpts().BracketDepth < *NumExpansions) {
16470 SemaRef.
Diag(E->getEllipsisLoc(),
16471 clang::diag::err_fold_expression_limit_exceeded)
16472 << *NumExpansions << SemaRef.
getLangOpts().BracketDepth
16473 << E->getSourceRange();
16474 SemaRef.
Diag(E->getEllipsisLoc(), diag::note_bracket_depth);
16483 bool LeftFold = E->isLeftFold();
16487 if (!LeftFold && RetainExpansion) {
16488 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
16491 if (
Out.isInvalid())
16494 Result = getDerived().RebuildCXXFoldExpr(
16495 Callee, E->getBeginLoc(),
Out.get(), E->getOperator(),
16496 E->getEllipsisLoc(),
Result.get(), E->getEndLoc(), OrigNumExpansions);
16501 bool WarnedOnComparison =
false;
16502 for (
unsigned I = 0; I != *NumExpansions; ++I) {
16504 getSema(), LeftFold ? I : *NumExpansions - I - 1);
16506 if (
Out.isInvalid())
16509 if (
Out.get()->containsUnexpandedParameterPack()) {
16511 Result = getDerived().RebuildCXXFoldExpr(
16512 Callee, E->getBeginLoc(), LeftFold ?
Result.get() :
Out.get(),
16513 E->getOperator(), E->getEllipsisLoc(),
16514 LeftFold ?
Out.get() :
Result.get(), E->getEndLoc(),
16515 OrigNumExpansions);
16516 }
else if (
Result.isUsable()) {
16523 Result = getDerived().RebuildCXXOperatorCallExpr(
16525 E->getEllipsisLoc(),
Callee->getBeginLoc(),
Callee->requiresADL(),
16526 Functions, LHS, RHS);
16528 Result = getDerived().RebuildBinaryOperator(E->getEllipsisLoc(),
16529 E->getOperator(), LHS, RHS,
16531 if (!WarnedOnComparison &&
Result.isUsable()) {
16532 if (
auto *BO = dyn_cast<BinaryOperator>(
Result.get());
16533 BO && BO->isComparisonOp()) {
16534 WarnedOnComparison =
true;
16535 SemaRef.
Diag(BO->getBeginLoc(),
16536 diag::warn_comparison_in_fold_expression)
16537 << BO->getOpcodeStr();
16550 if (LeftFold && RetainExpansion) {
16551 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
16554 if (
Out.isInvalid())
16557 Result = getDerived().RebuildCXXFoldExpr(
16558 Callee, E->getBeginLoc(),
Result.get(), E->getOperator(),
16559 E->getEllipsisLoc(),
Out.get(), E->getEndLoc(), OrigNumExpansions);
16565 PE->setIsProducedByFoldExpansion();
16570 return getDerived().RebuildEmptyCXXFoldExpr(E->getEllipsisLoc(),
16575template <
typename Derived>
16581 QualType T = getDerived().TransformType(E->getType());
16583 bool ArgChanged =
false;
16585 if (getDerived().TransformExprs(InitExprs.data(), InitExprs.size(),
true,
16586 TransformedInits, &ArgChanged))
16589 if (!getDerived().AlwaysRebuild() && !ArgChanged &&
T == E->getType())
16592 return getDerived().RebuildCXXParenListInitExpr(
16593 TransformedInits,
T, E->getUserSpecifiedInitExprs().size(),
16594 E->getInitLoc(), E->getBeginLoc(), E->getEndLoc());
16597template<
typename Derived>
16604template<
typename Derived>
16610template<
typename Derived>
16616template<
typename Derived>
16619 ExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
16620 if (SubExpr.isInvalid())
16623 if (!getDerived().AlwaysRebuild() &&
16624 SubExpr.get() == E->getSubExpr())
16627 return getDerived().RebuildObjCBoxedExpr(E->getSourceRange(), SubExpr.get());
16630template<
typename Derived>
16635 bool ArgChanged =
false;
16636 if (getDerived().TransformExprs(E->getElements(), E->getNumElements(),
16637 false, Elements, &ArgChanged))
16640 if (!getDerived().AlwaysRebuild() && !ArgChanged)
16643 return getDerived().RebuildObjCArrayLiteral(E->getSourceRange(),
16648template<
typename Derived>
16654 bool ArgChanged =
false;
16655 for (
unsigned I = 0, N = E->getNumElements(); I != N; ++I) {
16658 if (OrigElement.isPackExpansion()) {
16661 getSema().collectUnexpandedParameterPacks(OrigElement.Key, Unexpanded);
16662 getSema().collectUnexpandedParameterPacks(OrigElement.Value, Unexpanded);
16663 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
16667 bool Expand =
true;
16668 bool RetainExpansion =
false;
16671 SourceRange PatternRange(OrigElement.Key->getBeginLoc(),
16672 OrigElement.Value->getEndLoc());
16673 if (getDerived().TryExpandParameterPacks(
16674 OrigElement.EllipsisLoc, PatternRange, Unexpanded,
16675 true, Expand, RetainExpansion,
16684 ExprResult Key = getDerived().TransformExpr(OrigElement.Key);
16685 if (Key.isInvalid())
16688 if (Key.get() != OrigElement.Key)
16692 if (
Value.isInvalid())
16699 Key.get(),
Value.get(), OrigElement.EllipsisLoc, NumExpansions
16701 Elements.push_back(Expansion);
16711 for (
unsigned I = 0; I != *NumExpansions; ++I) {
16713 ExprResult Key = getDerived().TransformExpr(OrigElement.Key);
16714 if (Key.isInvalid())
16718 if (
Value.isInvalid())
16728 if (Key.get()->containsUnexpandedParameterPack() ||
16729 Value.get()->containsUnexpandedParameterPack())
16730 Element.EllipsisLoc = OrigElement.EllipsisLoc;
16732 Elements.push_back(Element);
16742 ExprResult Key = getDerived().TransformExpr(OrigElement.Key);
16743 if (Key.isInvalid())
16746 if (Key.get() != OrigElement.Key)
16751 = getDerived().TransformExpr(OrigElement.Value);
16752 if (
Value.isInvalid())
16760 Elements.push_back(Element);
16763 if (!getDerived().AlwaysRebuild() && !ArgChanged)
16766 return getDerived().RebuildObjCDictionaryLiteral(E->getSourceRange(),
16770template<
typename Derived>
16774 = getDerived().TransformType(E->getEncodedTypeSourceInfo());
16775 if (!EncodedTypeInfo)
16778 if (!getDerived().AlwaysRebuild() &&
16779 EncodedTypeInfo == E->getEncodedTypeSourceInfo())
16782 return getDerived().RebuildObjCEncodeExpr(E->getAtLoc(),
16784 E->getRParenLoc());
16787template<
typename Derived>
16797template<
typename Derived>
16801 = getDerived().TransformType(E->getTypeInfoAsWritten());
16809 if (!getDerived().AlwaysRebuild() &&
16810 TSInfo == E->getTypeInfoAsWritten() &&
16811 Result.get() == E->getSubExpr())
16815 E->getLParenLoc(), E->getBridgeKind(), E->getBridgeKeywordLoc(), TSInfo,
16819template <
typename Derived>
16825template<
typename Derived>
16829 bool ArgChanged =
false;
16831 Args.reserve(E->getNumArgs());
16832 if (getDerived().TransformExprs(E->getArgs(), E->getNumArgs(),
false, Args,
16839 = getDerived().TransformType(E->getClassReceiverTypeInfo());
16840 if (!ReceiverTypeInfo)
16844 if (!getDerived().AlwaysRebuild() &&
16845 ReceiverTypeInfo == E->getClassReceiverTypeInfo() && !ArgChanged)
16850 E->getSelectorLocs(SelLocs);
16851 return getDerived().RebuildObjCMessageExpr(ReceiverTypeInfo,
16854 E->getMethodDecl(),
16861 if (!E->getMethodDecl())
16866 E->getSelectorLocs(SelLocs);
16867 return getDerived().RebuildObjCMessageExpr(E->getSuperLoc(),
16870 E->getReceiverType(),
16871 E->getMethodDecl(),
16879 "Only class and instance messages may be instantiated");
16881 = getDerived().TransformExpr(E->getInstanceReceiver());
16882 if (Receiver.isInvalid())
16886 if (!getDerived().AlwaysRebuild() &&
16887 Receiver.get() == E->getInstanceReceiver() && !ArgChanged)
16892 E->getSelectorLocs(SelLocs);
16893 return getDerived().RebuildObjCMessageExpr(Receiver.get(),
16896 E->getMethodDecl(),
16902template<
typename Derived>
16908template<
typename Derived>
16914template<
typename Derived>
16919 if (
Base.isInvalid())
16925 if (!getDerived().AlwaysRebuild() &&
16926 Base.get() == E->getBase())
16929 return getDerived().RebuildObjCIvarRefExpr(
Base.get(), E->getDecl(),
16931 E->isArrow(), E->isFreeIvar());
16934template<
typename Derived>
16939 if (!E->isObjectReceiver())
16944 if (
Base.isInvalid())
16950 if (!getDerived().AlwaysRebuild() &&
16951 Base.get() == E->getBase())
16954 if (E->isExplicitProperty())
16955 return getDerived().RebuildObjCPropertyRefExpr(
Base.get(),
16956 E->getExplicitProperty(),
16959 return getDerived().RebuildObjCPropertyRefExpr(
Base.get(),
16961 E->getImplicitPropertyGetter(),
16962 E->getImplicitPropertySetter(),
16966template<
typename Derived>
16971 if (
Base.isInvalid())
16975 ExprResult Key = getDerived().TransformExpr(E->getKeyExpr());
16976 if (Key.isInvalid())
16980 if (!getDerived().AlwaysRebuild() &&
16981 Key.get() == E->getKeyExpr() &&
Base.get() == E->getBaseExpr())
16984 return getDerived().RebuildObjCSubscriptRefExpr(E->getRBracket(),
16985 Base.get(), Key.get(),
16986 E->getAtIndexMethodDecl(),
16987 E->setAtIndexMethodDecl());
16990template<
typename Derived>
16995 if (
Base.isInvalid())
16999 if (!getDerived().AlwaysRebuild() &&
17000 Base.get() == E->getBase())
17003 return getDerived().RebuildObjCIsaExpr(
Base.get(), E->getIsaMemberLoc(),
17008template<
typename Derived>
17011 bool ArgumentChanged =
false;
17013 SubExprs.reserve(E->getNumSubExprs());
17014 if (getDerived().TransformExprs(E->getSubExprs(), E->getNumSubExprs(),
false,
17015 SubExprs, &ArgumentChanged))
17018 if (!getDerived().AlwaysRebuild() &&
17022 return getDerived().RebuildShuffleVectorExpr(E->getBuiltinLoc(),
17024 E->getRParenLoc());
17027template<
typename Derived>
17030 ExprResult SrcExpr = getDerived().TransformExpr(E->getSrcExpr());
17031 if (SrcExpr.isInvalid())
17038 if (!getDerived().AlwaysRebuild() &&
17039 Type == E->getTypeSourceInfo() &&
17040 SrcExpr.get() == E->getSrcExpr())
17043 return getDerived().RebuildConvertVectorExpr(E->getBuiltinLoc(),
17044 SrcExpr.get(),
Type,
17045 E->getRParenLoc());
17048template<
typename Derived>
17051 BlockDecl *oldBlock = E->getBlockDecl();
17057 blockScope->TheDecl->setBlockMissingReturnType(
17058 oldBlock->blockMissingReturnType());
17067 if (getDerived().TransformFunctionTypeParams(
17068 E->getCaretLocation(), oldBlock->parameters(),
nullptr,
17069 exprFunctionType->getExtParameterInfosOrNull(), paramTypes, ¶ms,
17071 getSema().ActOnBlockError(E->getCaretLocation(),
nullptr);
17076 getDerived().TransformType(exprFunctionType->getReturnType());
17078 auto epi = exprFunctionType->getExtProtoInfo();
17079 epi.ExtParameterInfos = extParamInfos.getPointerOrNull(paramTypes.size());
17082 getDerived().RebuildFunctionProtoType(exprResultType, paramTypes, epi);
17086 if (!params.empty())
17087 blockScope->TheDecl->setParams(params);
17089 if (!oldBlock->blockMissingReturnType()) {
17090 blockScope->HasImplicitReturnType =
false;
17091 blockScope->ReturnType = exprResultType;
17095 StmtResult body = getDerived().TransformStmt(E->getBody());
17096 if (body.isInvalid()) {
17097 getSema().ActOnBlockError(E->getCaretLocation(),
nullptr);
17105 for (
const auto &I : oldBlock->captures()) {
17106 VarDecl *oldCapture = I.getVariable();
17109 if (oldCapture->isParameterPack())
17113 cast<VarDecl>(getDerived().TransformDecl(E->getCaretLocation(),
17115 assert(blockScope->CaptureMap.count(newCapture));
17121 assert((!blockScope->isCXXThisCaptured() || oldBlock->capturesCXXThis()) &&
17122 "this pointer isn't captured in the old block");
17130template<
typename Derived>
17133 ExprResult SrcExpr = getDerived().TransformExpr(E->getSrcExpr());
17134 if (SrcExpr.isInvalid())
17137 QualType Type = getDerived().TransformType(E->getType());
17140 E->getRParenLoc());
17143template<
typename Derived>
17146 bool ArgumentChanged =
false;
17148 SubExprs.reserve(E->getNumSubExprs());
17149 if (getDerived().TransformExprs(E->getSubExprs(), E->getNumSubExprs(),
false,
17150 SubExprs, &ArgumentChanged))
17153 if (!getDerived().AlwaysRebuild() &&
17157 return getDerived().RebuildAtomicExpr(E->getBuiltinLoc(), SubExprs,
17158 E->getOp(), E->getRParenLoc());
17165template<
typename Derived>
17168 return SemaRef.BuildPointerType(PointeeType,
Star,
17172template<
typename Derived>
17175 return SemaRef.BuildBlockPointerType(PointeeType,
Star,
17179template<
typename Derived>
17182 bool WrittenAsLValue,
17184 return SemaRef.BuildReferenceType(ReferentType, WrittenAsLValue,
17188template <
typename Derived>
17192 return SemaRef.BuildMemberPointerType(PointeeType, SS, Cls, Sigil,
17196template<
typename Derived>
17203 return SemaRef.ObjC().BuildObjCTypeParamType(
17204 Decl, ProtocolLAngleLoc, Protocols, ProtocolLocs, ProtocolRAngleLoc,
17208template<
typename Derived>
17219 return SemaRef.ObjC().BuildObjCObjectType(
17220 BaseType, Loc, TypeArgsLAngleLoc, TypeArgs, TypeArgsRAngleLoc,
17221 ProtocolLAngleLoc, Protocols, ProtocolLocs, ProtocolRAngleLoc,
17226template<
typename Derived>
17230 return SemaRef.Context.getObjCObjectPointerType(PointeeType);
17233template <
typename Derived>
17236 Expr *SizeExpr,
unsigned IndexTypeQuals,
SourceRange BracketsRange) {
17237 if (SizeExpr || !Size)
17238 return SemaRef.BuildArrayType(ElementType, SizeMod, SizeExpr,
17239 IndexTypeQuals, BracketsRange,
17243 SemaRef.Context.UnsignedCharTy,
SemaRef.Context.UnsignedShortTy,
17245 SemaRef.Context.UnsignedLongLongTy,
SemaRef.Context.UnsignedInt128Ty
17248 for (
const auto &
T : Types)
17249 if (Size->getBitWidth() ==
SemaRef.Context.getIntWidth(
T)) {
17259 return SemaRef.BuildArrayType(ElementType, SizeMod, ArraySize,
17260 IndexTypeQuals, BracketsRange,
17264template <
typename Derived>
17267 Expr *SizeExpr,
unsigned IndexTypeQuals,
SourceRange BracketsRange) {
17268 return getDerived().RebuildArrayType(ElementType, SizeMod, &Size, SizeExpr,
17269 IndexTypeQuals, BracketsRange);
17272template <
typename Derived>
17276 return getDerived().RebuildArrayType(ElementType, SizeMod,
nullptr,
nullptr,
17277 IndexTypeQuals, BracketsRange);
17280template <
typename Derived>
17283 unsigned IndexTypeQuals,
SourceRange BracketsRange) {
17284 return getDerived().RebuildArrayType(ElementType, SizeMod,
nullptr,
17286 IndexTypeQuals, BracketsRange);
17289template <
typename Derived>
17292 unsigned IndexTypeQuals,
SourceRange BracketsRange) {
17293 return getDerived().RebuildArrayType(ElementType, SizeMod,
nullptr,
17295 IndexTypeQuals, BracketsRange);
17298template <
typename Derived>
17301 return SemaRef.BuildAddressSpaceAttr(PointeeType, AddrSpaceExpr,
17305template <
typename Derived>
17307 unsigned NumElements,
17310 return SemaRef.Context.getVectorType(ElementType, NumElements, VecKind);
17313template <
typename Derived>
17317 return SemaRef.BuildVectorType(ElementType, SizeExpr, AttributeLoc);
17320template<
typename Derived>
17322 unsigned NumElements,
17324 llvm::APInt numElements(
SemaRef.Context.getIntWidth(
SemaRef.Context.IntTy),
17325 NumElements,
true);
17329 return SemaRef.BuildExtVectorType(ElementType, VectorSize, AttributeLoc);
17332template<
typename Derived>
17337 return SemaRef.BuildExtVectorType(ElementType, SizeExpr, AttributeLoc);
17340template <
typename Derived>
17342 QualType ElementType,
unsigned NumRows,
unsigned NumColumns) {
17343 return SemaRef.Context.getConstantMatrixType(ElementType, NumRows,
17347template <
typename Derived>
17351 return SemaRef.BuildMatrixType(ElementType, RowExpr, ColumnExpr,
17355template <
typename Derived>
17359 return SemaRef.BuildFunctionType(
T, ParamTypes,
17365template<
typename Derived>
17367 return SemaRef.Context.getFunctionNoProtoType(
T);
17370template <
typename Derived>
17374 assert(D &&
"no decl found");
17378 if (
auto *UPD = dyn_cast<UsingPackDecl>(D)) {
17382 if (UPD->expansions().empty()) {
17383 getSema().Diag(NameLoc, diag::err_using_pack_expansion_empty)
17384 << UPD->isCXXClassMember() << UPD;
17393 for (
auto *E : UPD->expansions()) {
17400 else if (
T.isNull())
17403 assert(
getSema().Context.hasSameType(ThisT,
T) &&
17404 "mismatched resolved types in using pack expansion");
17406 return T.isNull() ? FallbackT :
T;
17408 if (
auto *Using = dyn_cast<UsingDecl>(D)) {
17409 assert(Using->hasTypename() &&
17410 "UnresolvedUsingTypenameDecl transformed to non-typename using");
17413 assert(++Using->shadow_begin() == Using->shadow_end());
17418 return SemaRef.Context.getUsingType(
Keyword, Qualifier, Shadow);
17421 "UnresolvedUsingTypenameDecl transformed to non-using decl");
17422 return SemaRef.Context.getUnresolvedUsingType(
17426template <
typename Derived>
17429 return SemaRef.BuildTypeofExprType(E, Kind);
17432template<
typename Derived>
17435 return SemaRef.Context.getTypeOfType(Underlying, Kind);
17438template <
typename Derived>
17440 return SemaRef.BuildDecltypeType(E);
17443template <
typename Derived>
17448 return SemaRef.BuildPackIndexingType(Pattern, IndexExpr, Loc, EllipsisLoc,
17449 FullySubstituted, Expansions);
17452template<
typename Derived>
17454 UnaryTransformType::UTTKind UKind,
17456 return SemaRef.BuildUnaryTransformType(BaseType, UKind, Loc);
17459template <
typename Derived>
17463 return SemaRef.CheckTemplateIdType(
17468template<
typename Derived>
17471 return SemaRef.BuildAtomicType(ValueType, KWLoc);
17474template<
typename Derived>
17478 return isReadPipe ?
SemaRef.BuildReadPipeType(ValueType, KWLoc)
17479 :
SemaRef.BuildWritePipeType(ValueType, KWLoc);
17482template <
typename Derived>
17486 llvm::APInt NumBitsAP(
SemaRef.Context.getIntWidth(
SemaRef.Context.IntTy),
17490 return SemaRef.BuildBitIntType(IsUnsigned, Bits, Loc);
17493template <
typename Derived>
17496 return SemaRef.BuildBitIntType(IsUnsigned, NumBitsExpr, Loc);
17499template <
typename Derived>
17507template <
typename Derived>
17514 getSema().ActOnTemplateName(
nullptr, SS, TemplateKWLoc,
17517 AllowInjectedClassName);
17521template<
typename Derived>
17528 bool AllowInjectedClassName) {
17531 SourceLocation SymbolLocations[3] = { NameLoc, NameLoc, NameLoc };
17536 false,
Template, AllowInjectedClassName);
17540template <
typename Derived>
17545 bool isPostIncDec = Second && (Op == OO_PlusPlus || Op == OO_MinusMinus);
17550 return SemaRef.PseudoObject().checkAssignment(
nullptr, OpLoc,
17551 Opc,
First, Second);
17566 if (Op == OO_Subscript) {
17567 if (!
First->getType()->isOverloadableType() &&
17569 return getSema().CreateBuiltinArraySubscriptExpr(
First, CalleeLoc, Second,
17571 }
else if (Op == OO_Arrow) {
17574 if (
First->getType()->isDependentType())
17577 return SemaRef.BuildOverloadedArrowExpr(
nullptr,
First, OpLoc);
17578 }
else if (Second ==
nullptr || isPostIncDec) {
17579 if (!
First->getType()->isOverloadableType() ||
17580 (Op == OO_Amp &&
getSema().isQualifiedMemberAccess(
First))) {
17587 return getSema().CreateBuiltinUnaryOp(OpLoc, Opc,
First);
17591 !
First->getType()->isOverloadableType() &&
17597 =
SemaRef.CreateBuiltinBinOp(OpLoc, Opc,
First, Second);
17606 if (!Second || isPostIncDec) {
17609 return SemaRef.CreateOverloadedUnaryOp(OpLoc, Opc, Functions,
First,
17616 First, Second, RequiresADL);
17623template<
typename Derived>
17633 QualType CanonicalBaseType =
Base->getType().getCanonicalType();
17639 ->getAsCanonical<RecordType>())) {
17641 return SemaRef.BuildPseudoDestructorExpr(
17642 Base, OperatorLoc, isArrow ? tok::arrow : tok::period, SS, ScopeType,
17643 CCLoc, TildeLoc, Destroyed);
17655 if (!
isa<TagType>(ScopeType->getType().getCanonicalType())) {
17656 getSema().Diag(ScopeType->getTypeLoc().getBeginLoc(),
17657 diag::err_expected_class_or_namespace)
17658 << ScopeType->getType() <<
getSema().getLangOpts().CPlusPlus;
17662 SS.
Make(
SemaRef.Context, ScopeType->getTypeLoc(), CCLoc);
17666 return getSema().BuildMemberReferenceExpr(
17667 Base,
Base->getType(), OperatorLoc, isArrow, SS, TemplateKWLoc,
17673template<
typename Derived>
17681 for (
unsigned I = 0; I < NumParams; ++I) {
17682 if (I != ContextParamPos) {
17688 Params.push_back(std::make_pair(StringRef(), QualType()));
17691 getSema().ActOnCapturedRegionStart(Loc,
nullptr,
17699 if (Body.isInvalid()) {
17700 getSema().ActOnCapturedRegionError();
17704 return getSema().ActOnCapturedRegionEnd(Body.get());
17707template <
typename Derived>
17713 llvm_unreachable(
"SYCL kernel call statement cannot appear in dependent "
17717template <
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.
Expr * IgnoreImplicitAsWritten() LLVM_READONLY
Skip past any implicit AST nodes which might surround this expression until reaching a fixed point.
bool isDefaultArgument() const
Determine whether this expression is a default function argument.
bool hasPlaceholderType() const
Returns whether this expression has a placeholder type.
static ExprValueKind getValueKindForType(QualType T)
getValueKindForType - Given a formal return or parameter type, give its value kind.
An expression trait intrinsic.
ExtVectorElementExpr - This represents access to specific elements of a vector, and may occur on the ...
Represents difference between two FPOptions values.
FPOptions applyOverrides(FPOptions Base)
Represents a member of a struct/union/class.
ForStmt - This represents a 'for (init;cond;inc)' stmt.
Represents a function declaration or definition.
ArrayRef< ParmVarDecl * > parameters() const
SmallVector< Conflict > Conflicts
Represents an abstract function effect, using just an enumeration describing its kind.
StringRef name() const
The description printed in diagnostics, e.g. 'nonblocking'.
Kind oppositeKind() const
Return the opposite kind, for effects which have opposites.
ArrayRef< EffectConditionExpr > conditions() const
Represents a K&R-style 'int foo()' function, which has no information available about its arguments.
Represents a reference to a function parameter pack, init-capture pack, or binding pack that has been...
Represents a prototype with parameter type info, e.g.
param_type_iterator param_type_begin() const
unsigned getNumParams() const
SourceLocation getLocalRangeEnd() const
void setLocalRangeBegin(SourceLocation L)
void setLParenLoc(SourceLocation Loc)
SourceRange getExceptionSpecRange() const
void setParam(unsigned i, ParmVarDecl *VD)
ArrayRef< ParmVarDecl * > getParams() const
void setRParenLoc(SourceLocation Loc)
void setLocalRangeEnd(SourceLocation L)
void setExceptionSpecRange(SourceRange R)
TypeLoc getReturnLoc() const
SourceLocation getLocalRangeBegin() const
SourceLocation getLParenLoc() const
SourceLocation getRParenLoc() const
Interesting information about a specific parameter that can't simply be reflected in parameter's type...
This represents a GCC inline-assembly statement extension.
GNUNullExpr - Implements the GNU __null extension, which is a name for a null pointer constant that h...
Represents a C11 generic selection.
AssociationTy< false > Association
GotoStmt - This represents a direct goto.
Type source information for HLSL attributed resource type.
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 class represents the 'looprange' clause in the 'pragma omp fuse' directive.
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 * ActOnOpenMPLoopRangeClause(Expr *First, Expr *Count, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation FirstLoc, SourceLocation CountLoc, SourceLocation EndLoc)
Called on well-form 'looprange' clause after parsing its arguments.
OMPClause * ActOnOpenMPPermutationClause(ArrayRef< Expr * > PermExprs, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-form 'permutation' clause after parsing its arguments.
OMPClause * ActOnOpenMPNontemporalClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'nontemporal' clause.
OMPClause * 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 BuildSubstNonTypeTemplateParmExpr(Decl *AssociatedDecl, const NonTypeTemplateParmDecl *NTTP, SourceLocation loc, TemplateArgument Replacement, UnsignedOrNone PackIndex, bool Final)
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)
@ CTAK_Specified
The template argument was specified in the code or was instantiated with some deduced template argume...
ExprResult ActOnCXXDelete(SourceLocation StartLoc, bool UseGlobal, bool ArrayForm, Expr *Operand)
ActOnCXXDelete - Parsed a C++ 'delete' expression (C++ 5.3.5), as in:
ExprResult BuildCXXTypeId(QualType TypeInfoType, SourceLocation TypeidLoc, TypeSourceInfo *Operand, SourceLocation RParenLoc)
Build a C++ typeid expression with a type operand.
ExprResult PerformMemberExprBaseConversion(Expr *Base, bool IsArrow)
Perform conversions on the LHS of a member access expression.
DiagnosticsEngine & getDiagnostics() const
ExprResult BuildPackIndexingExpr(Expr *PackExpression, SourceLocation EllipsisLoc, Expr *IndexExpr, SourceLocation RSquareLoc, ArrayRef< Expr * > ExpandedExprs={}, bool FullySubstituted=false)
ParsedType getDestructorName(const IdentifierInfo &II, SourceLocation NameLoc, Scope *S, CXXScopeSpec &SS, ParsedType ObjectType, bool EnteringContext)
ASTContext & getASTContext() const
CXXDestructorDecl * LookupDestructor(CXXRecordDecl *Class)
Look for the destructor of the given class.
ExprResult BuildUnaryOp(Scope *S, SourceLocation OpLoc, UnaryOperatorKind Opc, Expr *Input, bool IsAfterAmp=false)
ExprResult BuildTemplateIdExpr(const CXXScopeSpec &SS, SourceLocation TemplateKWLoc, LookupResult &R, bool RequiresADL, const TemplateArgumentListInfo *TemplateArgs)
ExprResult CreateOverloadedBinOp(SourceLocation OpLoc, BinaryOperatorKind Opc, const UnresolvedSetImpl &Fns, Expr *LHS, Expr *RHS, bool RequiresADL=true, bool AllowRewrittenCandidates=true, FunctionDecl *DefaultedFn=nullptr)
Create a binary operation that may resolve to an overloaded operator.
StmtResult ActOnSEHTryBlock(bool IsCXXTry, SourceLocation TryLoc, Stmt *TryBlock, Stmt *Handler)
ExprResult BuildPredefinedExpr(SourceLocation Loc, PredefinedIdentKind IK)
ExprResult CheckConceptTemplateId(const CXXScopeSpec &SS, SourceLocation TemplateKWLoc, const DeclarationNameInfo &ConceptNameInfo, NamedDecl *FoundDecl, TemplateDecl *NamedConcept, const TemplateArgumentListInfo *TemplateArgs, bool DoCheckConstraintSatisfaction=true)
ExprResult BuildCompoundLiteralExpr(SourceLocation LParenLoc, TypeSourceInfo *TInfo, SourceLocation RParenLoc, Expr *LiteralExpr)
ExprResult ActOnAddrLabel(SourceLocation OpLoc, SourceLocation LabLoc, LabelDecl *TheDecl)
ActOnAddrLabel - Parse the GNU address of label extension: "&&foo".
ExprResult ActOnParenListExpr(SourceLocation L, SourceLocation R, MultiExprArg Val)
QualType BuildCountAttributedArrayOrPointerType(QualType WrappedTy, Expr *CountExpr, bool CountInBytes, bool OrNull)
ExprResult BuildCXXNew(SourceRange Range, bool UseGlobal, SourceLocation PlacementLParen, MultiExprArg PlacementArgs, SourceLocation PlacementRParen, SourceRange TypeIdParens, QualType AllocType, TypeSourceInfo *AllocTypeInfo, std::optional< Expr * > ArraySize, SourceRange DirectInitRange, Expr *Initializer)
DeclRefExpr * BuildDeclRefExpr(ValueDecl *D, QualType Ty, ExprValueKind VK, SourceLocation Loc, const CXXScopeSpec *SS=nullptr)
ExprResult BuildCXXFoldExpr(UnresolvedLookupExpr *Callee, SourceLocation LParenLoc, Expr *LHS, BinaryOperatorKind Operator, SourceLocation EllipsisLoc, Expr *RHS, SourceLocation RParenLoc, UnsignedOrNone NumExpansions)
ExprResult CreateGenericSelectionExpr(SourceLocation KeyLoc, SourceLocation DefaultLoc, SourceLocation RParenLoc, bool PredicateIsExpr, void *ControllingExprOrType, ArrayRef< TypeSourceInfo * > Types, ArrayRef< Expr * > Exprs)
ControllingExprOrType is either a TypeSourceInfo * or an Expr *.
bool CheckTemplateArgument(NamedDecl *Param, TemplateArgumentLoc &Arg, NamedDecl *Template, SourceLocation TemplateLoc, SourceLocation RAngleLoc, unsigned ArgumentPackIndex, CheckTemplateArgumentInfo &CTAI, CheckTemplateArgumentKind CTAK)
Check that the given template argument corresponds to the given template parameter.
StmtResult ActOnFinishSwitchStmt(SourceLocation SwitchLoc, Stmt *Switch, Stmt *Body)
SourceLocation getLocForEndOfToken(SourceLocation Loc, unsigned Offset=0)
Calls Lexer::getLocForEndOfToken()
const LangOptions & getLangOpts() const
StmtResult ActOnWhileStmt(SourceLocation WhileLoc, SourceLocation LParenLoc, ConditionResult Cond, SourceLocation RParenLoc, Stmt *Body)
bool isPotentialImplicitMemberAccess(const CXXScopeSpec &SS, LookupResult &R, bool IsAddressOfOperand)
Check whether an expression might be an implicit class member access.
void collectUnexpandedParameterPacks(TemplateArgument Arg, SmallVectorImpl< UnexpandedParameterPack > &Unexpanded)
Collect the set of unexpanded parameter packs within the given template argument.
ExprResult BuildSourceLocExpr(SourceLocIdentKind Kind, QualType ResultTy, SourceLocation BuiltinLoc, SourceLocation RPLoc, DeclContext *ParentContext)
ExprResult BuildCXXTypeConstructExpr(TypeSourceInfo *Type, SourceLocation LParenLoc, MultiExprArg Exprs, SourceLocation RParenLoc, bool ListInitialization)
ExprResult 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)
TemplateArgument getPackSubstitutedTemplateArgument(TemplateArgument Arg) const
ExprResult BuildUnresolvedCoawaitExpr(SourceLocation KwLoc, Expr *Operand, UnresolvedLookupExpr *Lookup)
ExprResult BuildExpressionTrait(ExpressionTrait OET, SourceLocation KWLoc, Expr *Queried, SourceLocation RParen)
bool buildCoroutineParameterMoves(SourceLocation Loc)
ExprResult BuildCStyleCastExpr(SourceLocation LParenLoc, TypeSourceInfo *Ty, SourceLocation RParenLoc, Expr *Op)
ExprResult BuildCXXUuidof(QualType TypeInfoType, SourceLocation TypeidLoc, TypeSourceInfo *Operand, SourceLocation RParenLoc)
Build a Microsoft __uuidof expression with a type operand.
sema::FunctionScopeInfo * getCurFunction() const
DeclGroupPtrTy BuildDeclaratorGroup(MutableArrayRef< Decl * > Group)
BuildDeclaratorGroup - convert a list of declarations into a declaration group, performing any necess...
Expr * BuildCXXThisExpr(SourceLocation Loc, QualType Type, bool IsImplicit)
Build a CXXThisExpr and mark it referenced in the current context.
UnsignedOrNone getPackIndex(TemplateArgument Pack) const
ExprResult BuildDeclarationNameExpr(const CXXScopeSpec &SS, LookupResult &R, bool NeedsADL, bool AcceptInvalidDecl=false)
sema::BlockScopeInfo * getCurBlock()
Retrieve the current block, if any.
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.
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.
TemplateParameterList * getReplacedTemplateParameterList(const Decl *D)
Internal helper used by Subst* nodes to retrieve the parameter list for their AssociatedDecl.
@ 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