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);
697 template <
typename InputIterator>
701 bool Uneval =
false);
722 return SemaRef.Context.getTrivialTypeSourceInfo(
T,
726#define ABSTRACT_TYPELOC(CLASS, PARENT)
727#define TYPELOC(CLASS, PARENT) \
728 QualType Transform##CLASS##Type(TypeLocBuilder &TLB, CLASS##TypeLoc T);
729#include "clang/AST/TypeLocNodes.def"
733 bool SuppressObjCLifetime);
737 bool SuppressObjCLifetime);
739 template<
typename Fn>
757 bool AllowInjectedClassName);
785 return getDerived().TransformFunctionTypeParams(
786 Loc, Params, ParamTypes, ParamInfos, PTypes, PVars, PInfos,
nullptr);
804 KWLoc, Params,
nullptr,
805 nullptr, PTypes, &TransParams, PInfos))
819 bool ExpectParameterPack);
846 bool IsAddressOfOperand,
854 bool IsAddressOfOperand);
862#define STMT(Node, Parent) \
863 LLVM_ATTRIBUTE_NOINLINE \
864 StmtResult Transform##Node(Node *S);
865#define VALUESTMT(Node, Parent) \
866 LLVM_ATTRIBUTE_NOINLINE \
867 StmtResult Transform##Node(Node *S, StmtDiscardKind SDK);
868#define EXPR(Node, Parent) \
869 LLVM_ATTRIBUTE_NOINLINE \
870 ExprResult Transform##Node(Node *E);
871#define ABSTRACT_STMT(Stmt)
872#include "clang/AST/StmtNodes.inc"
874#define GEN_CLANG_CLAUSE_CLASS
875#define CLAUSE_CLASS(Enum, Str, Class) \
876 LLVM_ATTRIBUTE_NOINLINE \
877 OMPClause *Transform##Class(Class *S);
878#include "llvm/Frontend/OpenMP/OMP.inc"
956 const llvm::APInt *Size,
Expr *SizeExpr,
957 unsigned IndexTypeQuals,
SourceRange BracketsRange);
966 const llvm::APInt &Size,
Expr *SizeExpr,
967 unsigned IndexTypeQuals,
977 unsigned IndexTypeQuals,
987 unsigned IndexTypeQuals,
998 unsigned IndexTypeQuals,
1036 unsigned NumColumns);
1053 Expr *AddrSpaceExpr,
1077 return SemaRef.Context.getUsingType(
Keyword, Qualifier, D, UnderlyingType);
1090 return SemaRef.Context.getMacroQualifiedType(
T, MacroII);
1100 return SemaRef.Context.getCanonicalTagType(Tag);
1117 UnaryTransformType::UTTKind UKind,
1129 bool FullySubstituted,
1143 TypeConstraintConcept,
1144 TypeConstraintArgs);
1151 return SemaRef.Context.getDeducedTemplateSpecializationType(
1170 return SemaRef.BuildParenType(InnerType);
1183 bool DeducedTSTContext) {
1185 SS.
Adopt(QualifierLoc);
1189 if (!
SemaRef.computeDeclContext(SS))
1197 return SemaRef.CheckTypenameType(
Keyword, KeywordLoc, QualifierLoc,
1198 *Id, IdLoc, DeducedTSTContext);
1211 if (
SemaRef.RequireCompleteDeclContext(SS, DC))
1216 switch (
Result.getResultKind()) {
1227 llvm_unreachable(
"Tag lookup cannot find non-tags");
1239 switch (
Result.getResultKind()) {
1245 SemaRef.Diag(IdLoc, diag::err_tag_reference_non_tag)
1246 << SomeDecl << NTK << Kind;
1251 SemaRef.Diag(IdLoc, diag::err_not_tag_in_scope)
1257 if (!
SemaRef.isAcceptableTagRedeclaration(Tag, Kind,
false,
1259 SemaRef.Diag(KeywordLoc, diag::err_use_with_wrong_tag) << Id;
1260 SemaRef.Diag(Tag->getLocation(), diag::note_previous_use);
1316 bool AllowInjectedClassName);
1329 bool AllowInjectedClassName);
1335 bool AllowInjectedClassName);
1345 Decl *AssociatedDecl,
unsigned Index,
1348 ArgPack, AssociatedDecl, Index, Final);
1402 return SemaRef.ActOnLabelStmt(IdentLoc, L, ColonLoc, SubStmt);
1412 if (
SemaRef.CheckRebuiltStmtAttributes(Attrs))
1414 return SemaRef.BuildAttributedStmt(AttrLoc, Attrs, SubStmt);
1426 Then, ElseLoc, Else);
1480 Inc, RParenLoc, Body);
1525 bool IsVolatile,
unsigned NumOutputs,
1532 NumInputs, Names, Constraints, Exprs,
1533 AsmString, Clobbers, NumLabels, RParenLoc);
1542 StringRef AsmString,
1543 unsigned NumOutputs,
unsigned NumInputs,
1549 NumOutputs, NumInputs,
1550 Constraints, Clobbers, Exprs, EndLoc);
1579 CoawaitLoc, Operand, OpCoawaitLookup);
1583 Suspend.
get(),
true);
1684 Kind, DirName, CancelRegion, Clauses, AStmt, StartLoc, EndLoc);
1696 Kind, DirName, Clauses, AStmt, StartLoc, EndLoc);
1710 NameModifier,
Condition, StartLoc, LParenLoc, NameModifierLoc, ColonLoc,
1736 Modifier, NumThreads, StartLoc, LParenLoc, ModifierLoc, EndLoc);
1797 First, Count, StartLoc, LParenLoc, FirstLoc, CountLoc, EndLoc);
1833 Kind, KindKwLoc, VCKind, VCLoc, StartLoc, LParenLoc, EndLoc);
1846 Kind, KindKwLoc, StartLoc, LParenLoc, EndLoc);
1859 M1, M2, Kind, ChunkSize, StartLoc, LParenLoc, M1Loc, M2Loc, KindLoc,
1921 VarList, LPKind, LPKindLoc, ColonLoc, StartLoc, LParenLoc, EndLoc);
1949 VarList, {Modifier, OriginalSharingModifier}, StartLoc, LParenLoc,
1950 ModifierLoc, ColonLoc, EndLoc, ReductionIdScopeSpec, ReductionId,
1951 UnresolvedReductions);
1965 VarList, StartLoc, LParenLoc, ColonLoc, EndLoc, ReductionIdScopeSpec,
1966 ReductionId, UnresolvedReductions);
1981 VarList, StartLoc, LParenLoc, ColonLoc, EndLoc, ReductionIdScopeSpec,
1982 ReductionId, UnresolvedReductions);
1995 VarList, Step, StartLoc, LParenLoc, Modifier, ModifierLoc, ColonLoc,
1996 StepModifierLoc, EndLoc);
2009 VarList, Alignment, StartLoc, LParenLoc, ColonLoc, EndLoc);
2069 Data, DepModifier, VarList, StartLoc, LParenLoc, EndLoc);
2082 Modifier,
Device, StartLoc, LParenLoc, ModifierLoc, EndLoc);
2097 IteratorModifier, MapTypeModifiers, MapTypeModifiersLoc,
2098 MapperIdScopeSpec, MapperId, MapType, IsMapTypeImplicit, MapLoc,
2099 ColonLoc, VarList, Locs,
2100 false, UnresolvedMappers);
2117 Allocate, Alignment, FirstModifier, FirstModifierLoc, SecondModifier,
2118 SecondModifierLoc, VarList, StartLoc, LParenLoc, ColonLoc, EndLoc);
2166 Modifier,
Device, StartLoc, LParenLoc, ModifierLoc, EndLoc);
2179 Modifier, NumTasks, StartLoc, LParenLoc, ModifierLoc, EndLoc);
2214 Kind, ChunkSize, StartLoc, LParenLoc, KindLoc, CommaLoc, EndLoc);
2229 MotionModifiers, MotionModifiersLoc, IteratorModifier,
2230 MapperIdScopeSpec, MapperId, ColonLoc, VarList, Locs,
2246 MotionModifiers, MotionModifiersLoc, IteratorModifier,
2247 MapperIdScopeSpec, MapperId, ColonLoc, VarList, Locs,
2299 M, Kind, StartLoc, LParenLoc, MLoc, KindLoc, EndLoc);
2346 StartLoc, LParenLoc, EndLoc,
Data);
2359 StartLoc, LParenLoc, ColonLoc, EndLoc, Modifier, Locators);
2371 Modifier, Kind, StartLoc, LParenLoc, ModifierKwLoc, KindKwLoc, EndLoc);
2384 InteropVar, InteropInfo, StartLoc, LParenLoc, VarLoc, EndLoc);
2395 LParenLoc, VarLoc, EndLoc);
2407 InteropVar, StartLoc, LParenLoc, VarLoc, EndLoc);
2478 M1, M2, Size, StartLoc, LParenLoc, M1Loc, M2Loc, EndLoc);
2559 DepType, DepLoc, ColonLoc, VarList, StartLoc, LParenLoc, EndLoc);
2607 ForLoc, Element, Collection, RParenLoc);
2625 StartLoc, IdLoc, Id);
2662 if (
DeclStmt *RangeStmt = dyn_cast<DeclStmt>(Range)) {
2663 if (RangeStmt->isSingleDecl()) {
2664 if (
VarDecl *RangeVar = dyn_cast<VarDecl>(RangeStmt->getSingleDecl())) {
2665 if (RangeVar->isInvalidDecl())
2668 Expr *RangeExpr = RangeVar->getInit();
2675 diag::err_objc_for_range_init_stmt)
2676 <<
Init->getSourceRange();
2679 ForLoc, LoopVar, RangeExpr, RParenLoc);
2686 ForLoc, CoawaitLoc,
Init, ColonLoc, Range, Begin, End,
Cond, Inc,
2700 QualifierLoc, NameInfo, Nested);
2762 SS.
Adopt(QualifierLoc);
2874 if (IsOMPArraySection)
2876 Base, LBracketLoc, LowerBound, ColonLocFirst, ColonLocSecond, Length,
2877 Stride, RBracketLoc);
2879 assert(Stride ==
nullptr && !ColonLocSecond.
isValid() &&
2880 "Stride/second colon not allowed for OpenACC");
2883 Base, LBracketLoc, LowerBound, ColonLocFirst, Length, RBracketLoc);
2895 Base, LParenLoc, RParenLoc, Dims, BracketsRanges);
2907 nullptr, IteratorKwLoc, LLoc, RLoc,
Data);
2917 Expr *ExecConfig =
nullptr) {
2919 nullptr, Callee, LParenLoc, Args, RParenLoc, ExecConfig);
2926 nullptr, Callee, LParenLoc, Args, RParenLoc);
2944 if (!
Member->getDeclName()) {
2948 assert(
Member->getType()->isRecordType() &&
2949 "unnamed member not of record type?");
2962 if (!isArrow &&
Base->isPRValue()) {
2977 SS.
Adopt(QualifierLoc);
2980 if (
Base->containsErrors())
2985 if (isArrow && !BaseType->isPointerType())
2994 if (
getSema().isUnevaluatedContext() &&
Base->isImplicitCXXThis() &&
2999 ->getAsCXXRecordDecl()) {
3003 if (!ThisClass->Equals(
Class) && !ThisClass->isDerivedFrom(
Class))
3011 FirstQualifierInScope,
3012 R, ExplicitTemplateArgs,
3022 bool ForFoldExpression =
false) {
3100 return SemaRef.BuildInitList(LBraceLoc, Inits, RBraceLoc);
3113 =
SemaRef.ActOnDesignatedInitializer(Desig, EqualOrColonLoc, GNUSyntax,
3153 unsigned NumUserSpecifiedExprs,
3158 InitLoc, LParenLoc, RParenLoc);
3188 return SemaRef.ActOnChooseExpr(BuiltinLoc,
3200 Expr *ControllingExpr,
3205 ControllingExpr, Types, Exprs);
3220 ControllingType, Types, Exprs);
3253 case Stmt::CXXStaticCastExprClass:
3254 return getDerived().RebuildCXXStaticCastExpr(OpLoc, LAngleLoc, TInfo,
3255 RAngleLoc, LParenLoc,
3256 SubExpr, RParenLoc);
3258 case Stmt::CXXDynamicCastExprClass:
3259 return getDerived().RebuildCXXDynamicCastExpr(OpLoc, LAngleLoc, TInfo,
3260 RAngleLoc, LParenLoc,
3261 SubExpr, RParenLoc);
3263 case Stmt::CXXReinterpretCastExprClass:
3264 return getDerived().RebuildCXXReinterpretCastExpr(OpLoc, LAngleLoc, TInfo,
3265 RAngleLoc, LParenLoc,
3269 case Stmt::CXXConstCastExprClass:
3270 return getDerived().RebuildCXXConstCastExpr(OpLoc, LAngleLoc, TInfo,
3271 RAngleLoc, LParenLoc,
3272 SubExpr, RParenLoc);
3274 case Stmt::CXXAddrspaceCastExprClass:
3275 return getDerived().RebuildCXXAddrspaceCastExpr(
3276 OpLoc, LAngleLoc, TInfo, RAngleLoc, LParenLoc, SubExpr, RParenLoc);
3279 llvm_unreachable(
"Invalid C++ named cast");
3357 OpLoc, tok::kw_addrspace_cast, TInfo, SubExpr,
3369 bool ListInitialization) {
3373 if (
auto *PLE = dyn_cast<ParenListExpr>(Sub))
3375 TInfo, LParenLoc,
MultiExprArg(PLE->getExprs(), PLE->getNumExprs()),
3376 RParenLoc, ListInitialization);
3378 if (
auto *PLE = dyn_cast<CXXParenListInitExpr>(Sub))
3380 TInfo, LParenLoc, PLE->getInitExprs(), RParenLoc, ListInitialization);
3384 ListInitialization);
3448 if (
getSema().CheckCXXThisType(ThisLoc, ThisType))
3458 bool IsThrownVariableInScope) {
3468 Expr *RewrittenExpr) {
3470 RewrittenExpr,
getSema().CurContext);
3504 std::optional<Expr *> ArraySize,
3523 bool IsGlobalDelete,
3574 bool IsAddressOfOperand,
3577 SS.
Adopt(QualifierLoc);
3579 if (TemplateArgs || TemplateKWLoc.
isValid())
3581 SS, TemplateKWLoc, NameInfo, TemplateArgs, IsAddressOfOperand);
3584 SS, NameInfo, IsAddressOfOperand, RecoveryTSI);
3606 bool IsElidable,
MultiExprArg Args,
bool HadMultipleCandidates,
3607 bool ListInitialization,
bool StdInitListInitialization,
3614 FoundCtor =
Constructor->getInheritedConstructor().getConstructor();
3617 if (
getSema().CompleteConstructorCall(FoundCtor,
T, Args, Loc,
3624 HadMultipleCandidates,
3626 StdInitListInitialization,
3627 RequiresZeroInit, ConstructKind,
3635 bool ConstructsVBase,
3636 bool InheritedFromVBase) {
3638 Loc,
T,
Constructor, ConstructsVBase, InheritedFromVBase);
3649 bool ListInitialization) {
3651 TSInfo, LParenOrBraceLoc, Args, RParenOrBraceLoc, ListInitialization);
3662 bool ListInitialization) {
3664 RParenLoc, ListInitialization);
3681 SS.
Adopt(QualifierLoc);
3683 return SemaRef.BuildMemberReferenceExpr(BaseE, BaseType,
3684 OperatorLoc, IsArrow,
3686 FirstQualifierInScope,
3688 TemplateArgs,
nullptr);
3704 SS.
Adopt(QualifierLoc);
3706 return SemaRef.BuildMemberReferenceExpr(BaseE, BaseType,
3707 OperatorLoc, IsArrow,
3709 FirstQualifierInScope,
3710 R, TemplateArgs,
nullptr);
3718 return SemaRef.BuildCXXNoexceptExpr(Range.getBegin(), Arg, Range.getEnd());
3731 RParenLoc, Length, PartialArgs);
3736 Expr *PackIdExpression,
Expr *IndexExpr,
3738 bool FullySubstituted =
false) {
3740 IndexExpr, RSquareLoc, ExpandedExprs,
3766 NamedConcept, TALI);
3784 LocalParameters, RParenLoc, Requirements,
3791 return SemaRef.BuildTypeRequirement(SubstDiag);
3795 return SemaRef.BuildTypeRequirement(
T);
3803 return SemaRef.BuildExprRequirement(SubstDiag, IsSimple, NoexceptLoc,
3810 return SemaRef.BuildExprRequirement(E, IsSimple, NoexceptLoc,
3817 return SemaRef.BuildNestedRequirement(InvalidConstraintEntity,
3822 return SemaRef.BuildNestedRequirement(Constraint);
3838 Expr **Elements,
unsigned NumElements) {
3848 RB,
Base, Key, getterMethod, setterMethod);
3867 return SemaRef.ObjC().BuildObjCEncodeExpression(AtLoc, EncodeTypeInfo,
3879 return SemaRef.ObjC().BuildClassMessage(
3880 ReceiverTypeInfo, ReceiverTypeInfo->
getType(),
3893 return SemaRef.ObjC().BuildInstanceMessage(Receiver, Receiver->
getType(),
3896 SelectorLocs, RBracLoc, Args);
3908 return Method->isInstanceMethod()
3909 ?
SemaRef.ObjC().BuildInstanceMessage(
3910 nullptr, SuperType, SuperLoc, Sel,
Method, LBracLoc,
3911 SelectorLocs, RBracLoc, Args)
3912 :
SemaRef.ObjC().BuildClassMessage(
nullptr, SuperType, SuperLoc,
3914 SelectorLocs, RBracLoc, Args);
3923 bool IsArrow,
bool IsFreeIvar) {
3932 if (IsFreeIvar &&
Result.isUsable())
3969 PropertyLoc,
Base));
3998 =
SemaRef.Context.Idents.get(
"__builtin_shufflevector");
4001 assert(!Lookup.
empty() &&
"No __builtin_shufflevector?");
4009 Callee =
SemaRef.ImpCastExprToType(Callee, CalleePtrTy,
4010 CK_BuiltinFnToFnPtr).get();
4026 return SemaRef.ConvertVectorExpr(SrcExpr, DstTInfo, BuiltinLoc, RParenLoc);
4041 EllipsisLoc, NumExpansions);
4065 llvm_unreachable(
"Pack expansion pattern has no parameter packs");
4101 EllipsisLoc, RHS, RParenLoc,
4110 Init->containsUnexpandedParameterPack();
4111 else if (PVD->hasUninstantiatedDefaultArg())
4113 PVD->getUninstantiatedDefaultArg()
4114 ->containsUnexpandedParameterPack();
4268 Exprs.push_back(DevNumExpr);
4269 llvm::append_range(Exprs, QueueIdExprs);
4306 AssociatedDecl, NTTP, Loc, Arg, PackIndex, Final);
4322 ObjectType, FirstQualifierInScope);
4328 QualType TransformDependentNameType(TypeLocBuilder &TLB,
4329 DependentNameTypeLoc TL,
4330 bool DeducibleTSTContext,
4331 QualType ObjectType = QualType(),
4332 NamedDecl *UnqualLookup =
nullptr);
4335 TransformOpenACCClauseList(OpenACCDirectiveKind DirKind,
4340 OpenACCDirectiveKind DirKind,
4341 const OpenACCClause *OldClause);
4344template <
typename Derived>
4354#define STMT(Node, Parent) \
4355 case Stmt::Node##Class: return getDerived().Transform##Node(cast<Node>(S));
4356#define VALUESTMT(Node, Parent) \
4357 case Stmt::Node##Class: \
4358 return getDerived().Transform##Node(cast<Node>(S), SDK);
4359#define ABSTRACT_STMT(Node)
4360#define EXPR(Node, Parent)
4361#include "clang/AST/StmtNodes.inc"
4364#define STMT(Node, Parent)
4365#define ABSTRACT_STMT(Stmt)
4366#define EXPR(Node, Parent) case Stmt::Node##Class:
4367#include "clang/AST/StmtNodes.inc"
4372 E =
getSema().ActOnStmtExprResult(E);
4380template<
typename Derived>
4388#define GEN_CLANG_CLAUSE_CLASS
4389#define CLAUSE_CLASS(Enum, Str, Class) \
4391 return getDerived().Transform##Class(cast<Class>(S));
4392#include "llvm/Frontend/OpenMP/OMP.inc"
4399template<
typename Derived>
4406#define STMT(Node, Parent) case Stmt::Node##Class: break;
4407#define ABSTRACT_STMT(Stmt)
4408#define EXPR(Node, Parent) \
4409 case Stmt::Node##Class: return getDerived().Transform##Node(cast<Node>(E));
4410#include "clang/AST/StmtNodes.inc"
4416template<
typename Derived>
4424 if (
auto *FE = dyn_cast<FullExpr>(
Init))
4425 Init = FE->getSubExpr();
4427 if (
auto *AIL = dyn_cast<ArrayInitLoopExpr>(
Init)) {
4433 Init = MTE->getSubExpr();
4436 Init = Binder->getSubExpr();
4439 Init = ICE->getSubExprAsWritten();
4442 dyn_cast<CXXStdInitializerListExpr>(
Init))
4479 getSema().currentEvaluationContext().InLifetimeExtendingContext =
4480 getSema().parentEvaluationContext().InLifetimeExtendingContext;
4481 getSema().currentEvaluationContext().RebuildDefaultArgOrDefaultInit =
4482 getSema().parentEvaluationContext().RebuildDefaultArgOrDefaultInit;
4484 bool ArgChanged =
false;
4486 true, NewArgs, &ArgChanged))
4496 if (
Parens.isInvalid()) {
4499 assert(NewArgs.empty() &&
4500 "no parens or braces but have direct init with arguments?");
4507template<
typename Derived>
4513 for (
unsigned I = 0; I != NumInputs; ++I) {
4523 Expr *Pattern = Expansion->getPattern();
4526 getSema().collectUnexpandedParameterPacks(Pattern, Unexpanded);
4527 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
4532 bool RetainExpansion =
false;
4533 UnsignedOrNone OrigNumExpansions = Expansion->getNumExpansions();
4537 Unexpanded,
true, Expand,
4538 RetainExpansion, NumExpansions))
4551 Expansion->getEllipsisLoc(),
4553 if (Out.isInvalid())
4558 Outputs.push_back(Out.get());
4564 if (ArgChanged) *ArgChanged =
true;
4568 for (
unsigned I = 0; I != *NumExpansions; ++I) {
4571 if (Out.isInvalid())
4574 if (Out.get()->containsUnexpandedParameterPack()) {
4576 Out.get(), Expansion->getEllipsisLoc(), OrigNumExpansions);
4577 if (Out.isInvalid())
4581 Outputs.push_back(Out.get());
4586 if (RetainExpansion) {
4587 ForgetPartiallySubstitutedPackRAII Forget(
getDerived());
4590 if (Out.isInvalid())
4594 Out.get(), Expansion->getEllipsisLoc(), OrigNumExpansions);
4595 if (Out.isInvalid())
4598 Outputs.push_back(Out.get());
4605 IsCall ?
getDerived().TransformInitializer(Inputs[I],
false)
4610 if (
Result.get() != Inputs[I] && ArgChanged)
4613 Outputs.push_back(
Result.get());
4619template <
typename Derived>
4630 VarDecl *ConditionVar = cast_or_null<VarDecl>(
4636 return getSema().ActOnConditionVariable(ConditionVar, Loc, Kind);
4645 return getSema().ActOnCondition(
nullptr, Loc, CondExpr.
get(), Kind,
4652template <
typename Derived>
4660 Qualifier = Qualifier.getAsNamespaceAndPrefix().Prefix)
4672 llvm_unreachable(
"unexpected null nested name specifier");
4703 QualifierLoc =
getDerived().TransformNestedNameSpecifierLoc(
4704 QualifierLoc, ObjectType, FirstQualifierInScope);
4708 FirstQualifierInScope =
nullptr;
4710 SS.
Adopt(QualifierLoc);
4714 if (
SemaRef.BuildCXXNestedNameSpecifier(
nullptr, IdInfo,
4716 FirstQualifierInScope,
false))
4724 T = TransformTypeInObjectScope(TLB, TL, ObjectType,
4725 FirstQualifierInScope);
4731 if (
T->isDependentType() ||
T->isRecordType() ||
4732 (
SemaRef.getLangOpts().CPlusPlus11 &&
T->isEnumeralType())) {
4733 if (
T->isEnumeralType())
4735 diag::warn_cxx98_compat_enum_nested_name_spec);
4742 if (!TTL || !TTL.
getDecl()->isInvalidDecl()) {
4766template<
typename Derived>
4786 TemplateDecl *NewTemplate = cast_or_null<TemplateDecl>(
4793 SemaRef.Context.DeclarationNames.getCXXDeductionGuideName(NewTemplate));
4803 NewTInfo =
getDerived().TransformType(OldTInfo);
4806 NewCanTy =
SemaRef.Context.getCanonicalType(NewTInfo->
getType());
4814 NewCanTy =
SemaRef.Context.getCanonicalType(NewT);
4827 llvm_unreachable(
"Unknown name kind.");
4830template <
typename Derived>
4834 QualType ObjectType,
bool AllowInjectedClassName) {
4836 return getDerived().RebuildTemplateName(SS, TemplateKWLoc, *II, NameLoc,
4837 ObjectType, AllowInjectedClassName);
4839 NameLoc, ObjectType,
4840 AllowInjectedClassName);
4843template <
typename Derived>
4847 NamedDecl *FirstQualifierInScope,
bool AllowInjectedClassName) {
4849 TemplateName UnderlyingName = QTN->getUnderlyingTemplate();
4852 QualifierLoc =
getDerived().TransformNestedNameSpecifierLoc(
4853 QualifierLoc, ObjectType, FirstQualifierInScope);
4860 UnderlyingQualifier, TemplateKWLoc, UnderlyingName, NameLoc, ObjectType,
4861 FirstQualifierInScope, AllowInjectedClassName);
4862 if (NewUnderlyingName.
isNull())
4864 assert(!UnderlyingQualifier &&
"unexpected qualifier");
4868 NewUnderlyingName == UnderlyingName)
4871 SS.
Adopt(QualifierLoc);
4872 return getDerived().RebuildTemplateName(SS, QTN->hasTemplateKeyword(),
4878 QualifierLoc =
getDerived().TransformNestedNameSpecifierLoc(
4879 QualifierLoc, ObjectType, FirstQualifierInScope);
4893 SS.
Adopt(QualifierLoc);
4894 return getDerived().RebuildTemplateName(SS, TemplateKWLoc, DTN->getName(),
4895 NameLoc, ObjectType,
4896 AllowInjectedClassName);
4901 assert(!QualifierLoc &&
"Unexpected qualified SubstTemplateTemplateParm");
4908 ReplacementQualifierLoc = Builder.getWithLocInContext(
SemaRef.Context);
4912 ReplacementQualifierLoc, TemplateKWLoc, ReplacementName, NameLoc,
4913 ObjectType, FirstQualifierInScope, AllowInjectedClassName);
4916 Decl *AssociatedDecl =
4917 getDerived().TransformDecl(NameLoc, S->getAssociatedDecl());
4919 AssociatedDecl == S->getAssociatedDecl())
4921 return SemaRef.Context.getSubstTemplateTemplateParm(
4922 NewName, AssociatedDecl, S->getIndex(), S->getPackIndex(),
4927 "DeducedTemplateName should not escape partial ordering");
4931 assert(!QualifierLoc &&
"Unexpected qualifier");
4938 assert(!QualifierLoc &&
4939 "Unexpected qualified SubstTemplateTemplateParmPack");
4941 SubstPack->getArgumentPack(), SubstPack->getAssociatedDecl(),
4942 SubstPack->getIndex(), SubstPack->getFinal());
4946 llvm_unreachable(
"overloaded function decl survived to here");
4949template <
typename Derived>
4954 QualifierLoc, TemplateKeywordLoc, Name, NameLoc);
4960template<
typename Derived>
4964 Output =
getSema().getTrivialTemplateArgumentLoc(
4968template <
typename Derived>
4976 llvm_unreachable(
"Unexpected TemplateArgument");
4999 if (NewT ==
T && D == NewD)
5016 llvm_unreachable(
"unexpected template argument kind");
5048 llvm_unreachable(
"Caller should expand pack expansions");
5064 E =
SemaRef.ActOnConstantExpression(E);
5079template<
typename Derived,
typename InputIterator>
5087 typedef typename std::iterator_traits<InputIterator>::difference_type
5102 : Self(Self), Iter(Iter) { }
5117 Self.InventTemplateArgumentLoc(*Iter,
Result);
5125 return X.Iter == Y.Iter;
5130 return X.Iter != Y.Iter;
5134template<
typename Derived>
5135template<
typename InputIterator>
5155 PackLocIterator(*
this, In.getArgument().pack_begin()),
5156 PackLocIterator(*
this, In.getArgument().pack_end()), *PackOutput,
5163 if (In.getArgument().isPackExpansion()) {
5175 std::optional<ForgetSubstitutionRAII> ForgetSubst;
5185 if (Out.getArgument().containsUnexpandedParameterPack()) {
5188 if (Out.getArgument().isNull())
5198 ForgetPartiallySubstitutedPackRAII Forget(
getDerived());
5206 if (Out.getArgument().isNull())
5225template <
typename Derived>
5226template <
typename InputIterator>
5235 return !Arg.isDependent() && Arg.isConceptOrConceptTemplateParameter();
5247 PackLocIterator(*
this, In.getArgument().pack_begin()),
5248 PackLocIterator(*
this, In.getArgument().pack_end()), Outputs,
5254 if (!isNonDependentConceptArgument(In.getArgument())) {
5269template <
typename Derived>
5280 Pattern =
getSema().getTemplateArgumentPackExpansionPattern(
5283 getSema().collectUnexpandedParameterPacks(Pattern, Unexpanded);
5284 if (IsLateExpansionAttempt) {
5289 return P.first.dyn_cast<
const SubstBuiltinTemplatePackType *>();
5291 if (!SawPackTypes) {
5296 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
5304 Info.
Ellipsis, Pattern.getSourceRange(), Unexpanded,
5310 if (ComputeInfo(In,
false, Info, Pattern))
5322 std::optional<Sema::ArgPackSubstIndexRAII> SubstIndex(
5323 std::in_place,
getSema(), std::nullopt);
5329 if (Out.getArgument().isNull())
5366 ForgetSubstitutionRAII ForgetSubst(
getDerived());
5367 if (ComputeInfo(Out,
true, Info, OutPattern))
5380template<
typename Derived>
5398template <
typename Derived>
5418template<
typename Derived>
5421 switch (
T.getTypeLocClass()) {
5422#define ABSTRACT_TYPELOC(CLASS, PARENT)
5423#define TYPELOC(CLASS, PARENT) \
5424 case TypeLoc::CLASS: \
5425 return getDerived().Transform##CLASS##Type(TLB, \
5426 T.castAs<CLASS##TypeLoc>());
5427#include "clang/AST/TypeLocNodes.def"
5430 llvm_unreachable(
"unhandled type loc!");
5433template<
typename Derived>
5446template <
typename Derived>
5484template<
typename Derived>
5489 TypeLoc UnqualTL =
T.getUnqualifiedLoc();
5490 auto SuppressObjCLifetime =
5491 T.getType().getLocalQualifiers().hasObjCLifetime();
5493 Result = getDerived().TransformTemplateTypeParmType(TLB, TTP,
5494 SuppressObjCLifetime);
5495 }
else if (
auto STTP = UnqualTL.
getAs<SubstTemplateTypeParmPackTypeLoc>()) {
5496 Result = getDerived().TransformSubstTemplateTypeParmPackType(
5497 TLB, STTP, SuppressObjCLifetime);
5499 Result = getDerived().TransformType(TLB, UnqualTL);
5518template <
typename Derived>
5528 SemaRef.Diag(Loc, diag::err_address_space_mismatch_templ_inst)
5535 if (
T.getPointerAuth().isPresent()) {
5536 SemaRef.Diag(Loc, diag::err_ptrauth_qualifier_redundant) << TL.
getType();
5539 if (!
T->isDependentType()) {
5540 if (!
T->isSignableType(
SemaRef.getASTContext())) {
5541 SemaRef.Diag(Loc, diag::err_ptrauth_qualifier_invalid_target) <<
T;
5549 if (
T->isFunctionType()) {
5550 T =
SemaRef.getASTContext().getAddrSpaceQualType(
T,
5560 if (
T->isReferenceType()) {
5570 if (!
T->isObjCLifetimeType() && !
T->isDependentType())
5572 else if (
T.getObjCLifetime()) {
5576 const AutoType *AutoTy;
5577 if ((AutoTy = dyn_cast<AutoType>(
T)) && AutoTy->isDeduced()) {
5579 QualType Deduced = AutoTy->getDeducedType();
5584 T =
SemaRef.Context.getAutoType(Deduced, AutoTy->getKeyword(),
5587 AutoTy->getTypeConstraintConcept(),
5588 AutoTy->getTypeConstraintArguments());
5593 SemaRef.Diag(Loc, diag::err_attr_objc_ownership_redundant) <<
T;
5599 return SemaRef.BuildQualifiedType(
T, Loc, Quals);
5602template <
typename Derived>
5603QualType TreeTransform<Derived>::TransformTypeInObjectScope(
5606 assert(!getDerived().AlreadyTransformed(TL.
getType()));
5609 case TypeLoc::TemplateSpecialization:
5610 return getDerived().TransformTemplateSpecializationType(
5612 FirstQualifierInScope,
true);
5613 case TypeLoc::DependentName:
5614 return getDerived().TransformDependentNameType(
5616 ObjectType, FirstQualifierInScope);
5620 return getDerived().TransformType(TLB, TL);
5624template <
class TyLoc>
static inline
5626 TyLoc NewT = TLB.
push<TyLoc>(
T.getType());
5627 NewT.setNameLoc(
T.getNameLoc());
5631template<
typename Derived>
5632QualType TreeTransform<Derived>::TransformBuiltinType(TypeLocBuilder &TLB,
5634 BuiltinTypeLoc NewT = TLB.push<BuiltinTypeLoc>(T.getType());
5635 NewT.setBuiltinLoc(T.getBuiltinLoc());
5636 if (T.needsExtraLocalData())
5637 NewT.getWrittenBuiltinSpecs() = T.getWrittenBuiltinSpecs();
5641template<
typename Derived>
5648template <
typename Derived>
5652 return getDerived().
TransformType(TLB, TL.getOriginalLoc());
5655template<
typename Derived>
5658 QualType OriginalType = getDerived().TransformType(TLB, TL.getOriginalLoc());
5659 if (OriginalType.isNull())
5663 if (getDerived().AlwaysRebuild() ||
5664 OriginalType != TL.getOriginalLoc().getType())
5671template <
typename Derived>
5675 QualType OriginalType = getDerived().TransformType(TLB, TL.getElementLoc());
5676 if (OriginalType.isNull())
5680 if (getDerived().AlwaysRebuild() ||
5681 OriginalType != TL.getElementLoc().getType())
5688template<
typename Derived>
5692 = getDerived().TransformType(TLB, TL.getPointeeLoc());
5693 if (PointeeType.isNull())
5697 if (PointeeType->getAs<ObjCObjectType>()) {
5709 if (getDerived().AlwaysRebuild() ||
5710 PointeeType != TL.getPointeeLoc().getType()) {
5711 Result = getDerived().RebuildPointerType(PointeeType, TL.getSigilLoc());
5718 TLB.TypeWasModifiedSafely(
Result->getPointeeType());
5725template<
typename Derived>
5730 = getDerived().TransformType(TLB, TL.getPointeeLoc());
5731 if (PointeeType.isNull())
5735 if (getDerived().AlwaysRebuild() ||
5736 PointeeType != TL.getPointeeLoc().getType()) {
5737 Result = getDerived().RebuildBlockPointerType(PointeeType,
5752template<
typename Derived>
5760 if (PointeeType.
isNull())
5765 PointeeType !=
T->getPointeeTypeAsWritten()) {
5767 T->isSpelledAsLValue(),
5789template<
typename Derived>
5793 return TransformReferenceType(TLB, TL);
5796template<
typename Derived>
5798TreeTransform<Derived>::TransformRValueReferenceType(TypeLocBuilder &TLB,
5799 RValueReferenceTypeLoc TL) {
5800 return TransformReferenceType(TLB, TL);
5803template<
typename Derived>
5807 QualType PointeeType = getDerived().TransformType(TLB, TL.getPointeeLoc());
5808 if (PointeeType.isNull())
5815 getDerived().TransformNestedNameSpecifierLoc(OldQualifierLoc);
5816 if (!NewQualifierLoc)
5819 CXXRecordDecl *OldCls =
T->getMostRecentCXXRecordDecl(), *NewCls =
nullptr;
5821 NewCls = cast_or_null<CXXRecordDecl>(
5822 getDerived().TransformDecl(TL.getStarLoc(), OldCls));
5828 if (getDerived().AlwaysRebuild() || PointeeType !=
T->getPointeeType() ||
5829 NewQualifierLoc.getNestedNameSpecifier() !=
5830 OldQualifierLoc.getNestedNameSpecifier() ||
5833 SS.
Adopt(NewQualifierLoc);
5834 Result = getDerived().RebuildMemberPointerType(PointeeType, SS, NewCls,
5843 if (MPT && PointeeType != MPT->getPointeeType()) {
5850 NewTL.setQualifierLoc(NewQualifierLoc);
5855template<
typename Derived>
5860 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
5861 if (ElementType.isNull())
5865 Expr *OldSize = TL.getSizeExpr();
5867 OldSize =
const_cast<Expr*
>(
T->getSizeExpr());
5868 Expr *NewSize =
nullptr;
5872 NewSize = getDerived().TransformExpr(OldSize).template getAs<Expr>();
5877 if (getDerived().AlwaysRebuild() ||
5878 ElementType !=
T->getElementType() ||
5879 (
T->getSizeExpr() && NewSize != OldSize)) {
5880 Result = getDerived().RebuildConstantArrayType(ElementType,
5881 T->getSizeModifier(),
5882 T->getSize(), NewSize,
5883 T->getIndexTypeCVRQualifiers(),
5884 TL.getBracketsRange());
5895 NewTL.setRBracketLoc(TL.getRBracketLoc());
5896 NewTL.setSizeExpr(NewSize);
5901template<
typename Derived>
5906 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
5907 if (ElementType.isNull())
5911 if (getDerived().AlwaysRebuild() ||
5912 ElementType !=
T->getElementType()) {
5913 Result = getDerived().RebuildIncompleteArrayType(ElementType,
5914 T->getSizeModifier(),
5915 T->getIndexTypeCVRQualifiers(),
5916 TL.getBracketsRange());
5923 NewTL.setRBracketLoc(TL.getRBracketLoc());
5924 NewTL.setSizeExpr(
nullptr);
5929template<
typename Derived>
5934 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
5935 if (ElementType.isNull())
5942 SizeResult = getDerived().TransformExpr(
T->getSizeExpr());
5944 if (SizeResult.isInvalid())
5948 if (SizeResult.isInvalid())
5954 if (getDerived().AlwaysRebuild() ||
5955 ElementType !=
T->getElementType() ||
5956 Size !=
T->getSizeExpr()) {
5957 Result = getDerived().RebuildVariableArrayType(ElementType,
5958 T->getSizeModifier(),
5960 T->getIndexTypeCVRQualifiers(),
5961 TL.getBracketsRange());
5970 NewTL.setRBracketLoc(TL.getRBracketLoc());
5971 NewTL.setSizeExpr(Size);
5976template<
typename Derived>
5981 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
5982 if (ElementType.isNull())
5990 SemaRef.
ExprEvalContexts.back().InConditionallyConstantEvaluateContext =
true;
5993 Expr *origSize = TL.getSizeExpr();
5994 if (!origSize) origSize =
T->getSizeExpr();
5997 = getDerived().TransformExpr(origSize);
5999 if (sizeResult.isInvalid())
6002 Expr *size = sizeResult.get();
6005 if (getDerived().AlwaysRebuild() ||
6006 ElementType !=
T->getElementType() ||
6008 Result = getDerived().RebuildDependentSizedArrayType(ElementType,
6009 T->getSizeModifier(),
6011 T->getIndexTypeCVRQualifiers(),
6012 TL.getBracketsRange());
6021 NewTL.setRBracketLoc(TL.getRBracketLoc());
6022 NewTL.setSizeExpr(size);
6027template <
typename Derived>
6031 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
6032 if (ElementType.isNull())
6040 if (
Size.isInvalid())
6044 if (getDerived().AlwaysRebuild() || ElementType !=
T->getElementType() ||
6045 Size.get() !=
T->getSizeExpr()) {
6046 Result = getDerived().RebuildDependentVectorType(
6047 ElementType,
Size.get(),
T->getAttributeLoc(),
T->getVectorKind());
6065template<
typename Derived>
6072 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
6073 if (ElementType.isNull())
6082 if (
Size.isInvalid())
6086 if (getDerived().AlwaysRebuild() ||
6087 ElementType !=
T->getElementType() ||
6088 Size.get() !=
T->getSizeExpr()) {
6089 Result = getDerived().RebuildDependentSizedExtVectorType(ElementType,
6091 T->getAttributeLoc());
6109template <
typename Derived>
6114 QualType ElementType = getDerived().TransformType(
T->getElementType());
6115 if (ElementType.isNull())
6119 if (getDerived().AlwaysRebuild() || ElementType !=
T->getElementType()) {
6120 Result = getDerived().RebuildConstantMatrixType(
6121 ElementType,
T->getNumRows(),
T->getNumColumns());
6128 NewTL.setAttrOperandParensRange(TL.getAttrOperandParensRange());
6129 NewTL.setAttrRowOperand(TL.getAttrRowOperand());
6130 NewTL.setAttrColumnOperand(TL.getAttrColumnOperand());
6135template <
typename Derived>
6140 QualType ElementType = getDerived().TransformType(
T->getElementType());
6141 if (ElementType.isNull()) {
6149 Expr *origRows = TL.getAttrRowOperand();
6151 origRows =
T->getRowExpr();
6152 Expr *origColumns = TL.getAttrColumnOperand();
6154 origColumns =
T->getColumnExpr();
6156 ExprResult rowResult = getDerived().TransformExpr(origRows);
6158 if (rowResult.isInvalid())
6161 ExprResult columnResult = getDerived().TransformExpr(origColumns);
6163 if (columnResult.isInvalid())
6166 Expr *rows = rowResult.get();
6167 Expr *columns = columnResult.get();
6170 if (getDerived().AlwaysRebuild() || ElementType !=
T->getElementType() ||
6171 rows != origRows || columns != origColumns) {
6172 Result = getDerived().RebuildDependentSizedMatrixType(
6173 ElementType, rows, columns,
T->getAttributeLoc());
6183 NewTL.setAttrOperandParensRange(TL.getAttrOperandParensRange());
6184 NewTL.setAttrRowOperand(rows);
6185 NewTL.setAttrColumnOperand(columns);
6189template <
typename Derived>
6195 getDerived().TransformType(TLB, TL.getPointeeTypeLoc());
6197 if (pointeeType.isNull())
6204 ExprResult AddrSpace = getDerived().TransformExpr(
T->getAddrSpaceExpr());
6206 if (AddrSpace.isInvalid())
6210 if (getDerived().AlwaysRebuild() || pointeeType !=
T->getPointeeType() ||
6211 AddrSpace.get() !=
T->getAddrSpaceExpr()) {
6212 Result = getDerived().RebuildDependentAddressSpaceType(
6213 pointeeType, AddrSpace.get(),
T->getAttributeLoc());
6224 NewTL.setAttrExprOperand(TL.getAttrExprOperand());
6225 NewTL.setAttrNameLoc(TL.getAttrNameLoc());
6228 TLB.TypeWasModifiedSafely(
Result);
6234template <
typename Derived>
6238 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
6239 if (ElementType.isNull())
6243 if (getDerived().AlwaysRebuild() ||
6244 ElementType !=
T->getElementType()) {
6245 Result = getDerived().RebuildVectorType(ElementType,
T->getNumElements(),
6246 T->getVectorKind());
6257template<
typename Derived>
6261 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
6262 if (ElementType.isNull())
6266 if (getDerived().AlwaysRebuild() ||
6267 ElementType !=
T->getElementType()) {
6268 Result = getDerived().RebuildExtVectorType(ElementType,
6269 T->getNumElements(),
6281template <
typename Derived>
6284 bool ExpectParameterPack) {
6319 if (NewTSI == OldTSI && indexAdjustment == 0)
6329 getDerived().transformedLocalDecl(OldParm, {newParm});
6333template <
typename Derived>
6341 unsigned *LastParamTransformed) {
6342 int indexAdjustment = 0;
6344 unsigned NumParams = Params.size();
6345 for (
unsigned i = 0; i != NumParams; ++i) {
6346 if (LastParamTransformed)
6347 *LastParamTransformed = i;
6349 assert(OldParm->getFunctionScopeIndex() == i);
6353 if (OldParm->isParameterPack()) {
6358 TypeLoc TL = OldParm->getTypeSourceInfo()->getTypeLoc();
6361 SemaRef.collectUnexpandedParameterPacks(Pattern, Unexpanded);
6364 bool ShouldExpand =
false;
6365 bool RetainExpansion =
false;
6367 if (Unexpanded.size() > 0) {
6368 OrigNumExpansions = ExpansionTL.
getTypePtr()->getNumExpansions();
6369 NumExpansions = OrigNumExpansions;
6373 ShouldExpand, RetainExpansion, NumExpansions)) {
6378 const AutoType *AT =
6379 Pattern.getType().getTypePtr()->getContainedAutoType();
6380 assert((AT && (!AT->isDeduced() || AT->getDeducedType().isNull())) &&
6381 "Could not find parameter packs or undeduced auto type!");
6388 getDerived().ExpandingFunctionParameterPack(OldParm);
6389 for (
unsigned I = 0; I != *NumExpansions; ++I) {
6392 =
getDerived().TransformFunctionTypeParam(OldParm,
6400 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6401 OutParamTypes.push_back(NewParm->
getType());
6403 PVars->push_back(NewParm);
6408 if (RetainExpansion) {
6409 ForgetPartiallySubstitutedPackRAII Forget(
getDerived());
6411 =
getDerived().TransformFunctionTypeParam(OldParm,
6419 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6420 OutParamTypes.push_back(NewParm->
getType());
6422 PVars->push_back(NewParm);
6438 NewParm =
getDerived().TransformFunctionTypeParam(OldParm,
6443 "Parameter pack no longer a parameter pack after "
6446 NewParm =
getDerived().TransformFunctionTypeParam(
6447 OldParm, indexAdjustment, std::nullopt,
6455 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6456 OutParamTypes.push_back(NewParm->
getType());
6458 PVars->push_back(NewParm);
6466 bool IsPackExpansion =
false;
6469 if (
const PackExpansionType *Expansion
6470 = dyn_cast<PackExpansionType>(OldType)) {
6472 QualType Pattern = Expansion->getPattern();
6474 getSema().collectUnexpandedParameterPacks(Pattern, Unexpanded);
6477 bool ShouldExpand =
false;
6478 bool RetainExpansion =
false;
6482 RetainExpansion, NumExpansions)) {
6489 for (
unsigned I = 0; I != *NumExpansions; ++I) {
6496 NewType =
getSema().getASTContext().getPackExpansionType(
6497 NewType, std::nullopt);
6504 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6505 OutParamTypes.push_back(NewType);
6507 PVars->push_back(
nullptr);
6516 if (RetainExpansion) {
6517 ForgetPartiallySubstitutedPackRAII Forget(
getDerived());
6523 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6524 OutParamTypes.push_back(NewType);
6526 PVars->push_back(
nullptr);
6531 OldType = Expansion->getPattern();
6532 IsPackExpansion =
true;
6534 NewType =
getDerived().TransformType(OldType);
6536 NewType =
getDerived().TransformType(OldType);
6542 if (IsPackExpansion)
6543 NewType =
getSema().Context.getPackExpansionType(NewType,
6547 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6548 OutParamTypes.push_back(NewType);
6550 PVars->push_back(
nullptr);
6555 for (
unsigned i = 0, e = PVars->size(); i != e; ++i)
6557 assert(parm->getFunctionScopeIndex() == i);
6564template<
typename Derived>
6569 return getDerived().TransformFunctionProtoType(
6573 ExceptionStorage, Changed);
6577template<
typename Derived>
template<
typename Fn>
6596 if (
T->hasTrailingReturn()) {
6600 T->getExtParameterInfosOrNull(),
6601 ParamTypes, &ParamDecls, ExtParamInfos))
6611 auto *RD = dyn_cast<CXXRecordDecl>(
SemaRef.getCurLexicalContext());
6613 SemaRef, !ThisContext && RD ? RD : ThisContext, ThisTypeQuals);
6628 T->getExtParameterInfosOrNull(),
6629 ParamTypes, &ParamDecls, ExtParamInfos))
6635 bool EPIChanged =
false;
6640 if (
auto NewExtParamInfos =
6656 std::optional<FunctionEffectSet> NewFX;
6668 std::optional<FunctionEffectMode> Mode =
6688 "FunctionEffectMode::None shouldn't be possible here");
6691 if (!
SemaRef.diagnoseConflictingFunctionEffect(*NewFX, NewEC,
6694 NewFX->insert(NewEC, Errs);
6695 assert(Errs.empty());
6705 Result =
getDerived().RebuildFunctionProtoType(ResultType, ParamTypes, EPI);
6716 for (
unsigned i = 0, e = NewTL.
getNumParams(); i != e; ++i)
6722template<
typename Derived>
6745 getSema().ActOnNoexceptSpec(NoexceptExpr.
get(), EST);
6760 if (
const PackExpansionType *PackExpansion =
6761 T->getAs<PackExpansionType>()) {
6766 SemaRef.collectUnexpandedParameterPacks(PackExpansion->getPattern(),
6768 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
6773 bool Expand =
false;
6774 bool RetainExpansion =
false;
6775 UnsignedOrNone NumExpansions = PackExpansion->getNumExpansions();
6780 true, Expand, RetainExpansion,
6793 U =
SemaRef.Context.getPackExpansionType(
U, NumExpansions);
6794 Exceptions.push_back(
U);
6800 for (
unsigned ArgIdx = 0; ArgIdx != *NumExpansions; ++ArgIdx) {
6804 if (
U.isNull() ||
SemaRef.CheckSpecifiedExceptionType(
U, Loc))
6807 Exceptions.push_back(
U);
6811 if (
U.isNull() ||
SemaRef.CheckSpecifiedExceptionType(
U, Loc))
6816 Exceptions.push_back(
U);
6826template<
typename Derived>
6836 if (getDerived().AlwaysRebuild() || ResultType !=
T->getReturnType())
6837 Result = getDerived().RebuildFunctionNoProtoType(ResultType);
6848template <
typename Derived>
6849QualType TreeTransform<Derived>::TransformUnresolvedUsingType(
6850 TypeLocBuilder &TLB, UnresolvedUsingTypeLoc TL) {
6852 const UnresolvedUsingType *T = TL.getTypePtr();
6853 bool Changed =
false;
6855 NestedNameSpecifierLoc QualifierLoc = TL.getQualifierLoc();
6856 if (NestedNameSpecifierLoc OldQualifierLoc = QualifierLoc) {
6857 QualifierLoc = getDerived().TransformNestedNameSpecifierLoc(QualifierLoc);
6860 Changed |= QualifierLoc != OldQualifierLoc;
6863 auto *D = getDerived().TransformDecl(TL.getNameLoc(),
T->getDecl());
6869 if (getDerived().AlwaysRebuild() || Changed) {
6870 Result = getDerived().RebuildUnresolvedUsingType(
6871 T->getKeyword(), QualifierLoc.getNestedNameSpecifier(), TL.getNameLoc(),
6879 QualifierLoc, TL.getNameLoc());
6882 QualifierLoc, TL.getNameLoc());
6886template <
typename Derived>
6894 QualifierLoc = getDerived().TransformNestedNameSpecifierLoc(QualifierLoc);
6897 Changed |= QualifierLoc != OldQualifierLoc;
6900 auto *D = cast_or_null<UsingShadowDecl>(
6901 getDerived().TransformDecl(TL.getNameLoc(),
T->getDecl()));
6906 QualType UnderlyingType = getDerived().TransformType(
T->desugar());
6907 if (UnderlyingType.isNull())
6909 Changed |= UnderlyingType !=
T->desugar();
6912 if (getDerived().AlwaysRebuild() || Changed) {
6913 Result = getDerived().RebuildUsingType(
6914 T->getKeyword(), QualifierLoc.getNestedNameSpecifier(), D,
6924template<
typename Derived>
6932 QualifierLoc = getDerived().TransformNestedNameSpecifierLoc(QualifierLoc);
6935 Changed |= QualifierLoc != OldQualifierLoc;
6938 auto *
Typedef = cast_or_null<TypedefNameDecl>(
6939 getDerived().TransformDecl(TL.getNameLoc(),
T->getDecl()));
6947 if (getDerived().AlwaysRebuild() || Changed) {
6948 Result = getDerived().RebuildTypedefType(
6949 T->getKeyword(), QualifierLoc.getNestedNameSpecifier(),
Typedef);
6955 QualifierLoc, TL.getNameLoc());
6959template<
typename Derived>
6967 ExprResult E = getDerived().TransformExpr(TL.getUnderlyingExpr());
6977 if (getDerived().AlwaysRebuild() || E.get() != TL.getUnderlyingExpr()) {
6979 getDerived().RebuildTypeOfExprType(E.get(), TL.getTypeofLoc(), Kind);
6986 NewTL.setLParenLoc(TL.getLParenLoc());
6987 NewTL.setRParenLoc(TL.getRParenLoc());
6992template<
typename Derived>
6996 TypeSourceInfo* New_Under_TI = getDerived().TransformType(Old_Under_TI);
7002 if (getDerived().AlwaysRebuild() || New_Under_TI != Old_Under_TI) {
7003 Result = getDerived().RebuildTypeOfType(New_Under_TI->getType(), Kind);
7010 NewTL.setLParenLoc(TL.getLParenLoc());
7011 NewTL.setRParenLoc(TL.getRParenLoc());
7012 NewTL.setUnmodifiedTInfo(New_Under_TI);
7017template<
typename Derived>
7020 const DecltypeType *
T = TL.getTypePtr();
7027 ExprResult E = getDerived().TransformExpr(
T->getUnderlyingExpr());
7031 E = getSema().ActOnDecltypeExpression(E.get());
7036 if (getDerived().AlwaysRebuild() ||
7037 E.get() !=
T->getUnderlyingExpr()) {
7038 Result = getDerived().RebuildDecltypeType(E.get(), TL.getDecltypeLoc());
7046 NewTL.setRParenLoc(TL.getRParenLoc());
7050template <
typename Derived>
7060 IndexExpr = getDerived().TransformExpr(TL.getIndexExpr());
7061 if (IndexExpr.isInvalid())
7064 QualType Pattern = TL.getPattern();
7066 const PackIndexingType *PIT = TL.
getTypePtr();
7070 bool NotYetExpanded = Types.empty();
7071 bool FullySubstituted =
true;
7073 if (Types.empty() && !PIT->expandsToEmptyPack())
7077 if (!
T->containsUnexpandedParameterPack()) {
7078 QualType Transformed = getDerived().TransformType(
T);
7079 if (Transformed.isNull())
7081 SubtitutedTypes.push_back(Transformed);
7086 getSema().collectUnexpandedParameterPacks(
T, Unexpanded);
7087 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
7090 bool ShouldExpand =
true;
7091 bool RetainExpansion =
false;
7093 if (getDerived().TryExpandParameterPacks(
7096 RetainExpansion, NumExpansions))
7098 if (!ShouldExpand) {
7104 QualType Pack = getDerived().TransformType(TLB, TI->getTypeLoc());
7107 if (NotYetExpanded) {
7108 FullySubstituted =
false;
7109 QualType Out = getDerived().RebuildPackIndexingType(
7119 SubtitutedTypes.push_back(Pack);
7122 for (
unsigned I = 0; I != *NumExpansions; ++I) {
7127 SubtitutedTypes.push_back(Out);
7128 FullySubstituted &= !
Out->containsUnexpandedParameterPack();
7132 if (RetainExpansion) {
7133 FullySubstituted =
false;
7134 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
7138 SubtitutedTypes.push_back(Out);
7146 QualType Result = getDerived().TransformType(TLB, TL.getPatternLoc());
7148 QualType Out = getDerived().RebuildPackIndexingType(
7150 FullySubstituted, SubtitutedTypes);
7159template<
typename Derived>
7165 if (
Result->isDependentType()) {
7166 const UnaryTransformType *
T = TL.getTypePtr();
7168 NewBaseTSI = getDerived().TransformType(TL.getUnderlyingTInfo());
7171 QualType NewBase = NewBaseTSI->getType();
7173 Result = getDerived().RebuildUnaryTransformType(NewBase,
7182 NewTL.setParensRange(TL.getParensRange());
7183 NewTL.setUnderlyingTInfo(NewBaseTSI);
7187template<
typename Derived>
7190 const DeducedTemplateSpecializationType *
T = TL.getTypePtr();
7195 TL.getTemplateNameLoc());
7199 QualType OldDeduced =
T->getDeducedType();
7201 if (!OldDeduced.isNull()) {
7202 NewDeduced = getDerived().TransformType(OldDeduced);
7203 if (NewDeduced.isNull())
7207 QualType Result = getDerived().RebuildDeducedTemplateSpecializationType(
7214 NewTL.setTemplateNameLoc(TL.getTemplateNameLoc());
7215 NewTL.setQualifierLoc(QualifierLoc);
7219template <
typename Derived>
7226 QualifierLoc =
getDerived().TransformNestedNameSpecifierLoc(QualifierLoc);
7231 auto *TD = cast_or_null<TagDecl>(
7238 TD !=
T->getDecl()) {
7239 if (
T->isCanonicalUnqualified())
7256template <
typename Derived>
7262template <
typename Derived>
7263QualType TreeTransform<Derived>::TransformRecordType(TypeLocBuilder &TLB,
7265 return getDerived().TransformTagType(TLB, TL);
7268template<
typename Derived>
7275template<
typename Derived>
7279 return getDerived().TransformTemplateTypeParmType(
7284template <
typename Derived>
7290template<
typename Derived>
7291QualType TreeTransform<Derived>::TransformSubstTemplateTypeParmType(
7292 TypeLocBuilder &TLB,
7293 SubstTemplateTypeParmTypeLoc TL) {
7294 const SubstTemplateTypeParmType *T = TL.getTypePtr();
7297 getDerived().TransformDecl(TL.getNameLoc(), T->getAssociatedDecl());
7302 TemporaryBase Rebase(*
this, TL.getNameLoc(), DeclarationName());
7303 QualType Replacement = getDerived().TransformType(T->getReplacementType());
7304 if (Replacement.isNull())
7308 Replacement, NewReplaced, T->getIndex(), T->getPackIndex(),
7312 SubstTemplateTypeParmTypeLoc NewTL
7313 = TLB.push<SubstTemplateTypeParmTypeLoc>(Result);
7314 NewTL.setNameLoc(TL.getNameLoc());
7318template <
typename Derived>
7324template<
typename Derived>
7328 return getDerived().TransformSubstTemplateTypeParmPackType(
7332template <
typename Derived>
7338template<
typename Derived>
7339QualType TreeTransform<Derived>::TransformAtomicType(TypeLocBuilder &TLB,
7341 QualType ValueType = getDerived().TransformType(TLB, TL.getValueLoc());
7342 if (ValueType.isNull())
7345 QualType Result = TL.getType();
7346 if (getDerived().AlwaysRebuild() ||
7347 ValueType != TL.getValueLoc().getType()) {
7348 Result = getDerived().RebuildAtomicType(ValueType, TL.getKWLoc());
7349 if (Result.isNull())
7355 NewTL.setLParenLoc(TL.getLParenLoc());
7356 NewTL.setRParenLoc(TL.getRParenLoc());
7361template <
typename Derived>
7364 QualType ValueType = getDerived().TransformType(TLB, TL.getValueLoc());
7365 if (ValueType.isNull())
7369 if (getDerived().AlwaysRebuild() || ValueType != TL.getValueLoc().getType()) {
7372 Result = getDerived().RebuildPipeType(ValueType, TL.getKWLoc(), isReadPipe);
7383template <
typename Derived>
7389 if (getDerived().AlwaysRebuild()) {
7390 Result = getDerived().RebuildBitIntType(EIT->isUnsigned(),
7391 EIT->getNumBits(), TL.getNameLoc());
7401template <
typename Derived>
7408 ExprResult BitsExpr = getDerived().TransformExpr(EIT->getNumBitsExpr());
7411 if (BitsExpr.isInvalid())
7416 if (getDerived().AlwaysRebuild() || BitsExpr.get() != EIT->getNumBitsExpr()) {
7417 Result = getDerived().RebuildDependentBitIntType(
7418 EIT->isUnsigned(), BitsExpr.get(), TL.getNameLoc());
7434template <
typename Derived>
7437 llvm_unreachable(
"This type does not need to be transformed.");
7445 template<
typename ArgLocContainer>
7447 ArgLocContainer *Container;
7472 : Container(&Container), Index(Index) { }
7486 return Container->getArgLoc(Index);
7490 return pointer(Container->getArgLoc(Index));
7495 return X.Container == Y.Container &&
X.Index == Y.Index;
7504template<
typename Derived>
7505QualType TreeTransform<Derived>::TransformAutoType(TypeLocBuilder &TLB,
7507 const AutoType *T = TL.getTypePtr();
7508 QualType OldDeduced = T->getDeducedType();
7509 QualType NewDeduced;
7510 if (!OldDeduced.isNull()) {
7511 NewDeduced = getDerived().TransformType(OldDeduced);
7512 if (NewDeduced.isNull())
7519 if (
T->isConstrained()) {
7520 assert(TL.getConceptReference());
7521 NewCD = cast_or_null<ConceptDecl>(getDerived().TransformDecl(
7522 TL.getConceptNameLoc(),
T->getTypeConstraintConcept()));
7524 NewTemplateArgs.setLAngleLoc(TL.getLAngleLoc());
7525 NewTemplateArgs.setRAngleLoc(TL.getRAngleLoc());
7527 if (getDerived().TransformTemplateArguments(
7528 ArgIterator(TL, 0), ArgIterator(TL, TL.getNumArgs()),
7532 if (TL.getNestedNameSpecifierLoc()) {
7534 = getDerived().TransformNestedNameSpecifierLoc(
7535 TL.getNestedNameSpecifierLoc());
7536 if (!NewNestedNameSpec)
7542 if (getDerived().AlwaysRebuild() || NewDeduced != OldDeduced ||
7543 T->isDependentType() ||
T->isConstrained()) {
7546 NewArgList.reserve(NewTemplateArgs.size());
7547 for (
const auto &ArgLoc : NewTemplateArgs.arguments())
7548 NewArgList.push_back(ArgLoc.getArgument());
7549 Result = getDerived().RebuildAutoType(NewDeduced,
T->getKeyword(), NewCD,
7557 NewTL.setRParenLoc(TL.getRParenLoc());
7558 NewTL.setConceptReference(
nullptr);
7560 if (
T->isConstrained()) {
7562 TL.getTypePtr()->getTypeConstraintConcept()->getDeclName(),
7563 TL.getConceptNameLoc(),
7564 TL.getTypePtr()->getTypeConstraintConcept()->getDeclName());
7566 SemaRef.
Context, NewNestedNameSpec, TL.getTemplateKWLoc(), DNI,
7567 TL.getFoundDecl(), TL.getTypePtr()->getTypeConstraintConcept(),
7569 NewTL.setConceptReference(CR);
7575template <
typename Derived>
7578 return getDerived().TransformTemplateSpecializationType(
7583template <
typename Derived>
7586 NamedDecl *FirstQualifierInScope,
bool AllowInjectedClassName) {
7587 const TemplateSpecializationType *
T = TL.
getTypePtr();
7593 AllowInjectedClassName);
7602 if (getDerived().TransformTemplateArguments(ArgIterator(TL, 0),
7611 QualType Result = getDerived().RebuildTemplateSpecializationType(
7624template <
typename Derived>
7628 QualType modifiedType = getDerived().TransformType(TLB, TL.getModifiedLoc());
7629 if (modifiedType.isNull())
7633 const Attr *oldAttr = TL.getAttr();
7634 const Attr *newAttr = oldAttr ? getDerived().TransformAttr(oldAttr) :
nullptr;
7635 if (oldAttr && !newAttr)
7641 if (getDerived().AlwaysRebuild() ||
7642 modifiedType != oldType->getModifiedType()) {
7655 QualType equivalentType = modifiedType;
7656 if (TL.getModifiedLoc().getType() != TL.getEquivalentTypeLoc().getType()) {
7658 AuxiliaryTLB.
reserve(TL.getFullDataSize());
7660 getDerived().TransformType(AuxiliaryTLB, TL.getEquivalentTypeLoc());
7661 if (equivalentType.isNull())
7667 if (
auto nullability = oldType->getImmediateNullability()) {
7668 if (!modifiedType->canHaveNullability()) {
7669 SemaRef.
Diag((TL.getAttr() ? TL.getAttr()->getLocation()
7670 : TL.getModifiedLoc().getBeginLoc()),
7671 diag::err_nullability_nonpointer)
7688template <
typename Derived>
7692 QualType InnerTy = getDerived().TransformType(TLB, TL.getInnerLoc());
7693 if (InnerTy.isNull())
7696 Expr *OldCount = TL.getCountExpr();
7697 Expr *NewCount =
nullptr;
7699 ExprResult CountResult = getDerived().TransformExpr(OldCount);
7700 if (CountResult.isInvalid())
7702 NewCount = CountResult.get();
7706 if (getDerived().AlwaysRebuild() || InnerTy != OldTy->desugar() ||
7707 OldCount != NewCount) {
7710 InnerTy, NewCount, OldTy->isCountInBytes(), OldTy->isOrNull());
7717template <
typename Derived>
7721 llvm_unreachable(
"Unexpected TreeTransform for BTFTagAttributedType");
7724template <
typename Derived>
7728 const HLSLAttributedResourceType *oldType = TL.getTypePtr();
7730 QualType WrappedTy = getDerived().TransformType(TLB, TL.getWrappedLoc());
7731 if (WrappedTy.isNull())
7735 QualType OldContainedTy = oldType->getContainedType();
7736 if (!OldContainedTy.isNull()) {
7737 TypeSourceInfo *oldContainedTSI = TL.getContainedTypeSourceInfo();
7738 if (!oldContainedTSI)
7739 oldContainedTSI = getSema().getASTContext().getTrivialTypeSourceInfo(
7741 TypeSourceInfo *ContainedTSI = getDerived().TransformType(oldContainedTSI);
7744 ContainedTy = ContainedTSI->getType();
7748 if (getDerived().AlwaysRebuild() || WrappedTy != oldType->getWrappedType() ||
7749 ContainedTy != oldType->getContainedType()) {
7751 WrappedTy, ContainedTy, oldType->getAttrs());
7758template <
typename Derived>
7762 return TL.getType();
7765template<
typename Derived>
7769 QualType Inner = getDerived().TransformType(TLB, TL.getInnerLoc());
7774 if (getDerived().AlwaysRebuild() ||
7775 Inner != TL.getInnerLoc().getType()) {
7776 Result = getDerived().RebuildParenType(Inner);
7783 NewTL.setRParenLoc(TL.getRParenLoc());
7787template <
typename Derived>
7791 QualType Inner = getDerived().TransformType(TLB, TL.getInnerLoc());
7796 if (getDerived().AlwaysRebuild() || Inner != TL.getInnerLoc().getType()) {
7798 getDerived().RebuildMacroQualifiedType(Inner, TL.getMacroIdentifier());
7808template<
typename Derived>
7809QualType TreeTransform<Derived>::TransformDependentNameType(
7811 return TransformDependentNameType(TLB, TL,
false);
7814template <
typename Derived>
7815QualType TreeTransform<Derived>::TransformDependentNameType(
7818 const DependentNameType *
T = TL.getTypePtr();
7822 QualifierLoc = getDerived().TransformNestedNameSpecifierLoc(
7823 QualifierLoc, ObjectType, UnqualLookup);
7827 assert((ObjectType.isNull() && !UnqualLookup) &&
7828 "must be transformed by TransformNestedNameSpecifierLoc");
7832 = getDerived().RebuildDependentNameType(
T->getKeyword(),
7833 TL.getElaboratedKeywordLoc(),
7844 NewTL.setQualifierLoc(QualifierLoc);
7845 NewTL.setNameLoc(TL.getNameLoc());
7849 NewTL.setTemplateNameLoc(TL.getNameLoc());
7850 NewTL.setQualifierLoc(QualifierLoc);
7853 QualifierLoc, TL.getNameLoc());
7856 NewTL.
set(TL.getElaboratedKeywordLoc(), QualifierLoc, TL.getNameLoc());
7860 NewTL.setQualifierLoc(QualifierLoc);
7861 NewTL.setNameLoc(TL.getNameLoc());
7866template<
typename Derived>
7870 = getDerived().TransformType(TLB, TL.getPatternLoc());
7871 if (Pattern.isNull())
7875 if (getDerived().AlwaysRebuild() ||
7876 Pattern != TL.getPatternLoc().getType()) {
7877 Result = getDerived().RebuildPackExpansionType(Pattern,
7878 TL.getPatternLoc().getSourceRange(),
7879 TL.getEllipsisLoc(),
7880 TL.getTypePtr()->getNumExpansions());
7890template<
typename Derived>
7895 TLB.pushFullCopy(TL);
7896 return TL.getType();
7899template<
typename Derived>
7903 const ObjCTypeParamType *
T = TL.getTypePtr();
7905 getDerived().TransformDecl(
T->getDecl()->getLocation(),
T->getDecl()));
7910 if (getDerived().AlwaysRebuild() ||
7911 OTP !=
T->getDecl()) {
7912 Result = getDerived().RebuildObjCTypeParamType(
7913 OTP, TL.getProtocolLAngleLoc(),
7914 llvm::ArrayRef(TL.getTypePtr()->qual_begin(), TL.getNumProtocols()),
7915 TL.getProtocolLocs(), TL.getProtocolRAngleLoc());
7921 if (TL.getNumProtocols()) {
7922 NewTL.setProtocolLAngleLoc(TL.getProtocolLAngleLoc());
7923 for (
unsigned i = 0, n = TL.getNumProtocols(); i != n; ++i)
7924 NewTL.setProtocolLoc(i, TL.getProtocolLoc(i));
7925 NewTL.setProtocolRAngleLoc(TL.getProtocolRAngleLoc());
7930template<
typename Derived>
7935 QualType BaseType = getDerived().TransformType(TLB, TL.getBaseLoc());
7936 if (BaseType.isNull())
7939 bool AnyChanged = BaseType != TL.getBaseLoc().getType();
7943 for (
unsigned i = 0, n = TL.getNumTypeArgs(); i != n; ++i) {
7945 TypeLoc TypeArgLoc = TypeArgInfo->getTypeLoc();
7946 QualType TypeArg = TypeArgInfo->getType();
7951 const auto *PackExpansion = PackExpansionLoc.getType()
7952 ->castAs<PackExpansionType>();
7956 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
7960 TypeLoc PatternLoc = PackExpansionLoc.getPatternLoc();
7961 bool Expand =
false;
7962 bool RetainExpansion =
false;
7963 UnsignedOrNone NumExpansions = PackExpansion->getNumExpansions();
7964 if (getDerived().TryExpandParameterPacks(
7965 PackExpansionLoc.getEllipsisLoc(), PatternLoc.getSourceRange(),
7966 Unexpanded,
true, Expand,
7967 RetainExpansion, NumExpansions))
7977 TypeArgBuilder.
reserve(PatternLoc.getFullDataSize());
7978 QualType NewPatternType = getDerived().TransformType(TypeArgBuilder,
7980 if (NewPatternType.isNull())
7984 NewPatternType, NumExpansions);
7986 NewExpansionLoc.
setEllipsisLoc(PackExpansionLoc.getEllipsisLoc());
7987 NewTypeArgInfos.push_back(
7988 TypeArgBuilder.getTypeSourceInfo(SemaRef.
Context, NewExpansionType));
7994 for (
unsigned ArgIdx = 0; ArgIdx != *NumExpansions; ++ArgIdx) {
7998 TypeArgBuilder.
reserve(PatternLoc.getFullDataSize());
8000 QualType NewTypeArg = getDerived().TransformType(TypeArgBuilder,
8002 if (NewTypeArg.isNull())
8005 NewTypeArgInfos.push_back(
8006 TypeArgBuilder.getTypeSourceInfo(SemaRef.
Context, NewTypeArg));
8013 TypeArgBuilder.
reserve(TypeArgLoc.getFullDataSize());
8015 getDerived().TransformType(TypeArgBuilder, TypeArgLoc);
8016 if (NewTypeArg.isNull())
8020 if (NewTypeArg == TypeArg) {
8021 NewTypeArgInfos.push_back(TypeArgInfo);
8025 NewTypeArgInfos.push_back(
8026 TypeArgBuilder.getTypeSourceInfo(SemaRef.
Context, NewTypeArg));
8031 if (getDerived().AlwaysRebuild() || AnyChanged) {
8033 Result = getDerived().RebuildObjCObjectType(
8034 BaseType, TL.getBeginLoc(), TL.getTypeArgsLAngleLoc(), NewTypeArgInfos,
8035 TL.getTypeArgsRAngleLoc(), TL.getProtocolLAngleLoc(),
8036 llvm::ArrayRef(TL.getTypePtr()->qual_begin(), TL.getNumProtocols()),
8037 TL.getProtocolLocs(), TL.getProtocolRAngleLoc());
8045 NewT.setTypeArgsLAngleLoc(TL.getTypeArgsLAngleLoc());
8046 for (
unsigned i = 0, n = TL.getNumTypeArgs(); i != n; ++i)
8047 NewT.setTypeArgTInfo(i, NewTypeArgInfos[i]);
8048 NewT.setTypeArgsRAngleLoc(TL.getTypeArgsRAngleLoc());
8049 NewT.setProtocolLAngleLoc(TL.getProtocolLAngleLoc());
8050 for (
unsigned i = 0, n = TL.getNumProtocols(); i != n; ++i)
8051 NewT.setProtocolLoc(i, TL.getProtocolLoc(i));
8052 NewT.setProtocolRAngleLoc(TL.getProtocolRAngleLoc());
8056template<
typename Derived>
8060 QualType PointeeType = getDerived().TransformType(TLB, TL.getPointeeLoc());
8061 if (PointeeType.isNull())
8065 if (getDerived().AlwaysRebuild() ||
8066 PointeeType != TL.getPointeeLoc().getType()) {
8067 Result = getDerived().RebuildObjCObjectPointerType(PointeeType,
8081template<
typename Derived>
8087template<
typename Derived>
8090 return getDerived().TransformCompoundStmt(S,
false);
8093template<
typename Derived>
8100 getSema().resetFPOptions(
8103 bool SubStmtInvalid =
false;
8104 bool SubStmtChanged =
false;
8106 for (
auto *B : S->
body()) {
8108 B, IsStmtExpr && B == S->
body_back() ? StmtDiscardKind::StmtExprResult
8109 : StmtDiscardKind::Discarded);
8111 if (
Result.isInvalid()) {
8118 SubStmtInvalid =
true;
8122 SubStmtChanged = SubStmtChanged || Result.get() != B;
8123 Statements.push_back(Result.getAs<Stmt>());
8129 if (!getDerived().AlwaysRebuild() &&
8133 return getDerived().RebuildCompoundStmt(S->
getLBracLoc(),
8139template<
typename Derived>
8148 LHS = getDerived().TransformExpr(S->getLHS());
8150 if (LHS.isInvalid())
8154 RHS = getDerived().TransformExpr(S->getRHS());
8156 if (RHS.isInvalid())
8163 StmtResult Case = getDerived().RebuildCaseStmt(S->getCaseLoc(),
8165 S->getEllipsisLoc(),
8168 if (Case.isInvalid())
8173 getDerived().TransformStmt(S->getSubStmt());
8174 if (SubStmt.isInvalid())
8178 return getDerived().RebuildCaseStmtBody(Case.get(), SubStmt.get());
8181template <
typename Derived>
8185 getDerived().TransformStmt(S->getSubStmt());
8186 if (SubStmt.isInvalid())
8190 return getDerived().RebuildDefaultStmt(S->getDefaultLoc(), S->getColonLoc(),
8194template<
typename Derived>
8197 StmtResult SubStmt = getDerived().TransformStmt(S->getSubStmt(), SDK);
8198 if (SubStmt.isInvalid())
8201 Decl *LD = getDerived().TransformDecl(S->getDecl()->getLocation(),
8209 if (LD == S->getDecl())
8210 S->getDecl()->setStmt(
nullptr);
8213 return getDerived().RebuildLabelStmt(S->getIdentLoc(),
8218template <
typename Derived>
8227 return getDerived().Transform##X##Attr(cast<X##Attr>(R));
8228#include "clang/Basic/AttrList.inc"
8233template <
typename Derived>
8244 return getDerived().TransformStmt##X##Attr(OrigS, InstS, cast<X##Attr>(R));
8245#include "clang/Basic/AttrList.inc"
8250template <
typename Derived>
8253 StmtDiscardKind SDK) {
8258 bool AttrsChanged =
false;
8262 for (
const auto *I : S->
getAttrs()) {
8264 getDerived().TransformStmtAttr(S->
getSubStmt(), SubStmt.
get(), I);
8265 AttrsChanged |= (I != R);
8278 return getDerived().RebuildAttributedStmt(S->
getAttrLoc(), Attrs,
8282template<
typename Derived>
8287 if (
Init.isInvalid())
8291 if (!S->isConsteval()) {
8293 Cond = getDerived().TransformCondition(
8294 S->getIfLoc(), S->getConditionVariable(), S->getCond(),
8297 if (
Cond.isInvalid())
8302 std::optional<bool> ConstexprConditionValue;
8303 if (S->isConstexpr())
8304 ConstexprConditionValue =
Cond.getKnownValue();
8308 if (!ConstexprConditionValue || *ConstexprConditionValue) {
8312 S->isNonNegatedConsteval());
8314 Then = getDerived().TransformStmt(S->getThen());
8315 if (Then.isInvalid())
8321 Then =
new (getSema().Context)
8322 CompoundStmt(S->getThen()->getBeginLoc(), S->getThen()->getEndLoc());
8327 if (!ConstexprConditionValue || !*ConstexprConditionValue) {
8331 S->isNegatedConsteval());
8333 Else = getDerived().TransformStmt(S->getElse());
8334 if (Else.isInvalid())
8336 }
else if (S->getElse() && ConstexprConditionValue &&
8337 *ConstexprConditionValue) {
8341 Else =
new (getSema().Context)
8342 CompoundStmt(S->getElse()->getBeginLoc(), S->getElse()->getEndLoc());
8345 if (!getDerived().AlwaysRebuild() &&
8346 Init.get() == S->getInit() &&
8347 Cond.get() == std::make_pair(S->getConditionVariable(), S->getCond()) &&
8348 Then.get() == S->getThen() &&
8349 Else.get() == S->getElse())
8352 return getDerived().RebuildIfStmt(
8353 S->getIfLoc(), S->getStatementKind(), S->getLParenLoc(),
Cond,
8354 S->getRParenLoc(),
Init.get(), Then.get(), S->getElseLoc(), Else.get());
8357template<
typename Derived>
8362 if (
Init.isInvalid())
8367 S->getSwitchLoc(), S->getConditionVariable(), S->getCond(),
8369 if (
Cond.isInvalid())
8374 getDerived().RebuildSwitchStmtStart(S->getSwitchLoc(), S->getLParenLoc(),
8375 Init.get(),
Cond, S->getRParenLoc());
8380 StmtResult Body = getDerived().TransformStmt(S->getBody());
8381 if (Body.isInvalid())
8385 return getDerived().RebuildSwitchStmtBody(S->getSwitchLoc(),
Switch.get(),
8389template<
typename Derived>
8394 S->getWhileLoc(), S->getConditionVariable(), S->getCond(),
8396 if (
Cond.isInvalid())
8405 StmtResult Body = getDerived().TransformStmt(S->getBody());
8406 if (Body.isInvalid())
8409 if (!getDerived().AlwaysRebuild() &&
8410 Cond.get() == std::make_pair(S->getConditionVariable(), S->getCond()) &&
8411 Body.get() == S->getBody())
8414 return getDerived().RebuildWhileStmt(S->getWhileLoc(), S->getLParenLoc(),
8415 Cond, S->getRParenLoc(), Body.get());
8418template<
typename Derived>
8427 StmtResult Body = getDerived().TransformStmt(S->getBody());
8428 if (Body.isInvalid())
8433 if (
Cond.isInvalid())
8436 if (!getDerived().AlwaysRebuild() &&
8437 Cond.get() == S->getCond() &&
8438 Body.get() == S->getBody())
8441 return getDerived().RebuildDoStmt(S->getDoLoc(), Body.get(), S->getWhileLoc(),
8442 S->getWhileLoc(),
Cond.get(),
8446template<
typename Derived>
8449 if (getSema().getLangOpts().OpenMP)
8450 getSema().OpenMP().startOpenMPLoop();
8454 if (
Init.isInvalid())
8459 if (getSema().getLangOpts().OpenMP &&
Init.isUsable())
8460 getSema().OpenMP().ActOnOpenMPLoopInitialization(S->getForLoc(),
8465 S->getForLoc(), S->getConditionVariable(), S->getCond(),
8467 if (
Cond.isInvalid())
8472 if (
Inc.isInvalid())
8476 if (S->getInc() && !FullInc.get())
8483 S->getBeginLoc(), S->getInit(),
Init.get(), S->getCond(),
8484 Cond.get().second, S->getInc(),
Inc.get());
8487 StmtResult Body = getDerived().TransformStmt(S->getBody());
8488 if (Body.isInvalid())
8493 if (!getDerived().AlwaysRebuild() &&
8494 Init.get() == S->getInit() &&
8495 Cond.get() == std::make_pair(S->getConditionVariable(), S->getCond()) &&
8496 Inc.get() == S->getInc() &&
8497 Body.get() == S->getBody())
8500 return getDerived().RebuildForStmt(S->getForLoc(), S->getLParenLoc(),
8502 S->getRParenLoc(), Body.get());
8505template<
typename Derived>
8508 Decl *LD = getDerived().TransformDecl(S->getLabel()->getLocation(),
8514 return getDerived().RebuildGotoStmt(S->getGotoLoc(), S->getLabelLoc(),
8518template<
typename Derived>
8526 if (!getDerived().AlwaysRebuild() &&
8527 Target.get() == S->getTarget())
8530 return getDerived().RebuildIndirectGotoStmt(S->getGotoLoc(), S->getStarLoc(),
8534template<
typename Derived>
8537 if (!S->hasLabelTarget())
8540 Decl *LD = getDerived().TransformDecl(S->getLabelDecl()->getLocation(),
8549template<
typename Derived>
8552 if (!S->hasLabelTarget())
8555 Decl *LD = getDerived().TransformDecl(S->getLabelDecl()->getLocation(),
8564template <
typename Derived>
8572template<
typename Derived>
8582 return getDerived().RebuildReturnStmt(S->getReturnLoc(),
Result.get());
8585template<
typename Derived>
8588 bool DeclChanged =
false;
8591 for (
auto *D : S->decls()) {
8592 Decl *Transformed = getDerived().TransformDefinition(D->getLocation(), D);
8596 if (Transformed != D)
8600 if (
auto *TD = dyn_cast<TypeDecl>(Transformed)) {
8601 if (
auto *TN = dyn_cast<TypedefNameDecl>(TD)) {
8602 LSI->ContainsUnexpandedParameterPack |=
8603 TN->getUnderlyingType()->containsUnexpandedParameterPack();
8605 LSI->ContainsUnexpandedParameterPack |=
8608 .getTypeDeclType(TD)
8609 ->containsUnexpandedParameterPack();
8612 if (
auto *VD = dyn_cast<VarDecl>(Transformed))
8613 LSI->ContainsUnexpandedParameterPack |=
8614 VD->getType()->containsUnexpandedParameterPack();
8617 Decls.push_back(Transformed);
8620 if (!getDerived().AlwaysRebuild() && !DeclChanged)
8623 return getDerived().RebuildDeclStmt(Decls, S->getBeginLoc(), S->getEndLoc());
8626template<
typename Derived>
8636 bool ExprsChanged =
false;
8638 auto RebuildString = [&](
Expr *E) {
8643 ExprsChanged =
true;
8650 for (
unsigned I = 0, E = S->getNumOutputs(); I != E; ++I) {
8651 Names.push_back(S->getOutputIdentifier(I));
8657 Constraints.push_back(
Result.get());
8660 Expr *OutputExpr = S->getOutputExpr(I);
8661 Result = getDerived().TransformExpr(OutputExpr);
8665 ExprsChanged |=
Result.get() != OutputExpr;
8667 Exprs.push_back(
Result.get());
8671 for (
unsigned I = 0, E = S->getNumInputs(); I != E; ++I) {
8672 Names.push_back(S->getInputIdentifier(I));
8678 Constraints.push_back(
Result.get());
8681 Expr *InputExpr = S->getInputExpr(I);
8682 Result = getDerived().TransformExpr(InputExpr);
8686 ExprsChanged |=
Result.get() != InputExpr;
8688 Exprs.push_back(
Result.get());
8692 for (
unsigned I = 0, E = S->getNumLabels(); I != E; ++I) {
8693 Names.push_back(S->getLabelIdentifier(I));
8698 ExprsChanged |=
Result.get() != S->getLabelExpr(I);
8699 Exprs.push_back(
Result.get());
8703 for (
unsigned I = 0, E = S->getNumClobbers(); I != E; ++I) {
8707 Clobbers.push_back(
Result.get());
8710 ExprResult AsmString = RebuildString(S->getAsmStringExpr());
8711 if (AsmString.isInvalid())
8714 if (!getDerived().AlwaysRebuild() && !ExprsChanged)
8717 return getDerived().RebuildGCCAsmStmt(S->getAsmLoc(), S->isSimple(),
8718 S->isVolatile(), S->getNumOutputs(),
8719 S->getNumInputs(), Names.data(),
8720 Constraints, Exprs, AsmString.get(),
8721 Clobbers, S->getNumLabels(),
8725template<
typename Derived>
8730 bool HadError =
false, HadChange =
false;
8734 TransformedExprs.reserve(SrcExprs.size());
8735 for (
unsigned i = 0, e = SrcExprs.size(); i != e; ++i) {
8737 if (!
Result.isUsable()) {
8740 HadChange |= (
Result.get() != SrcExprs[i]);
8741 TransformedExprs.push_back(
Result.get());
8746 if (!HadChange && !getDerived().AlwaysRebuild())
8749 return getDerived().RebuildMSAsmStmt(S->getAsmLoc(), S->getLBraceLoc(),
8750 AsmToks, S->getAsmString(),
8751 S->getNumOutputs(), S->getNumInputs(),
8752 S->getAllConstraints(), S->getClobbers(),
8753 TransformedExprs, S->getEndLoc());
8757template<
typename Derived>
8762 assert(FD && ScopeInfo && !ScopeInfo->CoroutinePromise &&
8763 ScopeInfo->NeedsCoroutineSuspends &&
8764 ScopeInfo->CoroutineSuspends.first ==
nullptr &&
8765 ScopeInfo->CoroutineSuspends.second ==
nullptr &&
8766 "expected clean scope info");
8770 ScopeInfo->setNeedsCoroutineSuspends(
false);
8783 getDerived().transformedLocalDecl(S->getPromiseDecl(), {Promise});
8784 ScopeInfo->CoroutinePromise = Promise;
8789 StmtResult InitSuspend = getDerived().TransformStmt(S->getInitSuspendStmt());
8790 if (InitSuspend.isInvalid())
8793 getDerived().TransformStmt(S->getFinalSuspendStmt());
8794 if (FinalSuspend.isInvalid() ||
8797 ScopeInfo->setCoroutineSuspends(InitSuspend.get(), FinalSuspend.get());
8800 StmtResult BodyRes = getDerived().TransformStmt(S->getBody());
8801 if (BodyRes.isInvalid())
8805 if (Builder.isInvalid())
8808 Expr *ReturnObject = S->getReturnValueInit();
8809 assert(ReturnObject &&
"the return object is expected to be valid");
8810 ExprResult Res = getDerived().TransformInitializer(ReturnObject,
8812 if (Res.isInvalid())
8814 Builder.ReturnValue = Res.get();
8819 if (S->hasDependentPromiseType()) {
8822 if (!Promise->getType()->isDependentType()) {
8823 assert(!S->getFallthroughHandler() && !S->getExceptionHandler() &&
8824 !S->getReturnStmtOnAllocFailure() && !S->getDeallocate() &&
8825 "these nodes should not have been built yet");
8826 if (!Builder.buildDependentStatements())
8830 if (
auto *OnFallthrough = S->getFallthroughHandler()) {
8831 StmtResult Res = getDerived().TransformStmt(OnFallthrough);
8832 if (Res.isInvalid())
8834 Builder.OnFallthrough = Res.get();
8837 if (
auto *OnException = S->getExceptionHandler()) {
8838 StmtResult Res = getDerived().TransformStmt(OnException);
8839 if (Res.isInvalid())
8841 Builder.OnException = Res.get();
8844 if (
auto *OnAllocFailure = S->getReturnStmtOnAllocFailure()) {
8845 StmtResult Res = getDerived().TransformStmt(OnAllocFailure);
8846 if (Res.isInvalid())
8848 Builder.ReturnStmtOnAllocFailure = Res.get();
8852 assert(S->getAllocate() && S->getDeallocate() &&
8853 "allocation and deallocation calls must already be built");
8854 ExprResult AllocRes = getDerived().TransformExpr(S->getAllocate());
8855 if (AllocRes.isInvalid())
8857 Builder.Allocate = AllocRes.get();
8859 ExprResult DeallocRes = getDerived().TransformExpr(S->getDeallocate());
8860 if (DeallocRes.isInvalid())
8862 Builder.Deallocate = DeallocRes.get();
8864 if (
auto *ResultDecl = S->getResultDecl()) {
8865 StmtResult Res = getDerived().TransformStmt(ResultDecl);
8866 if (Res.isInvalid())
8868 Builder.ResultDecl = Res.get();
8873 if (Res.isInvalid())
8875 Builder.ReturnStmt = Res.get();
8879 return getDerived().RebuildCoroutineBodyStmt(Builder);
8882template<
typename Derived>
8892 return getDerived().RebuildCoreturnStmt(S->getKeywordLoc(),
Result.get(),
8896template <
typename Derived>
8909 ExprResult Lookup = getSema().BuildOperatorCoawaitLookupExpr(
8910 getSema().getCurScope(), E->getKeywordLoc());
8914 return getDerived().RebuildCoawaitExpr(
8915 E->getKeywordLoc(),
Operand.get(),
8919template <
typename Derived>
8922 ExprResult OperandResult = getDerived().TransformInitializer(E->getOperand(),
8924 if (OperandResult.isInvalid())
8928 E->getOperatorCoawaitLookup());
8935 return getDerived().RebuildDependentCoawaitExpr(
8936 E->getKeywordLoc(), OperandResult.get(),
8940template<
typename Derived>
8950 return getDerived().RebuildCoyieldExpr(E->getKeywordLoc(),
Result.get());
8955template<
typename Derived>
8959 StmtResult TryBody = getDerived().TransformStmt(S->getTryBody());
8960 if (TryBody.isInvalid())
8964 bool AnyCatchChanged =
false;
8966 for (
unsigned I = 0, N = S->getNumCatchStmts(); I != N; ++I) {
8967 StmtResult Catch = getDerived().TransformStmt(S->getCatchStmt(I));
8968 if (Catch.isInvalid())
8970 if (Catch.get() != S->getCatchStmt(I))
8971 AnyCatchChanged =
true;
8972 CatchStmts.push_back(Catch.get());
8977 if (S->getFinallyStmt()) {
8978 Finally = getDerived().TransformStmt(S->getFinallyStmt());
8979 if (Finally.isInvalid())
8984 if (!getDerived().AlwaysRebuild() &&
8985 TryBody.get() == S->getTryBody() &&
8987 Finally.get() == S->getFinallyStmt())
8991 return getDerived().RebuildObjCAtTryStmt(S->getAtTryLoc(), TryBody.get(),
8992 CatchStmts, Finally.get());
8995template<
typename Derived>
9000 if (
VarDecl *FromVar = S->getCatchParamDecl()) {
9002 if (FromVar->getTypeSourceInfo()) {
9003 TSInfo = getDerived().TransformType(FromVar->getTypeSourceInfo());
9010 T = TSInfo->getType();
9012 T = getDerived().TransformType(FromVar->getType());
9017 Var = getDerived().RebuildObjCExceptionDecl(FromVar, TSInfo,
T);
9022 StmtResult Body = getDerived().TransformStmt(S->getCatchBody());
9023 if (Body.isInvalid())
9026 return getDerived().RebuildObjCAtCatchStmt(S->getAtCatchLoc(),
9031template<
typename Derived>
9035 StmtResult Body = getDerived().TransformStmt(S->getFinallyBody());
9036 if (Body.isInvalid())
9040 if (!getDerived().AlwaysRebuild() &&
9041 Body.get() == S->getFinallyBody())
9045 return getDerived().RebuildObjCAtFinallyStmt(S->getAtFinallyLoc(),
9049template<
typename Derived>
9053 if (S->getThrowExpr()) {
9054 Operand = getDerived().TransformExpr(S->getThrowExpr());
9059 if (!getDerived().AlwaysRebuild() &&
9060 Operand.get() == S->getThrowExpr())
9063 return getDerived().RebuildObjCAtThrowStmt(S->getThrowLoc(),
Operand.get());
9066template<
typename Derived>
9075 getDerived().RebuildObjCAtSynchronizedOperand(S->getAtSynchronizedLoc(),
9081 StmtResult Body = getDerived().TransformStmt(S->getSynchBody());
9082 if (Body.isInvalid())
9086 if (!getDerived().AlwaysRebuild() &&
9087 Object.get() == S->getSynchExpr() &&
9088 Body.get() == S->getSynchBody())
9092 return getDerived().RebuildObjCAtSynchronizedStmt(S->getAtSynchronizedLoc(),
9093 Object.get(), Body.get());
9096template<
typename Derived>
9101 StmtResult Body = getDerived().TransformStmt(S->getSubStmt());
9102 if (Body.isInvalid())
9106 if (!getDerived().AlwaysRebuild() &&
9107 Body.get() == S->getSubStmt())
9111 return getDerived().RebuildObjCAutoreleasePoolStmt(
9112 S->getAtLoc(), Body.get());
9115template<
typename Derived>
9120 StmtResult Element = getDerived().TransformStmt(
9121 S->getElement(), StmtDiscardKind::NotDiscarded);
9122 if (Element.isInvalid())
9126 ExprResult Collection = getDerived().TransformExpr(S->getCollection());
9127 if (Collection.isInvalid())
9131 StmtResult Body = getDerived().TransformStmt(S->getBody());
9132 if (Body.isInvalid())
9136 if (!getDerived().AlwaysRebuild() &&
9137 Element.get() == S->getElement() &&
9138 Collection.get() == S->getCollection() &&
9139 Body.get() == S->getBody())
9143 return getDerived().RebuildObjCForCollectionStmt(S->getForLoc(),
9150template <
typename Derived>
9154 if (
VarDecl *ExceptionDecl = S->getExceptionDecl()) {
9156 getDerived().TransformType(ExceptionDecl->getTypeSourceInfo());
9160 Var = getDerived().RebuildExceptionDecl(
9161 ExceptionDecl,
T, ExceptionDecl->getInnerLocStart(),
9162 ExceptionDecl->getLocation(), ExceptionDecl->getIdentifier());
9163 if (!Var || Var->isInvalidDecl())
9168 StmtResult Handler = getDerived().TransformStmt(S->getHandlerBlock());
9169 if (Handler.isInvalid())
9172 if (!getDerived().AlwaysRebuild() && !Var &&
9173 Handler.get() == S->getHandlerBlock())
9176 return getDerived().RebuildCXXCatchStmt(S->getCatchLoc(), Var, Handler.get());
9179template <
typename Derived>
9182 StmtResult TryBlock = getDerived().TransformCompoundStmt(S->getTryBlock());
9183 if (TryBlock.isInvalid())
9187 bool HandlerChanged =
false;
9189 for (
unsigned I = 0, N = S->getNumHandlers(); I != N; ++I) {
9190 StmtResult Handler = getDerived().TransformCXXCatchStmt(S->getHandler(I));
9191 if (Handler.isInvalid())
9194 HandlerChanged = HandlerChanged || Handler.get() != S->getHandler(I);
9195 Handlers.push_back(Handler.getAs<
Stmt>());
9198 getSema().DiagnoseExceptionUse(S->getTryLoc(),
true);
9200 if (!getDerived().AlwaysRebuild() && TryBlock.get() == S->getTryBlock() &&
9204 return getDerived().RebuildCXXTryStmt(S->getTryLoc(), TryBlock.get(),
9208template<
typename Derived>
9219 auto &LastRecord = getSema().currentEvaluationContext();
9220 LastRecord.InLifetimeExtendingContext =
true;
9221 LastRecord.RebuildDefaultArgOrDefaultInit =
true;
9224 S->getInit() ? getDerived().TransformStmt(S->getInit()) :
StmtResult();
9225 if (
Init.isInvalid())
9229 if (
Range.isInvalid())
9234 getSema().ExprEvalContexts.back().ForRangeLifetimeExtendTemps.empty());
9235 auto ForRangeLifetimeExtendTemps =
9236 getSema().ExprEvalContexts.back().ForRangeLifetimeExtendTemps;
9238 StmtResult Begin = getDerived().TransformStmt(S->getBeginStmt());
9239 if (Begin.isInvalid())
9241 StmtResult End = getDerived().TransformStmt(S->getEndStmt());
9242 if (End.isInvalid())
9246 if (
Cond.isInvalid())
9250 if (
Cond.isInvalid())
9256 if (
Inc.isInvalid())
9261 StmtResult LoopVar = getDerived().TransformStmt(S->getLoopVarStmt());
9262 if (LoopVar.isInvalid())
9266 if (getDerived().AlwaysRebuild() ||
9267 Init.get() != S->getInit() ||
9268 Range.get() != S->getRangeStmt() ||
9269 Begin.get() != S->getBeginStmt() ||
9270 End.get() != S->getEndStmt() ||
9271 Cond.get() != S->getCond() ||
9272 Inc.get() != S->getInc() ||
9273 LoopVar.get() != S->getLoopVarStmt()) {
9274 NewStmt = getDerived().RebuildCXXForRangeStmt(
9275 S->getForLoc(), S->getCoawaitLoc(),
Init.get(), S->getColonLoc(),
9276 Range.get(), Begin.get(), End.get(),
Cond.get(),
Inc.get(),
9277 LoopVar.get(), S->getRParenLoc(), ForRangeLifetimeExtendTemps);
9278 if (NewStmt.isInvalid() && LoopVar.get() != S->getLoopVarStmt()) {
9280 getSema().ActOnInitializerError(
9291 StmtResult Body = getDerived().TransformStmt(S->getBody());
9292 if (Body.isInvalid())
9299 if (Body.get() != S->getBody() && NewStmt.get() == S) {
9300 NewStmt = getDerived().RebuildCXXForRangeStmt(
9301 S->getForLoc(), S->getCoawaitLoc(),
Init.get(), S->getColonLoc(),
9302 Range.get(), Begin.get(), End.get(),
Cond.get(),
Inc.get(),
9303 LoopVar.get(), S->getRParenLoc(), ForRangeLifetimeExtendTemps);
9304 if (NewStmt.isInvalid())
9308 if (NewStmt.get() == S)
9311 return FinishCXXForRangeStmt(NewStmt.get(), Body.get());
9314template<
typename Derived>
9320 if (S->getQualifierLoc()) {
9322 = getDerived().TransformNestedNameSpecifierLoc(S->getQualifierLoc());
9329 if (NameInfo.getName()) {
9330 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
9331 if (!NameInfo.getName())
9336 if (!getDerived().AlwaysRebuild() &&
9337 QualifierLoc == S->getQualifierLoc() &&
9338 NameInfo.getName() == S->getNameInfo().getName())
9343 SS.
Adopt(QualifierLoc);
9345 switch (getSema().CheckMicrosoftIfExistsSymbol(
nullptr, SS, NameInfo)) {
9347 if (S->isIfExists())
9350 return new (getSema().Context)
NullStmt(S->getKeywordLoc());
9353 if (S->isIfNotExists())
9356 return new (getSema().Context)
NullStmt(S->getKeywordLoc());
9367 StmtResult SubStmt = getDerived().TransformCompoundStmt(S->getSubStmt());
9368 if (SubStmt.isInvalid())
9376 return getDerived().RebuildMSDependentExistsStmt(S->getKeywordLoc(),
9383template<
typename Derived>
9387 if (E->getQualifierLoc()) {
9389 = getDerived().TransformNestedNameSpecifierLoc(E->getQualifierLoc());
9395 getDerived().TransformDecl(E->getMemberLoc(), E->getPropertyDecl()));
9400 if (
Base.isInvalid())
9406 QualifierLoc, E->getMemberLoc());
9409template <
typename Derived>
9413 if (BaseRes.isInvalid())
9415 auto IdxRes = getDerived().TransformExpr(E->getIdx());
9416 if (IdxRes.isInvalid())
9419 if (!getDerived().AlwaysRebuild() &&
9420 BaseRes.get() == E->getBase() &&
9421 IdxRes.get() == E->getIdx())
9424 return getDerived().RebuildArraySubscriptExpr(
9425 BaseRes.get(),
SourceLocation(), IdxRes.get(), E->getRBracketLoc());
9428template <
typename Derived>
9430 StmtResult TryBlock = getDerived().TransformCompoundStmt(S->getTryBlock());
9431 if (TryBlock.isInvalid())
9434 StmtResult Handler = getDerived().TransformSEHHandler(S->getHandler());
9435 if (Handler.isInvalid())
9438 if (!getDerived().AlwaysRebuild() && TryBlock.get() == S->getTryBlock() &&
9439 Handler.get() == S->getHandler())
9442 return getDerived().RebuildSEHTryStmt(S->getIsCXXTry(), S->getTryLoc(),
9443 TryBlock.get(), Handler.get());
9446template <
typename Derived>
9449 if (
Block.isInvalid())
9452 return getDerived().RebuildSEHFinallyStmt(S->getFinallyLoc(),
Block.get());
9455template <
typename Derived>
9457 ExprResult FilterExpr = getDerived().TransformExpr(S->getFilterExpr());
9458 if (FilterExpr.isInvalid())
9462 if (
Block.isInvalid())
9465 return getDerived().RebuildSEHExceptStmt(S->getExceptLoc(), FilterExpr.get(),
9469template <
typename Derived>
9477template<
typename Derived>
9487template <
typename Derived>
9489TreeTransform<Derived>::TransformOMPCanonicalLoop(OMPCanonicalLoop *L) {
9493 return getDerived().TransformStmt(L->getLoopStmt());
9496template <
typename Derived>
9503 TClauses.reserve(Clauses.size());
9507 getDerived().getSema().OpenMP().StartOpenMPClause((*I)->getClauseKind());
9509 getDerived().getSema().OpenMP().EndOpenMPClause();
9511 TClauses.push_back(Clause);
9513 TClauses.push_back(
nullptr);
9517 if (D->hasAssociatedStmt() && D->getAssociatedStmt()) {
9518 getDerived().getSema().OpenMP().ActOnOpenMPRegionStart(
9519 D->getDirectiveKind(),
9525 if (D->getDirectiveKind() == OMPD_atomic ||
9526 D->getDirectiveKind() == OMPD_critical ||
9527 D->getDirectiveKind() == OMPD_section ||
9528 D->getDirectiveKind() == OMPD_master)
9529 CS = D->getAssociatedStmt();
9531 CS = D->getRawStmt();
9534 getSema().getLangOpts().OpenMPIRBuilder)
9538 getDerived().getSema().OpenMP().ActOnOpenMPRegionEnd(Body, TClauses);
9543 if (TClauses.size() != Clauses.size()) {
9549 if (D->getDirectiveKind() == OMPD_critical) {
9551 DirName =
getDerived().TransformDeclarationNameInfo(DirName);
9554 if (D->getDirectiveKind() == OMPD_cancellation_point) {
9556 }
else if (D->getDirectiveKind() == OMPD_cancel) {
9560 return getDerived().RebuildOMPExecutableDirective(
9561 D->getDirectiveKind(), DirName, CancelRegion, TClauses,
9562 AssociatedStmt.
get(), D->getBeginLoc(), D->getEndLoc());
9570template <
typename Derived>
9577 TClauses.reserve(Clauses.size());
9580 getDerived().getSema().OpenMP().StartOpenMPClause(
C->getClauseKind());
9582 getDerived().getSema().OpenMP().EndOpenMPClause();
9584 TClauses.push_back(Clause);
9586 TClauses.push_back(
nullptr);
9590 if (D->hasAssociatedStmt() && D->getAssociatedStmt()) {
9591 getDerived().getSema().OpenMP().ActOnOpenMPRegionStart(
9592 D->getDirectiveKind(),
9597 assert(D->getDirectiveKind() == OMPD_assume &&
9598 "Unexpected informational directive");
9599 Stmt *CS = D->getAssociatedStmt();
9603 getDerived().getSema().OpenMP().ActOnOpenMPRegionEnd(Body, TClauses);
9607 if (TClauses.size() != Clauses.size())
9612 return getDerived().RebuildOMPInformationalDirective(
9613 D->getDirectiveKind(), DirName, TClauses, AssociatedStmt.
get(),
9614 D->getBeginLoc(), D->getEndLoc());
9617template <
typename Derived>
9622 SemaRef.
Diag(D->getBeginLoc(), diag::err_omp_instantiation_not_supported)
9623 << getOpenMPDirectiveName(D->getDirectiveKind(), OMPVersion);
9627template <
typename Derived>
9629TreeTransform<Derived>::TransformOMPParallelDirective(OMPParallelDirective *D) {
9630 DeclarationNameInfo DirName;
9631 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9632 OMPD_parallel, DirName,
nullptr, D->getBeginLoc());
9633 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9634 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9638template <
typename Derived>
9642 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9643 OMPD_simd, DirName,
nullptr, D->getBeginLoc());
9644 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9645 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9649template <
typename Derived>
9653 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9654 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
9655 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9656 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9660template <
typename Derived>
9664 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9665 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
9666 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9667 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9671template <
typename Derived>
9675 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9676 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
9677 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9678 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9682template <
typename Derived>
9686 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9687 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
9688 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9689 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9693template <
typename Derived>
9695 OMPInterchangeDirective *D) {
9697 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9698 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
9699 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9700 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9704template <
typename Derived>
9708 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9709 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
9710 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9711 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9715template <
typename Derived>
9719 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9720 OMPD_for, DirName,
nullptr, D->getBeginLoc());
9721 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9722 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9726template <
typename Derived>
9730 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9731 OMPD_for_simd, DirName,
nullptr, D->getBeginLoc());
9732 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9733 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9737template <
typename Derived>
9741 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9742 OMPD_sections, DirName,
nullptr, D->getBeginLoc());
9743 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9744 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9748template <
typename Derived>
9752 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9753 OMPD_section, DirName,
nullptr, D->getBeginLoc());
9754 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9755 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9759template <
typename Derived>
9763 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9764 OMPD_scope, 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_single, DirName,
nullptr, D->getBeginLoc());
9776 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9777 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9781template <
typename Derived>
9785 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9786 OMPD_master, DirName,
nullptr, D->getBeginLoc());
9787 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9788 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9792template <
typename Derived>
9796 OMPD_critical, D->getDirectiveName(),
nullptr, D->getBeginLoc());
9797 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9798 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9802template <
typename Derived>
9804 OMPParallelForDirective *D) {
9806 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9807 OMPD_parallel_for, DirName,
nullptr, D->getBeginLoc());
9808 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9809 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9813template <
typename Derived>
9815 OMPParallelForSimdDirective *D) {
9817 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9818 OMPD_parallel_for_simd, DirName,
nullptr, D->getBeginLoc());
9819 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9820 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9824template <
typename Derived>
9826 OMPParallelMasterDirective *D) {
9828 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9829 OMPD_parallel_master, DirName,
nullptr, D->getBeginLoc());
9830 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9831 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9835template <
typename Derived>
9837 OMPParallelMaskedDirective *D) {
9839 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9840 OMPD_parallel_masked, DirName,
nullptr, D->getBeginLoc());
9841 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9842 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9846template <
typename Derived>
9848 OMPParallelSectionsDirective *D) {
9850 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9851 OMPD_parallel_sections, DirName,
nullptr, D->getBeginLoc());
9852 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9853 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9857template <
typename Derived>
9861 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9862 OMPD_task, DirName,
nullptr, D->getBeginLoc());
9863 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9864 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9868template <
typename Derived>
9870 OMPTaskyieldDirective *D) {
9872 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9873 OMPD_taskyield, DirName,
nullptr, D->getBeginLoc());
9874 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9875 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9879template <
typename Derived>
9883 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9884 OMPD_barrier, DirName,
nullptr, D->getBeginLoc());
9885 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9886 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9890template <
typename Derived>
9894 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9895 OMPD_taskwait, DirName,
nullptr, D->getBeginLoc());
9896 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9897 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9901template <
typename Derived>
9905 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9906 OMPD_assume, DirName,
nullptr, D->getBeginLoc());
9907 StmtResult Res = getDerived().TransformOMPInformationalDirective(D);
9908 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9912template <
typename Derived>
9916 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9917 OMPD_error, DirName,
nullptr, D->getBeginLoc());
9918 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9919 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9923template <
typename Derived>
9925 OMPTaskgroupDirective *D) {
9927 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9928 OMPD_taskgroup, DirName,
nullptr, D->getBeginLoc());
9929 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9930 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9934template <
typename Derived>
9938 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9939 OMPD_flush, DirName,
nullptr, D->getBeginLoc());
9940 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9941 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9945template <
typename Derived>
9949 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9950 OMPD_depobj, DirName,
nullptr, D->getBeginLoc());
9951 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9952 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9956template <
typename Derived>
9960 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9961 OMPD_scan, DirName,
nullptr, D->getBeginLoc());
9962 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9963 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9967template <
typename Derived>
9971 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9972 OMPD_ordered, DirName,
nullptr, D->getBeginLoc());
9973 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9974 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9978template <
typename Derived>
9982 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9983 OMPD_atomic, DirName,
nullptr, D->getBeginLoc());
9984 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9985 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9989template <
typename Derived>
9993 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9994 OMPD_target, DirName,
nullptr, D->getBeginLoc());
9995 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9996 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10000template <
typename Derived>
10002 OMPTargetDataDirective *D) {
10004 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10005 OMPD_target_data, DirName,
nullptr, D->getBeginLoc());
10006 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10007 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10011template <
typename Derived>
10013 OMPTargetEnterDataDirective *D) {
10015 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10016 OMPD_target_enter_data, DirName,
nullptr, D->getBeginLoc());
10017 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10018 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10022template <
typename Derived>
10024 OMPTargetExitDataDirective *D) {
10026 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10027 OMPD_target_exit_data, DirName,
nullptr, D->getBeginLoc());
10028 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10029 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10033template <
typename Derived>
10035 OMPTargetParallelDirective *D) {
10037 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10038 OMPD_target_parallel, DirName,
nullptr, D->getBeginLoc());
10039 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10040 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10044template <
typename Derived>
10046 OMPTargetParallelForDirective *D) {
10048 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10049 OMPD_target_parallel_for, DirName,
nullptr, D->getBeginLoc());
10050 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10051 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10055template <
typename Derived>
10057 OMPTargetUpdateDirective *D) {
10059 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10060 OMPD_target_update, DirName,
nullptr, D->getBeginLoc());
10061 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10062 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10066template <
typename Derived>
10070 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10071 OMPD_teams, DirName,
nullptr, D->getBeginLoc());
10072 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10073 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10077template <
typename Derived>
10079 OMPCancellationPointDirective *D) {
10081 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10082 OMPD_cancellation_point, DirName,
nullptr, D->getBeginLoc());
10083 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10084 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10088template <
typename Derived>
10092 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10093 OMPD_cancel, DirName,
nullptr, D->getBeginLoc());
10094 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10095 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10099template <
typename Derived>
10103 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10104 OMPD_taskloop, DirName,
nullptr, D->getBeginLoc());
10105 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10106 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10110template <
typename Derived>
10112 OMPTaskLoopSimdDirective *D) {
10114 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10115 OMPD_taskloop_simd, DirName,
nullptr, D->getBeginLoc());
10116 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10117 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10121template <
typename Derived>
10123 OMPMasterTaskLoopDirective *D) {
10125 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10126 OMPD_master_taskloop, DirName,
nullptr, D->getBeginLoc());
10127 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10128 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10132template <
typename Derived>
10134 OMPMaskedTaskLoopDirective *D) {
10136 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10137 OMPD_masked_taskloop, DirName,
nullptr, D->getBeginLoc());
10138 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10139 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10143template <
typename Derived>
10145 OMPMasterTaskLoopSimdDirective *D) {
10147 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10148 OMPD_master_taskloop_simd, DirName,
nullptr, D->getBeginLoc());
10149 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10150 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10154template <
typename Derived>
10156 OMPMaskedTaskLoopSimdDirective *D) {
10158 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10159 OMPD_masked_taskloop_simd, DirName,
nullptr, D->getBeginLoc());
10160 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10161 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10165template <
typename Derived>
10167 OMPParallelMasterTaskLoopDirective *D) {
10169 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10170 OMPD_parallel_master_taskloop, DirName,
nullptr, D->getBeginLoc());
10171 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10172 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10176template <
typename Derived>
10178 OMPParallelMaskedTaskLoopDirective *D) {
10180 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10181 OMPD_parallel_masked_taskloop, DirName,
nullptr, D->getBeginLoc());
10182 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10183 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10187template <
typename Derived>
10190 OMPParallelMasterTaskLoopSimdDirective *D) {
10192 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10193 OMPD_parallel_master_taskloop_simd, DirName,
nullptr, D->getBeginLoc());
10194 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10195 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10199template <
typename Derived>
10202 OMPParallelMaskedTaskLoopSimdDirective *D) {
10204 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10205 OMPD_parallel_masked_taskloop_simd, DirName,
nullptr, D->getBeginLoc());
10206 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10207 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10211template <
typename Derived>
10213 OMPDistributeDirective *D) {
10215 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10216 OMPD_distribute, DirName,
nullptr, D->getBeginLoc());
10217 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10218 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10222template <
typename Derived>
10224 OMPDistributeParallelForDirective *D) {
10226 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10227 OMPD_distribute_parallel_for, DirName,
nullptr, D->getBeginLoc());
10228 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10229 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10233template <
typename Derived>
10236 OMPDistributeParallelForSimdDirective *D) {
10238 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10239 OMPD_distribute_parallel_for_simd, DirName,
nullptr, D->getBeginLoc());
10240 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10241 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10245template <
typename Derived>
10247 OMPDistributeSimdDirective *D) {
10249 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10250 OMPD_distribute_simd, DirName,
nullptr, D->getBeginLoc());
10251 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10252 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10256template <
typename Derived>
10258 OMPTargetParallelForSimdDirective *D) {
10260 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10261 OMPD_target_parallel_for_simd, DirName,
nullptr, D->getBeginLoc());
10262 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10263 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10267template <
typename Derived>
10269 OMPTargetSimdDirective *D) {
10271 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10272 OMPD_target_simd, DirName,
nullptr, D->getBeginLoc());
10273 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10274 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10278template <
typename Derived>
10280 OMPTeamsDistributeDirective *D) {
10282 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10283 OMPD_teams_distribute, DirName,
nullptr, D->getBeginLoc());
10284 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10285 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10289template <
typename Derived>
10291 OMPTeamsDistributeSimdDirective *D) {
10293 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10294 OMPD_teams_distribute_simd, DirName,
nullptr, D->getBeginLoc());
10295 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10296 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10300template <
typename Derived>
10302 OMPTeamsDistributeParallelForSimdDirective *D) {
10304 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10305 OMPD_teams_distribute_parallel_for_simd, DirName,
nullptr,
10307 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10308 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10312template <
typename Derived>
10314 OMPTeamsDistributeParallelForDirective *D) {
10316 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10317 OMPD_teams_distribute_parallel_for, DirName,
nullptr, D->getBeginLoc());
10318 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10319 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10323template <
typename Derived>
10325 OMPTargetTeamsDirective *D) {
10327 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10328 OMPD_target_teams, DirName,
nullptr, D->getBeginLoc());
10329 auto Res = getDerived().TransformOMPExecutableDirective(D);
10330 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10334template <
typename Derived>
10336 OMPTargetTeamsDistributeDirective *D) {
10338 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10339 OMPD_target_teams_distribute, DirName,
nullptr, D->getBeginLoc());
10340 auto Res = getDerived().TransformOMPExecutableDirective(D);
10341 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10345template <
typename Derived>
10348 OMPTargetTeamsDistributeParallelForDirective *D) {
10350 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10351 OMPD_target_teams_distribute_parallel_for, DirName,
nullptr,
10353 auto Res = getDerived().TransformOMPExecutableDirective(D);
10354 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10358template <
typename Derived>
10361 OMPTargetTeamsDistributeParallelForSimdDirective *D) {
10363 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10364 OMPD_target_teams_distribute_parallel_for_simd, DirName,
nullptr,
10366 auto Res = getDerived().TransformOMPExecutableDirective(D);
10367 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10371template <
typename Derived>
10374 OMPTargetTeamsDistributeSimdDirective *D) {
10376 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10377 OMPD_target_teams_distribute_simd, DirName,
nullptr, D->getBeginLoc());
10378 auto Res = getDerived().TransformOMPExecutableDirective(D);
10379 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10383template <
typename Derived>
10387 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10388 OMPD_interop, DirName,
nullptr, D->getBeginLoc());
10389 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10390 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10394template <
typename Derived>
10398 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10399 OMPD_dispatch, DirName,
nullptr, D->getBeginLoc());
10400 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10401 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10405template <
typename Derived>
10409 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10410 OMPD_masked, DirName,
nullptr, D->getBeginLoc());
10411 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10412 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10416template <
typename Derived>
10418 OMPGenericLoopDirective *D) {
10420 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10421 OMPD_loop, DirName,
nullptr, D->getBeginLoc());
10422 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10423 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10427template <
typename Derived>
10429 OMPTeamsGenericLoopDirective *D) {
10431 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10432 OMPD_teams_loop, DirName,
nullptr, D->getBeginLoc());
10433 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10434 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10438template <
typename Derived>
10440 OMPTargetTeamsGenericLoopDirective *D) {
10442 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10443 OMPD_target_teams_loop, DirName,
nullptr, D->getBeginLoc());
10444 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10445 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10449template <
typename Derived>
10451 OMPParallelGenericLoopDirective *D) {
10453 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10454 OMPD_parallel_loop, DirName,
nullptr, D->getBeginLoc());
10455 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10456 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10460template <
typename Derived>
10463 OMPTargetParallelGenericLoopDirective *D) {
10465 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10466 OMPD_target_parallel_loop, DirName,
nullptr, D->getBeginLoc());
10467 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10468 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10475template <
typename Derived>
10478 if (
Cond.isInvalid())
10480 return getDerived().RebuildOMPIfClause(
10481 C->getNameModifier(),
Cond.get(),
C->getBeginLoc(),
C->getLParenLoc(),
10482 C->getNameModifierLoc(),
C->getColonLoc(),
C->getEndLoc());
10485template <
typename Derived>
10488 if (
Cond.isInvalid())
10490 return getDerived().RebuildOMPFinalClause(
Cond.get(),
C->getBeginLoc(),
10491 C->getLParenLoc(),
C->getEndLoc());
10494template <
typename Derived>
10497 ExprResult NumThreads = getDerived().TransformExpr(
C->getNumThreads());
10498 if (NumThreads.isInvalid())
10500 return getDerived().RebuildOMPNumThreadsClause(
10501 C->getModifier(), NumThreads.get(),
C->getBeginLoc(),
C->getLParenLoc(),
10502 C->getModifierLoc(),
C->getEndLoc());
10505template <
typename Derived>
10508 ExprResult E = getDerived().TransformExpr(
C->getSafelen());
10511 return getDerived().RebuildOMPSafelenClause(
10512 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10515template <
typename Derived>
10518 ExprResult E = getDerived().TransformExpr(
C->getAllocator());
10521 return getDerived().RebuildOMPAllocatorClause(
10522 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10525template <
typename Derived>
10528 ExprResult E = getDerived().TransformExpr(
C->getSimdlen());
10531 return getDerived().RebuildOMPSimdlenClause(
10532 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10535template <
typename Derived>
10538 TransformedSizes.reserve(
C->getNumSizes());
10540 for (
Expr *E :
C->getSizesRefs()) {
10542 TransformedSizes.push_back(
nullptr);
10551 TransformedSizes.push_back(
T.get());
10554 if (!Changed && !getDerived().AlwaysRebuild())
10556 return RebuildOMPSizesClause(TransformedSizes,
C->getBeginLoc(),
10557 C->getLParenLoc(),
C->getEndLoc());
10560template <
typename Derived>
10564 TransformedArgs.reserve(
C->getNumLoops());
10566 for (
Expr *E :
C->getArgsRefs()) {
10568 TransformedArgs.push_back(
nullptr);
10577 TransformedArgs.push_back(
T.get());
10580 if (!Changed && !getDerived().AlwaysRebuild())
10582 return RebuildOMPPermutationClause(TransformedArgs,
C->getBeginLoc(),
10583 C->getLParenLoc(),
C->getEndLoc());
10586template <
typename Derived>
10588 if (!getDerived().AlwaysRebuild())
10590 return RebuildOMPFullClause(
C->getBeginLoc(),
C->getEndLoc());
10593template <
typename Derived>
10596 ExprResult T = getDerived().TransformExpr(
C->getFactor());
10599 Expr *Factor =
T.get();
10600 bool Changed = Factor !=
C->getFactor();
10602 if (!Changed && !getDerived().AlwaysRebuild())
10604 return RebuildOMPPartialClause(Factor,
C->getBeginLoc(),
C->getLParenLoc(),
10608template <
typename Derived>
10611 ExprResult F = getDerived().TransformExpr(
C->getFirst());
10615 ExprResult Cn = getDerived().TransformExpr(
C->getCount());
10616 if (Cn.isInvalid())
10620 Expr *Count = Cn.get();
10622 bool Changed = (
First !=
C->getFirst()) || (Count !=
C->getCount());
10625 if (!Changed && !getDerived().AlwaysRebuild())
10628 return RebuildOMPLoopRangeClause(
First, Count,
C->getBeginLoc(),
10629 C->getLParenLoc(),
C->getFirstLoc(),
10630 C->getCountLoc(),
C->getEndLoc());
10633template <
typename Derived>
10636 ExprResult E = getDerived().TransformExpr(
C->getNumForLoops());
10639 return getDerived().RebuildOMPCollapseClause(
10640 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10643template <
typename Derived>
10647 C->getDefaultKind(),
C->getDefaultKindKwLoc(),
C->getDefaultVC(),
10648 C->getDefaultVCLoc(),
C->getBeginLoc(),
C->getLParenLoc(),
10652template <
typename Derived>
10659template <
typename Derived>
10663 C->getProcBindKind(),
C->getProcBindKindKwLoc(),
C->getBeginLoc(),
10664 C->getLParenLoc(),
C->getEndLoc());
10667template <
typename Derived>
10670 ExprResult E = getDerived().TransformExpr(
C->getChunkSize());
10673 return getDerived().RebuildOMPScheduleClause(
10674 C->getFirstScheduleModifier(),
C->getSecondScheduleModifier(),
10675 C->getScheduleKind(), E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
10676 C->getFirstScheduleModifierLoc(),
C->getSecondScheduleModifierLoc(),
10677 C->getScheduleKindLoc(),
C->getCommaLoc(),
C->getEndLoc());
10680template <
typename Derived>
10684 if (
auto *
Num =
C->getNumForLoops()) {
10685 E = getDerived().TransformExpr(
Num);
10689 return getDerived().RebuildOMPOrderedClause(
C->getBeginLoc(),
C->getEndLoc(),
10690 C->getLParenLoc(), E.get());
10693template <
typename Derived>
10697 if (
Expr *Evt =
C->getEventHandler()) {
10698 E = getDerived().TransformExpr(Evt);
10702 return getDerived().RebuildOMPDetachClause(E.get(),
C->getBeginLoc(),
10703 C->getLParenLoc(),
C->getEndLoc());
10706template <
typename Derived>
10712 if (
Cond.isInvalid())
10715 return getDerived().RebuildOMPNowaitClause(
Cond.get(),
C->getBeginLoc(),
10716 C->getLParenLoc(),
C->getEndLoc());
10719template <
typename Derived>
10726template <
typename Derived>
10733template <
typename Derived>
10739template <
typename Derived>
10745template <
typename Derived>
10752template <
typename Derived>
10759template <
typename Derived>
10766template <
typename Derived>
10772template <
typename Derived>
10778template <
typename Derived>
10780 ExprResult E = getDerived().TransformExpr(
C->getExpr());
10783 return getDerived().RebuildOMPHoldsClause(E.get(),
C->getBeginLoc(),
10784 C->getLParenLoc(),
C->getEndLoc());
10787template <
typename Derived>
10793template <
typename Derived>
10798template <
typename Derived>
10803template <
typename Derived>
10808template <
typename Derived>
10814template <
typename Derived>
10821template <
typename Derived>
10828template <
typename Derived>
10835template <
typename Derived>
10842template <
typename Derived>
10849template <
typename Derived>
10855template <
typename Derived>
10862template <
typename Derived>
10868template <
typename Derived>
10875template <
typename Derived>
10877 ExprResult IVR = getDerived().TransformExpr(
C->getInteropVar());
10878 if (IVR.isInvalid())
10882 InteropInfo.PreferTypes.reserve(
C->varlist_size() - 1);
10883 for (
Expr *E : llvm::drop_begin(
C->varlist())) {
10885 if (ER.isInvalid())
10887 InteropInfo.PreferTypes.push_back(ER.get());
10889 return getDerived().RebuildOMPInitClause(IVR.get(), InteropInfo,
10890 C->getBeginLoc(),
C->getLParenLoc(),
10891 C->getVarLoc(),
C->getEndLoc());
10894template <
typename Derived>
10896 ExprResult ER = getDerived().TransformExpr(
C->getInteropVar());
10897 if (ER.isInvalid())
10899 return getDerived().RebuildOMPUseClause(ER.get(),
C->getBeginLoc(),
10900 C->getLParenLoc(),
C->getVarLoc(),
10904template <
typename Derived>
10908 if (
Expr *IV =
C->getInteropVar()) {
10909 ER = getDerived().TransformExpr(IV);
10910 if (ER.isInvalid())
10913 return getDerived().RebuildOMPDestroyClause(ER.get(),
C->getBeginLoc(),
10914 C->getLParenLoc(),
C->getVarLoc(),
10918template <
typename Derived>
10922 if (
Cond.isInvalid())
10924 return getDerived().RebuildOMPNovariantsClause(
10925 Cond.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10928template <
typename Derived>
10932 if (
Cond.isInvalid())
10934 return getDerived().RebuildOMPNocontextClause(
10935 Cond.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10938template <
typename Derived>
10941 ExprResult ThreadID = getDerived().TransformExpr(
C->getThreadID());
10942 if (ThreadID.isInvalid())
10944 return getDerived().RebuildOMPFilterClause(ThreadID.get(),
C->getBeginLoc(),
10945 C->getLParenLoc(),
C->getEndLoc());
10948template <
typename Derived>
10950 ExprResult E = getDerived().TransformExpr(
C->getAlignment());
10953 return getDerived().RebuildOMPAlignClause(E.get(),
C->getBeginLoc(),
10954 C->getLParenLoc(),
C->getEndLoc());
10957template <
typename Derived>
10960 llvm_unreachable(
"unified_address clause cannot appear in dependent context");
10963template <
typename Derived>
10967 "unified_shared_memory clause cannot appear in dependent context");
10970template <
typename Derived>
10973 llvm_unreachable(
"reverse_offload clause cannot appear in dependent context");
10976template <
typename Derived>
10980 "dynamic_allocators clause cannot appear in dependent context");
10983template <
typename Derived>
10987 "atomic_default_mem_order clause cannot appear in dependent context");
10990template <
typename Derived>
10993 llvm_unreachable(
"self_maps clause cannot appear in dependent context");
10996template <
typename Derived>
10999 C->getBeginLoc(),
C->getLParenLoc(),
11003template <
typename Derived>
11007 C->getSeverityKind(),
C->getSeverityKindKwLoc(),
C->getBeginLoc(),
11008 C->getLParenLoc(),
C->getEndLoc());
11011template <
typename Derived>
11014 ExprResult E = getDerived().TransformExpr(
C->getMessageString());
11017 return getDerived().RebuildOMPMessageClause(
11018 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11021template <
typename Derived>
11025 Vars.reserve(
C->varlist_size());
11026 for (
auto *
VE :
C->varlist()) {
11028 if (EVar.isInvalid())
11030 Vars.push_back(EVar.get());
11032 return getDerived().RebuildOMPPrivateClause(
11033 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11036template <
typename Derived>
11040 Vars.reserve(
C->varlist_size());
11041 for (
auto *
VE :
C->varlist()) {
11043 if (EVar.isInvalid())
11045 Vars.push_back(EVar.get());
11047 return getDerived().RebuildOMPFirstprivateClause(
11048 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11051template <
typename Derived>
11055 Vars.reserve(
C->varlist_size());
11056 for (
auto *
VE :
C->varlist()) {
11058 if (EVar.isInvalid())
11060 Vars.push_back(EVar.get());
11062 return getDerived().RebuildOMPLastprivateClause(
11063 Vars,
C->getKind(),
C->getKindLoc(),
C->getColonLoc(),
C->getBeginLoc(),
11064 C->getLParenLoc(),
C->getEndLoc());
11067template <
typename Derived>
11071 Vars.reserve(
C->varlist_size());
11072 for (
auto *
VE :
C->varlist()) {
11074 if (EVar.isInvalid())
11076 Vars.push_back(EVar.get());
11078 return getDerived().RebuildOMPSharedClause(Vars,
C->getBeginLoc(),
11079 C->getLParenLoc(),
C->getEndLoc());
11082template <
typename Derived>
11086 Vars.reserve(
C->varlist_size());
11087 for (
auto *
VE :
C->varlist()) {
11089 if (EVar.isInvalid())
11091 Vars.push_back(EVar.get());
11094 ReductionIdScopeSpec.
Adopt(
C->getQualifierLoc());
11097 if (NameInfo.getName()) {
11098 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
11099 if (!NameInfo.getName())
11105 for (
auto *E :
C->reduction_ops()) {
11110 for (
auto *D : ULE->decls()) {
11113 Decls.addDecl(InstD, InstD->getAccess());
11117 ReductionIdScopeSpec.getWithLocInContext(SemaRef.
Context), NameInfo,
11118 true, Decls.begin(), Decls.end(),
11121 UnresolvedReductions.push_back(
nullptr);
11123 return getDerived().RebuildOMPReductionClause(
11124 Vars,
C->getModifier(),
C->getOriginalSharingModifier(),
C->getBeginLoc(),
11125 C->getLParenLoc(),
C->getModifierLoc(),
C->getColonLoc(),
C->getEndLoc(),
11126 ReductionIdScopeSpec, NameInfo, UnresolvedReductions);
11129template <
typename Derived>
11133 Vars.reserve(
C->varlist_size());
11134 for (
auto *
VE :
C->varlist()) {
11136 if (EVar.isInvalid())
11138 Vars.push_back(EVar.get());
11141 ReductionIdScopeSpec.
Adopt(
C->getQualifierLoc());
11144 if (NameInfo.getName()) {
11145 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
11146 if (!NameInfo.getName())
11152 for (
auto *E :
C->reduction_ops()) {
11157 for (
auto *D : ULE->decls()) {
11160 Decls.addDecl(InstD, InstD->getAccess());
11164 ReductionIdScopeSpec.getWithLocInContext(SemaRef.
Context), NameInfo,
11165 true, Decls.begin(), Decls.end(),
11168 UnresolvedReductions.push_back(
nullptr);
11170 return getDerived().RebuildOMPTaskReductionClause(
11171 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getColonLoc(),
11172 C->getEndLoc(), ReductionIdScopeSpec, NameInfo, UnresolvedReductions);
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());
11187 ReductionIdScopeSpec.
Adopt(
C->getQualifierLoc());
11190 if (NameInfo.getName()) {
11191 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
11192 if (!NameInfo.getName())
11198 for (
auto *E :
C->reduction_ops()) {
11203 for (
auto *D : ULE->decls()) {
11206 Decls.addDecl(InstD, InstD->getAccess());
11210 ReductionIdScopeSpec.getWithLocInContext(SemaRef.
Context), NameInfo,
11211 true, Decls.begin(), Decls.end(),
11214 UnresolvedReductions.push_back(
nullptr);
11216 return getDerived().RebuildOMPInReductionClause(
11217 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getColonLoc(),
11218 C->getEndLoc(), ReductionIdScopeSpec, NameInfo, UnresolvedReductions);
11221template <
typename Derived>
11225 Vars.reserve(
C->varlist_size());
11226 for (
auto *
VE :
C->varlist()) {
11228 if (EVar.isInvalid())
11230 Vars.push_back(EVar.get());
11232 ExprResult Step = getDerived().TransformExpr(
C->getStep());
11233 if (Step.isInvalid())
11235 return getDerived().RebuildOMPLinearClause(
11236 Vars, Step.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getModifier(),
11237 C->getModifierLoc(),
C->getColonLoc(),
C->getStepModifierLoc(),
11241template <
typename Derived>
11245 Vars.reserve(
C->varlist_size());
11246 for (
auto *
VE :
C->varlist()) {
11248 if (EVar.isInvalid())
11250 Vars.push_back(EVar.get());
11252 ExprResult Alignment = getDerived().TransformExpr(
C->getAlignment());
11253 if (Alignment.isInvalid())
11255 return getDerived().RebuildOMPAlignedClause(
11256 Vars, Alignment.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11257 C->getColonLoc(),
C->getEndLoc());
11260template <
typename Derived>
11264 Vars.reserve(
C->varlist_size());
11265 for (
auto *
VE :
C->varlist()) {
11267 if (EVar.isInvalid())
11269 Vars.push_back(EVar.get());
11271 return getDerived().RebuildOMPCopyinClause(Vars,
C->getBeginLoc(),
11272 C->getLParenLoc(),
C->getEndLoc());
11275template <
typename Derived>
11279 Vars.reserve(
C->varlist_size());
11280 for (
auto *
VE :
C->varlist()) {
11282 if (EVar.isInvalid())
11284 Vars.push_back(EVar.get());
11286 return getDerived().RebuildOMPCopyprivateClause(
11287 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11290template <
typename Derived>
11293 Vars.reserve(
C->varlist_size());
11294 for (
auto *
VE :
C->varlist()) {
11296 if (EVar.isInvalid())
11298 Vars.push_back(EVar.get());
11300 return getDerived().RebuildOMPFlushClause(Vars,
C->getBeginLoc(),
11301 C->getLParenLoc(),
C->getEndLoc());
11304template <
typename Derived>
11307 ExprResult E = getDerived().TransformExpr(
C->getDepobj());
11310 return getDerived().RebuildOMPDepobjClause(E.get(),
C->getBeginLoc(),
11311 C->getLParenLoc(),
C->getEndLoc());
11314template <
typename Derived>
11318 Expr *DepModifier =
C->getModifier();
11320 ExprResult DepModRes = getDerived().TransformExpr(DepModifier);
11321 if (DepModRes.isInvalid())
11323 DepModifier = DepModRes.get();
11325 Vars.reserve(
C->varlist_size());
11326 for (
auto *
VE :
C->varlist()) {
11328 if (EVar.isInvalid())
11330 Vars.push_back(EVar.get());
11332 return getDerived().RebuildOMPDependClause(
11333 {
C->getDependencyKind(),
C->getDependencyLoc(),
C->getColonLoc(),
11334 C->getOmpAllMemoryLoc()},
11335 DepModifier, Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11338template <
typename Derived>
11341 ExprResult E = getDerived().TransformExpr(
C->getDevice());
11344 return getDerived().RebuildOMPDeviceClause(
11345 C->getModifier(), E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11346 C->getModifierLoc(),
C->getEndLoc());
11349template <
typename Derived,
class T>
11356 Vars.reserve(
C->varlist_size());
11357 for (
auto *
VE :
C->varlist()) {
11361 Vars.push_back(EVar.
get());
11365 if (
C->getMapperQualifierLoc()) {
11366 QualifierLoc = TT.
getDerived().TransformNestedNameSpecifierLoc(
11367 C->getMapperQualifierLoc());
11371 MapperIdScopeSpec.
Adopt(QualifierLoc);
11372 MapperIdInfo =
C->getMapperIdInfo();
11373 if (MapperIdInfo.
getName()) {
11374 MapperIdInfo = TT.
getDerived().TransformDeclarationNameInfo(MapperIdInfo);
11380 for (
auto *E :
C->mapperlists()) {
11385 for (
auto *D : ULE->decls()) {
11388 Decls.addDecl(InstD, InstD->
getAccess());
11393 MapperIdInfo,
true, Decls.begin(), Decls.end(),
11396 UnresolvedMappers.push_back(
nullptr);
11402template <
typename Derived>
11403OMPClause *TreeTransform<Derived>::TransformOMPMapClause(OMPMapClause *
C) {
11404 OMPVarListLocTy Locs(
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11406 Expr *IteratorModifier =
C->getIteratorModifier();
11407 if (IteratorModifier) {
11408 ExprResult MapModRes = getDerived().TransformExpr(IteratorModifier);
11409 if (MapModRes.isInvalid())
11411 IteratorModifier = MapModRes.
get();
11417 *
this,
C, Vars, MapperIdScopeSpec, MapperIdInfo, UnresolvedMappers))
11419 return getDerived().RebuildOMPMapClause(
11420 IteratorModifier,
C->getMapTypeModifiers(),
C->getMapTypeModifiersLoc(),
11421 MapperIdScopeSpec, MapperIdInfo,
C->getMapType(),
C->isImplicitMapType(),
11422 C->getMapLoc(),
C->getColonLoc(), Vars, Locs, UnresolvedMappers);
11425template <
typename Derived>
11428 Expr *Allocator =
C->getAllocator();
11430 ExprResult AllocatorRes = getDerived().TransformExpr(Allocator);
11431 if (AllocatorRes.isInvalid())
11433 Allocator = AllocatorRes.get();
11435 Expr *Alignment =
C->getAlignment();
11437 ExprResult AlignmentRes = getDerived().TransformExpr(Alignment);
11438 if (AlignmentRes.isInvalid())
11440 Alignment = AlignmentRes.get();
11443 Vars.reserve(
C->varlist_size());
11444 for (
auto *
VE :
C->varlist()) {
11446 if (EVar.isInvalid())
11448 Vars.push_back(EVar.get());
11450 return getDerived().RebuildOMPAllocateClause(
11451 Allocator, Alignment,
C->getFirstAllocateModifier(),
11452 C->getFirstAllocateModifierLoc(),
C->getSecondAllocateModifier(),
11453 C->getSecondAllocateModifierLoc(), Vars,
C->getBeginLoc(),
11454 C->getLParenLoc(),
C->getColonLoc(),
C->getEndLoc());
11457template <
typename Derived>
11461 Vars.reserve(
C->varlist_size());
11462 for (
auto *
VE :
C->varlist()) {
11464 if (EVar.isInvalid())
11466 Vars.push_back(EVar.get());
11468 return getDerived().RebuildOMPNumTeamsClause(
11469 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11472template <
typename Derived>
11476 Vars.reserve(
C->varlist_size());
11477 for (
auto *
VE :
C->varlist()) {
11479 if (EVar.isInvalid())
11481 Vars.push_back(EVar.get());
11483 return getDerived().RebuildOMPThreadLimitClause(
11484 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11487template <
typename Derived>
11490 ExprResult E = getDerived().TransformExpr(
C->getPriority());
11493 return getDerived().RebuildOMPPriorityClause(
11494 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11497template <
typename Derived>
11500 ExprResult E = getDerived().TransformExpr(
C->getGrainsize());
11503 return getDerived().RebuildOMPGrainsizeClause(
11504 C->getModifier(), E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11505 C->getModifierLoc(),
C->getEndLoc());
11508template <
typename Derived>
11511 ExprResult E = getDerived().TransformExpr(
C->getNumTasks());
11514 return getDerived().RebuildOMPNumTasksClause(
11515 C->getModifier(), E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11516 C->getModifierLoc(),
C->getEndLoc());
11519template <
typename Derived>
11521 ExprResult E = getDerived().TransformExpr(
C->getHint());
11524 return getDerived().RebuildOMPHintClause(E.get(),
C->getBeginLoc(),
11525 C->getLParenLoc(),
C->getEndLoc());
11528template <
typename Derived>
11531 ExprResult E = getDerived().TransformExpr(
C->getChunkSize());
11534 return getDerived().RebuildOMPDistScheduleClause(
11535 C->getDistScheduleKind(), E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11536 C->getDistScheduleKindLoc(),
C->getCommaLoc(),
C->getEndLoc());
11539template <
typename Derived>
11545 C->getDefaultmapKind(),
11548 C->getDefaultmapModifierLoc(),
11549 C->getDefaultmapKindLoc(),
11553template <
typename Derived>
11557 Expr *IteratorModifier =
C->getIteratorModifier();
11558 if (IteratorModifier) {
11559 ExprResult MapModRes = getDerived().TransformExpr(IteratorModifier);
11560 if (MapModRes.isInvalid())
11562 IteratorModifier = MapModRes.get();
11568 *
this,
C, Vars, MapperIdScopeSpec, MapperIdInfo, UnresolvedMappers))
11570 return getDerived().RebuildOMPToClause(
11571 C->getMotionModifiers(),
C->getMotionModifiersLoc(), IteratorModifier,
11572 MapperIdScopeSpec, MapperIdInfo,
C->getColonLoc(), Vars, Locs,
11573 UnresolvedMappers);
11576template <
typename Derived>
11580 Expr *IteratorModifier =
C->getIteratorModifier();
11581 if (IteratorModifier) {
11582 ExprResult MapModRes = getDerived().TransformExpr(IteratorModifier);
11583 if (MapModRes.isInvalid())
11585 IteratorModifier = MapModRes.get();
11591 *
this,
C, Vars, MapperIdScopeSpec, MapperIdInfo, UnresolvedMappers))
11593 return getDerived().RebuildOMPFromClause(
11594 C->getMotionModifiers(),
C->getMotionModifiersLoc(), IteratorModifier,
11595 MapperIdScopeSpec, MapperIdInfo,
C->getColonLoc(), Vars, Locs,
11596 UnresolvedMappers);
11599template <
typename Derived>
11603 Vars.reserve(
C->varlist_size());
11604 for (
auto *
VE :
C->varlist()) {
11606 if (EVar.isInvalid())
11608 Vars.push_back(EVar.get());
11611 return getDerived().RebuildOMPUseDevicePtrClause(Vars, Locs);
11614template <
typename Derived>
11618 Vars.reserve(
C->varlist_size());
11619 for (
auto *
VE :
C->varlist()) {
11621 if (EVar.isInvalid())
11623 Vars.push_back(EVar.get());
11626 return getDerived().RebuildOMPUseDeviceAddrClause(Vars, Locs);
11629template <
typename Derived>
11633 Vars.reserve(
C->varlist_size());
11634 for (
auto *
VE :
C->varlist()) {
11636 if (EVar.isInvalid())
11638 Vars.push_back(EVar.get());
11641 return getDerived().RebuildOMPIsDevicePtrClause(Vars, Locs);
11644template <
typename Derived>
11648 Vars.reserve(
C->varlist_size());
11649 for (
auto *
VE :
C->varlist()) {
11651 if (EVar.isInvalid())
11653 Vars.push_back(EVar.get());
11656 return getDerived().RebuildOMPHasDeviceAddrClause(Vars, Locs);
11659template <
typename Derived>
11663 Vars.reserve(
C->varlist_size());
11664 for (
auto *
VE :
C->varlist()) {
11666 if (EVar.isInvalid())
11668 Vars.push_back(EVar.get());
11670 return getDerived().RebuildOMPNontemporalClause(
11671 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11674template <
typename Derived>
11678 Vars.reserve(
C->varlist_size());
11679 for (
auto *
VE :
C->varlist()) {
11681 if (EVar.isInvalid())
11683 Vars.push_back(EVar.get());
11685 return getDerived().RebuildOMPInclusiveClause(
11686 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11689template <
typename Derived>
11693 Vars.reserve(
C->varlist_size());
11694 for (
auto *
VE :
C->varlist()) {
11696 if (EVar.isInvalid())
11698 Vars.push_back(EVar.get());
11700 return getDerived().RebuildOMPExclusiveClause(
11701 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11704template <
typename Derived>
11708 Data.reserve(
C->getNumberOfAllocators());
11709 for (
unsigned I = 0, E =
C->getNumberOfAllocators(); I < E; ++I) {
11711 ExprResult Allocator = getDerived().TransformExpr(D.Allocator);
11712 if (Allocator.isInvalid())
11715 if (
Expr *AT = D.AllocatorTraits) {
11716 AllocatorTraits = getDerived().TransformExpr(AT);
11717 if (AllocatorTraits.isInvalid())
11721 NewD.Allocator = Allocator.get();
11722 NewD.AllocatorTraits = AllocatorTraits.get();
11723 NewD.LParenLoc = D.LParenLoc;
11724 NewD.RParenLoc = D.RParenLoc;
11726 return getDerived().RebuildOMPUsesAllocatorsClause(
11727 Data,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11730template <
typename Derived>
11734 Locators.reserve(
C->varlist_size());
11736 if (
Expr *Modifier =
C->getModifier()) {
11737 ModifierRes = getDerived().TransformExpr(Modifier);
11738 if (ModifierRes.isInvalid())
11741 for (
Expr *E :
C->varlist()) {
11742 ExprResult Locator = getDerived().TransformExpr(E);
11743 if (Locator.isInvalid())
11745 Locators.push_back(Locator.get());
11747 return getDerived().RebuildOMPAffinityClause(
11748 C->getBeginLoc(),
C->getLParenLoc(),
C->getColonLoc(),
C->getEndLoc(),
11749 ModifierRes.get(), Locators);
11752template <
typename Derived>
11755 C->getKind(),
C->getKindKwLoc(),
C->getBeginLoc(),
C->getLParenLoc(),
11756 C->getEndLoc(),
C->getModifier(),
C->getModifierKwLoc());
11759template <
typename Derived>
11762 C->getBindKind(),
C->getBindKindLoc(),
C->getBeginLoc(),
11763 C->getLParenLoc(),
C->getEndLoc());
11766template <
typename Derived>
11770 if (
Size.isInvalid())
11772 return getDerived().RebuildOMPXDynCGroupMemClause(
11773 Size.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11776template <
typename Derived>
11780 if (
Size.isInvalid())
11782 return getDerived().RebuildOMPDynGroupprivateClause(
11783 C->getDynGroupprivateModifier(),
C->getDynGroupprivateFallbackModifier(),
11784 Size.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11785 C->getDynGroupprivateModifierLoc(),
11786 C->getDynGroupprivateFallbackModifierLoc(),
C->getEndLoc());
11789template <
typename Derived>
11793 Vars.reserve(
C->varlist_size());
11794 for (
auto *
VE :
C->varlist()) {
11796 if (EVar.isInvalid())
11798 Vars.push_back(EVar.get());
11800 return getDerived().RebuildOMPDoacrossClause(
11801 C->getDependenceType(),
C->getDependenceLoc(),
C->getColonLoc(), Vars,
11802 C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11805template <
typename Derived>
11809 for (
auto *A :
C->getAttrs())
11810 NewAttrs.push_back(getDerived().TransformAttr(A));
11811 return getDerived().RebuildOMPXAttributeClause(
11812 NewAttrs,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11815template <
typename Derived>
11824template <
typename Derived>
11825class OpenACCClauseTransform final
11827 TreeTransform<Derived> &Self;
11828 ArrayRef<const OpenACCClause *> ExistingClauses;
11829 SemaOpenACC::OpenACCParsedClause &ParsedClause;
11830 OpenACCClause *NewClause =
nullptr;
11833 ExprResult Res = Self.TransformExpr(VarRef);
11835 if (!Res.isUsable())
11838 Res = Self.getSema().OpenACC().ActOnVar(ParsedClause.getDirectiveKind(),
11839 ParsedClause.getClauseKind(),
11845 llvm::SmallVector<Expr *> VisitVarList(ArrayRef<Expr *> VarList) {
11846 llvm::SmallVector<Expr *> InstantiatedVarList;
11847 for (Expr *CurVar : VarList) {
11850 if (VarRef.isUsable())
11851 InstantiatedVarList.push_back(VarRef.get());
11854 return InstantiatedVarList;
11858 OpenACCClauseTransform(TreeTransform<Derived> &Self,
11859 ArrayRef<const OpenACCClause *> ExistingClauses,
11860 SemaOpenACC::OpenACCParsedClause &PC)
11861 : Self(Self), ExistingClauses(ExistingClauses), ParsedClause(PC) {}
11863 OpenACCClause *CreatedClause()
const {
return NewClause; }
11865#define VISIT_CLAUSE(CLAUSE_NAME) \
11866 void Visit##CLAUSE_NAME##Clause(const OpenACC##CLAUSE_NAME##Clause &Clause);
11867#include "clang/Basic/OpenACCClauses.def"
11870template <
typename Derived>
11871void OpenACCClauseTransform<Derived>::VisitDefaultClause(
11873 ParsedClause.setDefaultDetails(
C.getDefaultClauseKind());
11876 Self.getSema().getASTContext(), ParsedClause.getDefaultClauseKind(),
11877 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
11878 ParsedClause.getEndLoc());
11881template <
typename Derived>
11882void OpenACCClauseTransform<Derived>::VisitIfClause(
const OpenACCIfClause &
C) {
11884 assert(
Cond &&
"If constructed with invalid Condition");
11888 if (Res.isInvalid() || !Res.get().second)
11891 ParsedClause.setConditionDetails(Res.get().second);
11894 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
11895 ParsedClause.getLParenLoc(), ParsedClause.getConditionExpr(),
11896 ParsedClause.getEndLoc());
11899template <
typename Derived>
11900void OpenACCClauseTransform<Derived>::VisitSelfClause(
11906 for (
Expr *CurVar :
C.getVarList()) {
11909 if (!Res.isUsable())
11912 Res =
Self.getSema().OpenACC().ActOnVar(ParsedClause.getDirectiveKind(),
11913 ParsedClause.getClauseKind(),
11916 if (Res.isUsable())
11917 InstantiatedVarList.push_back(Res.get());
11920 ParsedClause.setVarListDetails(InstantiatedVarList,
11924 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
11925 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
11926 ParsedClause.getEndLoc());
11929 if (
C.hasConditionExpr()) {
11932 Self.TransformCondition(
Cond->getExprLoc(),
nullptr,
Cond,
11935 if (Res.isInvalid() || !Res.get().second)
11938 ParsedClause.setConditionDetails(Res.get().second);
11942 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
11943 ParsedClause.getLParenLoc(), ParsedClause.getConditionExpr(),
11944 ParsedClause.getEndLoc());
11948template <
typename Derived>
11949void OpenACCClauseTransform<Derived>::VisitNumGangsClause(
11953 for (
Expr *CurIntExpr :
C.getIntExprs()) {
11956 if (!Res.isUsable())
11961 C.getBeginLoc(), Res.get());
11962 if (!Res.isUsable())
11965 InstantiatedIntExprs.push_back(Res.get());
11968 ParsedClause.setIntExprDetails(InstantiatedIntExprs);
11970 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
11971 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs(),
11972 ParsedClause.getEndLoc());
11975template <
typename Derived>
11976void OpenACCClauseTransform<Derived>::VisitPrivateClause(
11981 for (
const auto [RefExpr, InitRecipe] :
11982 llvm::zip(
C.getVarList(),
C.getInitRecipes())) {
11985 if (VarRef.isUsable()) {
11986 InstantiatedVarList.push_back(VarRef.get());
11990 if (InitRecipe.isSet())
11991 InitRecipes.push_back(InitRecipe);
11993 InitRecipes.push_back(
11994 Self.getSema().OpenACC().CreatePrivateInitRecipe(VarRef.get()));
11997 ParsedClause.setVarListDetails(InstantiatedVarList,
12001 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12002 ParsedClause.getLParenLoc(), ParsedClause.getVarList(), InitRecipes,
12003 ParsedClause.getEndLoc());
12006template <
typename Derived>
12007void OpenACCClauseTransform<Derived>::VisitHostClause(
12009 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12013 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12014 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12015 ParsedClause.getEndLoc());
12018template <
typename Derived>
12019void OpenACCClauseTransform<Derived>::VisitDeviceClause(
12021 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12025 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12026 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12027 ParsedClause.getEndLoc());
12030template <
typename Derived>
12031void OpenACCClauseTransform<Derived>::VisitFirstPrivateClause(
12036 for (
const auto [RefExpr, InitRecipe] :
12037 llvm::zip(
C.getVarList(),
C.getInitRecipes())) {
12040 if (VarRef.isUsable()) {
12041 InstantiatedVarList.push_back(VarRef.get());
12045 if (InitRecipe.isSet())
12046 InitRecipes.push_back(InitRecipe);
12048 InitRecipes.push_back(
12049 Self.getSema().OpenACC().CreateFirstPrivateInitRecipe(
12053 ParsedClause.setVarListDetails(InstantiatedVarList,
12057 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12058 ParsedClause.getLParenLoc(), ParsedClause.getVarList(), InitRecipes,
12059 ParsedClause.getEndLoc());
12062template <
typename Derived>
12063void OpenACCClauseTransform<Derived>::VisitNoCreateClause(
12065 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12069 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12070 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12071 ParsedClause.getEndLoc());
12074template <
typename Derived>
12075void OpenACCClauseTransform<Derived>::VisitPresentClause(
12077 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12081 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12082 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12083 ParsedClause.getEndLoc());
12086template <
typename Derived>
12087void OpenACCClauseTransform<Derived>::VisitCopyClause(
12089 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12090 C.getModifierList());
12093 Self.getSema().getASTContext(), ParsedClause.getClauseKind(),
12094 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12095 ParsedClause.getModifierList(), ParsedClause.getVarList(),
12096 ParsedClause.getEndLoc());
12099template <
typename Derived>
12100void OpenACCClauseTransform<Derived>::VisitLinkClause(
12102 llvm_unreachable(
"link clause not valid unless a decl transform");
12105template <
typename Derived>
12106void OpenACCClauseTransform<Derived>::VisitDeviceResidentClause(
12108 llvm_unreachable(
"device_resident clause not valid unless a decl transform");
12110template <
typename Derived>
12111void OpenACCClauseTransform<Derived>::VisitNoHostClause(
12113 llvm_unreachable(
"nohost clause not valid unless a decl transform");
12115template <
typename Derived>
12116void OpenACCClauseTransform<Derived>::VisitBindClause(
12118 llvm_unreachable(
"bind clause not valid unless a decl transform");
12121template <
typename Derived>
12122void OpenACCClauseTransform<Derived>::VisitCopyInClause(
12124 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12125 C.getModifierList());
12128 Self.getSema().getASTContext(), ParsedClause.getClauseKind(),
12129 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12130 ParsedClause.getModifierList(), ParsedClause.getVarList(),
12131 ParsedClause.getEndLoc());
12134template <
typename Derived>
12135void OpenACCClauseTransform<Derived>::VisitCopyOutClause(
12137 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12138 C.getModifierList());
12141 Self.getSema().getASTContext(), ParsedClause.getClauseKind(),
12142 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12143 ParsedClause.getModifierList(), ParsedClause.getVarList(),
12144 ParsedClause.getEndLoc());
12147template <
typename Derived>
12148void OpenACCClauseTransform<Derived>::VisitCreateClause(
12150 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12151 C.getModifierList());
12154 Self.getSema().getASTContext(), ParsedClause.getClauseKind(),
12155 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12156 ParsedClause.getModifierList(), ParsedClause.getVarList(),
12157 ParsedClause.getEndLoc());
12159template <
typename Derived>
12160void OpenACCClauseTransform<Derived>::VisitAttachClause(
12165 llvm::erase_if(VarList, [&](
Expr *E) {
12166 return Self.getSema().OpenACC().CheckVarIsPointerType(
12172 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12173 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12174 ParsedClause.getEndLoc());
12177template <
typename Derived>
12178void OpenACCClauseTransform<Derived>::VisitDetachClause(
12183 llvm::erase_if(VarList, [&](
Expr *E) {
12184 return Self.getSema().OpenACC().CheckVarIsPointerType(
12190 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12191 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12192 ParsedClause.getEndLoc());
12195template <
typename Derived>
12196void OpenACCClauseTransform<Derived>::VisitDeleteClause(
12198 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12201 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12202 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12203 ParsedClause.getEndLoc());
12206template <
typename Derived>
12207void OpenACCClauseTransform<Derived>::VisitUseDeviceClause(
12209 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12212 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12213 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12214 ParsedClause.getEndLoc());
12217template <
typename Derived>
12218void OpenACCClauseTransform<Derived>::VisitDevicePtrClause(
12223 llvm::erase_if(VarList, [&](
Expr *E) {
12224 return Self.getSema().OpenACC().CheckVarIsPointerType(
12230 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12231 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12232 ParsedClause.getEndLoc());
12235template <
typename Derived>
12236void OpenACCClauseTransform<Derived>::VisitNumWorkersClause(
12238 Expr *IntExpr =
const_cast<Expr *
>(
C.getIntExpr());
12239 assert(IntExpr &&
"num_workers clause constructed with invalid int expr");
12242 if (!Res.isUsable())
12247 C.getBeginLoc(), Res.get());
12248 if (!Res.isUsable())
12251 ParsedClause.setIntExprDetails(Res.get());
12253 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12254 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs()[0],
12255 ParsedClause.getEndLoc());
12258template <
typename Derived>
12259void OpenACCClauseTransform<Derived>::VisitDeviceNumClause (
12261 Expr *IntExpr =
const_cast<Expr *
>(
C.getIntExpr());
12262 assert(IntExpr &&
"device_num clause constructed with invalid int expr");
12265 if (!Res.isUsable())
12270 C.getBeginLoc(), Res.get());
12271 if (!Res.isUsable())
12274 ParsedClause.setIntExprDetails(Res.get());
12276 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12277 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs()[0],
12278 ParsedClause.getEndLoc());
12281template <
typename Derived>
12282void OpenACCClauseTransform<Derived>::VisitDefaultAsyncClause(
12284 Expr *IntExpr =
const_cast<Expr *
>(
C.getIntExpr());
12285 assert(IntExpr &&
"default_async clause constructed with invalid int expr");
12288 if (!Res.isUsable())
12293 C.getBeginLoc(), Res.get());
12294 if (!Res.isUsable())
12297 ParsedClause.setIntExprDetails(Res.get());
12299 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12300 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs()[0],
12301 ParsedClause.getEndLoc());
12304template <
typename Derived>
12305void OpenACCClauseTransform<Derived>::VisitVectorLengthClause(
12307 Expr *IntExpr =
const_cast<Expr *
>(
C.getIntExpr());
12308 assert(IntExpr &&
"vector_length clause constructed with invalid int expr");
12311 if (!Res.isUsable())
12316 C.getBeginLoc(), Res.get());
12317 if (!Res.isUsable())
12320 ParsedClause.setIntExprDetails(Res.get());
12322 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12323 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs()[0],
12324 ParsedClause.getEndLoc());
12327template <
typename Derived>
12328void OpenACCClauseTransform<Derived>::VisitAsyncClause(
12330 if (
C.hasIntExpr()) {
12332 if (!Res.isUsable())
12337 C.getBeginLoc(), Res.get());
12338 if (!Res.isUsable())
12340 ParsedClause.setIntExprDetails(Res.get());
12344 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12345 ParsedClause.getLParenLoc(),
12346 ParsedClause.getNumIntExprs() != 0 ? ParsedClause.getIntExprs()[0]
12348 ParsedClause.getEndLoc());
12351template <
typename Derived>
12352void OpenACCClauseTransform<Derived>::VisitWorkerClause(
12354 if (
C.hasIntExpr()) {
12359 if (!Res.isUsable())
12364 C.getBeginLoc(), Res.get());
12365 if (!Res.isUsable())
12367 ParsedClause.setIntExprDetails(Res.get());
12371 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12372 ParsedClause.getLParenLoc(),
12373 ParsedClause.getNumIntExprs() != 0 ? ParsedClause.getIntExprs()[0]
12375 ParsedClause.getEndLoc());
12378template <
typename Derived>
12379void OpenACCClauseTransform<Derived>::VisitVectorClause(
12381 if (
C.hasIntExpr()) {
12386 if (!Res.isUsable())
12391 C.getBeginLoc(), Res.get());
12392 if (!Res.isUsable())
12394 ParsedClause.setIntExprDetails(Res.get());
12398 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12399 ParsedClause.getLParenLoc(),
12400 ParsedClause.getNumIntExprs() != 0 ? ParsedClause.getIntExprs()[0]
12402 ParsedClause.getEndLoc());
12405template <
typename Derived>
12406void OpenACCClauseTransform<Derived>::VisitWaitClause(
12408 if (
C.hasExprs()) {
12409 Expr *DevNumExpr =
nullptr;
12413 if (
C.getDevNumExpr()) {
12415 if (!Res.isUsable())
12419 C.getBeginLoc(), Res.get());
12420 if (!Res.isUsable())
12423 DevNumExpr = Res.get();
12427 for (
Expr *CurQueueIdExpr :
C.getQueueIdExprs()) {
12429 if (!Res.isUsable())
12433 C.getBeginLoc(), Res.get());
12434 if (!Res.isUsable())
12437 InstantiatedQueueIdExprs.push_back(Res.get());
12440 ParsedClause.setWaitDetails(DevNumExpr,
C.getQueuesLoc(),
12441 std::move(InstantiatedQueueIdExprs));
12445 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12446 ParsedClause.getLParenLoc(), ParsedClause.getDevNumExpr(),
12447 ParsedClause.getQueuesLoc(), ParsedClause.getQueueIdExprs(),
12448 ParsedClause.getEndLoc());
12451template <
typename Derived>
12452void OpenACCClauseTransform<Derived>::VisitDeviceTypeClause(
12456 Self.getSema().getASTContext(),
C.getClauseKind(),
12457 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12458 C.getArchitectures(), ParsedClause.getEndLoc());
12461template <
typename Derived>
12462void OpenACCClauseTransform<Derived>::VisitAutoClause(
12466 ParsedClause.getBeginLoc(),
12467 ParsedClause.getEndLoc());
12470template <
typename Derived>
12471void OpenACCClauseTransform<Derived>::VisitIndependentClause(
12474 ParsedClause.getBeginLoc(),
12475 ParsedClause.getEndLoc());
12478template <
typename Derived>
12479void OpenACCClauseTransform<Derived>::VisitSeqClause(
12482 ParsedClause.getBeginLoc(),
12483 ParsedClause.getEndLoc());
12485template <
typename Derived>
12486void OpenACCClauseTransform<Derived>::VisitFinalizeClause(
12489 ParsedClause.getBeginLoc(),
12490 ParsedClause.getEndLoc());
12493template <
typename Derived>
12494void OpenACCClauseTransform<Derived>::VisitIfPresentClause(
12497 ParsedClause.getBeginLoc(),
12498 ParsedClause.getEndLoc());
12501template <
typename Derived>
12502void OpenACCClauseTransform<Derived>::VisitReductionClause(
12508 for (
const auto [Var, OrigRecipe] :
12509 llvm::zip(TransformedVars,
C.getRecipes())) {
12511 ParsedClause.getDirectiveKind(),
C.getReductionOp(), Var);
12512 if (Res.isUsable()) {
12513 ValidVars.push_back(Res.get());
12515 if (OrigRecipe.isSet())
12516 Recipes.emplace_back(OrigRecipe.AllocaDecl, OrigRecipe.CombinerRecipes);
12518 Recipes.push_back(
Self.getSema().OpenACC().CreateReductionInitRecipe(
12519 C.getReductionOp(), Res.get()));
12523 NewClause =
Self.getSema().OpenACC().CheckReductionClause(
12524 ExistingClauses, ParsedClause.getDirectiveKind(),
12525 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12526 C.getReductionOp(), ValidVars, Recipes, ParsedClause.getEndLoc());
12529template <
typename Derived>
12530void OpenACCClauseTransform<Derived>::VisitCollapseClause(
12532 Expr *LoopCount =
const_cast<Expr *
>(
C.getLoopCount());
12533 assert(LoopCount &&
"collapse clause constructed with invalid loop count");
12537 NewLoopCount =
Self.getSema().OpenACC().ActOnIntExpr(
12539 NewLoopCount.get()->getBeginLoc(), NewLoopCount.get());
12542 Self.getSema().OpenACC().CheckCollapseLoopCount(NewLoopCount.get());
12544 ParsedClause.setCollapseDetails(
C.hasForce(), NewLoopCount.get());
12546 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12547 ParsedClause.getLParenLoc(), ParsedClause.isForce(),
12548 ParsedClause.getLoopCount(), ParsedClause.getEndLoc());
12551template <
typename Derived>
12552void OpenACCClauseTransform<Derived>::VisitTileClause(
12557 for (
Expr *E :
C.getSizeExprs()) {
12560 if (!NewSizeExpr.isUsable())
12563 NewSizeExpr =
Self.getSema().OpenACC().ActOnIntExpr(
12565 NewSizeExpr.get()->getBeginLoc(), NewSizeExpr.get());
12567 NewSizeExpr =
Self.getSema().OpenACC().CheckTileSizeExpr(NewSizeExpr.get());
12569 if (!NewSizeExpr.isUsable())
12571 TransformedExprs.push_back(NewSizeExpr.get());
12574 ParsedClause.setIntExprDetails(TransformedExprs);
12576 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12577 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs(),
12578 ParsedClause.getEndLoc());
12580template <
typename Derived>
12581void OpenACCClauseTransform<Derived>::VisitGangClause(
12586 for (
unsigned I = 0; I <
C.getNumExprs(); ++I) {
12588 if (!ER.isUsable())
12591 ER =
Self.getSema().OpenACC().CheckGangExpr(ExistingClauses,
12592 ParsedClause.getDirectiveKind(),
12593 C.getExpr(I).first, ER.get());
12594 if (!ER.isUsable())
12596 TransformedGangKinds.push_back(
C.getExpr(I).first);
12597 TransformedIntExprs.push_back(ER.get());
12600 NewClause =
Self.getSema().OpenACC().CheckGangClause(
12601 ParsedClause.getDirectiveKind(), ExistingClauses,
12602 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12603 TransformedGangKinds, TransformedIntExprs, ParsedClause.getEndLoc());
12606template <
typename Derived>
12607OpenACCClause *TreeTransform<Derived>::TransformOpenACCClause(
12612 DirKind, OldClause->getClauseKind(), OldClause->getBeginLoc());
12613 ParsedClause.setEndLoc(OldClause->getEndLoc());
12615 if (
const auto *WithParms = dyn_cast<OpenACCClauseWithParams>(OldClause))
12616 ParsedClause.setLParenLoc(WithParms->getLParenLoc());
12618 OpenACCClauseTransform<Derived> Transform{*
this, ExistingClauses,
12620 Transform.Visit(OldClause);
12622 return Transform.CreatedClause();
12625template <
typename Derived>
12627TreeTransform<Derived>::TransformOpenACCClauseList(
12630 for (
const auto *Clause : OldClauses) {
12631 if (
OpenACCClause *TransformedClause = getDerived().TransformOpenACCClause(
12632 TransformedClauses, DirKind, Clause))
12633 TransformedClauses.push_back(TransformedClause);
12635 return TransformedClauses;
12638template <
typename Derived>
12641 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12644 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12647 if (getSema().OpenACC().ActOnStartStmtDirective(
12648 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12653 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
12654 C->clauses(), TransformedClauses);
12655 StmtResult StrBlock = getDerived().TransformStmt(
C->getStructuredBlock());
12656 StrBlock = getSema().OpenACC().ActOnAssociatedStmt(
12657 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses, StrBlock);
12659 return getDerived().RebuildOpenACCComputeConstruct(
12660 C->getDirectiveKind(),
C->getBeginLoc(),
C->getDirectiveLoc(),
12661 C->getEndLoc(), TransformedClauses, StrBlock);
12664template <
typename Derived>
12668 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12671 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12674 if (getSema().OpenACC().ActOnStartStmtDirective(
12675 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12680 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
12681 C->clauses(), TransformedClauses);
12683 Loop = getSema().OpenACC().ActOnAssociatedStmt(
12684 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses,
Loop);
12686 return getDerived().RebuildOpenACCLoopConstruct(
12687 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12688 TransformedClauses,
Loop);
12691template <
typename Derived>
12693 OpenACCCombinedConstruct *
C) {
12694 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12697 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12700 if (getSema().OpenACC().ActOnStartStmtDirective(
12701 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12706 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
12707 C->clauses(), TransformedClauses);
12709 Loop = getSema().OpenACC().ActOnAssociatedStmt(
12710 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses,
Loop);
12712 return getDerived().RebuildOpenACCCombinedConstruct(
12713 C->getDirectiveKind(),
C->getBeginLoc(),
C->getDirectiveLoc(),
12714 C->getEndLoc(), TransformedClauses,
Loop);
12717template <
typename Derived>
12720 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12723 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12725 if (getSema().OpenACC().ActOnStartStmtDirective(
12726 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12730 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
12731 C->clauses(), TransformedClauses);
12732 StmtResult StrBlock = getDerived().TransformStmt(
C->getStructuredBlock());
12733 StrBlock = getSema().OpenACC().ActOnAssociatedStmt(
12734 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses, StrBlock);
12736 return getDerived().RebuildOpenACCDataConstruct(
12737 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12738 TransformedClauses, StrBlock);
12741template <
typename Derived>
12743 OpenACCEnterDataConstruct *
C) {
12744 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12747 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12749 if (getSema().OpenACC().ActOnStartStmtDirective(
12750 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12753 return getDerived().RebuildOpenACCEnterDataConstruct(
12754 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12755 TransformedClauses);
12758template <
typename Derived>
12760 OpenACCExitDataConstruct *
C) {
12761 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12764 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12766 if (getSema().OpenACC().ActOnStartStmtDirective(
12767 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12770 return getDerived().RebuildOpenACCExitDataConstruct(
12771 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12772 TransformedClauses);
12775template <
typename Derived>
12777 OpenACCHostDataConstruct *
C) {
12778 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12781 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12783 if (getSema().OpenACC().ActOnStartStmtDirective(
12784 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12788 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
12789 C->clauses(), TransformedClauses);
12790 StmtResult StrBlock = getDerived().TransformStmt(
C->getStructuredBlock());
12791 StrBlock = getSema().OpenACC().ActOnAssociatedStmt(
12792 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses, StrBlock);
12794 return getDerived().RebuildOpenACCHostDataConstruct(
12795 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12796 TransformedClauses, StrBlock);
12799template <
typename Derived>
12802 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12805 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12807 if (getSema().OpenACC().ActOnStartStmtDirective(
12808 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12811 return getDerived().RebuildOpenACCInitConstruct(
12812 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12813 TransformedClauses);
12816template <
typename Derived>
12818 OpenACCShutdownConstruct *
C) {
12819 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12822 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12824 if (getSema().OpenACC().ActOnStartStmtDirective(
12825 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12828 return getDerived().RebuildOpenACCShutdownConstruct(
12829 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12830 TransformedClauses);
12832template <
typename Derived>
12835 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12838 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12840 if (getSema().OpenACC().ActOnStartStmtDirective(
12841 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12844 return getDerived().RebuildOpenACCSetConstruct(
12845 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12846 TransformedClauses);
12849template <
typename Derived>
12851 OpenACCUpdateConstruct *
C) {
12852 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12855 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12857 if (getSema().OpenACC().ActOnStartStmtDirective(
12858 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12861 return getDerived().RebuildOpenACCUpdateConstruct(
12862 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12863 TransformedClauses);
12866template <
typename Derived>
12869 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12872 if (
C->hasDevNumExpr()) {
12873 DevNumExpr = getDerived().TransformExpr(
C->getDevNumExpr());
12875 if (DevNumExpr.isUsable())
12876 DevNumExpr = getSema().OpenACC().ActOnIntExpr(
12878 C->getBeginLoc(), DevNumExpr.get());
12883 for (
Expr *QE :
C->getQueueIdExprs()) {
12884 assert(QE &&
"Null queue id expr?");
12885 ExprResult NewEQ = getDerived().TransformExpr(QE);
12887 if (!NewEQ.isUsable())
12891 C->getBeginLoc(), NewEQ.get());
12892 if (NewEQ.isUsable())
12893 QueueIdExprs.push_back(NewEQ.get());
12897 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12900 if (getSema().OpenACC().ActOnStartStmtDirective(
12901 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12904 return getDerived().RebuildOpenACCWaitConstruct(
12905 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getLParenLoc(),
12906 DevNumExpr.isUsable() ? DevNumExpr.get() :
nullptr,
C->getQueuesLoc(),
12907 QueueIdExprs,
C->getRParenLoc(),
C->getEndLoc(), TransformedClauses);
12909template <
typename Derived>
12911 OpenACCCacheConstruct *
C) {
12912 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12915 for (
Expr *Var :
C->getVarList()) {
12916 assert(Var &&
"Null var listexpr?");
12918 ExprResult NewVar = getDerived().TransformExpr(Var);
12920 if (!NewVar.isUsable())
12923 NewVar = getSema().OpenACC().ActOnVar(
12925 if (!NewVar.isUsable())
12928 TransformedVarList.push_back(NewVar.get());
12931 if (getSema().OpenACC().ActOnStartStmtDirective(
C->getDirectiveKind(),
12932 C->getBeginLoc(), {}))
12935 return getDerived().RebuildOpenACCCacheConstruct(
12936 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getLParenLoc(),
12937 C->getReadOnlyLoc(), TransformedVarList,
C->getRParenLoc(),
12941template <
typename Derived>
12943 OpenACCAtomicConstruct *
C) {
12944 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12947 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12950 if (getSema().OpenACC().ActOnStartStmtDirective(
C->getDirectiveKind(),
12951 C->getBeginLoc(), {}))
12956 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(), {}, {});
12958 StmtResult AssocStmt = getDerived().TransformStmt(
C->getAssociatedStmt());
12959 AssocStmt = getSema().OpenACC().ActOnAssociatedStmt(
12960 C->getBeginLoc(),
C->getDirectiveKind(),
C->getAtomicKind(), {},
12963 return getDerived().RebuildOpenACCAtomicConstruct(
12964 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getAtomicKind(),
12965 C->getEndLoc(), TransformedClauses, AssocStmt);
12968template <
typename Derived>
12971 if (getDerived().AlwaysRebuild())
12980template<
typename Derived>
12983 return TransformExpr(E->getSubExpr());
12986template <
typename Derived>
12989 if (!E->isTypeDependent())
12992 TypeSourceInfo *NewT = getDerived().TransformType(E->getTypeSourceInfo());
12997 if (!getDerived().AlwaysRebuild() && E->getTypeSourceInfo() == NewT)
13000 return getDerived().RebuildSYCLUniqueStableNameExpr(
13001 E->getLocation(), E->getLParenLocation(), E->getRParenLocation(), NewT);
13004template<
typename Derived>
13007 if (!E->isTypeDependent())
13011 E->getIdentKind());
13014template<
typename Derived>
13018 if (E->getQualifierLoc()) {
13020 = getDerived().TransformNestedNameSpecifierLoc(E->getQualifierLoc());
13026 = cast_or_null<ValueDecl>(getDerived().TransformDecl(E->getLocation(),
13028 if (!ND || ND->isInvalidDecl())
13032 if (E->getFoundDecl() != E->getDecl()) {
13033 Found = cast_or_null<NamedDecl>(
13034 getDerived().TransformDecl(E->getLocation(), E->getFoundDecl()));
13040 if (NameInfo.getName()) {
13041 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
13042 if (!NameInfo.getName())
13046 if (!getDerived().AlwaysRebuild() &&
13047 !E->isCapturedByCopyInLambdaWithExplicitObjectParameter() &&
13048 QualifierLoc == E->getQualifierLoc() && ND == E->getDecl() &&
13049 Found == E->getFoundDecl() &&
13050 NameInfo.getName() == E->getDecl()->getDeclName() &&
13051 !E->hasExplicitTemplateArgs()) {
13061 if (E->hasExplicitTemplateArgs()) {
13062 TemplateArgs = &TransArgs;
13063 TransArgs.setLAngleLoc(E->getLAngleLoc());
13064 TransArgs.setRAngleLoc(E->getRAngleLoc());
13065 if (getDerived().TransformTemplateArguments(E->getTemplateArgs(),
13066 E->getNumTemplateArgs(),
13071 return getDerived().RebuildDeclRefExpr(QualifierLoc, ND, NameInfo,
13072 Found, TemplateArgs);
13075template<
typename Derived>
13081template <
typename Derived>
13087template<
typename Derived>
13093template<
typename Derived>
13099template<
typename Derived>
13105template<
typename Derived>
13111template<
typename Derived>
13114 return getDerived().TransformCallExpr(E);
13117template<
typename Derived>
13122 if (E->isExprPredicate())
13123 ControllingExpr = getDerived().TransformExpr(E->getControllingExpr());
13125 ControllingType = getDerived().TransformType(E->getControllingType());
13127 if (ControllingExpr.isInvalid() && !ControllingType)
13138 AssocTypes.push_back(AssocType);
13140 AssocTypes.push_back(
nullptr);
13144 getDerived().TransformExpr(Assoc.getAssociationExpr());
13145 if (AssocExpr.isInvalid())
13147 AssocExprs.push_back(AssocExpr.get());
13150 if (!ControllingType)
13151 return getDerived().RebuildGenericSelectionExpr(E->getGenericLoc(),
13152 E->getDefaultLoc(),
13154 ControllingExpr.get(),
13157 return getDerived().RebuildGenericSelectionExpr(
13158 E->getGenericLoc(), E->getDefaultLoc(), E->getRParenLoc(),
13159 ControllingType, AssocTypes, AssocExprs);
13162template<
typename Derived>
13165 ExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
13166 if (SubExpr.isInvalid())
13169 if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getSubExpr())
13172 return getDerived().RebuildParenExpr(SubExpr.get(), E->getLParen(),
13179template<
typename Derived>
13183 return getDerived().TransformDependentScopeDeclRefExpr(
13184 DRE,
true,
nullptr);
13186 return getDerived().TransformUnresolvedLookupExpr(
13192template<
typename Derived>
13197 SubExpr = TransformAddressOfOperand(E->
getSubExpr());
13203 if (!getDerived().AlwaysRebuild() && SubExpr.
get() == E->
getSubExpr())
13211template<
typename Derived>
13213TreeTransform<Derived>::TransformOffsetOfExpr(OffsetOfExpr *E) {
13215 TypeSourceInfo *Type = getDerived().TransformType(E->getTypeSourceInfo());
13225 bool ExprChanged =
false;
13226 typedef Sema::OffsetOfComponent Component;
13228 for (
unsigned I = 0, N = E->getNumComponents(); I != N; ++I) {
13229 const OffsetOfNode &ON = E->getComponent(I);
13231 Comp.isBrackets =
true;
13232 Comp.LocStart = ON.getSourceRange().getBegin();
13233 Comp.LocEnd = ON.getSourceRange().getEnd();
13234 switch (ON.getKind()) {
13236 Expr *FromIndex = E->getIndexExpr(ON.getArrayExprIndex());
13237 ExprResult Index = getDerived().TransformExpr(FromIndex);
13238 if (Index.isInvalid())
13241 ExprChanged = ExprChanged || Index.get() != FromIndex;
13242 Comp.isBrackets =
true;
13243 Comp.U.E = Index.get();
13249 Comp.isBrackets =
false;
13250 Comp.U.IdentInfo = ON.getFieldName();
13251 if (!
Comp.U.IdentInfo)
13261 Components.push_back(Comp);
13265 if (!getDerived().AlwaysRebuild() &&
13266 Type == E->getTypeSourceInfo() &&
13271 return getDerived().RebuildOffsetOfExpr(E->getOperatorLoc(),
Type,
13272 Components, E->getRParenLoc());
13275template<
typename Derived>
13278 assert((!E->getSourceExpr() || getDerived().AlreadyTransformed(E->getType())) &&
13279 "opaque value expression requires transformation");
13283template <
typename Derived>
13287 for (
Expr *
C : E->subExpressions()) {
13289 if (NewC.isInvalid())
13295 if (!getDerived().AlwaysRebuild() && !Changed)
13297 return getDerived().RebuildRecoveryExpr(E->getBeginLoc(), E->getEndLoc(),
13301template<
typename Derived>
13311 ExprResult result = getDerived().TransformExpr(newSyntacticForm);
13312 if (result.isInvalid())
return ExprError();
13317 if (result.get()->hasPlaceholderType(BuiltinType::PseudoObject))
13323template<
typename Derived>
13327 if (E->isArgumentType()) {
13334 if (!getDerived().AlwaysRebuild() && OldT == NewT)
13337 return getDerived().RebuildUnaryExprOrTypeTrait(NewT, E->getOperatorLoc(),
13339 E->getSourceRange());
13353 auto *PE = dyn_cast<ParenExpr>(E->getArgumentExpr());
13355 PE ? dyn_cast<DependentScopeDeclRefExpr>(PE->getSubExpr()) :
nullptr)
13356 SubExpr = getDerived().TransformParenDependentScopeDeclRefExpr(
13357 PE, DRE,
false, &RecoveryTSI);
13359 SubExpr = getDerived().TransformExpr(E->getArgumentExpr());
13362 return getDerived().RebuildUnaryExprOrTypeTrait(
13363 RecoveryTSI, E->getOperatorLoc(), E->getKind(), E->getSourceRange());
13364 }
else if (SubExpr.isInvalid())
13367 if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getArgumentExpr())
13370 return getDerived().RebuildUnaryExprOrTypeTrait(SubExpr.get(),
13371 E->getOperatorLoc(),
13373 E->getSourceRange());
13376template<
typename Derived>
13379 ExprResult LHS = getDerived().TransformExpr(E->getLHS());
13380 if (LHS.isInvalid())
13383 ExprResult RHS = getDerived().TransformExpr(E->getRHS());
13384 if (RHS.isInvalid())
13388 if (!getDerived().AlwaysRebuild() &&
13389 LHS.get() == E->getLHS() &&
13390 RHS.get() == E->getRHS())
13393 return getDerived().RebuildArraySubscriptExpr(
13395 E->getLHS()->getBeginLoc(), RHS.get(), E->getRBracketLoc());
13398template <
typename Derived>
13402 if (
Base.isInvalid())
13405 ExprResult RowIdx = getDerived().TransformExpr(E->getRowIdx());
13406 if (RowIdx.isInvalid())
13409 ExprResult ColumnIdx = getDerived().TransformExpr(E->getColumnIdx());
13410 if (ColumnIdx.isInvalid())
13413 if (!getDerived().AlwaysRebuild() &&
Base.get() == E->getBase() &&
13414 RowIdx.get() == E->getRowIdx() && ColumnIdx.get() == E->getColumnIdx())
13417 return getDerived().RebuildMatrixSubscriptExpr(
13418 Base.get(), RowIdx.get(), ColumnIdx.get(), E->getRBracketLoc());
13421template <
typename Derived>
13425 if (
Base.isInvalid())
13429 if (E->getLowerBound()) {
13430 LowerBound = getDerived().TransformExpr(E->getLowerBound());
13431 if (LowerBound.isInvalid())
13436 if (E->getLength()) {
13437 Length = getDerived().TransformExpr(E->getLength());
13438 if (Length.isInvalid())
13443 if (E->isOMPArraySection()) {
13444 if (
Expr *Str = E->getStride()) {
13445 Stride = getDerived().TransformExpr(Str);
13446 if (Stride.isInvalid())
13451 if (!getDerived().AlwaysRebuild() &&
Base.get() == E->getBase() &&
13452 LowerBound.get() == E->getLowerBound() &&
13453 Length.get() == E->getLength() &&
13454 (E->isOpenACCArraySection() || Stride.get() == E->getStride()))
13457 return getDerived().RebuildArraySectionExpr(
13458 E->isOMPArraySection(),
Base.get(), E->getBase()->getEndLoc(),
13459 LowerBound.get(), E->getColonLocFirst(),
13460 E->isOMPArraySection() ? E->getColonLocSecond() :
SourceLocation{},
13461 Length.get(), Stride.get(), E->getRBracketLoc());
13464template <
typename Derived>
13468 if (
Base.isInvalid())
13472 bool ErrorFound =
false;
13473 for (
Expr *
Dim : E->getDimensions()) {
13475 if (DimRes.isInvalid()) {
13479 Dims.push_back(DimRes.get());
13484 return getDerived().RebuildOMPArrayShapingExpr(
Base.get(), E->getLParenLoc(),
13485 E->getRParenLoc(), Dims,
13486 E->getBracketsRanges());
13489template <
typename Derived>
13492 unsigned NumIterators = E->numOfIterators();
13495 bool ErrorFound =
false;
13496 bool NeedToRebuild = getDerived().AlwaysRebuild();
13497 for (
unsigned I = 0; I < NumIterators; ++I) {
13499 Data[I].DeclIdent = D->getIdentifier();
13500 Data[I].DeclIdentLoc = D->getLocation();
13501 if (D->getLocation() == D->getBeginLoc()) {
13503 "Implicit type must be int.");
13505 TypeSourceInfo *TSI = getDerived().TransformType(D->getTypeSourceInfo());
13513 ErrorFound = ErrorFound ||
13514 !(!D->getTypeSourceInfo() || (
Data[I].
Type.getAsOpaquePtr() &&
13515 !
Data[I].Type.get().isNull())) ||
13516 Begin.isInvalid() || End.isInvalid() || Step.isInvalid();
13519 Data[I].Range.Begin = Begin.get();
13520 Data[I].Range.End = End.get();
13521 Data[I].Range.Step = Step.get();
13522 Data[I].AssignLoc = E->getAssignLoc(I);
13523 Data[I].ColonLoc = E->getColonLoc(I);
13524 Data[I].SecColonLoc = E->getSecondColonLoc(I);
13527 (D->getTypeSourceInfo() &&
Data[I].
Type.get().getTypePtrOrNull() !=
13528 D->getType().getTypePtrOrNull()) ||
13534 if (!NeedToRebuild)
13537 ExprResult Res = getDerived().RebuildOMPIteratorExpr(
13538 E->getIteratorKwLoc(), E->getLParenLoc(), E->getRParenLoc(),
Data);
13539 if (!Res.isUsable())
13542 for (
unsigned I = 0; I < NumIterators; ++I)
13543 getDerived().transformedLocalDecl(E->getIteratorDecl(I),
13544 IE->getIteratorDecl(I));
13548template<
typename Derived>
13557 bool ArgChanged =
false;
13559 if (getDerived().TransformExprs(E->getArgs(), E->getNumArgs(),
true, Args,
13563 if (!getDerived().AlwaysRebuild() &&
13564 Callee.get() == E->getCallee() &&
13570 = ((
Expr *)
Callee.get())->getSourceRange().getBegin();
13573 if (E->hasStoredFPFeatures()) {
13575 getSema().CurFPFeatures =
13577 getSema().FpPragmaStack.CurrentValue = NewOverrides;
13580 return getDerived().RebuildCallExpr(
Callee.get(), FakeLParenLoc,
13582 E->getRParenLoc());
13585template<
typename Derived>
13589 if (
Base.isInvalid())
13593 if (E->hasQualifier()) {
13595 = getDerived().TransformNestedNameSpecifierLoc(E->getQualifierLoc());
13603 = cast_or_null<ValueDecl>(getDerived().TransformDecl(E->getMemberLoc(),
13604 E->getMemberDecl()));
13608 NamedDecl *FoundDecl = E->getFoundDecl();
13609 if (FoundDecl == E->getMemberDecl()) {
13612 FoundDecl = cast_or_null<NamedDecl>(
13613 getDerived().TransformDecl(E->getMemberLoc(), FoundDecl));
13618 if (!getDerived().AlwaysRebuild() &&
13619 Base.get() == E->getBase() &&
13620 QualifierLoc == E->getQualifierLoc() &&
13621 Member == E->getMemberDecl() &&
13622 FoundDecl == E->getFoundDecl() &&
13623 !E->hasExplicitTemplateArgs()) {
13628 getSema().OpenMP().isOpenMPRebuildMemberExpr(
13638 if (E->hasExplicitTemplateArgs()) {
13639 TransArgs.setLAngleLoc(E->getLAngleLoc());
13640 TransArgs.setRAngleLoc(E->getRAngleLoc());
13641 if (getDerived().TransformTemplateArguments(E->getTemplateArgs(),
13642 E->getNumTemplateArgs(),
13655 NamedDecl *FirstQualifierInScope =
nullptr;
13657 if (MemberNameInfo.getName()) {
13658 MemberNameInfo = getDerived().TransformDeclarationNameInfo(MemberNameInfo);
13659 if (!MemberNameInfo.getName())
13663 return getDerived().RebuildMemberExpr(
Base.get(), FakeOperatorLoc,
13670 (E->hasExplicitTemplateArgs()
13671 ? &TransArgs :
nullptr),
13672 FirstQualifierInScope);
13675template<
typename Derived>
13678 ExprResult LHS = getDerived().TransformExpr(E->getLHS());
13679 if (LHS.isInvalid())
13683 getDerived().TransformInitializer(E->getRHS(),
false);
13684 if (RHS.isInvalid())
13687 if (!getDerived().AlwaysRebuild() &&
13688 LHS.get() == E->getLHS() &&
13689 RHS.get() == E->getRHS())
13692 if (E->isCompoundAssignmentOp())
13694 return getDerived().RebuildBinaryOperator(
13695 E->getOperatorLoc(), E->getOpcode(), LHS.get(), RHS.get());
13698 getSema().CurFPFeatures =
13699 NewOverrides.applyOverrides(getSema().getLangOpts());
13700 getSema().FpPragmaStack.CurrentValue = NewOverrides;
13701 return getDerived().RebuildBinaryOperator(E->getOperatorLoc(), E->getOpcode(),
13702 LHS.get(), RHS.get());
13705template <
typename Derived>
13710 ExprResult LHS = getDerived().TransformExpr(
const_cast<Expr*
>(Decomp.LHS));
13711 if (LHS.isInvalid())
13714 ExprResult RHS = getDerived().TransformExpr(
const_cast<Expr*
>(Decomp.RHS));
13715 if (RHS.isInvalid())
13721 bool ChangedAnyLookups =
false;
13722 Expr *PossibleBinOps[] = {E->getSemanticForm(),
13723 const_cast<Expr *
>(Decomp.InnerBinOp)};
13724 for (
Expr *PossibleBinOp : PossibleBinOps) {
13725 auto *Op = dyn_cast<CXXOperatorCallExpr>(PossibleBinOp->IgnoreImplicit());
13728 auto *
Callee = dyn_cast<DeclRefExpr>(Op->getCallee()->IgnoreImplicit());
13734 NamedDecl *
Found = cast_or_null<NamedDecl>(getDerived().TransformDecl(
13735 E->getOperatorLoc(),
Callee->getFoundDecl()));
13739 ChangedAnyLookups =
true;
13740 UnqualLookups.addDecl(
Found);
13743 if (!getDerived().AlwaysRebuild() && !ChangedAnyLookups &&
13744 LHS.get() == Decomp.LHS && RHS.get() == Decomp.RHS) {
13750 const Expr *StopAt[] = {Decomp.LHS, Decomp.RHS};
13755 return getDerived().RebuildCXXRewrittenBinaryOperator(
13756 E->getOperatorLoc(), Decomp.Opcode, UnqualLookups, LHS.get(), RHS.get());
13759template<
typename Derived>
13765 getSema().CurFPFeatures =
13766 NewOverrides.applyOverrides(getSema().getLangOpts());
13767 getSema().FpPragmaStack.CurrentValue = NewOverrides;
13768 return getDerived().TransformBinaryOperator(E);
13771template<
typename Derived>
13777 ExprResult commonExpr = getDerived().TransformExpr(e->getCommon());
13778 if (commonExpr.isInvalid())
13781 ExprResult rhs = getDerived().TransformExpr(e->getFalseExpr());
13782 if (rhs.isInvalid())
13785 if (!getDerived().AlwaysRebuild() &&
13786 commonExpr.get() == e->getCommon() &&
13787 rhs.get() == e->getFalseExpr())
13790 return getDerived().RebuildConditionalOperator(commonExpr.get(),
13791 e->getQuestionLoc(),
13797template<
typename Derived>
13801 if (
Cond.isInvalid())
13804 ExprResult LHS = getDerived().TransformExpr(E->getLHS());
13805 if (LHS.isInvalid())
13808 ExprResult RHS = getDerived().TransformExpr(E->getRHS());
13809 if (RHS.isInvalid())
13812 if (!getDerived().AlwaysRebuild() &&
13813 Cond.get() == E->getCond() &&
13814 LHS.get() == E->getLHS() &&
13815 RHS.get() == E->getRHS())
13818 return getDerived().RebuildConditionalOperator(
Cond.get(),
13819 E->getQuestionLoc(),
13825template<
typename Derived>
13830 return getDerived().
TransformExpr(E->getSubExprAsWritten());
13833template<
typename Derived>
13841 = getDerived().TransformExpr(E->getSubExprAsWritten());
13842 if (SubExpr.isInvalid())
13845 if (!getDerived().AlwaysRebuild() &&
13846 Type == E->getTypeInfoAsWritten() &&
13847 SubExpr.get() == E->getSubExpr())
13850 return getDerived().RebuildCStyleCastExpr(E->getLParenLoc(),
13856template<
typename Derived>
13864 ExprResult Init = getDerived().TransformExpr(E->getInitializer());
13865 if (
Init.isInvalid())
13868 if (!getDerived().AlwaysRebuild() &&
13870 Init.get() == E->getInitializer())
13877 return getDerived().RebuildCompoundLiteralExpr(
13878 E->getLParenLoc(), NewT,
13879 E->getInitializer()->getEndLoc(),
Init.get());
13882template<
typename Derived>
13886 if (
Base.isInvalid())
13889 if (!getDerived().AlwaysRebuild() &&
13890 Base.get() == E->getBase())
13896 return getDerived().RebuildExtVectorElementExpr(
13897 Base.get(), FakeOperatorLoc, E->isArrow(), E->getAccessorLoc(),
13901template<
typename Derived>
13907 bool InitChanged =
false;
13913 if (getDerived().TransformExprs(E->getInits(), E->getNumInits(),
false,
13914 Inits, &InitChanged))
13917 if (!getDerived().AlwaysRebuild() && !InitChanged) {
13924 return getDerived().RebuildInitList(E->getLBraceLoc(), Inits,
13925 E->getRBraceLoc());
13928template<
typename Derived>
13935 if (
Init.isInvalid())
13940 bool ExprChanged =
false;
13942 if (D.isFieldDesignator()) {
13943 if (D.getFieldDecl()) {
13945 getDerived().TransformDecl(D.getFieldLoc(), D.getFieldDecl()));
13946 if (Field != D.getFieldDecl())
13949 ExprChanged =
true;
13950 if (
Field->isAnonymousStructOrUnion())
13956 ExprChanged =
true;
13959 D.getFieldName(), D.getDotLoc(), D.getFieldLoc()));
13963 if (D.isArrayDesignator()) {
13964 ExprResult Index = getDerived().TransformExpr(E->getArrayIndex(D));
13965 if (Index.isInvalid())
13968 Desig.AddDesignator(
13971 ExprChanged = ExprChanged || Index.get() != E->getArrayIndex(D);
13972 ArrayExprs.push_back(Index.get());
13976 assert(D.isArrayRangeDesignator() &&
"New kind of designator?");
13978 = getDerived().TransformExpr(E->getArrayRangeStart(D));
13979 if (Start.isInvalid())
13982 ExprResult End = getDerived().TransformExpr(E->getArrayRangeEnd(D));
13983 if (End.isInvalid())
13987 Start.get(), End.get(), D.getLBracketLoc(), D.getEllipsisLoc()));
13989 ExprChanged = ExprChanged || Start.get() != E->getArrayRangeStart(D) ||
13990 End.get() != E->getArrayRangeEnd(D);
13992 ArrayExprs.push_back(Start.get());
13993 ArrayExprs.push_back(End.get());
13996 if (!getDerived().AlwaysRebuild() &&
13997 Init.get() == E->getInit() &&
14001 return getDerived().RebuildDesignatedInitExpr(Desig, ArrayExprs,
14002 E->getEqualOrColonLoc(),
14003 E->usesGNUSyntax(),
Init.get());
14008template<
typename Derived>
14012 llvm_unreachable(
"Unexpected DesignatedInitUpdateExpr in syntactic form of "
14017template<
typename Derived>
14021 llvm_unreachable(
"Unexpected NoInitExpr in syntactic form of initializer");
14025template<
typename Derived>
14028 llvm_unreachable(
"Unexpected ArrayInitLoopExpr outside of initializer");
14032template<
typename Derived>
14035 llvm_unreachable(
"Unexpected ArrayInitIndexExpr outside of initializer");
14039template<
typename Derived>
14047 QualType T = getDerived().TransformType(E->getType());
14051 if (!getDerived().AlwaysRebuild() &&
14055 return getDerived().RebuildImplicitValueInitExpr(
T);
14058template<
typename Derived>
14061 TypeSourceInfo *TInfo = getDerived().TransformType(E->getWrittenTypeInfo());
14065 ExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
14066 if (SubExpr.isInvalid())
14069 if (!getDerived().AlwaysRebuild() &&
14070 TInfo == E->getWrittenTypeInfo() &&
14071 SubExpr.get() == E->getSubExpr())
14074 return getDerived().RebuildVAArgExpr(E->getBuiltinLoc(), SubExpr.get(),
14075 TInfo, E->getRParenLoc());
14078template<
typename Derived>
14081 bool ArgumentChanged =
false;
14083 if (TransformExprs(E->getExprs(), E->getNumExprs(),
true, Inits,
14087 return getDerived().RebuildParenListExpr(E->getLParenLoc(),
14089 E->getRParenLoc());
14097template<
typename Derived>
14100 Decl *LD = getDerived().TransformDecl(E->getLabel()->getLocation(),
14105 return getDerived().RebuildAddrLabelExpr(E->getAmpAmpLoc(), E->getLabelLoc(),
14109template<
typename Derived>
14114 = getDerived().TransformCompoundStmt(E->getSubStmt(),
true);
14115 if (SubStmt.isInvalid()) {
14120 unsigned OldDepth = E->getTemplateDepth();
14121 unsigned NewDepth = getDerived().TransformTemplateDepth(OldDepth);
14123 if (!getDerived().AlwaysRebuild() && OldDepth == NewDepth &&
14124 SubStmt.get() == E->getSubStmt()) {
14130 return getDerived().RebuildStmtExpr(E->getLParenLoc(), SubStmt.get(),
14131 E->getRParenLoc(), NewDepth);
14134template<
typename Derived>
14138 if (
Cond.isInvalid())
14141 ExprResult LHS = getDerived().TransformExpr(E->getLHS());
14142 if (LHS.isInvalid())
14145 ExprResult RHS = getDerived().TransformExpr(E->getRHS());
14146 if (RHS.isInvalid())
14149 if (!getDerived().AlwaysRebuild() &&
14150 Cond.get() == E->getCond() &&
14151 LHS.get() == E->getLHS() &&
14152 RHS.get() == E->getRHS())
14155 return getDerived().RebuildChooseExpr(E->getBuiltinLoc(),
14156 Cond.get(), LHS.get(), RHS.get(),
14157 E->getRParenLoc());
14160template<
typename Derived>
14166template<
typename Derived>
14169 switch (E->getOperator()) {
14173 case OO_Array_Delete:
14174 llvm_unreachable(
"new and delete operators cannot use CXXOperatorCallExpr");
14179 assert(E->getNumArgs() >= 1 &&
"Object call is missing arguments");
14192 if (FakeLParenLoc.isInvalid() && EndLoc.isValid())
14193 FakeLParenLoc = EndLoc;
14197 if (getDerived().TransformExprs(E->getArgs() + 1, E->getNumArgs() - 1,
true,
14201 if (E->getOperator() == OO_Subscript)
14202 return getDerived().RebuildCxxSubscriptExpr(
Object.get(), FakeLParenLoc,
14203 Args, E->getEndLoc());
14205 return getDerived().RebuildCallExpr(
Object.get(), FakeLParenLoc, Args,
14209#define OVERLOADED_OPERATOR(Name, Spelling, Token, Unary, Binary, MemberOnly) \
14213#define OVERLOADED_OPERATOR_MULTI(Name,Spelling,Unary,Binary,MemberOnly)
14214#include "clang/Basic/OperatorKinds.def"
14216 case OO_Conditional:
14217 llvm_unreachable(
"conditional operator is not actually overloadable");
14221 llvm_unreachable(
"not an overloaded operator?");
14225 if (E->getNumArgs() == 1 && E->getOperator() == OO_Amp)
14226 First = getDerived().TransformAddressOfOperand(E->getArg(0));
14228 First = getDerived().TransformExpr(E->getArg(0));
14229 if (
First.isInvalid())
14233 if (E->getNumArgs() == 2) {
14235 getDerived().TransformInitializer(E->getArg(1),
false);
14236 if (Second.isInvalid())
14242 getSema().CurFPFeatures =
14243 NewOverrides.applyOverrides(getSema().getLangOpts());
14244 getSema().FpPragmaStack.CurrentValue = NewOverrides;
14248 LookupResult R(SemaRef, ULE->getName(), ULE->getNameLoc(),
14250 if (getDerived().TransformOverloadExprDecls(ULE, ULE->requiresADL(), R))
14253 return getDerived().RebuildCXXOperatorCallExpr(
14254 E->getOperator(), E->getOperatorLoc(),
Callee->getBeginLoc(),
14255 ULE->requiresADL(), R.asUnresolvedSet(),
First.get(), Second.get());
14260 Callee = ICE->getSubExprAsWritten();
14262 ValueDecl *VD = cast_or_null<ValueDecl>(
14263 getDerived().TransformDecl(DR->getLocation(), DR));
14268 Functions.addDecl(VD);
14270 return getDerived().RebuildCXXOperatorCallExpr(
14271 E->getOperator(), E->getOperatorLoc(),
Callee->getBeginLoc(),
14272 false, Functions,
First.get(), Second.get());
14275template<
typename Derived>
14278 return getDerived().TransformCallExpr(E);
14281template <
typename Derived>
14284 getSema().CurContext != E->getParentContext();
14286 if (!getDerived().AlwaysRebuild() && !NeedRebuildFunc)
14289 return getDerived().RebuildSourceLocExpr(E->getIdentKind(), E->getType(),
14290 E->getBeginLoc(), E->getEndLoc(),
14291 getSema().CurContext);
14294template <
typename Derived>
14299template<
typename Derived>
14308 ExprResult EC = getDerived().TransformCallExpr(E->getConfig());
14309 if (EC.isInvalid())
14313 bool ArgChanged =
false;
14315 if (getDerived().TransformExprs(E->getArgs(), E->getNumArgs(),
true, Args,
14319 if (!getDerived().AlwaysRebuild() &&
14320 Callee.get() == E->getCallee() &&
14326 = ((
Expr *)
Callee.get())->getSourceRange().getBegin();
14327 return getDerived().RebuildCallExpr(
Callee.get(), FakeLParenLoc,
14329 E->getRParenLoc(), EC.get());
14332template<
typename Derived>
14348 return getDerived().RebuildCXXNamedCastExpr(
14355template<
typename Derived>
14364 if (Sub.isInvalid())
14367 return getDerived().RebuildBuiltinBitCastExpr(BCE->
getBeginLoc(), TSI,
14371template<
typename Derived>
14373TreeTransform<Derived>::TransformCXXStaticCastExpr(CXXStaticCastExpr *E) {
14374 return getDerived().TransformCXXNamedCastExpr(E);
14377template<
typename Derived>
14383template<
typename Derived>
14390template<
typename Derived>
14396template<
typename Derived>
14402template<
typename Derived>
14407 getDerived().TransformTypeWithDeducedTST(E->getTypeInfoAsWritten());
14412 = getDerived().TransformExpr(E->getSubExprAsWritten());
14413 if (SubExpr.isInvalid())
14416 if (!getDerived().AlwaysRebuild() &&
14417 Type == E->getTypeInfoAsWritten() &&
14418 SubExpr.get() == E->getSubExpr())
14421 return getDerived().RebuildCXXFunctionalCastExpr(
Type,
14425 E->isListInitialization());
14428template<
typename Derived>
14431 if (E->isTypeOperand()) {
14433 = getDerived().TransformType(E->getTypeOperandSourceInfo());
14437 if (!getDerived().AlwaysRebuild() &&
14438 TInfo == E->getTypeOperandSourceInfo())
14441 return getDerived().RebuildCXXTypeidExpr(E->getType(), E->getBeginLoc(),
14442 TInfo, E->getEndLoc());
14448 Expr *Op = E->getExprOperand();
14450 if (E->isGLValue())
14451 if (
auto *RD = Op->getType()->getAsCXXRecordDecl();
14452 RD && RD->isPolymorphic())
14458 ExprResult SubExpr = getDerived().TransformExpr(Op);
14459 if (SubExpr.isInvalid())
14462 if (!getDerived().AlwaysRebuild() &&
14463 SubExpr.get() == E->getExprOperand())
14466 return getDerived().RebuildCXXTypeidExpr(E->getType(), E->getBeginLoc(),
14467 SubExpr.get(), E->getEndLoc());
14470template<
typename Derived>
14473 if (E->isTypeOperand()) {
14475 = getDerived().TransformType(E->getTypeOperandSourceInfo());
14479 if (!getDerived().AlwaysRebuild() &&
14480 TInfo == E->getTypeOperandSourceInfo())
14483 return getDerived().RebuildCXXUuidofExpr(E->getType(), E->getBeginLoc(),
14484 TInfo, E->getEndLoc());
14490 ExprResult SubExpr = getDerived().TransformExpr(E->getExprOperand());
14491 if (SubExpr.isInvalid())
14494 if (!getDerived().AlwaysRebuild() &&
14495 SubExpr.get() == E->getExprOperand())
14498 return getDerived().RebuildCXXUuidofExpr(E->getType(), E->getBeginLoc(),
14499 SubExpr.get(), E->getEndLoc());
14502template<
typename Derived>
14508template<
typename Derived>
14515template<
typename Derived>
14531 auto &S = getSema();
14532 if (E->isCapturedByCopyInLambdaWithExplicitObjectParameter())
14533 return S.getCurrentThisType();
14534 if (S.getCurLambda())
14535 return getDerived().TransformType(E->getType());
14536 return S.getCurrentThisType();
14539 if (!getDerived().AlwaysRebuild() &&
T == E->getType() &&
14540 !E->isCapturedByCopyInLambdaWithExplicitObjectParameter()) {
14543 getSema().MarkThisReferenced(E);
14547 return getDerived().RebuildCXXThisExpr(E->getBeginLoc(),
T, E->isImplicit());
14550template<
typename Derived>
14553 ExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
14554 if (SubExpr.isInvalid())
14557 getSema().DiagnoseExceptionUse(E->getThrowLoc(),
false);
14559 if (!getDerived().AlwaysRebuild() &&
14560 SubExpr.get() == E->getSubExpr())
14563 return getDerived().RebuildCXXThrowExpr(E->getThrowLoc(), SubExpr.get(),
14564 E->isThrownVariableInScope());
14567template<
typename Derived>
14571 getDerived().TransformDecl(E->getBeginLoc(), E->getParam()));
14576 if (E->hasRewrittenInit()) {
14577 InitRes = getDerived().TransformExpr(E->getRewrittenExpr());
14578 if (InitRes.isInvalid())
14582 if (!getDerived().AlwaysRebuild() && Param == E->getParam() &&
14583 E->getUsedContext() == SemaRef.
CurContext &&
14584 InitRes.get() == E->getRewrittenExpr())
14587 return getDerived().RebuildCXXDefaultArgExpr(E->getUsedLocation(), Param,
14591template<
typename Derived>
14595 getDerived().TransformDecl(E->getBeginLoc(), E->getField()));
14599 if (!getDerived().AlwaysRebuild() && Field == E->getField() &&
14603 return getDerived().RebuildCXXDefaultInitExpr(E->getExprLoc(), Field);
14606template<
typename Derived>
14610 TypeSourceInfo *
T = getDerived().TransformType(E->getTypeSourceInfo());
14614 if (!getDerived().AlwaysRebuild() &&
14615 T == E->getTypeSourceInfo())
14618 return getDerived().RebuildCXXScalarValueInitExpr(
T,
14619 T->getTypeLoc().getEndLoc(),
14620 E->getRParenLoc());
14623template<
typename Derived>
14628 getDerived().TransformTypeWithDeducedTST(E->getAllocatedTypeSourceInfo());
14629 if (!AllocTypeInfo)
14633 std::optional<Expr *> ArraySize;
14634 if (E->isArray()) {
14636 if (std::optional<Expr *> OldArraySize = E->getArraySize()) {
14637 NewArraySize = getDerived().TransformExpr(*OldArraySize);
14638 if (NewArraySize.isInvalid())
14641 ArraySize = NewArraySize.get();
14645 bool ArgumentChanged =
false;
14647 if (getDerived().TransformExprs(E->getPlacementArgs(),
14648 E->getNumPlacementArgs(),
true,
14649 PlacementArgs, &ArgumentChanged))
14653 Expr *OldInit = E->getInitializer();
14656 NewInit = getDerived().TransformInitializer(OldInit,
true);
14657 if (NewInit.isInvalid())
14662 if (E->getOperatorNew()) {
14663 OperatorNew = cast_or_null<FunctionDecl>(
14664 getDerived().TransformDecl(E->getBeginLoc(), E->getOperatorNew()));
14670 if (E->getOperatorDelete()) {
14671 OperatorDelete = cast_or_null<FunctionDecl>(
14672 getDerived().TransformDecl(E->getBeginLoc(), E->getOperatorDelete()));
14673 if (!OperatorDelete)
14677 if (!getDerived().AlwaysRebuild() &&
14678 AllocTypeInfo == E->getAllocatedTypeSourceInfo() &&
14679 ArraySize == E->getArraySize() &&
14680 NewInit.get() == OldInit &&
14681 OperatorNew == E->getOperatorNew() &&
14682 OperatorDelete == E->getOperatorDelete() &&
14683 !ArgumentChanged) {
14688 if (OperatorDelete)
14691 if (E->isArray() && !E->getAllocatedType()->isDependentType()) {
14703 QualType AllocType = AllocTypeInfo->getType();
14714 = dyn_cast<ConstantArrayType>(ArrayT)) {
14718 AllocType = ConsArrayT->getElementType();
14720 = dyn_cast<DependentSizedArrayType>(ArrayT)) {
14721 if (DepArrayT->getSizeExpr()) {
14722 ArraySize = DepArrayT->getSizeExpr();
14723 AllocType = DepArrayT->getElementType();
14728 return getDerived().RebuildCXXNewExpr(
14729 E->getBeginLoc(), E->isGlobalNew(),
14730 E->getBeginLoc(), PlacementArgs,
14731 E->getBeginLoc(), E->getTypeIdParens(), AllocType,
14732 AllocTypeInfo, ArraySize, E->getDirectInitRange(), NewInit.get());
14735template<
typename Derived>
14744 if (E->getOperatorDelete()) {
14745 OperatorDelete = cast_or_null<FunctionDecl>(
14746 getDerived().TransformDecl(E->getBeginLoc(), E->getOperatorDelete()));
14747 if (!OperatorDelete)
14751 if (!getDerived().AlwaysRebuild() &&
14752 Operand.get() == E->getArgument() &&
14753 OperatorDelete == E->getOperatorDelete()) {
14756 if (OperatorDelete)
14759 if (!E->getArgument()->isTypeDependent()) {
14761 E->getDestroyedType());
14762 if (
auto *
Record = Destroyed->getAsCXXRecordDecl())
14770 return getDerived().RebuildCXXDeleteExpr(
14771 E->getBeginLoc(), E->isGlobalDelete(), E->isArrayForm(),
Operand.get());
14774template<
typename Derived>
14779 if (
Base.isInvalid())
14783 bool MayBePseudoDestructor =
false;
14785 E->getOperatorLoc(),
14786 E->isArrow()? tok::arrow : tok::period,
14788 MayBePseudoDestructor);
14789 if (
Base.isInvalid())
14792 QualType ObjectType = ObjectTypePtr.get();
14794 if (QualifierLoc) {
14796 = getDerived().TransformNestedNameSpecifierLoc(QualifierLoc, ObjectType);
14801 SS.
Adopt(QualifierLoc);
14804 if (E->getDestroyedTypeInfo()) {
14805 TypeSourceInfo *DestroyedTypeInfo = getDerived().TransformTypeInObjectScope(
14806 E->getDestroyedTypeInfo(), ObjectType,
14808 if (!DestroyedTypeInfo)
14810 Destroyed = DestroyedTypeInfo;
14811 }
else if (!ObjectType.isNull() && ObjectType->isDependentType()) {
14815 E->getDestroyedTypeLoc());
14819 *E->getDestroyedTypeIdentifier(), E->getDestroyedTypeLoc(),
14820 nullptr, SS, ObjectTypePtr,
false);
14826 E->getDestroyedTypeLoc());
14830 if (E->getScopeTypeInfo()) {
14831 ScopeTypeInfo = getDerived().TransformTypeInObjectScope(
14832 E->getScopeTypeInfo(), ObjectType,
nullptr);
14833 if (!ScopeTypeInfo)
14837 return getDerived().RebuildCXXPseudoDestructorExpr(
Base.get(),
14838 E->getOperatorLoc(),
14842 E->getColonColonLoc(),
14847template <
typename Derived>
14852 bool AllEmptyPacks =
true;
14853 for (
auto *OldD : Old->
decls()) {
14869 if (
auto *UPD = dyn_cast<UsingPackDecl>(InstD))
14870 Decls = UPD->expansions();
14873 for (
auto *D : Decls) {
14874 if (
auto *UD = dyn_cast<UsingDecl>(D)) {
14875 for (
auto *SD : UD->shadows())
14882 AllEmptyPacks &= Decls.empty();
14891 if (AllEmptyPacks && !RequiresADL) {
14903 getSema().FilterAcceptableTemplateNames(R,
14910 diag::err_template_kw_refers_to_non_template)
14914 diag::note_template_kw_refers_to_non_template)
14923template <
typename Derived>
14929template <
typename Derived>
14932 bool IsAddressOfOperand) {
14937 if (TransformOverloadExprDecls(Old, Old->
requiresADL(), R))
14944 = getDerived().TransformNestedNameSpecifierLoc(Old->
getQualifierLoc());
14948 SS.
Adopt(QualifierLoc);
14952 CXXRecordDecl *NamingClass
14953 = cast_or_null<CXXRecordDecl>(getDerived().TransformDecl(
14956 if (!NamingClass) {
14961 R.setNamingClass(NamingClass);
14982 SS, TemplateKWLoc, R,
14989 return getDerived().RebuildDeclarationNameExpr(SS, R, Old->
requiresADL());
14992 return getDerived().RebuildTemplateIdExpr(SS, TemplateKWLoc, R,
14996template<
typename Derived>
14999 bool ArgChanged =
false;
15001 for (
unsigned I = 0, N = E->getNumArgs(); I != N; ++I) {
15003 TypeLoc FromTL = From->getTypeLoc();
15006 TLB.
reserve(FromTL.getFullDataSize());
15007 QualType To = getDerived().TransformType(TLB, FromTL);
15011 if (To == From->getType())
15012 Args.push_back(From);
15014 Args.push_back(TLB.getTypeSourceInfo(SemaRef.
Context, To));
15024 TypeLoc PatternTL = ExpansionTL.getPatternLoc();
15030 bool Expand =
true;
15031 bool RetainExpansion =
false;
15033 ExpansionTL.getTypePtr()->getNumExpansions();
15035 if (getDerived().TryExpandParameterPacks(
15036 ExpansionTL.getEllipsisLoc(), PatternTL.getSourceRange(),
15037 Unexpanded,
true, Expand,
15038 RetainExpansion, NumExpansions))
15048 TLB.
reserve(From->getTypeLoc().getFullDataSize());
15050 QualType To = getDerived().TransformType(TLB, PatternTL);
15054 To = getDerived().RebuildPackExpansionType(To,
15055 PatternTL.getSourceRange(),
15056 ExpansionTL.getEllipsisLoc(),
15064 Args.push_back(TLB.getTypeSourceInfo(SemaRef.
Context, To));
15070 for (
unsigned I = 0; I != *NumExpansions; ++I) {
15073 TLB.
reserve(PatternTL.getFullDataSize());
15074 QualType To = getDerived().TransformType(TLB, PatternTL);
15078 if (To->containsUnexpandedParameterPack()) {
15079 To = getDerived().RebuildPackExpansionType(To,
15080 PatternTL.getSourceRange(),
15081 ExpansionTL.getEllipsisLoc(),
15091 Args.push_back(TLB.getTypeSourceInfo(SemaRef.
Context, To));
15094 if (!RetainExpansion)
15099 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
15102 TLB.
reserve(From->getTypeLoc().getFullDataSize());
15104 QualType To = getDerived().TransformType(TLB, PatternTL);
15108 To = getDerived().RebuildPackExpansionType(To,
15109 PatternTL.getSourceRange(),
15110 ExpansionTL.getEllipsisLoc(),
15118 Args.push_back(TLB.getTypeSourceInfo(SemaRef.
Context, To));
15121 if (!getDerived().AlwaysRebuild() && !ArgChanged)
15124 return getDerived().RebuildTypeTrait(E->getTrait(), E->getBeginLoc(), Args,
15128template<
typename Derived>
15134 if (getDerived().TransformTemplateArguments(Old->getTemplateArgs(),
15135 Old->NumTemplateArgs, TransArgs))
15138 return getDerived().RebuildConceptSpecializationExpr(
15139 E->getNestedNameSpecifierLoc(), E->getTemplateKWLoc(),
15140 E->getConceptNameInfo(), E->getFoundDecl(), E->getNamedConcept(),
15144template<
typename Derived>
15158 getSema().Context, getSema().CurContext,
15159 E->getBody()->getBeginLoc());
15163 ExprResult TypeParamResult = getDerived().TransformRequiresTypeParams(
15164 E->getRequiresKWLoc(), E->getRBraceLoc(), E, Body,
15165 E->getLocalParameters(), TransParamTypes, TransParams, ExtParamInfos);
15169 Param->setDeclContext(Body);
15175 if (!TypeParamResult.isUnset())
15176 return TypeParamResult;
15179 if (getDerived().TransformRequiresExprRequirements(E->getRequirements(),
15184 if (
auto *ER = dyn_cast<concepts::ExprRequirement>(Req)) {
15185 if (ER->getReturnTypeRequirement().isTypeConstraint()) {
15186 ER->getReturnTypeRequirement()
15187 .getTypeConstraintTemplateParameterList()->getParam(0)
15188 ->setDeclContext(Body);
15193 return getDerived().RebuildRequiresExpr(
15194 E->getRequiresKWLoc(), Body, E->getLParenLoc(), TransParams,
15195 E->getRParenLoc(), TransReqs, E->getRBraceLoc());
15198template<
typename Derived>
15204 if (
auto *TypeReq = dyn_cast<concepts::TypeRequirement>(Req))
15205 TransReq =
getDerived().TransformTypeRequirement(TypeReq);
15206 else if (
auto *ExprReq = dyn_cast<concepts::ExprRequirement>(Req))
15207 TransReq =
getDerived().TransformExprRequirement(ExprReq);
15209 TransReq =
getDerived().TransformNestedRequirement(
15213 Transformed.push_back(TransReq);
15218template<
typename Derived>
15231 return getDerived().RebuildTypeRequirement(TransType);
15234template<
typename Derived>
15237 llvm::PointerUnion<Expr *, concepts::Requirement::SubstitutionDiagnostic *> TransExpr;
15243 TransExprRes =
SemaRef.CheckPlaceholderExpr(TransExprRes.
get());
15246 TransExpr = TransExprRes.
get();
15249 std::optional<concepts::ExprRequirement::ReturnTypeRequirement> TransRetReq;
15251 if (RetReq.isEmpty())
15252 TransRetReq.emplace();
15253 else if (RetReq.isSubstitutionFailure())
15254 TransRetReq.emplace(RetReq.getSubstitutionDiagnostic());
15255 else if (RetReq.isTypeConstraint()) {
15257 RetReq.getTypeConstraintTemplateParameterList();
15259 getDerived().TransformTemplateParameterList(OrigTPL);
15262 TransRetReq.emplace(TPL);
15264 assert(TransRetReq &&
"All code paths leading here must set TransRetReq");
15265 if (
Expr *E = dyn_cast<Expr *>(TransExpr))
15268 std::move(*TransRetReq));
15274template<
typename Derived>
15280 return getDerived().RebuildNestedRequirement(
15288 return getDerived().RebuildNestedRequirement(TransConstraint.
get());
15291template<
typename Derived>
15298 if (!getDerived().AlwaysRebuild() &&
15315template<
typename Derived>
15322 SubExpr = getDerived().TransformExpr(E->getQueriedExpression());
15323 if (SubExpr.isInvalid())
15326 if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getQueriedExpression())
15330 return getDerived().RebuildExpressionTrait(E->getTrait(), E->getBeginLoc(),
15331 SubExpr.get(), E->getEndLoc());
15334template <
typename Derived>
15339 DRE, AddrTaken, RecoveryTSI);
15352template <
typename Derived>
15359template <
typename Derived>
15375 getDerived().TransformDeclarationNameInfo(E->
getNameInfo());
15380 if (!getDerived().AlwaysRebuild() && QualifierLoc == E->
getQualifierLoc() &&
15386 return getDerived().RebuildDependentScopeDeclRefExpr(
15387 QualifierLoc, TemplateKWLoc, NameInfo,
nullptr,
15388 IsAddressOfOperand, RecoveryTSI);
15392 if (getDerived().TransformTemplateArguments(
15396 return getDerived().RebuildDependentScopeDeclRefExpr(
15397 QualifierLoc, TemplateKWLoc, NameInfo, &TransArgs, IsAddressOfOperand,
15401template<
typename Derived>
15407 if (getDerived().AllowSkippingCXXConstructExpr() &&
15408 ((E->getNumArgs() == 1 ||
15409 (E->getNumArgs() > 1 && getDerived().DropCallArgument(E->getArg(1)))) &&
15410 (!getDerived().DropCallArgument(E->getArg(0))) &&
15411 !E->isListInitialization()))
15417 QualType T = getDerived().TransformType(E->getType());
15422 getDerived().TransformDecl(E->getBeginLoc(), E->getConstructor()));
15426 bool ArgumentChanged =
false;
15431 E->isListInitialization());
15432 if (getDerived().TransformExprs(E->getArgs(), E->getNumArgs(),
true, Args,
15437 if (!getDerived().AlwaysRebuild() &&
15438 T == E->getType() &&
15440 !ArgumentChanged) {
15447 return getDerived().RebuildCXXConstructExpr(
15448 T, E->getBeginLoc(),
Constructor, E->isElidable(), Args,
15449 E->hadMultipleCandidates(), E->isListInitialization(),
15450 E->isStdInitListInitialization(), E->requiresZeroInitialization(),
15451 E->getConstructionKind(), E->getParenOrBraceRange());
15454template<
typename Derived>
15457 QualType T = getDerived().TransformType(E->getType());
15462 getDerived().TransformDecl(E->getBeginLoc(), E->getConstructor()));
15466 if (!getDerived().AlwaysRebuild() &&
15467 T == E->getType() &&
15475 return getDerived().RebuildCXXInheritedCtorInitExpr(
15477 E->constructsVBase(), E->inheritedFromVBase());
15484template<
typename Derived>
15487 if (
auto *Dtor = E->getTemporary()->getDestructor())
15490 return getDerived().TransformExpr(E->getSubExpr());
15498template<
typename Derived>
15504template<
typename Derived>
15509 getDerived().TransformTypeWithDeducedTST(E->getTypeSourceInfo());
15514 getDerived().TransformDecl(E->getBeginLoc(), E->getConstructor()));
15518 bool ArgumentChanged =
false;
15520 Args.reserve(E->getNumArgs());
15524 E->isListInitialization());
15525 if (TransformExprs(E->getArgs(), E->getNumArgs(),
true, Args,
15529 if (E->isListInitialization() && !E->isStdInitListInitialization()) {
15530 ExprResult Res = RebuildInitList(E->getBeginLoc(), Args, E->getEndLoc());
15531 if (Res.isInvalid())
15533 Args = {Res.get()};
15537 if (!getDerived().AlwaysRebuild() &&
15538 T == E->getTypeSourceInfo() &&
15540 !ArgumentChanged) {
15547 return getDerived().RebuildCXXTemporaryObjectExpr(
15548 T, LParenLoc, Args, E->getEndLoc(), E->isListInitialization());
15551template<
typename Derived>
15556 typedef std::pair<ExprResult, QualType> InitCaptureInfoTy;
15557 struct TransformedInitCapture {
15559 SourceLocation EllipsisLoc;
15561 SmallVector<InitCaptureInfoTy, 4> Expansions;
15564 InitCaptures.resize(E->explicit_capture_end() - E->explicit_capture_begin());
15566 CEnd = E->capture_end();
15568 if (!E->isInitCapture(
C))
15571 TransformedInitCapture &
Result = InitCaptures[
C - E->capture_begin()];
15576 ExprResult NewExprInitResult = getDerived().TransformInitializer(
15579 if (NewExprInitResult.isInvalid()) {
15583 Expr *NewExprInit = NewExprInitResult.get();
15586 getSema().buildLambdaInitCaptureInitialization(
15587 C->getLocation(),
C->getCaptureKind() ==
LCK_ByRef,
15588 EllipsisLoc, NumExpansions, OldVD->getIdentifier(),
15592 Result.Expansions.push_back(
15593 InitCaptureInfoTy(NewExprInit, NewInitCaptureType));
15597 if (OldVD->isParameterPack()) {
15606 bool Expand =
true;
15607 bool RetainExpansion =
false;
15609 ExpansionTL.getTypePtr()->getNumExpansions();
15611 if (getDerived().TryExpandParameterPacks(
15612 ExpansionTL.getEllipsisLoc(), OldVD->getInit()->getSourceRange(),
15613 Unexpanded,
true, Expand,
15614 RetainExpansion, NumExpansions))
15616 assert(!RetainExpansion &&
"Should not need to retain expansion after a "
15617 "capture since it cannot be extended");
15619 for (
unsigned I = 0; I != *NumExpansions; ++I) {
15624 SubstInitCapture(ExpansionTL.getEllipsisLoc(), NumExpansions);
15625 Result.EllipsisLoc = ExpansionTL.getEllipsisLoc();
15662 while (DC->isRequiresExprBody())
15664 if ((getSema().isUnevaluatedContext() ||
15665 getSema().isConstantEvaluatedContext()) &&
15666 !(dyn_cast_or_null<CXXRecordDecl>(DC->getParent()) &&
15668 (DC->isFileContext() || !DC->getParent()->isDependentContext()))
15673 E->getIntroducerRange(),
nullptr, DependencyKind,
15674 E->getCaptureDefault());
15675 getDerived().transformedLocalDecl(OldClass, {
Class});
15678 getSema().CreateLambdaCallOperator(E->getIntroducerRange(),
Class);
15681 getSema().buildLambdaScope(LSI, NewCallOperator, E->getIntroducerRange(),
15682 E->getCaptureDefault(), E->getCaptureDefaultLoc(),
15683 E->hasExplicitParameters(), E->isMutable());
15693 CEnd = E->capture_end();
15697 if (
C->isImplicit())
15701 if (
C->capturesThis()) {
15709 dyn_cast_if_present<CXXRecordDecl>(
15710 getSema().getFunctionLevelDeclContext()),
15712 getSema().CheckCXXThisCapture(
C->getLocation(),
C->isExplicit(),
15719 if (
C->capturesVLAType())
15723 if (E->isInitCapture(
C)) {
15724 TransformedInitCapture &NewC = InitCaptures[
C - E->capture_begin()];
15729 for (InitCaptureInfoTy &Info : NewC.Expansions) {
15731 QualType InitQualType = Info.second;
15732 if (
Init.isInvalid() || InitQualType.isNull()) {
15736 VarDecl *NewVD = getSema().createLambdaInitCaptureVarDecl(
15737 OldVD->getLocation(), InitQualType, NewC.EllipsisLoc,
15738 OldVD->getIdentifier(), OldVD->getInitStyle(),
Init.get(),
15739 getSema().CurContext);
15744 NewVDs.push_back(NewVD);
15745 getSema().addInitCapture(LSI, NewVD,
C->getCaptureKind() ==
LCK_ByRef);
15750 if (NewC.EllipsisLoc.isInvalid())
15751 LSI->ContainsUnexpandedParameterPack |=
15752 Init.get()->containsUnexpandedParameterPack();
15758 getDerived().transformedLocalDecl(OldVD, NewVDs);
15762 assert(
C->capturesVariable() &&
"unexpected kind of lambda capture");
15770 if (
C->isPackExpansion()) {
15772 bool ShouldExpand =
false;
15773 bool RetainExpansion =
false;
15775 if (getDerived().TryExpandParameterPacks(
15776 C->getEllipsisLoc(),
C->getLocation(), Unexpanded,
15777 true, ShouldExpand,
15778 RetainExpansion, NumExpansions)) {
15783 if (ShouldExpand) {
15788 for (
unsigned I = 0; I != *NumExpansions; ++I) {
15790 ValueDecl *CapturedVar = cast_if_present<ValueDecl>(
15791 getDerived().TransformDecl(
C->getLocation(), Pack));
15792 if (!CapturedVar) {
15798 getSema().tryCaptureVariable(CapturedVar,
C->getLocation(), Kind);
15806 EllipsisLoc =
C->getEllipsisLoc();
15810 auto *CapturedVar = cast_or_null<ValueDecl>(
15811 getDerived().TransformDecl(
C->getLocation(),
C->getCapturedVar()));
15812 if (!CapturedVar || CapturedVar->isInvalidDecl()) {
15819 if (
auto *VD = dyn_cast<VarDecl>(CapturedVar); VD && !
C->isPackExpansion())
15820 LSI->ContainsUnexpandedParameterPack |= VD->isParameterPack();
15823 getSema().tryCaptureVariable(CapturedVar,
C->getLocation(), Kind,
15826 getSema().finishLambdaExplicitCaptures(LSI);
15830 auto TPL = getDerived().TransformTemplateParameterList(
15831 E->getTemplateParameterList());
15832 LSI->GLTemplateParameterList = TPL;
15834 getSema().AddTemplateParametersToLambdaCallOperator(NewCallOperator,
Class,
15836 LSI->ContainsUnexpandedParameterPack |=
15837 TPL->containsUnexpandedParameterPack();
15842 E->getCallOperator()->getTypeSourceInfo()->getTypeLoc();
15844 getDerived().TransformType(NewCallOpTLBuilder, OldCallOpTypeLoc);
15845 if (NewCallOpType.isNull())
15847 LSI->ContainsUnexpandedParameterPack |=
15848 NewCallOpType->containsUnexpandedParameterPack();
15850 NewCallOpTLBuilder.getTypeSourceInfo(getSema().Context, NewCallOpType);
15855 assert(FPTL &&
"Not a FunctionProtoType?");
15858 if (!TRC.ArgPackSubstIndex)
15861 getSema().CompleteLambdaCallOperator(
15862 NewCallOperator, E->getCallOperator()->getLocation(),
15863 E->getCallOperator()->getInnerLocStart(), TRC, NewCallOpTSI,
15864 E->getCallOperator()->getConstexprKind(),
15865 E->getCallOperator()->getStorageClass(), FPTL.getParams(),
15866 E->hasExplicitResultType());
15868 getDerived().transformAttrs(E->getCallOperator(), NewCallOperator);
15869 getDerived().transformedLocalDecl(E->getCallOperator(), {NewCallOperator});
15875 std::optional<CXXRecordDecl::LambdaNumbering> Numbering;
15876 if (getDerived().ReplacingOriginal()) {
15877 Numbering = OldClass->getLambdaNumbering();
15880 getSema().handleLambdaNumbering(
Class, NewCallOperator, Numbering);
15885 getSema().PushExpressionEvaluationContextForFunction(
15887 E->getCallOperator());
15894 C.PointOfInstantiation = E->getBody()->getBeginLoc();
15895 getSema().pushCodeSynthesisContext(
C);
15899 : getDerived().TransformLambdaBody(E, E->getBody());
15901 getSema().popCodeSynthesisContext();
15905 FuncScopeCleanup.disable();
15907 if (Body.isInvalid()) {
15908 SavedContext.pop();
15909 getSema().ActOnLambdaError(E->getBeginLoc(),
nullptr,
15914 getSema().ActOnFinishFunctionBody(NewCallOperator, Body.get(),
15917 SavedContext.pop();
15952 DependencyKind = getDerived().ComputeLambdaDependency(LSI);
15953 Class->setLambdaDependencyKind(DependencyKind);
15955 return getDerived().RebuildLambdaExpr(E->getBeginLoc(),
15956 Body.get()->getEndLoc(), LSI);
15959template<
typename Derived>
15965template<
typename Derived>
15974 if (!
C->isImplicit())
15978 if (
C->capturesThis()) {
15979 getSema().CheckCXXThisCapture(
C->getLocation(),
C->isExplicit(),
15986 if (
C->capturesVLAType())
15989 assert(
C->capturesVariable() &&
"unexpected kind of lambda capture");
15993 VarDecl *CapturedVar = cast_or_null<VarDecl>(
15999 getSema().tryCaptureVariable(CapturedVar,
C->getLocation());
16005template<
typename Derived>
16014 bool ArgumentChanged =
false;
16026 if (!getDerived().AlwaysRebuild() &&
16032 return getDerived().RebuildCXXUnresolvedConstructExpr(
16036template<
typename Derived>
16045 if (!E->isImplicitAccess()) {
16046 OldBase = E->getBase();
16047 Base = getDerived().TransformExpr(OldBase);
16048 if (
Base.isInvalid())
16053 bool MayBePseudoDestructor =
false;
16055 E->getOperatorLoc(),
16056 E->isArrow()? tok::arrow : tok::period,
16058 MayBePseudoDestructor);
16059 if (
Base.isInvalid())
16062 ObjectType = ObjectTy.get();
16063 BaseType = ((
Expr*)
Base.get())->getType();
16066 BaseType = getDerived().TransformType(E->getBaseType());
16073 = getDerived().TransformFirstQualifierInScope(
16074 E->getFirstQualifierFoundInScope(),
16075 E->getQualifierLoc().getBeginLoc());
16078 if (E->getQualifier()) {
16080 = getDerived().TransformNestedNameSpecifierLoc(E->getQualifierLoc(),
16082 FirstQualifierInScope);
16094 = getDerived().TransformDeclarationNameInfo(E->getMemberNameInfo());
16095 if (!NameInfo.getName())
16098 if (!E->hasExplicitTemplateArgs()) {
16101 if (!getDerived().AlwaysRebuild() &&
16102 Base.get() == OldBase &&
16103 BaseType == E->getBaseType() &&
16104 QualifierLoc == E->getQualifierLoc() &&
16105 NameInfo.getName() == E->getMember() &&
16106 FirstQualifierInScope == E->getFirstQualifierFoundInScope())
16109 return getDerived().RebuildCXXDependentScopeMemberExpr(
Base.get(),
16112 E->getOperatorLoc(),
16115 FirstQualifierInScope,
16121 if (getDerived().TransformTemplateArguments(E->getTemplateArgs(),
16122 E->getNumTemplateArgs(),
16126 return getDerived().RebuildCXXDependentScopeMemberExpr(
Base.get(),
16129 E->getOperatorLoc(),
16132 FirstQualifierInScope,
16137template <
typename Derived>
16143 if (!Old->isImplicitAccess()) {
16144 Base = getDerived().TransformExpr(Old->getBase());
16145 if (
Base.isInvalid())
16148 getSema().PerformMemberExprBaseConversion(
Base.get(), Old->isArrow());
16149 if (
Base.isInvalid())
16151 BaseType =
Base.get()->getType();
16153 BaseType = getDerived().TransformType(Old->getBaseType());
16157 if (Old->getQualifierLoc()) {
16159 getDerived().TransformNestedNameSpecifierLoc(Old->getQualifierLoc());
16169 if (TransformOverloadExprDecls(Old,
false, R))
16173 if (Old->getNamingClass()) {
16175 getDerived().TransformDecl(Old->getMemberLoc(), Old->getNamingClass()));
16179 R.setNamingClass(NamingClass);
16183 if (Old->hasExplicitTemplateArgs()) {
16184 TransArgs.setLAngleLoc(Old->getLAngleLoc());
16185 TransArgs.setRAngleLoc(Old->getRAngleLoc());
16186 if (getDerived().TransformTemplateArguments(
16187 Old->getTemplateArgs(), Old->getNumTemplateArgs(), TransArgs))
16195 NamedDecl *FirstQualifierInScope =
nullptr;
16197 return getDerived().RebuildUnresolvedMemberExpr(
16198 Base.get(), BaseType, Old->getOperatorLoc(), Old->isArrow(), QualifierLoc,
16199 TemplateKWLoc, FirstQualifierInScope, R,
16200 (Old->hasExplicitTemplateArgs() ? &TransArgs :
nullptr));
16203template<
typename Derived>
16208 ExprResult SubExpr = getDerived().TransformExpr(E->getOperand());
16209 if (SubExpr.isInvalid())
16212 if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getOperand())
16215 return getDerived().RebuildCXXNoexceptExpr(E->getSourceRange(),SubExpr.get());
16218template<
typename Derived>
16221 ExprResult Pattern = getDerived().TransformExpr(E->getPattern());
16222 if (Pattern.isInvalid())
16225 if (!getDerived().AlwaysRebuild() && Pattern.get() == E->getPattern())
16228 return getDerived().RebuildPackExpansion(Pattern.get(), E->getEllipsisLoc(),
16229 E->getNumExpansions());
16232template <
typename Derived>
16237 if (!Arg.isPackExpansion()) {
16249 getSema().getTemplateArgumentPackExpansionPattern(ArgLoc, Ellipsis,
16250 OrigNumExpansions);
16262 if (!NumExpansions) {
16274template<
typename Derived>
16293 bool ShouldExpand =
false;
16294 bool RetainExpansion =
false;
16295 UnsignedOrNone NumExpansions = std::nullopt;
16296 if (getDerived().TryExpandParameterPacks(
16298 true, ShouldExpand,
16299 RetainExpansion, NumExpansions))
16304 if (ShouldExpand) {
16306 if (
auto *TTPD = dyn_cast<TemplateTypeParmDecl>(Pack)) {
16307 ArgStorage = getSema().Context.getPackExpansionType(
16308 getSema().Context.getTypeDeclType(TTPD), std::nullopt);
16309 }
else if (
auto *TTPD = dyn_cast<TemplateTemplateParmDecl>(Pack)) {
16313 ExprResult DRE = getSema().BuildDeclRefExpr(
16314 VD, VD->getType().getNonLValueExprType(getSema().Context),
16317 if (DRE.isInvalid())
16320 new (getSema().Context)
16324 PackArgs = ArgStorage;
16329 if (!PackArgs.size()) {
16330 auto *Pack = cast_or_null<NamedDecl>(
16334 return getDerived().RebuildSizeOfPackExpr(
16341 getDerived().ComputeSizeOfPackExprWithoutSubstitution(PackArgs);
16353 TemporaryBase Rebase(*
this, E->
getPackLoc(), getBaseEntity());
16356 if (TransformTemplateArguments(PackLocIterator(*
this, PackArgs.begin()),
16357 PackLocIterator(*
this, PackArgs.end()),
16358 TransformedPackArgs,
true))
16365 bool PartialSubstitution =
false;
16366 for (
auto &Loc : TransformedPackArgs.arguments()) {
16367 Args.push_back(Loc.getArgument());
16368 if (Loc.getArgument().isPackExpansion())
16369 PartialSubstitution =
true;
16372 if (PartialSubstitution)
16373 return getDerived().RebuildSizeOfPackExpr(
16375 std::nullopt, Args);
16377 return getDerived().RebuildSizeOfPackExpr(
16379 static_cast<unsigned>(Args.size()),
16383template <
typename Derived>
16386 if (!E->isValueDependent())
16394 IndexExpr = getDerived().TransformExpr(E->getIndexExpr());
16395 if (IndexExpr.isInvalid())
16400 bool FullySubstituted =
true;
16401 if (!E->expandsToEmptyPack() && E->getExpressions().empty()) {
16402 Expr *Pattern = E->getPackIdExpression();
16404 getSema().collectUnexpandedParameterPacks(E->getPackIdExpression(),
16406 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
16410 bool ShouldExpand =
true;
16411 bool RetainExpansion =
false;
16413 NumExpansions = std::nullopt;
16414 if (getDerived().TryExpandParameterPacks(
16415 E->getEllipsisLoc(), Pattern->getSourceRange(), Unexpanded,
16416 true, ShouldExpand,
16417 RetainExpansion, NumExpansions))
16419 if (!ShouldExpand) {
16421 ExprResult Pack = getDerived().TransformExpr(Pattern);
16422 if (Pack.isInvalid())
16424 return getDerived().RebuildPackIndexingExpr(
16425 E->getEllipsisLoc(), E->getRSquareLoc(), Pack.get(), IndexExpr.get(),
16428 for (
unsigned I = 0; I != *NumExpansions; ++I) {
16431 if (
Out.isInvalid())
16433 if (
Out.get()->containsUnexpandedParameterPack()) {
16434 Out = getDerived().RebuildPackExpansion(
Out.get(), E->getEllipsisLoc(),
16435 OrigNumExpansions);
16436 if (
Out.isInvalid())
16438 FullySubstituted =
false;
16440 ExpandedExprs.push_back(
Out.get());
16444 if (RetainExpansion) {
16445 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
16448 if (
Out.isInvalid())
16451 Out = getDerived().RebuildPackExpansion(
Out.get(), E->getEllipsisLoc(),
16452 OrigNumExpansions);
16453 if (
Out.isInvalid())
16455 FullySubstituted =
false;
16456 ExpandedExprs.push_back(
Out.get());
16458 }
else if (!E->expandsToEmptyPack()) {
16459 if (getDerived().TransformExprs(E->getExpressions().data(),
16460 E->getExpressions().size(),
false,
16465 return getDerived().RebuildPackIndexingExpr(
16466 E->getEllipsisLoc(), E->getRSquareLoc(), E->getPackIdExpression(),
16467 IndexExpr.get(), ExpandedExprs, FullySubstituted);
16470template <
typename Derived>
16473 if (!getSema().ArgPackSubstIndex)
16479 return getDerived().RebuildSubstNonTypeTemplateParmExpr(
16480 E->getAssociatedDecl(), E->getParameterPack(),
16481 E->getParameterPackLocation(), Arg, SemaRef.
getPackIndex(Pack),
16485template <
typename Derived>
16489 ExprResult Replacement = getDerived().TransformExpr(OrigReplacement);
16490 if (Replacement.isInvalid())
16493 Decl *AssociatedDecl =
16494 getDerived().TransformDecl(E->getNameLoc(), E->getAssociatedDecl());
16495 if (!AssociatedDecl)
16498 if (Replacement.get() == OrigReplacement &&
16499 AssociatedDecl == E->getAssociatedDecl())
16502 auto getParamAndType = [E](
Decl *AssociatedDecl)
16503 -> std::tuple<NonTypeTemplateParmDecl *, QualType> {
16504 auto [PDecl, Arg] =
16508 return {Param, Param->getType()};
16510 Arg = Arg.getPackAsArray()[*PackIndex];
16511 return {Param, Arg.getNonTypeTemplateArgumentType()};
16517 if (
auto [Param, ParamType] = getParamAndType(AssociatedDecl);
16519 ParamType, std::get<1>(getParamAndType(E->getAssociatedDecl()))) ||
16520 Replacement.get() != OrigReplacement) {
16527 Param, ParamType, Replacement.get(), SugaredConverted,
16528 CanonicalConverted,
16530 if (Replacement.isInvalid())
16534 Replacement = E->getReplacement();
16537 return getDerived().RebuildSubstNonTypeTemplateParmExpr(
16538 AssociatedDecl, E->getParameter(), E->getNameLoc(),
16540 E->getPackIndex(), E->getFinal());
16543template<
typename Derived>
16550template<
typename Derived>
16557template<
typename Derived>
16561 if (
Expr *OldCallee = E->getCallee()) {
16562 ExprResult CalleeResult = getDerived().TransformExpr(OldCallee);
16563 if (CalleeResult.isInvalid())
16568 Expr *Pattern = E->getPattern();
16571 getSema().collectUnexpandedParameterPacks(Pattern, Unexpanded);
16572 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
16576 bool Expand =
true;
16577 bool RetainExpansion =
false;
16579 NumExpansions = OrigNumExpansions;
16580 if (getDerived().TryExpandParameterPacks(
16581 E->getEllipsisLoc(), Pattern->getSourceRange(), Unexpanded,
16582 true, Expand, RetainExpansion,
16592 E->getLHS() ? getDerived().TransformExpr(E->getLHS()) :
ExprResult();
16593 if (LHS.isInvalid())
16597 E->getRHS() ? getDerived().TransformExpr(E->getRHS()) :
ExprResult();
16598 if (RHS.isInvalid())
16601 if (!getDerived().AlwaysRebuild() &&
16602 LHS.get() == E->getLHS() && RHS.get() == E->getRHS())
16605 return getDerived().RebuildCXXFoldExpr(
16606 Callee, E->getBeginLoc(), LHS.get(), E->getOperator(),
16607 E->getEllipsisLoc(), RHS.get(), E->getEndLoc(), NumExpansions);
16613 if (NumExpansions && SemaRef.
getLangOpts().BracketDepth < *NumExpansions) {
16614 SemaRef.
Diag(E->getEllipsisLoc(),
16615 clang::diag::err_fold_expression_limit_exceeded)
16616 << *NumExpansions << SemaRef.
getLangOpts().BracketDepth
16617 << E->getSourceRange();
16618 SemaRef.
Diag(E->getEllipsisLoc(), diag::note_bracket_depth);
16627 bool LeftFold = E->isLeftFold();
16631 if (!LeftFold && RetainExpansion) {
16632 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
16635 if (
Out.isInvalid())
16638 Result = getDerived().RebuildCXXFoldExpr(
16639 Callee, E->getBeginLoc(),
Out.get(), E->getOperator(),
16640 E->getEllipsisLoc(),
Result.get(), E->getEndLoc(), OrigNumExpansions);
16645 bool WarnedOnComparison =
false;
16646 for (
unsigned I = 0; I != *NumExpansions; ++I) {
16648 getSema(), LeftFold ? I : *NumExpansions - I - 1);
16650 if (
Out.isInvalid())
16653 if (
Out.get()->containsUnexpandedParameterPack()) {
16655 Result = getDerived().RebuildCXXFoldExpr(
16656 Callee, E->getBeginLoc(), LeftFold ?
Result.get() :
Out.get(),
16657 E->getOperator(), E->getEllipsisLoc(),
16658 LeftFold ?
Out.get() :
Result.get(), E->getEndLoc(),
16659 OrigNumExpansions);
16660 }
else if (
Result.isUsable()) {
16667 Result = getDerived().RebuildCXXOperatorCallExpr(
16669 E->getEllipsisLoc(),
Callee->getBeginLoc(),
Callee->requiresADL(),
16670 Functions, LHS, RHS);
16672 Result = getDerived().RebuildBinaryOperator(E->getEllipsisLoc(),
16673 E->getOperator(), LHS, RHS,
16675 if (!WarnedOnComparison &&
Result.isUsable()) {
16676 if (
auto *BO = dyn_cast<BinaryOperator>(
Result.get());
16677 BO && BO->isComparisonOp()) {
16678 WarnedOnComparison =
true;
16679 SemaRef.
Diag(BO->getBeginLoc(),
16680 diag::warn_comparison_in_fold_expression)
16681 << BO->getOpcodeStr();
16694 if (LeftFold && RetainExpansion) {
16695 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
16698 if (
Out.isInvalid())
16701 Result = getDerived().RebuildCXXFoldExpr(
16702 Callee, E->getBeginLoc(),
Result.get(), E->getOperator(),
16703 E->getEllipsisLoc(),
Out.get(), E->getEndLoc(), OrigNumExpansions);
16709 PE->setIsProducedByFoldExpansion();
16714 return getDerived().RebuildEmptyCXXFoldExpr(E->getEllipsisLoc(),
16719template <
typename Derived>
16725 QualType T = getDerived().TransformType(E->getType());
16727 bool ArgChanged =
false;
16729 if (getDerived().TransformExprs(InitExprs.data(), InitExprs.size(),
true,
16730 TransformedInits, &ArgChanged))
16733 if (!getDerived().AlwaysRebuild() && !ArgChanged &&
T == E->getType())
16736 return getDerived().RebuildCXXParenListInitExpr(
16737 TransformedInits,
T, E->getUserSpecifiedInitExprs().size(),
16738 E->getInitLoc(), E->getBeginLoc(), E->getEndLoc());
16741template<
typename Derived>
16748template<
typename Derived>
16754template<
typename Derived>
16760template<
typename Derived>
16763 ExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
16764 if (SubExpr.isInvalid())
16767 if (!getDerived().AlwaysRebuild() &&
16768 SubExpr.get() == E->getSubExpr())
16771 return getDerived().RebuildObjCBoxedExpr(E->getSourceRange(), SubExpr.get());
16774template<
typename Derived>
16779 bool ArgChanged =
false;
16780 if (getDerived().TransformExprs(E->getElements(), E->getNumElements(),
16781 false, Elements, &ArgChanged))
16784 if (!getDerived().AlwaysRebuild() && !ArgChanged)
16787 return getDerived().RebuildObjCArrayLiteral(E->getSourceRange(),
16792template<
typename Derived>
16798 bool ArgChanged =
false;
16799 for (
unsigned I = 0, N = E->getNumElements(); I != N; ++I) {
16802 if (OrigElement.isPackExpansion()) {
16805 getSema().collectUnexpandedParameterPacks(OrigElement.Key, Unexpanded);
16806 getSema().collectUnexpandedParameterPacks(OrigElement.Value, Unexpanded);
16807 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
16811 bool Expand =
true;
16812 bool RetainExpansion =
false;
16815 SourceRange PatternRange(OrigElement.Key->getBeginLoc(),
16816 OrigElement.Value->getEndLoc());
16817 if (getDerived().TryExpandParameterPacks(
16818 OrigElement.EllipsisLoc, PatternRange, Unexpanded,
16819 true, Expand, RetainExpansion,
16828 ExprResult Key = getDerived().TransformExpr(OrigElement.Key);
16829 if (Key.isInvalid())
16832 if (Key.get() != OrigElement.Key)
16836 if (
Value.isInvalid())
16843 Key.get(),
Value.get(), OrigElement.EllipsisLoc, NumExpansions
16845 Elements.push_back(Expansion);
16855 for (
unsigned I = 0; I != *NumExpansions; ++I) {
16857 ExprResult Key = getDerived().TransformExpr(OrigElement.Key);
16858 if (Key.isInvalid())
16862 if (
Value.isInvalid())
16872 if (Key.get()->containsUnexpandedParameterPack() ||
16873 Value.get()->containsUnexpandedParameterPack())
16874 Element.EllipsisLoc = OrigElement.EllipsisLoc;
16876 Elements.push_back(Element);
16886 ExprResult Key = getDerived().TransformExpr(OrigElement.Key);
16887 if (Key.isInvalid())
16890 if (Key.get() != OrigElement.Key)
16895 = getDerived().TransformExpr(OrigElement.Value);
16896 if (
Value.isInvalid())
16904 Elements.push_back(Element);
16907 if (!getDerived().AlwaysRebuild() && !ArgChanged)
16910 return getDerived().RebuildObjCDictionaryLiteral(E->getSourceRange(),
16914template<
typename Derived>
16918 = getDerived().TransformType(E->getEncodedTypeSourceInfo());
16919 if (!EncodedTypeInfo)
16922 if (!getDerived().AlwaysRebuild() &&
16923 EncodedTypeInfo == E->getEncodedTypeSourceInfo())
16926 return getDerived().RebuildObjCEncodeExpr(E->getAtLoc(),
16928 E->getRParenLoc());
16931template<
typename Derived>
16941template<
typename Derived>
16945 = getDerived().TransformType(E->getTypeInfoAsWritten());
16953 if (!getDerived().AlwaysRebuild() &&
16954 TSInfo == E->getTypeInfoAsWritten() &&
16955 Result.get() == E->getSubExpr())
16959 E->getLParenLoc(), E->getBridgeKind(), E->getBridgeKeywordLoc(), TSInfo,
16963template <
typename Derived>
16969template<
typename Derived>
16973 bool ArgChanged =
false;
16975 Args.reserve(E->getNumArgs());
16976 if (getDerived().TransformExprs(E->getArgs(), E->getNumArgs(),
false, Args,
16983 = getDerived().TransformType(E->getClassReceiverTypeInfo());
16984 if (!ReceiverTypeInfo)
16988 if (!getDerived().AlwaysRebuild() &&
16989 ReceiverTypeInfo == E->getClassReceiverTypeInfo() && !ArgChanged)
16994 E->getSelectorLocs(SelLocs);
16995 return getDerived().RebuildObjCMessageExpr(ReceiverTypeInfo,
16998 E->getMethodDecl(),
17005 if (!E->getMethodDecl())
17010 E->getSelectorLocs(SelLocs);
17011 return getDerived().RebuildObjCMessageExpr(E->getSuperLoc(),
17014 E->getReceiverType(),
17015 E->getMethodDecl(),
17023 "Only class and instance messages may be instantiated");
17025 = getDerived().TransformExpr(E->getInstanceReceiver());
17026 if (Receiver.isInvalid())
17030 if (!getDerived().AlwaysRebuild() &&
17031 Receiver.get() == E->getInstanceReceiver() && !ArgChanged)
17036 E->getSelectorLocs(SelLocs);
17037 return getDerived().RebuildObjCMessageExpr(Receiver.get(),
17040 E->getMethodDecl(),
17046template<
typename Derived>
17052template<
typename Derived>
17058template<
typename Derived>
17063 if (
Base.isInvalid())
17069 if (!getDerived().AlwaysRebuild() &&
17070 Base.get() == E->getBase())
17073 return getDerived().RebuildObjCIvarRefExpr(
Base.get(), E->getDecl(),
17075 E->isArrow(), E->isFreeIvar());
17078template<
typename Derived>
17083 if (!E->isObjectReceiver())
17088 if (
Base.isInvalid())
17094 if (!getDerived().AlwaysRebuild() &&
17095 Base.get() == E->getBase())
17098 if (E->isExplicitProperty())
17099 return getDerived().RebuildObjCPropertyRefExpr(
Base.get(),
17100 E->getExplicitProperty(),
17103 return getDerived().RebuildObjCPropertyRefExpr(
Base.get(),
17105 E->getImplicitPropertyGetter(),
17106 E->getImplicitPropertySetter(),
17110template<
typename Derived>
17115 if (
Base.isInvalid())
17119 ExprResult Key = getDerived().TransformExpr(E->getKeyExpr());
17120 if (Key.isInvalid())
17124 if (!getDerived().AlwaysRebuild() &&
17125 Key.get() == E->getKeyExpr() &&
Base.get() == E->getBaseExpr())
17128 return getDerived().RebuildObjCSubscriptRefExpr(E->getRBracket(),
17129 Base.get(), Key.get(),
17130 E->getAtIndexMethodDecl(),
17131 E->setAtIndexMethodDecl());
17134template<
typename Derived>
17139 if (
Base.isInvalid())
17143 if (!getDerived().AlwaysRebuild() &&
17144 Base.get() == E->getBase())
17147 return getDerived().RebuildObjCIsaExpr(
Base.get(), E->getIsaMemberLoc(),
17152template<
typename Derived>
17155 bool ArgumentChanged =
false;
17157 SubExprs.reserve(E->getNumSubExprs());
17158 if (getDerived().TransformExprs(E->getSubExprs(), E->getNumSubExprs(),
false,
17159 SubExprs, &ArgumentChanged))
17162 if (!getDerived().AlwaysRebuild() &&
17166 return getDerived().RebuildShuffleVectorExpr(E->getBuiltinLoc(),
17168 E->getRParenLoc());
17171template<
typename Derived>
17174 ExprResult SrcExpr = getDerived().TransformExpr(E->getSrcExpr());
17175 if (SrcExpr.isInvalid())
17182 if (!getDerived().AlwaysRebuild() &&
17183 Type == E->getTypeSourceInfo() &&
17184 SrcExpr.get() == E->getSrcExpr())
17187 return getDerived().RebuildConvertVectorExpr(E->getBuiltinLoc(),
17188 SrcExpr.get(),
Type,
17189 E->getRParenLoc());
17192template<
typename Derived>
17195 BlockDecl *oldBlock = E->getBlockDecl();
17201 blockScope->TheDecl->setBlockMissingReturnType(
17202 oldBlock->blockMissingReturnType());
17211 if (getDerived().TransformFunctionTypeParams(
17212 E->getCaretLocation(), oldBlock->parameters(),
nullptr,
17213 exprFunctionType->getExtParameterInfosOrNull(), paramTypes, ¶ms,
17215 getSema().ActOnBlockError(E->getCaretLocation(),
nullptr);
17220 getDerived().TransformType(exprFunctionType->getReturnType());
17222 auto epi = exprFunctionType->getExtProtoInfo();
17223 epi.ExtParameterInfos = extParamInfos.getPointerOrNull(paramTypes.size());
17226 getDerived().RebuildFunctionProtoType(exprResultType, paramTypes, epi);
17230 if (!params.empty())
17231 blockScope->TheDecl->setParams(params);
17233 if (!oldBlock->blockMissingReturnType()) {
17234 blockScope->HasImplicitReturnType =
false;
17235 blockScope->ReturnType = exprResultType;
17239 StmtResult body = getDerived().TransformStmt(E->getBody());
17240 if (body.isInvalid()) {
17241 getSema().ActOnBlockError(E->getCaretLocation(),
nullptr);
17249 for (
const auto &I : oldBlock->captures()) {
17250 VarDecl *oldCapture = I.getVariable();
17253 if (oldCapture->isParameterPack())
17257 cast<VarDecl>(getDerived().TransformDecl(E->getCaretLocation(),
17259 assert(blockScope->CaptureMap.count(newCapture));
17265 assert((!blockScope->isCXXThisCaptured() || oldBlock->capturesCXXThis()) &&
17266 "this pointer isn't captured in the old block");
17274template<
typename Derived>
17277 ExprResult SrcExpr = getDerived().TransformExpr(E->getSrcExpr());
17278 if (SrcExpr.isInvalid())
17281 QualType Type = getDerived().TransformType(E->getType());
17284 E->getRParenLoc());
17287template<
typename Derived>
17290 bool ArgumentChanged =
false;
17292 SubExprs.reserve(E->getNumSubExprs());
17293 if (getDerived().TransformExprs(E->getSubExprs(), E->getNumSubExprs(),
false,
17294 SubExprs, &ArgumentChanged))
17297 if (!getDerived().AlwaysRebuild() &&
17301 return getDerived().RebuildAtomicExpr(E->getBuiltinLoc(), SubExprs,
17302 E->getOp(), E->getRParenLoc());
17309template<
typename Derived>
17312 return SemaRef.BuildPointerType(PointeeType,
Star,
17316template<
typename Derived>
17319 return SemaRef.BuildBlockPointerType(PointeeType,
Star,
17323template<
typename Derived>
17326 bool WrittenAsLValue,
17328 return SemaRef.BuildReferenceType(ReferentType, WrittenAsLValue,
17332template <
typename Derived>
17336 return SemaRef.BuildMemberPointerType(PointeeType, SS, Cls, Sigil,
17340template<
typename Derived>
17347 return SemaRef.ObjC().BuildObjCTypeParamType(
17348 Decl, ProtocolLAngleLoc, Protocols, ProtocolLocs, ProtocolRAngleLoc,
17352template<
typename Derived>
17363 return SemaRef.ObjC().BuildObjCObjectType(
17364 BaseType, Loc, TypeArgsLAngleLoc, TypeArgs, TypeArgsRAngleLoc,
17365 ProtocolLAngleLoc, Protocols, ProtocolLocs, ProtocolRAngleLoc,
17370template<
typename Derived>
17374 return SemaRef.Context.getObjCObjectPointerType(PointeeType);
17377template <
typename Derived>
17380 Expr *SizeExpr,
unsigned IndexTypeQuals,
SourceRange BracketsRange) {
17381 if (SizeExpr || !Size)
17382 return SemaRef.BuildArrayType(ElementType, SizeMod, SizeExpr,
17383 IndexTypeQuals, BracketsRange,
17387 SemaRef.Context.UnsignedCharTy,
SemaRef.Context.UnsignedShortTy,
17389 SemaRef.Context.UnsignedLongLongTy,
SemaRef.Context.UnsignedInt128Ty
17392 for (
const auto &
T : Types)
17393 if (Size->getBitWidth() ==
SemaRef.Context.getIntWidth(
T)) {
17403 return SemaRef.BuildArrayType(ElementType, SizeMod, ArraySize,
17404 IndexTypeQuals, BracketsRange,
17408template <
typename Derived>
17411 Expr *SizeExpr,
unsigned IndexTypeQuals,
SourceRange BracketsRange) {
17412 return getDerived().RebuildArrayType(ElementType, SizeMod, &Size, SizeExpr,
17413 IndexTypeQuals, BracketsRange);
17416template <
typename Derived>
17420 return getDerived().RebuildArrayType(ElementType, SizeMod,
nullptr,
nullptr,
17421 IndexTypeQuals, BracketsRange);
17424template <
typename Derived>
17427 unsigned IndexTypeQuals,
SourceRange BracketsRange) {
17428 return getDerived().RebuildArrayType(ElementType, SizeMod,
nullptr,
17430 IndexTypeQuals, BracketsRange);
17433template <
typename Derived>
17436 unsigned IndexTypeQuals,
SourceRange BracketsRange) {
17437 return getDerived().RebuildArrayType(ElementType, SizeMod,
nullptr,
17439 IndexTypeQuals, BracketsRange);
17442template <
typename Derived>
17445 return SemaRef.BuildAddressSpaceAttr(PointeeType, AddrSpaceExpr,
17449template <
typename Derived>
17451 unsigned NumElements,
17454 return SemaRef.Context.getVectorType(ElementType, NumElements, VecKind);
17457template <
typename Derived>
17461 return SemaRef.BuildVectorType(ElementType, SizeExpr, AttributeLoc);
17464template<
typename Derived>
17466 unsigned NumElements,
17468 llvm::APInt numElements(
SemaRef.Context.getIntWidth(
SemaRef.Context.IntTy),
17469 NumElements,
true);
17473 return SemaRef.BuildExtVectorType(ElementType, VectorSize, AttributeLoc);
17476template<
typename Derived>
17481 return SemaRef.BuildExtVectorType(ElementType, SizeExpr, AttributeLoc);
17484template <
typename Derived>
17486 QualType ElementType,
unsigned NumRows,
unsigned NumColumns) {
17487 return SemaRef.Context.getConstantMatrixType(ElementType, NumRows,
17491template <
typename Derived>
17495 return SemaRef.BuildMatrixType(ElementType, RowExpr, ColumnExpr,
17499template <
typename Derived>
17503 return SemaRef.BuildFunctionType(
T, ParamTypes,
17509template<
typename Derived>
17511 return SemaRef.Context.getFunctionNoProtoType(
T);
17514template <
typename Derived>
17518 assert(D &&
"no decl found");
17522 if (
auto *UPD = dyn_cast<UsingPackDecl>(D)) {
17526 if (UPD->expansions().empty()) {
17527 getSema().Diag(NameLoc, diag::err_using_pack_expansion_empty)
17528 << UPD->isCXXClassMember() << UPD;
17537 for (
auto *E : UPD->expansions()) {
17544 else if (
T.isNull())
17547 assert(
getSema().Context.hasSameType(ThisT,
T) &&
17548 "mismatched resolved types in using pack expansion");
17550 return T.isNull() ? FallbackT :
T;
17552 if (
auto *Using = dyn_cast<UsingDecl>(D)) {
17553 assert(Using->hasTypename() &&
17554 "UnresolvedUsingTypenameDecl transformed to non-typename using");
17557 assert(++Using->shadow_begin() == Using->shadow_end());
17562 return SemaRef.Context.getUsingType(
Keyword, Qualifier, Shadow);
17565 "UnresolvedUsingTypenameDecl transformed to non-using decl");
17566 return SemaRef.Context.getUnresolvedUsingType(
17570template <
typename Derived>
17573 return SemaRef.BuildTypeofExprType(E, Kind);
17576template<
typename Derived>
17579 return SemaRef.Context.getTypeOfType(Underlying, Kind);
17582template <
typename Derived>
17584 return SemaRef.BuildDecltypeType(E);
17587template <
typename Derived>
17592 return SemaRef.BuildPackIndexingType(Pattern, IndexExpr, Loc, EllipsisLoc,
17593 FullySubstituted, Expansions);
17596template<
typename Derived>
17598 UnaryTransformType::UTTKind UKind,
17600 return SemaRef.BuildUnaryTransformType(BaseType, UKind, Loc);
17603template <
typename Derived>
17607 return SemaRef.CheckTemplateIdType(
17612template<
typename Derived>
17615 return SemaRef.BuildAtomicType(ValueType, KWLoc);
17618template<
typename Derived>
17622 return isReadPipe ?
SemaRef.BuildReadPipeType(ValueType, KWLoc)
17623 :
SemaRef.BuildWritePipeType(ValueType, KWLoc);
17626template <
typename Derived>
17630 llvm::APInt NumBitsAP(
SemaRef.Context.getIntWidth(
SemaRef.Context.IntTy),
17634 return SemaRef.BuildBitIntType(IsUnsigned, Bits, Loc);
17637template <
typename Derived>
17640 return SemaRef.BuildBitIntType(IsUnsigned, NumBitsExpr, Loc);
17643template <
typename Derived>
17651template <
typename Derived>
17658 getSema().ActOnTemplateName(
nullptr, SS, TemplateKWLoc,
17661 AllowInjectedClassName);
17665template<
typename Derived>
17672 bool AllowInjectedClassName) {
17675 SourceLocation SymbolLocations[3] = { NameLoc, NameLoc, NameLoc };
17680 false,
Template, AllowInjectedClassName);
17684template <
typename Derived>
17689 bool isPostIncDec = Second && (Op == OO_PlusPlus || Op == OO_MinusMinus);
17694 return SemaRef.PseudoObject().checkAssignment(
nullptr, OpLoc,
17695 Opc,
First, Second);
17710 if (Op == OO_Subscript) {
17711 if (!
First->getType()->isOverloadableType() &&
17713 return getSema().CreateBuiltinArraySubscriptExpr(
First, CalleeLoc, Second,
17715 }
else if (Op == OO_Arrow) {
17718 if (
First->getType()->isDependentType())
17721 return SemaRef.BuildOverloadedArrowExpr(
nullptr,
First, OpLoc);
17722 }
else if (Second ==
nullptr || isPostIncDec) {
17723 if (!
First->getType()->isOverloadableType() ||
17724 (Op == OO_Amp &&
getSema().isQualifiedMemberAccess(
First))) {
17731 return getSema().CreateBuiltinUnaryOp(OpLoc, Opc,
First);
17735 !
First->getType()->isOverloadableType() &&
17741 =
SemaRef.CreateBuiltinBinOp(OpLoc, Opc,
First, Second);
17750 if (!Second || isPostIncDec) {
17753 return SemaRef.CreateOverloadedUnaryOp(OpLoc, Opc, Functions,
First,
17760 First, Second, RequiresADL);
17767template<
typename Derived>
17777 QualType CanonicalBaseType =
Base->getType().getCanonicalType();
17783 ->getAsCanonical<RecordType>())) {
17785 return SemaRef.BuildPseudoDestructorExpr(
17786 Base, OperatorLoc, isArrow ? tok::arrow : tok::period, SS, ScopeType,
17787 CCLoc, TildeLoc, Destroyed);
17799 if (!
isa<TagType>(ScopeType->getType().getCanonicalType())) {
17800 getSema().Diag(ScopeType->getTypeLoc().getBeginLoc(),
17801 diag::err_expected_class_or_namespace)
17802 << ScopeType->getType() <<
getSema().getLangOpts().CPlusPlus;
17806 SS.
Make(
SemaRef.Context, ScopeType->getTypeLoc(), CCLoc);
17810 return getSema().BuildMemberReferenceExpr(
17811 Base,
Base->getType(), OperatorLoc, isArrow, SS, TemplateKWLoc,
17817template<
typename Derived>
17825 for (
unsigned I = 0; I < NumParams; ++I) {
17826 if (I != ContextParamPos) {
17832 Params.push_back(std::make_pair(StringRef(), QualType()));
17835 getSema().ActOnCapturedRegionStart(Loc,
nullptr,
17843 if (Body.isInvalid()) {
17844 getSema().ActOnCapturedRegionError();
17848 return getSema().ActOnCapturedRegionEnd(Body.get());
17851template <
typename Derived>
17857 llvm_unreachable(
"SYCL kernel call statement cannot appear in dependent "
17861template <
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.
QualType getSubstTemplateTypeParmType(QualType Replacement, Decl *AssociatedDecl, unsigned Index, UnsignedOrNone PackIndex, bool Final) const
Retrieve a substitution-result type.
QualType getDecayedType(QualType T) const
Return the uniqued reference to the decayed version of the given type.
QualType getBaseElementType(const ArrayType *VAT) const
Return the innermost element type of an array type.
TypeSourceInfo * getTrivialTypeSourceInfo(QualType T, SourceLocation Loc=SourceLocation()) const
Allocate a TypeSourceInfo where all locations have been initialized to a given location,...
CanQualType PseudoObjectTy
QualType getObjCObjectPointerType(QualType OIT) const
Return a ObjCObjectPointerType type for the given ObjCObjectType.
const ArrayType * getAsArrayType(QualType T) const
Type Query functions.
QualType getPackExpansionType(QualType Pattern, UnsignedOrNone NumExpansions, bool ExpectPackInType=true) const
Form a pack expansion type with the given pattern.
static bool hasSameType(QualType T1, QualType T2)
Determine whether the given types T1 and T2 are equivalent.
QualType getSizeType() const
Return the unique type for "size_t" (C99 7.17), defined in <stddef.h>.
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
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)
DeferStmt - This represents a deferred statement.
static DeferStmt * Create(ASTContext &Context, SourceLocation DeferLoc, Stmt *Body)
void setAttrOperandParensRange(SourceRange range)
Represents an extended address space qualifier where the input address space value is dependent.
Represents a 'co_await' expression while the type of the promise is dependent.
void setElaboratedKeywordLoc(SourceLocation Loc)
A qualified reference to a name whose declaration cannot yet be resolved.
SourceLocation getRAngleLoc() const
Retrieve the location of the right angle bracket ending the explicit template argument list following...
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies the name, with source location information.
SourceLocation getLAngleLoc() const
Retrieve the location of the left angle bracket starting the explicit template argument list followin...
bool hasExplicitTemplateArgs() const
Determines whether this lookup had explicit template arguments.
SourceLocation getTemplateKeywordLoc() const
Retrieve the location of the template keyword preceding this name, if any.
unsigned getNumTemplateArgs() const
DeclarationName getDeclName() const
Retrieve the name that this expression refers to.
TemplateArgumentLoc const * getTemplateArgs() const
const DeclarationNameInfo & getNameInfo() const
Retrieve the name that this expression refers to.
Represents an array type in C++ whose size is a value-dependent expression.
void setNameLoc(SourceLocation Loc)
Represents an extended vector type where either the type or size is dependent.
Represents a matrix type where the type and the number of rows and columns is dependent on a template...
void setNameLoc(SourceLocation Loc)
Represents a vector type where either the type or size is dependent.
Represents a single C99 designator.
Represents a C99 designated initializer expression.
Designation - Represent a full designation, which is a sequence of designators.
static Designator CreateArrayRangeDesignator(Expr *Start, Expr *End, SourceLocation LBracketLoc, SourceLocation EllipsisLoc)
Creates a GNU array-range designator.
static Designator CreateArrayDesignator(Expr *Index, SourceLocation LBracketLoc)
Creates an array designator.
static Designator CreateFieldDesignator(const IdentifierInfo *FieldName, SourceLocation DotLoc, SourceLocation FieldLoc)
Creates a field designator.
bool hasErrorOccurred() const
DoStmt - This represents a 'do/while' stmt.
Wrap a function effect's condition expression in another struct so that FunctionProtoType's TrailingO...
Expr * getCondition() const
void set(SourceLocation ElaboratedKeywordLoc, NestedNameSpecifierLoc QualifierLoc, SourceLocation NameLoc)
Represents a reference to emded data.
RAII object that enters a new expression evaluation context.
Wrapper for source info for enum types.
TypeSourceInfo * getTypeInfoAsWritten() const
getTypeInfoAsWritten - Returns the type source info for the type that this expression is casting to.
Represents an expression – generally a full-expression – that introduces cleanups to be run at the en...
This represents one expression.
bool isValueDependent() const
Determines whether the value of this expression depends on.
bool isTypeDependent() const
Determines whether the type of this expression depends on.
ExprObjectKind getObjectKind() const
getObjectKind - The object kind that this expression produces.
Expr * IgnoreImplicitAsWritten() LLVM_READONLY
Skip past any implicit AST nodes which might surround this expression until reaching a fixed point.
bool isDefaultArgument() const
Determine whether this expression is a default function argument.
bool hasPlaceholderType() const
Returns whether this expression has a placeholder type.
static ExprValueKind getValueKindForType(QualType T)
getValueKindForType - Given a formal return or parameter type, give its value kind.
An expression trait intrinsic.
ExtVectorElementExpr - This represents access to specific elements of a vector, and may occur on the ...
Represents difference between two FPOptions values.
FPOptions applyOverrides(FPOptions Base)
Represents a member of a struct/union/class.
ForStmt - This represents a 'for (init;cond;inc)' stmt.
Represents a function declaration or definition.
ArrayRef< ParmVarDecl * > parameters() const
SmallVector< Conflict > Conflicts
Represents an abstract function effect, using just an enumeration describing its kind.
StringRef name() const
The description printed in diagnostics, e.g. 'nonblocking'.
Kind oppositeKind() const
Return the opposite kind, for effects which have opposites.
ArrayRef< EffectConditionExpr > conditions() const
Represents a K&R-style 'int foo()' function, which has no information available about its arguments.
Represents a reference to a function parameter pack, init-capture pack, or binding pack that has been...
Represents a prototype with parameter type info, e.g.
param_type_iterator param_type_begin() const
unsigned getNumParams() const
SourceLocation getLocalRangeEnd() const
void setLocalRangeBegin(SourceLocation L)
void setLParenLoc(SourceLocation Loc)
SourceRange getExceptionSpecRange() const
void setParam(unsigned i, ParmVarDecl *VD)
ArrayRef< ParmVarDecl * > getParams() const
void setRParenLoc(SourceLocation Loc)
void setLocalRangeEnd(SourceLocation L)
void setExceptionSpecRange(SourceRange R)
TypeLoc getReturnLoc() const
SourceLocation getLocalRangeBegin() const
SourceLocation getLParenLoc() const
SourceLocation getRParenLoc() const
Interesting information about a specific parameter that can't simply be reflected in parameter's type...
This represents a GCC inline-assembly statement extension.
GNUNullExpr - Implements the GNU __null extension, which is a name for a null pointer constant that h...
Represents a C11 generic selection.
AssociationTy< false > Association
GotoStmt - This represents a direct goto.
Type source information for HLSL attributed resource type.
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.
NonTypeTemplateParmDecl - Declares a non-type template parameter, e.g., "Size" in.
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 'dyn_groupprivate' clause in 'pragma omp target ...' and 'pragma omp teams ....
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 'threadset' clause in the 'pragma omp task ...' 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)
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 * 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 * 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 * ActOnOpenMPNowaitClause(SourceLocation StartLoc, SourceLocation EndLoc, SourceLocation LParenLoc, Expr *Condition)
Called on well-formed 'nowait' clause.
OMPClause * ActOnOpenMPOrderClause(OpenMPOrderClauseModifier Modifier, OpenMPOrderClauseKind Kind, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation MLoc, SourceLocation KindLoc, SourceLocation EndLoc)
Called on well-formed 'order' clause.
OMPClause * ActOnOpenMPSizesClause(ArrayRef< Expr * > SizeExprs, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-form 'sizes' clause.
OMPClause * ActOnOpenMPDeviceClause(OpenMPDeviceClauseModifier Modifier, Expr *Device, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ModifierLoc, SourceLocation EndLoc)
Called on well-formed 'device' clause.
OMPClause * ActOnOpenMPInReductionClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc, CXXScopeSpec &ReductionIdScopeSpec, const DeclarationNameInfo &ReductionId, ArrayRef< Expr * > UnresolvedReductions={})
Called on well-formed 'in_reduction' clause.
OMPClause * ActOnOpenMPFlushClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'flush' pseudo clause.
StmtResult ActOnOpenMPExecutableDirective(OpenMPDirectiveKind Kind, const DeclarationNameInfo &DirName, OpenMPDirectiveKind CancelRegion, ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
OMPClause * ActOnOpenMPMessageClause(Expr *MS, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'message' clause.
OMPClause * ActOnOpenMPScheduleClause(OpenMPScheduleClauseModifier M1, OpenMPScheduleClauseModifier M2, OpenMPScheduleClauseKind Kind, Expr *ChunkSize, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation M1Loc, SourceLocation M2Loc, SourceLocation KindLoc, SourceLocation CommaLoc, SourceLocation EndLoc)
Called on well-formed 'schedule' clause.
OMPClause * ActOnOpenMPSimdlenClause(Expr *Length, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'simdlen' clause.
OMPClause * 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.
OMPClause * ActOnOpenMPFromClause(ArrayRef< OpenMPMotionModifierKind > MotionModifiers, ArrayRef< SourceLocation > MotionModifiersLoc, Expr *IteratorModifier, CXXScopeSpec &MapperIdScopeSpec, DeclarationNameInfo &MapperId, SourceLocation ColonLoc, ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs, ArrayRef< Expr * > UnresolvedMappers={})
Called on well-formed 'from' clause.
OMPClause * ActOnOpenMPDynGroupprivateClause(OpenMPDynGroupprivateClauseModifier M1, OpenMPDynGroupprivateClauseFallbackModifier M2, Expr *Size, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation M1Loc, SourceLocation M2Loc, SourceLocation EndLoc)
Called on a well-formed 'dyn_groupprivate' clause.
void StartOpenMPDSABlock(OpenMPDirectiveKind K, const DeclarationNameInfo &DirName, Scope *CurScope, SourceLocation Loc)
Called on start of new data sharing attribute block.
OMPClause * ActOnOpenMPSeverityClause(OpenMPSeverityClauseKind Kind, SourceLocation KindLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'severity' clause.
OMPClause * ActOnOpenMPToClause(ArrayRef< OpenMPMotionModifierKind > MotionModifiers, ArrayRef< SourceLocation > MotionModifiersLoc, Expr *IteratorModifier, CXXScopeSpec &MapperIdScopeSpec, DeclarationNameInfo &MapperId, SourceLocation ColonLoc, ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs, ArrayRef< Expr * > UnresolvedMappers={})
Called on well-formed 'to' clause.
OMPClause * ActOnOpenMPLinearClause(ArrayRef< Expr * > VarList, Expr *Step, SourceLocation StartLoc, SourceLocation LParenLoc, OpenMPLinearClauseKind LinKind, SourceLocation LinLoc, SourceLocation ColonLoc, SourceLocation StepModifierLoc, SourceLocation EndLoc)
Called on well-formed 'linear' clause.
OMPClause * ActOnOpenMPDefaultmapClause(OpenMPDefaultmapClauseModifier M, OpenMPDefaultmapClauseKind Kind, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation MLoc, SourceLocation KindLoc, SourceLocation EndLoc)
Called on well-formed 'defaultmap' clause.
OMPClause * ActOnOpenMPReductionClause(ArrayRef< Expr * > VarList, OpenMPVarListDataTy::OpenMPReductionClauseModifiers Modifiers, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ModifierLoc, SourceLocation ColonLoc, SourceLocation EndLoc, CXXScopeSpec &ReductionIdScopeSpec, const DeclarationNameInfo &ReductionId, ArrayRef< Expr * > UnresolvedReductions={})
Called on well-formed 'reduction' clause.
OMPClause * ActOnOpenMPAlignedClause(ArrayRef< Expr * > VarList, Expr *Alignment, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc)
Called on well-formed 'aligned' clause.
OMPClause * ActOnOpenMPDepobjClause(Expr *Depobj, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'depobj' pseudo clause.
OMPClause * ActOnOpenMPNovariantsClause(Expr *Condition, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'novariants' clause.
OMPClause * ActOnOpenMPCopyprivateClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'copyprivate' clause.
OMPClause * ActOnOpenMPCollapseClause(Expr *NumForLoops, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'collapse' clause.
OMPClause * ActOnOpenMPDefaultClause(llvm::omp::DefaultKind M, SourceLocation MLoc, OpenMPDefaultClauseVariableCategory VCKind, SourceLocation VCKindLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'default' clause.
OMPClause * ActOnOpenMPAlignClause(Expr *Alignment, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'align' clause.
OMPClause * ActOnOpenMPXAttributeClause(ArrayRef< const Attr * > Attrs, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on a well-formed 'ompx_attribute' clause.
OMPClause * ActOnOpenMPExclusiveClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'exclusive' clause.
OMPClause * ActOnOpenMPIfClause(OpenMPDirectiveKind NameModifier, Expr *Condition, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation NameModifierLoc, SourceLocation ColonLoc, SourceLocation EndLoc)
Called on well-formed 'if' clause.
Expr * recreateSyntacticForm(PseudoObjectExpr *E)
Given a pseudo-object expression, recreate what it looks like syntactically without the attendant Opa...
ExprResult checkRValue(Expr *E)
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.
OpenMPDynGroupprivateClauseFallbackModifier
MutableArrayRef< Expr * > MultiExprArg
@ Property
The type of a property.
@ Result
The result type of a method or function.
OpenMPBindClauseKind
OpenMP bindings for the 'bind' clause.
ArraySizeModifier
Capture whether this is a normal array (e.g.
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.
std::tuple< NamedDecl *, TemplateArgument > getReplacedTemplateParameter(Decl *D, unsigned Index)
Internal helper used by Subst* nodes to retrieve a parameter from the AssociatedDecl,...
OpenMPDefaultmapClauseKind
OpenMP attributes for 'defaultmap' clause.
OpenMPAllocateClauseModifier
OpenMP modifiers for 'allocate' clause.
OpenMPLinearClauseKind
OpenMP attributes for 'linear' clause.
llvm::omp::Directive OpenMPDirectiveKind
OpenMP directives.
OpenMPDynGroupprivateClauseModifier
@ VK_PRValue
A pr-value expression (in the C++11 taxonomy) produces a temporary value.
@ VK_LValue
An l-value expression is a reference to an object with independent storage.
@ Dependent
The name is a dependent name, so the results will differ from one instantiation to the next.
@ Exists
The symbol exists.
@ Error
An error occurred.
@ DoesNotExist
The symbol does not exist.
MutableArrayRef< Stmt * > MultiStmtArg
OpenMPNumThreadsClauseModifier
U cast(CodeGen::Address addr)
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