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, MapperIdScopeSpec, MapperId,
2230 ColonLoc, VarList, Locs, UnresolvedMappers);
2245 MotionModifiers, MotionModifiersLoc, MapperIdScopeSpec, MapperId,
2246 ColonLoc, VarList, Locs, UnresolvedMappers);
2297 M, Kind, StartLoc, LParenLoc, MLoc, KindLoc, EndLoc);
2344 StartLoc, LParenLoc, EndLoc,
Data);
2357 StartLoc, LParenLoc, ColonLoc, EndLoc, Modifier, Locators);
2369 Modifier, Kind, StartLoc, LParenLoc, ModifierKwLoc, KindKwLoc, EndLoc);
2382 InteropVar, InteropInfo, StartLoc, LParenLoc, VarLoc, EndLoc);
2393 LParenLoc, VarLoc, EndLoc);
2405 InteropVar, StartLoc, LParenLoc, VarLoc, EndLoc);
2544 DepType, DepLoc, ColonLoc, VarList, StartLoc, LParenLoc, EndLoc);
2592 ForLoc, Element, Collection, RParenLoc);
2610 StartLoc, IdLoc, Id);
2647 if (
DeclStmt *RangeStmt = dyn_cast<DeclStmt>(Range)) {
2648 if (RangeStmt->isSingleDecl()) {
2649 if (
VarDecl *RangeVar = dyn_cast<VarDecl>(RangeStmt->getSingleDecl())) {
2650 if (RangeVar->isInvalidDecl())
2653 Expr *RangeExpr = RangeVar->getInit();
2660 diag::err_objc_for_range_init_stmt)
2661 <<
Init->getSourceRange();
2664 ForLoc, LoopVar, RangeExpr, RParenLoc);
2671 ForLoc, CoawaitLoc,
Init, ColonLoc, Range, Begin, End,
Cond, Inc,
2685 QualifierLoc, NameInfo, Nested);
2747 SS.
Adopt(QualifierLoc);
2859 if (IsOMPArraySection)
2861 Base, LBracketLoc, LowerBound, ColonLocFirst, ColonLocSecond, Length,
2862 Stride, RBracketLoc);
2864 assert(Stride ==
nullptr && !ColonLocSecond.
isValid() &&
2865 "Stride/second colon not allowed for OpenACC");
2868 Base, LBracketLoc, LowerBound, ColonLocFirst, Length, RBracketLoc);
2880 Base, LParenLoc, RParenLoc, Dims, BracketsRanges);
2892 nullptr, IteratorKwLoc, LLoc, RLoc,
Data);
2902 Expr *ExecConfig =
nullptr) {
2904 nullptr, Callee, LParenLoc, Args, RParenLoc, ExecConfig);
2911 nullptr, Callee, LParenLoc, Args, RParenLoc);
2929 if (!
Member->getDeclName()) {
2933 assert(
Member->getType()->isRecordType() &&
2934 "unnamed member not of record type?");
2947 if (!isArrow &&
Base->isPRValue()) {
2962 SS.
Adopt(QualifierLoc);
2965 if (
Base->containsErrors())
2970 if (isArrow && !BaseType->isPointerType())
2979 if (
getSema().isUnevaluatedContext() &&
Base->isImplicitCXXThis() &&
2984 ->getAsCXXRecordDecl()) {
2988 if (!ThisClass->Equals(
Class) && !ThisClass->isDerivedFrom(
Class))
2996 FirstQualifierInScope,
2997 R, ExplicitTemplateArgs,
3007 bool ForFoldExpression =
false) {
3085 return SemaRef.BuildInitList(LBraceLoc, Inits, RBraceLoc);
3098 =
SemaRef.ActOnDesignatedInitializer(Desig, EqualOrColonLoc, GNUSyntax,
3138 unsigned NumUserSpecifiedExprs,
3143 InitLoc, LParenLoc, RParenLoc);
3173 return SemaRef.ActOnChooseExpr(BuiltinLoc,
3185 Expr *ControllingExpr,
3190 ControllingExpr, Types, Exprs);
3205 ControllingType, Types, Exprs);
3238 case Stmt::CXXStaticCastExprClass:
3239 return getDerived().RebuildCXXStaticCastExpr(OpLoc, LAngleLoc, TInfo,
3240 RAngleLoc, LParenLoc,
3241 SubExpr, RParenLoc);
3243 case Stmt::CXXDynamicCastExprClass:
3244 return getDerived().RebuildCXXDynamicCastExpr(OpLoc, LAngleLoc, TInfo,
3245 RAngleLoc, LParenLoc,
3246 SubExpr, RParenLoc);
3248 case Stmt::CXXReinterpretCastExprClass:
3249 return getDerived().RebuildCXXReinterpretCastExpr(OpLoc, LAngleLoc, TInfo,
3250 RAngleLoc, LParenLoc,
3254 case Stmt::CXXConstCastExprClass:
3255 return getDerived().RebuildCXXConstCastExpr(OpLoc, LAngleLoc, TInfo,
3256 RAngleLoc, LParenLoc,
3257 SubExpr, RParenLoc);
3259 case Stmt::CXXAddrspaceCastExprClass:
3260 return getDerived().RebuildCXXAddrspaceCastExpr(
3261 OpLoc, LAngleLoc, TInfo, RAngleLoc, LParenLoc, SubExpr, RParenLoc);
3264 llvm_unreachable(
"Invalid C++ named cast");
3342 OpLoc, tok::kw_addrspace_cast, TInfo, SubExpr,
3354 bool ListInitialization) {
3358 if (
auto *PLE = dyn_cast<ParenListExpr>(Sub))
3360 TInfo, LParenLoc,
MultiExprArg(PLE->getExprs(), PLE->getNumExprs()),
3361 RParenLoc, ListInitialization);
3363 if (
auto *PLE = dyn_cast<CXXParenListInitExpr>(Sub))
3365 TInfo, LParenLoc, PLE->getInitExprs(), RParenLoc, ListInitialization);
3369 ListInitialization);
3433 if (
getSema().CheckCXXThisType(ThisLoc, ThisType))
3443 bool IsThrownVariableInScope) {
3453 Expr *RewrittenExpr) {
3455 RewrittenExpr,
getSema().CurContext);
3489 std::optional<Expr *> ArraySize,
3508 bool IsGlobalDelete,
3559 bool IsAddressOfOperand,
3562 SS.
Adopt(QualifierLoc);
3564 if (TemplateArgs || TemplateKWLoc.
isValid())
3566 SS, TemplateKWLoc, NameInfo, TemplateArgs, IsAddressOfOperand);
3569 SS, NameInfo, IsAddressOfOperand, RecoveryTSI);
3591 bool IsElidable,
MultiExprArg Args,
bool HadMultipleCandidates,
3592 bool ListInitialization,
bool StdInitListInitialization,
3599 FoundCtor =
Constructor->getInheritedConstructor().getConstructor();
3602 if (
getSema().CompleteConstructorCall(FoundCtor,
T, Args, Loc,
3609 HadMultipleCandidates,
3611 StdInitListInitialization,
3612 RequiresZeroInit, ConstructKind,
3620 bool ConstructsVBase,
3621 bool InheritedFromVBase) {
3623 Loc,
T,
Constructor, ConstructsVBase, InheritedFromVBase);
3634 bool ListInitialization) {
3636 TSInfo, LParenOrBraceLoc, Args, RParenOrBraceLoc, ListInitialization);
3647 bool ListInitialization) {
3649 RParenLoc, ListInitialization);
3666 SS.
Adopt(QualifierLoc);
3668 return SemaRef.BuildMemberReferenceExpr(BaseE, BaseType,
3669 OperatorLoc, IsArrow,
3671 FirstQualifierInScope,
3673 TemplateArgs,
nullptr);
3689 SS.
Adopt(QualifierLoc);
3691 return SemaRef.BuildMemberReferenceExpr(BaseE, BaseType,
3692 OperatorLoc, IsArrow,
3694 FirstQualifierInScope,
3695 R, TemplateArgs,
nullptr);
3703 return SemaRef.BuildCXXNoexceptExpr(Range.getBegin(), Arg, Range.getEnd());
3716 RParenLoc, Length, PartialArgs);
3721 Expr *PackIdExpression,
Expr *IndexExpr,
3723 bool FullySubstituted =
false) {
3725 IndexExpr, RSquareLoc, ExpandedExprs,
3751 NamedConcept, TALI);
3769 LocalParameters, RParenLoc, Requirements,
3776 return SemaRef.BuildTypeRequirement(SubstDiag);
3780 return SemaRef.BuildTypeRequirement(
T);
3788 return SemaRef.BuildExprRequirement(SubstDiag, IsSimple, NoexceptLoc,
3795 return SemaRef.BuildExprRequirement(E, IsSimple, NoexceptLoc,
3802 return SemaRef.BuildNestedRequirement(InvalidConstraintEntity,
3807 return SemaRef.BuildNestedRequirement(Constraint);
3823 Expr **Elements,
unsigned NumElements) {
3833 RB,
Base, Key, getterMethod, setterMethod);
3852 return SemaRef.ObjC().BuildObjCEncodeExpression(AtLoc, EncodeTypeInfo,
3864 return SemaRef.ObjC().BuildClassMessage(
3865 ReceiverTypeInfo, ReceiverTypeInfo->
getType(),
3878 return SemaRef.ObjC().BuildInstanceMessage(Receiver, Receiver->
getType(),
3881 SelectorLocs, RBracLoc, Args);
3893 return Method->isInstanceMethod()
3894 ?
SemaRef.ObjC().BuildInstanceMessage(
3895 nullptr, SuperType, SuperLoc, Sel,
Method, LBracLoc,
3896 SelectorLocs, RBracLoc, Args)
3897 :
SemaRef.ObjC().BuildClassMessage(
nullptr, SuperType, SuperLoc,
3899 SelectorLocs, RBracLoc, Args);
3908 bool IsArrow,
bool IsFreeIvar) {
3917 if (IsFreeIvar &&
Result.isUsable())
3954 PropertyLoc,
Base));
3983 =
SemaRef.Context.Idents.get(
"__builtin_shufflevector");
3986 assert(!Lookup.
empty() &&
"No __builtin_shufflevector?");
3994 Callee =
SemaRef.ImpCastExprToType(Callee, CalleePtrTy,
3995 CK_BuiltinFnToFnPtr).get();
4011 return SemaRef.ConvertVectorExpr(SrcExpr, DstTInfo, BuiltinLoc, RParenLoc);
4026 EllipsisLoc, NumExpansions);
4050 llvm_unreachable(
"Pack expansion pattern has no parameter packs");
4086 EllipsisLoc, RHS, RParenLoc,
4095 Init->containsUnexpandedParameterPack();
4096 else if (PVD->hasUninstantiatedDefaultArg())
4098 PVD->getUninstantiatedDefaultArg()
4099 ->containsUnexpandedParameterPack();
4253 Exprs.push_back(DevNumExpr);
4254 llvm::append_range(Exprs, QueueIdExprs);
4298 ObjectType, FirstQualifierInScope);
4304 QualType TransformDependentNameType(TypeLocBuilder &TLB,
4305 DependentNameTypeLoc TL,
4306 bool DeducibleTSTContext,
4307 QualType ObjectType = QualType(),
4308 NamedDecl *UnqualLookup =
nullptr);
4311 TransformOpenACCClauseList(OpenACCDirectiveKind DirKind,
4316 OpenACCDirectiveKind DirKind,
4317 const OpenACCClause *OldClause);
4320template <
typename Derived>
4330#define STMT(Node, Parent) \
4331 case Stmt::Node##Class: return getDerived().Transform##Node(cast<Node>(S));
4332#define VALUESTMT(Node, Parent) \
4333 case Stmt::Node##Class: \
4334 return getDerived().Transform##Node(cast<Node>(S), SDK);
4335#define ABSTRACT_STMT(Node)
4336#define EXPR(Node, Parent)
4337#include "clang/AST/StmtNodes.inc"
4340#define STMT(Node, Parent)
4341#define ABSTRACT_STMT(Stmt)
4342#define EXPR(Node, Parent) case Stmt::Node##Class:
4343#include "clang/AST/StmtNodes.inc"
4348 E =
getSema().ActOnStmtExprResult(E);
4356template<
typename Derived>
4364#define GEN_CLANG_CLAUSE_CLASS
4365#define CLAUSE_CLASS(Enum, Str, Class) \
4367 return getDerived().Transform##Class(cast<Class>(S));
4368#include "llvm/Frontend/OpenMP/OMP.inc"
4375template<
typename Derived>
4382#define STMT(Node, Parent) case Stmt::Node##Class: break;
4383#define ABSTRACT_STMT(Stmt)
4384#define EXPR(Node, Parent) \
4385 case Stmt::Node##Class: return getDerived().Transform##Node(cast<Node>(E));
4386#include "clang/AST/StmtNodes.inc"
4392template<
typename Derived>
4400 if (
auto *FE = dyn_cast<FullExpr>(
Init))
4401 Init = FE->getSubExpr();
4403 if (
auto *AIL = dyn_cast<ArrayInitLoopExpr>(
Init)) {
4409 Init = MTE->getSubExpr();
4412 Init = Binder->getSubExpr();
4415 Init = ICE->getSubExprAsWritten();
4418 dyn_cast<CXXStdInitializerListExpr>(
Init))
4455 getSema().currentEvaluationContext().InLifetimeExtendingContext =
4456 getSema().parentEvaluationContext().InLifetimeExtendingContext;
4457 getSema().currentEvaluationContext().RebuildDefaultArgOrDefaultInit =
4458 getSema().parentEvaluationContext().RebuildDefaultArgOrDefaultInit;
4460 bool ArgChanged =
false;
4462 true, NewArgs, &ArgChanged))
4472 if (
Parens.isInvalid()) {
4475 assert(NewArgs.empty() &&
4476 "no parens or braces but have direct init with arguments?");
4483template<
typename Derived>
4489 for (
unsigned I = 0; I != NumInputs; ++I) {
4499 Expr *Pattern = Expansion->getPattern();
4502 getSema().collectUnexpandedParameterPacks(Pattern, Unexpanded);
4503 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
4508 bool RetainExpansion =
false;
4509 UnsignedOrNone OrigNumExpansions = Expansion->getNumExpansions();
4513 Unexpanded,
true, Expand,
4514 RetainExpansion, NumExpansions))
4527 Expansion->getEllipsisLoc(),
4529 if (Out.isInvalid())
4534 Outputs.push_back(Out.get());
4540 if (ArgChanged) *ArgChanged =
true;
4544 for (
unsigned I = 0; I != *NumExpansions; ++I) {
4547 if (Out.isInvalid())
4550 if (Out.get()->containsUnexpandedParameterPack()) {
4552 Out.get(), Expansion->getEllipsisLoc(), OrigNumExpansions);
4553 if (Out.isInvalid())
4557 Outputs.push_back(Out.get());
4562 if (RetainExpansion) {
4563 ForgetPartiallySubstitutedPackRAII Forget(
getDerived());
4566 if (Out.isInvalid())
4570 Out.get(), Expansion->getEllipsisLoc(), OrigNumExpansions);
4571 if (Out.isInvalid())
4574 Outputs.push_back(Out.get());
4581 IsCall ?
getDerived().TransformInitializer(Inputs[I],
false)
4586 if (
Result.get() != Inputs[I] && ArgChanged)
4589 Outputs.push_back(
Result.get());
4595template <
typename Derived>
4606 VarDecl *ConditionVar = cast_or_null<VarDecl>(
4612 return getSema().ActOnConditionVariable(ConditionVar, Loc, Kind);
4621 return getSema().ActOnCondition(
nullptr, Loc, CondExpr.
get(), Kind,
4628template <
typename Derived>
4636 Qualifier = Qualifier.getAsNamespaceAndPrefix().Prefix)
4648 llvm_unreachable(
"unexpected null nested name specifier");
4679 QualifierLoc =
getDerived().TransformNestedNameSpecifierLoc(
4680 QualifierLoc, ObjectType, FirstQualifierInScope);
4684 FirstQualifierInScope =
nullptr;
4686 SS.
Adopt(QualifierLoc);
4690 if (
SemaRef.BuildCXXNestedNameSpecifier(
nullptr, IdInfo,
4692 FirstQualifierInScope,
false))
4700 T = TransformTypeInObjectScope(TLB, TL, ObjectType,
4701 FirstQualifierInScope);
4707 if (
T->isDependentType() ||
T->isRecordType() ||
4708 (
SemaRef.getLangOpts().CPlusPlus11 &&
T->isEnumeralType())) {
4709 if (
T->isEnumeralType())
4711 diag::warn_cxx98_compat_enum_nested_name_spec);
4718 if (!TTL || !TTL.
getDecl()->isInvalidDecl()) {
4742template<
typename Derived>
4762 TemplateDecl *NewTemplate = cast_or_null<TemplateDecl>(
4769 SemaRef.Context.DeclarationNames.getCXXDeductionGuideName(NewTemplate));
4779 NewTInfo =
getDerived().TransformType(OldTInfo);
4782 NewCanTy =
SemaRef.Context.getCanonicalType(NewTInfo->
getType());
4790 NewCanTy =
SemaRef.Context.getCanonicalType(NewT);
4803 llvm_unreachable(
"Unknown name kind.");
4806template <
typename Derived>
4810 QualType ObjectType,
bool AllowInjectedClassName) {
4812 return getDerived().RebuildTemplateName(SS, TemplateKWLoc, *II, NameLoc,
4813 ObjectType, AllowInjectedClassName);
4815 NameLoc, ObjectType,
4816 AllowInjectedClassName);
4819template <
typename Derived>
4823 NamedDecl *FirstQualifierInScope,
bool AllowInjectedClassName) {
4825 TemplateName UnderlyingName = QTN->getUnderlyingTemplate();
4828 QualifierLoc =
getDerived().TransformNestedNameSpecifierLoc(
4829 QualifierLoc, ObjectType, FirstQualifierInScope);
4836 UnderlyingQualifier, TemplateKWLoc, UnderlyingName, NameLoc, ObjectType,
4837 FirstQualifierInScope, AllowInjectedClassName);
4838 if (NewUnderlyingName.
isNull())
4840 assert(!UnderlyingQualifier &&
"unexpected qualifier");
4844 NewUnderlyingName == UnderlyingName)
4847 SS.
Adopt(QualifierLoc);
4848 return getDerived().RebuildTemplateName(SS, QTN->hasTemplateKeyword(),
4854 QualifierLoc =
getDerived().TransformNestedNameSpecifierLoc(
4855 QualifierLoc, ObjectType, FirstQualifierInScope);
4869 SS.
Adopt(QualifierLoc);
4870 return getDerived().RebuildTemplateName(SS, TemplateKWLoc, DTN->getName(),
4871 NameLoc, ObjectType,
4872 AllowInjectedClassName);
4877 assert(!QualifierLoc &&
"Unexpected qualified SubstTemplateTemplateParm");
4884 ReplacementQualifierLoc = Builder.getWithLocInContext(
SemaRef.Context);
4888 ReplacementQualifierLoc, TemplateKWLoc, ReplacementName, NameLoc,
4889 ObjectType, FirstQualifierInScope, AllowInjectedClassName);
4892 Decl *AssociatedDecl =
4893 getDerived().TransformDecl(NameLoc, S->getAssociatedDecl());
4895 AssociatedDecl == S->getAssociatedDecl())
4897 return SemaRef.Context.getSubstTemplateTemplateParm(
4898 NewName, AssociatedDecl, S->getIndex(), S->getPackIndex(),
4903 "DeducedTemplateName should not escape partial ordering");
4907 assert(!QualifierLoc &&
"Unexpected qualifier");
4914 assert(!QualifierLoc &&
4915 "Unexpected qualified SubstTemplateTemplateParmPack");
4917 SubstPack->getArgumentPack(), SubstPack->getAssociatedDecl(),
4918 SubstPack->getIndex(), SubstPack->getFinal());
4922 llvm_unreachable(
"overloaded function decl survived to here");
4925template <
typename Derived>
4930 QualifierLoc, TemplateKeywordLoc, Name, NameLoc);
4936template<
typename Derived>
4940 Output =
getSema().getTrivialTemplateArgumentLoc(
4944template <
typename Derived>
4952 llvm_unreachable(
"Unexpected TemplateArgument");
4975 if (NewT ==
T && D == NewD)
4992 llvm_unreachable(
"unexpected template argument kind");
5024 llvm_unreachable(
"Caller should expand pack expansions");
5040 E =
SemaRef.ActOnConstantExpression(E);
5055template<
typename Derived,
typename InputIterator>
5063 typedef typename std::iterator_traits<InputIterator>::difference_type
5078 : Self(Self), Iter(Iter) { }
5093 Self.InventTemplateArgumentLoc(*Iter,
Result);
5101 return X.Iter == Y.Iter;
5106 return X.Iter != Y.Iter;
5110template<
typename Derived>
5111template<
typename InputIterator>
5131 PackLocIterator(*
this, In.getArgument().pack_begin()),
5132 PackLocIterator(*
this, In.getArgument().pack_end()), *PackOutput,
5139 if (In.getArgument().isPackExpansion()) {
5151 std::optional<ForgetSubstitutionRAII> ForgetSubst;
5161 if (Out.getArgument().containsUnexpandedParameterPack()) {
5164 if (Out.getArgument().isNull())
5174 ForgetPartiallySubstitutedPackRAII Forget(
getDerived());
5182 if (Out.getArgument().isNull())
5201template <
typename Derived>
5202template <
typename InputIterator>
5211 return !Arg.isDependent() && Arg.isConceptOrConceptTemplateParameter();
5223 PackLocIterator(*
this, In.getArgument().pack_begin()),
5224 PackLocIterator(*
this, In.getArgument().pack_end()), Outputs,
5230 if (!isNonDependentConceptArgument(In.getArgument())) {
5245template <
typename Derived>
5256 Pattern =
getSema().getTemplateArgumentPackExpansionPattern(
5259 getSema().collectUnexpandedParameterPacks(Pattern, Unexpanded);
5260 if (IsLateExpansionAttempt) {
5265 return P.first.dyn_cast<
const SubstBuiltinTemplatePackType *>();
5267 if (!SawPackTypes) {
5272 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
5280 Info.
Ellipsis, Pattern.getSourceRange(), Unexpanded,
5286 if (ComputeInfo(In,
false, Info, Pattern))
5298 std::optional<Sema::ArgPackSubstIndexRAII> SubstIndex(
5299 std::in_place,
getSema(), std::nullopt);
5305 if (Out.getArgument().isNull())
5342 ForgetSubstitutionRAII ForgetSubst(
getDerived());
5343 if (ComputeInfo(Out,
true, Info, OutPattern))
5356template<
typename Derived>
5374template<
typename Derived>
5394template<
typename Derived>
5397 switch (
T.getTypeLocClass()) {
5398#define ABSTRACT_TYPELOC(CLASS, PARENT)
5399#define TYPELOC(CLASS, PARENT) \
5400 case TypeLoc::CLASS: \
5401 return getDerived().Transform##CLASS##Type(TLB, \
5402 T.castAs<CLASS##TypeLoc>());
5403#include "clang/AST/TypeLocNodes.def"
5406 llvm_unreachable(
"unhandled type loc!");
5409template<
typename Derived>
5422template<
typename Derived>
5460template<
typename Derived>
5465 TypeLoc UnqualTL =
T.getUnqualifiedLoc();
5466 auto SuppressObjCLifetime =
5467 T.getType().getLocalQualifiers().hasObjCLifetime();
5469 Result = getDerived().TransformTemplateTypeParmType(TLB, TTP,
5470 SuppressObjCLifetime);
5471 }
else if (
auto STTP = UnqualTL.
getAs<SubstTemplateTypeParmPackTypeLoc>()) {
5472 Result = getDerived().TransformSubstTemplateTypeParmPackType(
5473 TLB, STTP, SuppressObjCLifetime);
5475 Result = getDerived().TransformType(TLB, UnqualTL);
5494template <
typename Derived>
5504 SemaRef.Diag(Loc, diag::err_address_space_mismatch_templ_inst)
5511 if (
T.getPointerAuth().isPresent()) {
5512 SemaRef.Diag(Loc, diag::err_ptrauth_qualifier_redundant) << TL.
getType();
5515 if (!
T->isDependentType()) {
5516 if (!
T->isSignableType(
SemaRef.getASTContext())) {
5517 SemaRef.Diag(Loc, diag::err_ptrauth_qualifier_invalid_target) <<
T;
5525 if (
T->isFunctionType()) {
5526 T =
SemaRef.getASTContext().getAddrSpaceQualType(
T,
5536 if (
T->isReferenceType()) {
5546 if (!
T->isObjCLifetimeType() && !
T->isDependentType())
5548 else if (
T.getObjCLifetime()) {
5552 const AutoType *AutoTy;
5553 if ((AutoTy = dyn_cast<AutoType>(
T)) && AutoTy->isDeduced()) {
5555 QualType Deduced = AutoTy->getDeducedType();
5560 T =
SemaRef.Context.getAutoType(Deduced, AutoTy->getKeyword(),
5563 AutoTy->getTypeConstraintConcept(),
5564 AutoTy->getTypeConstraintArguments());
5569 SemaRef.Diag(Loc, diag::err_attr_objc_ownership_redundant) <<
T;
5575 return SemaRef.BuildQualifiedType(
T, Loc, Quals);
5578template <
typename Derived>
5579QualType TreeTransform<Derived>::TransformTypeInObjectScope(
5582 assert(!getDerived().AlreadyTransformed(TL.
getType()));
5585 case TypeLoc::TemplateSpecialization:
5586 return getDerived().TransformTemplateSpecializationType(
5588 FirstQualifierInScope,
true);
5589 case TypeLoc::DependentName:
5590 return getDerived().TransformDependentNameType(
5592 ObjectType, FirstQualifierInScope);
5596 return getDerived().TransformType(TLB, TL);
5600template <
class TyLoc>
static inline
5602 TyLoc NewT = TLB.
push<TyLoc>(
T.getType());
5603 NewT.setNameLoc(
T.getNameLoc());
5607template<
typename Derived>
5608QualType TreeTransform<Derived>::TransformBuiltinType(TypeLocBuilder &TLB,
5610 BuiltinTypeLoc NewT = TLB.push<BuiltinTypeLoc>(T.getType());
5611 NewT.setBuiltinLoc(T.getBuiltinLoc());
5612 if (T.needsExtraLocalData())
5613 NewT.getWrittenBuiltinSpecs() = T.getWrittenBuiltinSpecs();
5617template<
typename Derived>
5624template <
typename Derived>
5628 return getDerived().
TransformType(TLB, TL.getOriginalLoc());
5631template<
typename Derived>
5634 QualType OriginalType = getDerived().TransformType(TLB, TL.getOriginalLoc());
5635 if (OriginalType.isNull())
5639 if (getDerived().AlwaysRebuild() ||
5640 OriginalType != TL.getOriginalLoc().getType())
5647template <
typename Derived>
5651 QualType OriginalType = getDerived().TransformType(TLB, TL.getElementLoc());
5652 if (OriginalType.isNull())
5656 if (getDerived().AlwaysRebuild() ||
5657 OriginalType != TL.getElementLoc().getType())
5664template<
typename Derived>
5668 = getDerived().TransformType(TLB, TL.getPointeeLoc());
5669 if (PointeeType.isNull())
5673 if (PointeeType->getAs<ObjCObjectType>()) {
5685 if (getDerived().AlwaysRebuild() ||
5686 PointeeType != TL.getPointeeLoc().getType()) {
5687 Result = getDerived().RebuildPointerType(PointeeType, TL.getSigilLoc());
5694 TLB.TypeWasModifiedSafely(
Result->getPointeeType());
5701template<
typename Derived>
5706 = getDerived().TransformType(TLB, TL.getPointeeLoc());
5707 if (PointeeType.isNull())
5711 if (getDerived().AlwaysRebuild() ||
5712 PointeeType != TL.getPointeeLoc().getType()) {
5713 Result = getDerived().RebuildBlockPointerType(PointeeType,
5728template<
typename Derived>
5736 if (PointeeType.
isNull())
5741 PointeeType !=
T->getPointeeTypeAsWritten()) {
5743 T->isSpelledAsLValue(),
5765template<
typename Derived>
5769 return TransformReferenceType(TLB, TL);
5772template<
typename Derived>
5774TreeTransform<Derived>::TransformRValueReferenceType(TypeLocBuilder &TLB,
5775 RValueReferenceTypeLoc TL) {
5776 return TransformReferenceType(TLB, TL);
5779template<
typename Derived>
5783 QualType PointeeType = getDerived().TransformType(TLB, TL.getPointeeLoc());
5784 if (PointeeType.isNull())
5791 getDerived().TransformNestedNameSpecifierLoc(OldQualifierLoc);
5792 if (!NewQualifierLoc)
5795 CXXRecordDecl *OldCls =
T->getMostRecentCXXRecordDecl(), *NewCls =
nullptr;
5797 NewCls = cast_or_null<CXXRecordDecl>(
5798 getDerived().TransformDecl(TL.getStarLoc(), OldCls));
5804 if (getDerived().AlwaysRebuild() || PointeeType !=
T->getPointeeType() ||
5805 NewQualifierLoc.getNestedNameSpecifier() !=
5806 OldQualifierLoc.getNestedNameSpecifier() ||
5809 SS.
Adopt(NewQualifierLoc);
5810 Result = getDerived().RebuildMemberPointerType(PointeeType, SS, NewCls,
5819 if (MPT && PointeeType != MPT->getPointeeType()) {
5826 NewTL.setQualifierLoc(NewQualifierLoc);
5831template<
typename Derived>
5836 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
5837 if (ElementType.isNull())
5841 Expr *OldSize = TL.getSizeExpr();
5843 OldSize =
const_cast<Expr*
>(
T->getSizeExpr());
5844 Expr *NewSize =
nullptr;
5848 NewSize = getDerived().TransformExpr(OldSize).template getAs<Expr>();
5853 if (getDerived().AlwaysRebuild() ||
5854 ElementType !=
T->getElementType() ||
5855 (
T->getSizeExpr() && NewSize != OldSize)) {
5856 Result = getDerived().RebuildConstantArrayType(ElementType,
5857 T->getSizeModifier(),
5858 T->getSize(), NewSize,
5859 T->getIndexTypeCVRQualifiers(),
5860 TL.getBracketsRange());
5871 NewTL.setRBracketLoc(TL.getRBracketLoc());
5872 NewTL.setSizeExpr(NewSize);
5877template<
typename Derived>
5882 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
5883 if (ElementType.isNull())
5887 if (getDerived().AlwaysRebuild() ||
5888 ElementType !=
T->getElementType()) {
5889 Result = getDerived().RebuildIncompleteArrayType(ElementType,
5890 T->getSizeModifier(),
5891 T->getIndexTypeCVRQualifiers(),
5892 TL.getBracketsRange());
5899 NewTL.setRBracketLoc(TL.getRBracketLoc());
5900 NewTL.setSizeExpr(
nullptr);
5905template<
typename Derived>
5910 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
5911 if (ElementType.isNull())
5918 SizeResult = getDerived().TransformExpr(
T->getSizeExpr());
5920 if (SizeResult.isInvalid())
5924 if (SizeResult.isInvalid())
5930 if (getDerived().AlwaysRebuild() ||
5931 ElementType !=
T->getElementType() ||
5932 Size !=
T->getSizeExpr()) {
5933 Result = getDerived().RebuildVariableArrayType(ElementType,
5934 T->getSizeModifier(),
5936 T->getIndexTypeCVRQualifiers(),
5937 TL.getBracketsRange());
5946 NewTL.setRBracketLoc(TL.getRBracketLoc());
5947 NewTL.setSizeExpr(Size);
5952template<
typename Derived>
5957 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
5958 if (ElementType.isNull())
5966 SemaRef.
ExprEvalContexts.back().InConditionallyConstantEvaluateContext =
true;
5969 Expr *origSize = TL.getSizeExpr();
5970 if (!origSize) origSize =
T->getSizeExpr();
5973 = getDerived().TransformExpr(origSize);
5975 if (sizeResult.isInvalid())
5978 Expr *size = sizeResult.get();
5981 if (getDerived().AlwaysRebuild() ||
5982 ElementType !=
T->getElementType() ||
5984 Result = getDerived().RebuildDependentSizedArrayType(ElementType,
5985 T->getSizeModifier(),
5987 T->getIndexTypeCVRQualifiers(),
5988 TL.getBracketsRange());
5997 NewTL.setRBracketLoc(TL.getRBracketLoc());
5998 NewTL.setSizeExpr(size);
6003template <
typename Derived>
6007 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
6008 if (ElementType.isNull())
6016 if (
Size.isInvalid())
6020 if (getDerived().AlwaysRebuild() || ElementType !=
T->getElementType() ||
6021 Size.get() !=
T->getSizeExpr()) {
6022 Result = getDerived().RebuildDependentVectorType(
6023 ElementType,
Size.get(),
T->getAttributeLoc(),
T->getVectorKind());
6041template<
typename Derived>
6048 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
6049 if (ElementType.isNull())
6058 if (
Size.isInvalid())
6062 if (getDerived().AlwaysRebuild() ||
6063 ElementType !=
T->getElementType() ||
6064 Size.get() !=
T->getSizeExpr()) {
6065 Result = getDerived().RebuildDependentSizedExtVectorType(ElementType,
6067 T->getAttributeLoc());
6085template <
typename Derived>
6090 QualType ElementType = getDerived().TransformType(
T->getElementType());
6091 if (ElementType.isNull())
6095 if (getDerived().AlwaysRebuild() || ElementType !=
T->getElementType()) {
6096 Result = getDerived().RebuildConstantMatrixType(
6097 ElementType,
T->getNumRows(),
T->getNumColumns());
6104 NewTL.setAttrOperandParensRange(TL.getAttrOperandParensRange());
6105 NewTL.setAttrRowOperand(TL.getAttrRowOperand());
6106 NewTL.setAttrColumnOperand(TL.getAttrColumnOperand());
6111template <
typename Derived>
6116 QualType ElementType = getDerived().TransformType(
T->getElementType());
6117 if (ElementType.isNull()) {
6125 Expr *origRows = TL.getAttrRowOperand();
6127 origRows =
T->getRowExpr();
6128 Expr *origColumns = TL.getAttrColumnOperand();
6130 origColumns =
T->getColumnExpr();
6132 ExprResult rowResult = getDerived().TransformExpr(origRows);
6134 if (rowResult.isInvalid())
6137 ExprResult columnResult = getDerived().TransformExpr(origColumns);
6139 if (columnResult.isInvalid())
6142 Expr *rows = rowResult.get();
6143 Expr *columns = columnResult.get();
6146 if (getDerived().AlwaysRebuild() || ElementType !=
T->getElementType() ||
6147 rows != origRows || columns != origColumns) {
6148 Result = getDerived().RebuildDependentSizedMatrixType(
6149 ElementType, rows, columns,
T->getAttributeLoc());
6159 NewTL.setAttrOperandParensRange(TL.getAttrOperandParensRange());
6160 NewTL.setAttrRowOperand(rows);
6161 NewTL.setAttrColumnOperand(columns);
6165template <
typename Derived>
6171 getDerived().TransformType(TLB, TL.getPointeeTypeLoc());
6173 if (pointeeType.isNull())
6180 ExprResult AddrSpace = getDerived().TransformExpr(
T->getAddrSpaceExpr());
6182 if (AddrSpace.isInvalid())
6186 if (getDerived().AlwaysRebuild() || pointeeType !=
T->getPointeeType() ||
6187 AddrSpace.get() !=
T->getAddrSpaceExpr()) {
6188 Result = getDerived().RebuildDependentAddressSpaceType(
6189 pointeeType, AddrSpace.get(),
T->getAttributeLoc());
6200 NewTL.setAttrExprOperand(TL.getAttrExprOperand());
6201 NewTL.setAttrNameLoc(TL.getAttrNameLoc());
6204 TLB.TypeWasModifiedSafely(
Result);
6210template <
typename Derived>
6214 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
6215 if (ElementType.isNull())
6219 if (getDerived().AlwaysRebuild() ||
6220 ElementType !=
T->getElementType()) {
6221 Result = getDerived().RebuildVectorType(ElementType,
T->getNumElements(),
6222 T->getVectorKind());
6233template<
typename Derived>
6237 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
6238 if (ElementType.isNull())
6242 if (getDerived().AlwaysRebuild() ||
6243 ElementType !=
T->getElementType()) {
6244 Result = getDerived().RebuildExtVectorType(ElementType,
6245 T->getNumElements(),
6257template <
typename Derived>
6260 bool ExpectParameterPack) {
6295 if (NewDI == OldDI && indexAdjustment == 0)
6309 getDerived().transformedLocalDecl(OldParm, {newParm});
6313template <
typename Derived>
6321 unsigned *LastParamTransformed) {
6322 int indexAdjustment = 0;
6324 unsigned NumParams = Params.size();
6325 for (
unsigned i = 0; i != NumParams; ++i) {
6326 if (LastParamTransformed)
6327 *LastParamTransformed = i;
6329 assert(OldParm->getFunctionScopeIndex() == i);
6333 if (OldParm->isParameterPack()) {
6338 TypeLoc TL = OldParm->getTypeSourceInfo()->getTypeLoc();
6341 SemaRef.collectUnexpandedParameterPacks(Pattern, Unexpanded);
6344 bool ShouldExpand =
false;
6345 bool RetainExpansion =
false;
6347 if (Unexpanded.size() > 0) {
6348 OrigNumExpansions = ExpansionTL.
getTypePtr()->getNumExpansions();
6349 NumExpansions = OrigNumExpansions;
6353 ShouldExpand, RetainExpansion, NumExpansions)) {
6358 const AutoType *AT =
6359 Pattern.getType().getTypePtr()->getContainedAutoType();
6360 assert((AT && (!AT->isDeduced() || AT->getDeducedType().isNull())) &&
6361 "Could not find parameter packs or undeduced auto type!");
6368 getDerived().ExpandingFunctionParameterPack(OldParm);
6369 for (
unsigned I = 0; I != *NumExpansions; ++I) {
6372 =
getDerived().TransformFunctionTypeParam(OldParm,
6380 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6381 OutParamTypes.push_back(NewParm->
getType());
6383 PVars->push_back(NewParm);
6388 if (RetainExpansion) {
6389 ForgetPartiallySubstitutedPackRAII Forget(
getDerived());
6391 =
getDerived().TransformFunctionTypeParam(OldParm,
6399 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6400 OutParamTypes.push_back(NewParm->
getType());
6402 PVars->push_back(NewParm);
6418 NewParm =
getDerived().TransformFunctionTypeParam(OldParm,
6423 "Parameter pack no longer a parameter pack after "
6426 NewParm =
getDerived().TransformFunctionTypeParam(
6427 OldParm, indexAdjustment, std::nullopt,
6435 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6436 OutParamTypes.push_back(NewParm->
getType());
6438 PVars->push_back(NewParm);
6446 bool IsPackExpansion =
false;
6449 if (
const PackExpansionType *Expansion
6450 = dyn_cast<PackExpansionType>(OldType)) {
6452 QualType Pattern = Expansion->getPattern();
6454 getSema().collectUnexpandedParameterPacks(Pattern, Unexpanded);
6457 bool ShouldExpand =
false;
6458 bool RetainExpansion =
false;
6462 RetainExpansion, NumExpansions)) {
6469 for (
unsigned I = 0; I != *NumExpansions; ++I) {
6476 NewType =
getSema().getASTContext().getPackExpansionType(
6477 NewType, std::nullopt);
6484 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6485 OutParamTypes.push_back(NewType);
6487 PVars->push_back(
nullptr);
6496 if (RetainExpansion) {
6497 ForgetPartiallySubstitutedPackRAII Forget(
getDerived());
6503 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6504 OutParamTypes.push_back(NewType);
6506 PVars->push_back(
nullptr);
6511 OldType = Expansion->getPattern();
6512 IsPackExpansion =
true;
6514 NewType =
getDerived().TransformType(OldType);
6516 NewType =
getDerived().TransformType(OldType);
6522 if (IsPackExpansion)
6523 NewType =
getSema().Context.getPackExpansionType(NewType,
6527 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6528 OutParamTypes.push_back(NewType);
6530 PVars->push_back(
nullptr);
6535 for (
unsigned i = 0, e = PVars->size(); i != e; ++i)
6537 assert(parm->getFunctionScopeIndex() == i);
6544template<
typename Derived>
6549 return getDerived().TransformFunctionProtoType(
6553 ExceptionStorage, Changed);
6557template<
typename Derived>
template<
typename Fn>
6576 if (
T->hasTrailingReturn()) {
6580 T->getExtParameterInfosOrNull(),
6581 ParamTypes, &ParamDecls, ExtParamInfos))
6591 auto *RD = dyn_cast<CXXRecordDecl>(
SemaRef.getCurLexicalContext());
6593 SemaRef, !ThisContext && RD ? RD : ThisContext, ThisTypeQuals);
6608 T->getExtParameterInfosOrNull(),
6609 ParamTypes, &ParamDecls, ExtParamInfos))
6615 bool EPIChanged =
false;
6620 if (
auto NewExtParamInfos =
6636 std::optional<FunctionEffectSet> NewFX;
6648 std::optional<FunctionEffectMode> Mode =
6668 "FunctionEffectMode::None shouldn't be possible here");
6671 if (!
SemaRef.diagnoseConflictingFunctionEffect(*NewFX, NewEC,
6674 NewFX->insert(NewEC, Errs);
6675 assert(Errs.empty());
6685 Result =
getDerived().RebuildFunctionProtoType(ResultType, ParamTypes, EPI);
6696 for (
unsigned i = 0, e = NewTL.
getNumParams(); i != e; ++i)
6702template<
typename Derived>
6725 getSema().ActOnNoexceptSpec(NoexceptExpr.
get(), EST);
6740 if (
const PackExpansionType *PackExpansion =
6741 T->getAs<PackExpansionType>()) {
6746 SemaRef.collectUnexpandedParameterPacks(PackExpansion->getPattern(),
6748 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
6753 bool Expand =
false;
6754 bool RetainExpansion =
false;
6755 UnsignedOrNone NumExpansions = PackExpansion->getNumExpansions();
6760 true, Expand, RetainExpansion,
6773 U =
SemaRef.Context.getPackExpansionType(
U, NumExpansions);
6774 Exceptions.push_back(
U);
6780 for (
unsigned ArgIdx = 0; ArgIdx != *NumExpansions; ++ArgIdx) {
6784 if (
U.isNull() ||
SemaRef.CheckSpecifiedExceptionType(
U, Loc))
6787 Exceptions.push_back(
U);
6791 if (
U.isNull() ||
SemaRef.CheckSpecifiedExceptionType(
U, Loc))
6796 Exceptions.push_back(
U);
6806template<
typename Derived>
6816 if (getDerived().AlwaysRebuild() || ResultType !=
T->getReturnType())
6817 Result = getDerived().RebuildFunctionNoProtoType(ResultType);
6828template <
typename Derived>
6829QualType TreeTransform<Derived>::TransformUnresolvedUsingType(
6830 TypeLocBuilder &TLB, UnresolvedUsingTypeLoc TL) {
6832 const UnresolvedUsingType *T = TL.getTypePtr();
6833 bool Changed =
false;
6835 NestedNameSpecifierLoc QualifierLoc = TL.getQualifierLoc();
6836 if (NestedNameSpecifierLoc OldQualifierLoc = QualifierLoc) {
6837 QualifierLoc = getDerived().TransformNestedNameSpecifierLoc(QualifierLoc);
6840 Changed |= QualifierLoc != OldQualifierLoc;
6843 auto *D = getDerived().TransformDecl(TL.getNameLoc(),
T->getDecl());
6849 if (getDerived().AlwaysRebuild() || Changed) {
6850 Result = getDerived().RebuildUnresolvedUsingType(
6851 T->getKeyword(), QualifierLoc.getNestedNameSpecifier(), TL.getNameLoc(),
6859 QualifierLoc, TL.getNameLoc());
6862 QualifierLoc, TL.getNameLoc());
6866template <
typename Derived>
6874 QualifierLoc = getDerived().TransformNestedNameSpecifierLoc(QualifierLoc);
6877 Changed |= QualifierLoc != OldQualifierLoc;
6880 auto *D = cast_or_null<UsingShadowDecl>(
6881 getDerived().TransformDecl(TL.getNameLoc(),
T->getDecl()));
6886 QualType UnderlyingType = getDerived().TransformType(
T->desugar());
6887 if (UnderlyingType.isNull())
6889 Changed |= UnderlyingType !=
T->desugar();
6892 if (getDerived().AlwaysRebuild() || Changed) {
6893 Result = getDerived().RebuildUsingType(
6894 T->getKeyword(), QualifierLoc.getNestedNameSpecifier(), D,
6904template<
typename Derived>
6912 QualifierLoc = getDerived().TransformNestedNameSpecifierLoc(QualifierLoc);
6915 Changed |= QualifierLoc != OldQualifierLoc;
6918 auto *
Typedef = cast_or_null<TypedefNameDecl>(
6919 getDerived().TransformDecl(TL.getNameLoc(),
T->getDecl()));
6927 if (getDerived().AlwaysRebuild() || Changed) {
6928 Result = getDerived().RebuildTypedefType(
6929 T->getKeyword(), QualifierLoc.getNestedNameSpecifier(),
Typedef);
6935 QualifierLoc, TL.getNameLoc());
6939template<
typename Derived>
6947 ExprResult E = getDerived().TransformExpr(TL.getUnderlyingExpr());
6957 if (getDerived().AlwaysRebuild() || E.get() != TL.getUnderlyingExpr()) {
6959 getDerived().RebuildTypeOfExprType(E.get(), TL.getTypeofLoc(), Kind);
6966 NewTL.setLParenLoc(TL.getLParenLoc());
6967 NewTL.setRParenLoc(TL.getRParenLoc());
6972template<
typename Derived>
6976 TypeSourceInfo* New_Under_TI = getDerived().TransformType(Old_Under_TI);
6982 if (getDerived().AlwaysRebuild() || New_Under_TI != Old_Under_TI) {
6983 Result = getDerived().RebuildTypeOfType(New_Under_TI->getType(), Kind);
6990 NewTL.setLParenLoc(TL.getLParenLoc());
6991 NewTL.setRParenLoc(TL.getRParenLoc());
6992 NewTL.setUnmodifiedTInfo(New_Under_TI);
6997template<
typename Derived>
7000 const DecltypeType *
T = TL.getTypePtr();
7007 ExprResult E = getDerived().TransformExpr(
T->getUnderlyingExpr());
7011 E = getSema().ActOnDecltypeExpression(E.get());
7016 if (getDerived().AlwaysRebuild() ||
7017 E.get() !=
T->getUnderlyingExpr()) {
7018 Result = getDerived().RebuildDecltypeType(E.get(), TL.getDecltypeLoc());
7026 NewTL.setRParenLoc(TL.getRParenLoc());
7030template <
typename Derived>
7040 IndexExpr = getDerived().TransformExpr(TL.getIndexExpr());
7041 if (IndexExpr.isInvalid())
7044 QualType Pattern = TL.getPattern();
7046 const PackIndexingType *PIT = TL.
getTypePtr();
7050 bool NotYetExpanded = Types.empty();
7051 bool FullySubstituted =
true;
7053 if (Types.empty() && !PIT->expandsToEmptyPack())
7057 if (!
T->containsUnexpandedParameterPack()) {
7058 QualType Transformed = getDerived().TransformType(
T);
7059 if (Transformed.isNull())
7061 SubtitutedTypes.push_back(Transformed);
7066 getSema().collectUnexpandedParameterPacks(
T, Unexpanded);
7067 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
7070 bool ShouldExpand =
true;
7071 bool RetainExpansion =
false;
7073 if (getDerived().TryExpandParameterPacks(
7076 RetainExpansion, NumExpansions))
7078 if (!ShouldExpand) {
7084 QualType Pack = getDerived().TransformType(TLB, TI->getTypeLoc());
7087 if (NotYetExpanded) {
7088 FullySubstituted =
false;
7089 QualType Out = getDerived().RebuildPackIndexingType(
7099 SubtitutedTypes.push_back(Pack);
7102 for (
unsigned I = 0; I != *NumExpansions; ++I) {
7107 SubtitutedTypes.push_back(Out);
7108 FullySubstituted &= !
Out->containsUnexpandedParameterPack();
7112 if (RetainExpansion) {
7113 FullySubstituted =
false;
7114 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
7118 SubtitutedTypes.push_back(Out);
7126 QualType Result = getDerived().TransformType(TLB, TL.getPatternLoc());
7128 QualType Out = getDerived().RebuildPackIndexingType(
7130 FullySubstituted, SubtitutedTypes);
7139template<
typename Derived>
7145 if (
Result->isDependentType()) {
7146 const UnaryTransformType *
T = TL.getTypePtr();
7148 NewBaseTSI = getDerived().TransformType(TL.getUnderlyingTInfo());
7151 QualType NewBase = NewBaseTSI->getType();
7153 Result = getDerived().RebuildUnaryTransformType(NewBase,
7162 NewTL.setParensRange(TL.getParensRange());
7163 NewTL.setUnderlyingTInfo(NewBaseTSI);
7167template<
typename Derived>
7170 const DeducedTemplateSpecializationType *
T = TL.getTypePtr();
7175 TL.getTemplateNameLoc());
7179 QualType OldDeduced =
T->getDeducedType();
7181 if (!OldDeduced.isNull()) {
7182 NewDeduced = getDerived().TransformType(OldDeduced);
7183 if (NewDeduced.isNull())
7187 QualType Result = getDerived().RebuildDeducedTemplateSpecializationType(
7194 NewTL.setTemplateNameLoc(TL.getTemplateNameLoc());
7195 NewTL.setQualifierLoc(QualifierLoc);
7199template <
typename Derived>
7206 QualifierLoc =
getDerived().TransformNestedNameSpecifierLoc(QualifierLoc);
7211 auto *TD = cast_or_null<TagDecl>(
7218 TD !=
T->getDecl()) {
7219 if (
T->isCanonicalUnqualified())
7236template <
typename Derived>
7242template <
typename Derived>
7243QualType TreeTransform<Derived>::TransformRecordType(TypeLocBuilder &TLB,
7245 return getDerived().TransformTagType(TLB, TL);
7248template<
typename Derived>
7255template<
typename Derived>
7259 return getDerived().TransformTemplateTypeParmType(
7264template <
typename Derived>
7270template<
typename Derived>
7271QualType TreeTransform<Derived>::TransformSubstTemplateTypeParmType(
7272 TypeLocBuilder &TLB,
7273 SubstTemplateTypeParmTypeLoc TL) {
7274 const SubstTemplateTypeParmType *T = TL.getTypePtr();
7277 getDerived().TransformDecl(TL.getNameLoc(), T->getAssociatedDecl());
7282 TemporaryBase Rebase(*
this, TL.getNameLoc(), DeclarationName());
7283 QualType Replacement = getDerived().TransformType(T->getReplacementType());
7284 if (Replacement.isNull())
7288 Replacement, NewReplaced, T->getIndex(), T->getPackIndex(),
7292 SubstTemplateTypeParmTypeLoc NewTL
7293 = TLB.push<SubstTemplateTypeParmTypeLoc>(Result);
7294 NewTL.setNameLoc(TL.getNameLoc());
7298template <
typename Derived>
7304template<
typename Derived>
7308 return getDerived().TransformSubstTemplateTypeParmPackType(
7312template <
typename Derived>
7318template<
typename Derived>
7319QualType TreeTransform<Derived>::TransformAtomicType(TypeLocBuilder &TLB,
7321 QualType ValueType = getDerived().TransformType(TLB, TL.getValueLoc());
7322 if (ValueType.isNull())
7325 QualType Result = TL.getType();
7326 if (getDerived().AlwaysRebuild() ||
7327 ValueType != TL.getValueLoc().getType()) {
7328 Result = getDerived().RebuildAtomicType(ValueType, TL.getKWLoc());
7329 if (Result.isNull())
7335 NewTL.setLParenLoc(TL.getLParenLoc());
7336 NewTL.setRParenLoc(TL.getRParenLoc());
7341template <
typename Derived>
7344 QualType ValueType = getDerived().TransformType(TLB, TL.getValueLoc());
7345 if (ValueType.isNull())
7349 if (getDerived().AlwaysRebuild() || ValueType != TL.getValueLoc().getType()) {
7352 Result = getDerived().RebuildPipeType(ValueType, TL.getKWLoc(), isReadPipe);
7363template <
typename Derived>
7369 if (getDerived().AlwaysRebuild()) {
7370 Result = getDerived().RebuildBitIntType(EIT->isUnsigned(),
7371 EIT->getNumBits(), TL.getNameLoc());
7381template <
typename Derived>
7388 ExprResult BitsExpr = getDerived().TransformExpr(EIT->getNumBitsExpr());
7391 if (BitsExpr.isInvalid())
7396 if (getDerived().AlwaysRebuild() || BitsExpr.get() != EIT->getNumBitsExpr()) {
7397 Result = getDerived().RebuildDependentBitIntType(
7398 EIT->isUnsigned(), BitsExpr.get(), TL.getNameLoc());
7414template <
typename Derived>
7417 llvm_unreachable(
"This type does not need to be transformed.");
7425 template<
typename ArgLocContainer>
7427 ArgLocContainer *Container;
7452 : Container(&Container), Index(Index) { }
7466 return Container->getArgLoc(Index);
7470 return pointer(Container->getArgLoc(Index));
7475 return X.Container == Y.Container &&
X.Index == Y.Index;
7484template<
typename Derived>
7485QualType TreeTransform<Derived>::TransformAutoType(TypeLocBuilder &TLB,
7487 const AutoType *T = TL.getTypePtr();
7488 QualType OldDeduced = T->getDeducedType();
7489 QualType NewDeduced;
7490 if (!OldDeduced.isNull()) {
7491 NewDeduced = getDerived().TransformType(OldDeduced);
7492 if (NewDeduced.isNull())
7499 if (
T->isConstrained()) {
7500 assert(TL.getConceptReference());
7501 NewCD = cast_or_null<ConceptDecl>(getDerived().TransformDecl(
7502 TL.getConceptNameLoc(),
T->getTypeConstraintConcept()));
7504 NewTemplateArgs.setLAngleLoc(TL.getLAngleLoc());
7505 NewTemplateArgs.setRAngleLoc(TL.getRAngleLoc());
7507 if (getDerived().TransformTemplateArguments(
7508 ArgIterator(TL, 0), ArgIterator(TL, TL.getNumArgs()),
7512 if (TL.getNestedNameSpecifierLoc()) {
7514 = getDerived().TransformNestedNameSpecifierLoc(
7515 TL.getNestedNameSpecifierLoc());
7516 if (!NewNestedNameSpec)
7522 if (getDerived().AlwaysRebuild() || NewDeduced != OldDeduced ||
7523 T->isDependentType() ||
T->isConstrained()) {
7526 NewArgList.reserve(NewTemplateArgs.size());
7527 for (
const auto &ArgLoc : NewTemplateArgs.arguments())
7528 NewArgList.push_back(ArgLoc.getArgument());
7529 Result = getDerived().RebuildAutoType(NewDeduced,
T->getKeyword(), NewCD,
7537 NewTL.setRParenLoc(TL.getRParenLoc());
7538 NewTL.setConceptReference(
nullptr);
7540 if (
T->isConstrained()) {
7542 TL.getTypePtr()->getTypeConstraintConcept()->getDeclName(),
7543 TL.getConceptNameLoc(),
7544 TL.getTypePtr()->getTypeConstraintConcept()->getDeclName());
7546 SemaRef.
Context, NewNestedNameSpec, TL.getTemplateKWLoc(), DNI,
7547 TL.getFoundDecl(), TL.getTypePtr()->getTypeConstraintConcept(),
7549 NewTL.setConceptReference(CR);
7555template <
typename Derived>
7558 return getDerived().TransformTemplateSpecializationType(
7563template <
typename Derived>
7566 NamedDecl *FirstQualifierInScope,
bool AllowInjectedClassName) {
7567 const TemplateSpecializationType *
T = TL.
getTypePtr();
7573 AllowInjectedClassName);
7582 if (getDerived().TransformTemplateArguments(ArgIterator(TL, 0),
7591 QualType Result = getDerived().RebuildTemplateSpecializationType(
7604template <
typename Derived>
7608 QualType modifiedType = getDerived().TransformType(TLB, TL.getModifiedLoc());
7609 if (modifiedType.isNull())
7613 const Attr *oldAttr = TL.getAttr();
7614 const Attr *newAttr = oldAttr ? getDerived().TransformAttr(oldAttr) :
nullptr;
7615 if (oldAttr && !newAttr)
7621 if (getDerived().AlwaysRebuild() ||
7622 modifiedType != oldType->getModifiedType()) {
7635 QualType equivalentType = modifiedType;
7636 if (TL.getModifiedLoc().getType() != TL.getEquivalentTypeLoc().getType()) {
7638 AuxiliaryTLB.
reserve(TL.getFullDataSize());
7640 getDerived().TransformType(AuxiliaryTLB, TL.getEquivalentTypeLoc());
7641 if (equivalentType.isNull())
7647 if (
auto nullability = oldType->getImmediateNullability()) {
7648 if (!modifiedType->canHaveNullability()) {
7649 SemaRef.
Diag((TL.getAttr() ? TL.getAttr()->getLocation()
7650 : TL.getModifiedLoc().getBeginLoc()),
7651 diag::err_nullability_nonpointer)
7668template <
typename Derived>
7672 QualType InnerTy = getDerived().TransformType(TLB, TL.getInnerLoc());
7673 if (InnerTy.isNull())
7676 Expr *OldCount = TL.getCountExpr();
7677 Expr *NewCount =
nullptr;
7679 ExprResult CountResult = getDerived().TransformExpr(OldCount);
7680 if (CountResult.isInvalid())
7682 NewCount = CountResult.get();
7686 if (getDerived().AlwaysRebuild() || InnerTy != OldTy->desugar() ||
7687 OldCount != NewCount) {
7690 InnerTy, NewCount, OldTy->isCountInBytes(), OldTy->isOrNull());
7697template <
typename Derived>
7701 llvm_unreachable(
"Unexpected TreeTransform for BTFTagAttributedType");
7704template <
typename Derived>
7708 const HLSLAttributedResourceType *oldType = TL.getTypePtr();
7710 QualType WrappedTy = getDerived().TransformType(TLB, TL.getWrappedLoc());
7711 if (WrappedTy.isNull())
7715 QualType OldContainedTy = oldType->getContainedType();
7716 if (!OldContainedTy.isNull()) {
7717 TypeSourceInfo *oldContainedTSI = TL.getContainedTypeSourceInfo();
7718 if (!oldContainedTSI)
7719 oldContainedTSI = getSema().getASTContext().getTrivialTypeSourceInfo(
7721 TypeSourceInfo *ContainedTSI = getDerived().TransformType(oldContainedTSI);
7724 ContainedTy = ContainedTSI->getType();
7728 if (getDerived().AlwaysRebuild() || WrappedTy != oldType->getWrappedType() ||
7729 ContainedTy != oldType->getContainedType()) {
7731 WrappedTy, ContainedTy, oldType->getAttrs());
7738template <
typename Derived>
7742 return TL.getType();
7745template<
typename Derived>
7749 QualType Inner = getDerived().TransformType(TLB, TL.getInnerLoc());
7754 if (getDerived().AlwaysRebuild() ||
7755 Inner != TL.getInnerLoc().getType()) {
7756 Result = getDerived().RebuildParenType(Inner);
7763 NewTL.setRParenLoc(TL.getRParenLoc());
7767template <
typename Derived>
7771 QualType Inner = getDerived().TransformType(TLB, TL.getInnerLoc());
7776 if (getDerived().AlwaysRebuild() || Inner != TL.getInnerLoc().getType()) {
7778 getDerived().RebuildMacroQualifiedType(Inner, TL.getMacroIdentifier());
7788template<
typename Derived>
7789QualType TreeTransform<Derived>::TransformDependentNameType(
7791 return TransformDependentNameType(TLB, TL,
false);
7794template <
typename Derived>
7795QualType TreeTransform<Derived>::TransformDependentNameType(
7798 const DependentNameType *
T = TL.getTypePtr();
7802 QualifierLoc = getDerived().TransformNestedNameSpecifierLoc(
7803 QualifierLoc, ObjectType, UnqualLookup);
7807 assert((ObjectType.isNull() && !UnqualLookup) &&
7808 "must be transformed by TransformNestedNameSpecifierLoc");
7812 = getDerived().RebuildDependentNameType(
T->getKeyword(),
7813 TL.getElaboratedKeywordLoc(),
7824 NewTL.setQualifierLoc(QualifierLoc);
7825 NewTL.setNameLoc(TL.getNameLoc());
7829 NewTL.setTemplateNameLoc(TL.getNameLoc());
7830 NewTL.setQualifierLoc(QualifierLoc);
7833 QualifierLoc, TL.getNameLoc());
7836 NewTL.
set(TL.getElaboratedKeywordLoc(), QualifierLoc, TL.getNameLoc());
7840 NewTL.setQualifierLoc(QualifierLoc);
7841 NewTL.setNameLoc(TL.getNameLoc());
7846template<
typename Derived>
7850 = getDerived().TransformType(TLB, TL.getPatternLoc());
7851 if (Pattern.isNull())
7855 if (getDerived().AlwaysRebuild() ||
7856 Pattern != TL.getPatternLoc().getType()) {
7857 Result = getDerived().RebuildPackExpansionType(Pattern,
7858 TL.getPatternLoc().getSourceRange(),
7859 TL.getEllipsisLoc(),
7860 TL.getTypePtr()->getNumExpansions());
7870template<
typename Derived>
7875 TLB.pushFullCopy(TL);
7876 return TL.getType();
7879template<
typename Derived>
7883 const ObjCTypeParamType *
T = TL.getTypePtr();
7885 getDerived().TransformDecl(
T->getDecl()->getLocation(),
T->getDecl()));
7890 if (getDerived().AlwaysRebuild() ||
7891 OTP !=
T->getDecl()) {
7892 Result = getDerived().RebuildObjCTypeParamType(
7893 OTP, TL.getProtocolLAngleLoc(),
7894 llvm::ArrayRef(TL.getTypePtr()->qual_begin(), TL.getNumProtocols()),
7895 TL.getProtocolLocs(), TL.getProtocolRAngleLoc());
7901 if (TL.getNumProtocols()) {
7902 NewTL.setProtocolLAngleLoc(TL.getProtocolLAngleLoc());
7903 for (
unsigned i = 0, n = TL.getNumProtocols(); i != n; ++i)
7904 NewTL.setProtocolLoc(i, TL.getProtocolLoc(i));
7905 NewTL.setProtocolRAngleLoc(TL.getProtocolRAngleLoc());
7910template<
typename Derived>
7915 QualType BaseType = getDerived().TransformType(TLB, TL.getBaseLoc());
7916 if (BaseType.isNull())
7919 bool AnyChanged = BaseType != TL.getBaseLoc().getType();
7923 for (
unsigned i = 0, n = TL.getNumTypeArgs(); i != n; ++i) {
7925 TypeLoc TypeArgLoc = TypeArgInfo->getTypeLoc();
7926 QualType TypeArg = TypeArgInfo->getType();
7931 const auto *PackExpansion = PackExpansionLoc.getType()
7932 ->castAs<PackExpansionType>();
7936 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
7940 TypeLoc PatternLoc = PackExpansionLoc.getPatternLoc();
7941 bool Expand =
false;
7942 bool RetainExpansion =
false;
7943 UnsignedOrNone NumExpansions = PackExpansion->getNumExpansions();
7944 if (getDerived().TryExpandParameterPacks(
7945 PackExpansionLoc.getEllipsisLoc(), PatternLoc.getSourceRange(),
7946 Unexpanded,
true, Expand,
7947 RetainExpansion, NumExpansions))
7957 TypeArgBuilder.
reserve(PatternLoc.getFullDataSize());
7958 QualType NewPatternType = getDerived().TransformType(TypeArgBuilder,
7960 if (NewPatternType.isNull())
7964 NewPatternType, NumExpansions);
7966 NewExpansionLoc.
setEllipsisLoc(PackExpansionLoc.getEllipsisLoc());
7967 NewTypeArgInfos.push_back(
7968 TypeArgBuilder.getTypeSourceInfo(SemaRef.
Context, NewExpansionType));
7974 for (
unsigned ArgIdx = 0; ArgIdx != *NumExpansions; ++ArgIdx) {
7978 TypeArgBuilder.
reserve(PatternLoc.getFullDataSize());
7980 QualType NewTypeArg = getDerived().TransformType(TypeArgBuilder,
7982 if (NewTypeArg.isNull())
7985 NewTypeArgInfos.push_back(
7986 TypeArgBuilder.getTypeSourceInfo(SemaRef.
Context, NewTypeArg));
7993 TypeArgBuilder.
reserve(TypeArgLoc.getFullDataSize());
7995 getDerived().TransformType(TypeArgBuilder, TypeArgLoc);
7996 if (NewTypeArg.isNull())
8000 if (NewTypeArg == TypeArg) {
8001 NewTypeArgInfos.push_back(TypeArgInfo);
8005 NewTypeArgInfos.push_back(
8006 TypeArgBuilder.getTypeSourceInfo(SemaRef.
Context, NewTypeArg));
8011 if (getDerived().AlwaysRebuild() || AnyChanged) {
8013 Result = getDerived().RebuildObjCObjectType(
8014 BaseType, TL.getBeginLoc(), TL.getTypeArgsLAngleLoc(), NewTypeArgInfos,
8015 TL.getTypeArgsRAngleLoc(), TL.getProtocolLAngleLoc(),
8016 llvm::ArrayRef(TL.getTypePtr()->qual_begin(), TL.getNumProtocols()),
8017 TL.getProtocolLocs(), TL.getProtocolRAngleLoc());
8025 NewT.setTypeArgsLAngleLoc(TL.getTypeArgsLAngleLoc());
8026 for (
unsigned i = 0, n = TL.getNumTypeArgs(); i != n; ++i)
8027 NewT.setTypeArgTInfo(i, NewTypeArgInfos[i]);
8028 NewT.setTypeArgsRAngleLoc(TL.getTypeArgsRAngleLoc());
8029 NewT.setProtocolLAngleLoc(TL.getProtocolLAngleLoc());
8030 for (
unsigned i = 0, n = TL.getNumProtocols(); i != n; ++i)
8031 NewT.setProtocolLoc(i, TL.getProtocolLoc(i));
8032 NewT.setProtocolRAngleLoc(TL.getProtocolRAngleLoc());
8036template<
typename Derived>
8040 QualType PointeeType = getDerived().TransformType(TLB, TL.getPointeeLoc());
8041 if (PointeeType.isNull())
8045 if (getDerived().AlwaysRebuild() ||
8046 PointeeType != TL.getPointeeLoc().getType()) {
8047 Result = getDerived().RebuildObjCObjectPointerType(PointeeType,
8061template<
typename Derived>
8067template<
typename Derived>
8070 return getDerived().TransformCompoundStmt(S,
false);
8073template<
typename Derived>
8080 getSema().resetFPOptions(
8084 bool SubStmtInvalid =
false;
8085 bool SubStmtChanged =
false;
8087 for (
auto *B : S->
body()) {
8089 B, IsStmtExpr && B ==
ExprResult ? StmtDiscardKind::StmtExprResult
8090 : StmtDiscardKind::Discarded);
8092 if (
Result.isInvalid()) {
8099 SubStmtInvalid =
true;
8103 SubStmtChanged = SubStmtChanged || Result.get() != B;
8104 Statements.push_back(Result.getAs<Stmt>());
8110 if (!getDerived().AlwaysRebuild() &&
8114 return getDerived().RebuildCompoundStmt(S->
getLBracLoc(),
8120template<
typename Derived>
8129 LHS = getDerived().TransformExpr(S->getLHS());
8131 if (LHS.isInvalid())
8135 RHS = getDerived().TransformExpr(S->getRHS());
8137 if (RHS.isInvalid())
8144 StmtResult Case = getDerived().RebuildCaseStmt(S->getCaseLoc(),
8146 S->getEllipsisLoc(),
8149 if (Case.isInvalid())
8154 getDerived().TransformStmt(S->getSubStmt());
8155 if (SubStmt.isInvalid())
8159 return getDerived().RebuildCaseStmtBody(Case.get(), SubStmt.get());
8162template <
typename Derived>
8166 getDerived().TransformStmt(S->getSubStmt());
8167 if (SubStmt.isInvalid())
8171 return getDerived().RebuildDefaultStmt(S->getDefaultLoc(), S->getColonLoc(),
8175template<
typename Derived>
8178 StmtResult SubStmt = getDerived().TransformStmt(S->getSubStmt(), SDK);
8179 if (SubStmt.isInvalid())
8182 Decl *LD = getDerived().TransformDecl(S->getDecl()->getLocation(),
8190 if (LD == S->getDecl())
8191 S->getDecl()->setStmt(
nullptr);
8194 return getDerived().RebuildLabelStmt(S->getIdentLoc(),
8199template <
typename Derived>
8208 return getDerived().Transform##X##Attr(cast<X##Attr>(R));
8209#include "clang/Basic/AttrList.inc"
8214template <
typename Derived>
8225 return getDerived().TransformStmt##X##Attr(OrigS, InstS, cast<X##Attr>(R));
8226#include "clang/Basic/AttrList.inc"
8231template <
typename Derived>
8234 StmtDiscardKind SDK) {
8239 bool AttrsChanged =
false;
8243 for (
const auto *I : S->
getAttrs()) {
8245 getDerived().TransformStmtAttr(S->
getSubStmt(), SubStmt.
get(), I);
8246 AttrsChanged |= (I != R);
8259 return getDerived().RebuildAttributedStmt(S->
getAttrLoc(), Attrs,
8263template<
typename Derived>
8268 if (
Init.isInvalid())
8272 if (!S->isConsteval()) {
8274 Cond = getDerived().TransformCondition(
8275 S->getIfLoc(), S->getConditionVariable(), S->getCond(),
8278 if (
Cond.isInvalid())
8283 std::optional<bool> ConstexprConditionValue;
8284 if (S->isConstexpr())
8285 ConstexprConditionValue =
Cond.getKnownValue();
8289 if (!ConstexprConditionValue || *ConstexprConditionValue) {
8293 S->isNonNegatedConsteval());
8295 Then = getDerived().TransformStmt(S->getThen());
8296 if (Then.isInvalid())
8302 Then =
new (getSema().Context)
8303 CompoundStmt(S->getThen()->getBeginLoc(), S->getThen()->getEndLoc());
8308 if (!ConstexprConditionValue || !*ConstexprConditionValue) {
8312 S->isNegatedConsteval());
8314 Else = getDerived().TransformStmt(S->getElse());
8315 if (Else.isInvalid())
8317 }
else if (S->getElse() && ConstexprConditionValue &&
8318 *ConstexprConditionValue) {
8322 Else =
new (getSema().Context)
8323 CompoundStmt(S->getElse()->getBeginLoc(), S->getElse()->getEndLoc());
8326 if (!getDerived().AlwaysRebuild() &&
8327 Init.get() == S->getInit() &&
8328 Cond.get() == std::make_pair(S->getConditionVariable(), S->getCond()) &&
8329 Then.get() == S->getThen() &&
8330 Else.get() == S->getElse())
8333 return getDerived().RebuildIfStmt(
8334 S->getIfLoc(), S->getStatementKind(), S->getLParenLoc(),
Cond,
8335 S->getRParenLoc(),
Init.get(), Then.get(), S->getElseLoc(), Else.get());
8338template<
typename Derived>
8343 if (
Init.isInvalid())
8348 S->getSwitchLoc(), S->getConditionVariable(), S->getCond(),
8350 if (
Cond.isInvalid())
8355 getDerived().RebuildSwitchStmtStart(S->getSwitchLoc(), S->getLParenLoc(),
8356 Init.get(),
Cond, S->getRParenLoc());
8361 StmtResult Body = getDerived().TransformStmt(S->getBody());
8362 if (Body.isInvalid())
8366 return getDerived().RebuildSwitchStmtBody(S->getSwitchLoc(),
Switch.get(),
8370template<
typename Derived>
8375 S->getWhileLoc(), S->getConditionVariable(), S->getCond(),
8377 if (
Cond.isInvalid())
8386 StmtResult Body = getDerived().TransformStmt(S->getBody());
8387 if (Body.isInvalid())
8390 if (!getDerived().AlwaysRebuild() &&
8391 Cond.get() == std::make_pair(S->getConditionVariable(), S->getCond()) &&
8392 Body.get() == S->getBody())
8395 return getDerived().RebuildWhileStmt(S->getWhileLoc(), S->getLParenLoc(),
8396 Cond, S->getRParenLoc(), Body.get());
8399template<
typename Derived>
8408 StmtResult Body = getDerived().TransformStmt(S->getBody());
8409 if (Body.isInvalid())
8414 if (
Cond.isInvalid())
8417 if (!getDerived().AlwaysRebuild() &&
8418 Cond.get() == S->getCond() &&
8419 Body.get() == S->getBody())
8422 return getDerived().RebuildDoStmt(S->getDoLoc(), Body.get(), S->getWhileLoc(),
8423 S->getWhileLoc(),
Cond.get(),
8427template<
typename Derived>
8430 if (getSema().getLangOpts().OpenMP)
8431 getSema().OpenMP().startOpenMPLoop();
8435 if (
Init.isInvalid())
8440 if (getSema().getLangOpts().OpenMP &&
Init.isUsable())
8441 getSema().OpenMP().ActOnOpenMPLoopInitialization(S->getForLoc(),
8446 S->getForLoc(), S->getConditionVariable(), S->getCond(),
8448 if (
Cond.isInvalid())
8453 if (
Inc.isInvalid())
8457 if (S->getInc() && !FullInc.get())
8464 S->getBeginLoc(), S->getInit(),
Init.get(), S->getCond(),
8465 Cond.get().second, S->getInc(),
Inc.get());
8468 StmtResult Body = getDerived().TransformStmt(S->getBody());
8469 if (Body.isInvalid())
8474 if (!getDerived().AlwaysRebuild() &&
8475 Init.get() == S->getInit() &&
8476 Cond.get() == std::make_pair(S->getConditionVariable(), S->getCond()) &&
8477 Inc.get() == S->getInc() &&
8478 Body.get() == S->getBody())
8481 return getDerived().RebuildForStmt(S->getForLoc(), S->getLParenLoc(),
8483 S->getRParenLoc(), Body.get());
8486template<
typename Derived>
8489 Decl *LD = getDerived().TransformDecl(S->getLabel()->getLocation(),
8495 return getDerived().RebuildGotoStmt(S->getGotoLoc(), S->getLabelLoc(),
8499template<
typename Derived>
8507 if (!getDerived().AlwaysRebuild() &&
8508 Target.get() == S->getTarget())
8511 return getDerived().RebuildIndirectGotoStmt(S->getGotoLoc(), S->getStarLoc(),
8515template<
typename Derived>
8518 if (!S->hasLabelTarget())
8521 Decl *LD = getDerived().TransformDecl(S->getLabelDecl()->getLocation(),
8530template<
typename Derived>
8533 if (!S->hasLabelTarget())
8536 Decl *LD = getDerived().TransformDecl(S->getLabelDecl()->getLocation(),
8545template<
typename Derived>
8555 return getDerived().RebuildReturnStmt(S->getReturnLoc(),
Result.get());
8558template<
typename Derived>
8561 bool DeclChanged =
false;
8564 for (
auto *D : S->decls()) {
8565 Decl *Transformed = getDerived().TransformDefinition(D->getLocation(), D);
8569 if (Transformed != D)
8573 if (
auto *TD = dyn_cast<TypeDecl>(Transformed)) {
8574 if (
auto *TN = dyn_cast<TypedefNameDecl>(TD)) {
8575 LSI->ContainsUnexpandedParameterPack |=
8576 TN->getUnderlyingType()->containsUnexpandedParameterPack();
8578 LSI->ContainsUnexpandedParameterPack |=
8581 .getTypeDeclType(TD)
8582 ->containsUnexpandedParameterPack();
8585 if (
auto *VD = dyn_cast<VarDecl>(Transformed))
8586 LSI->ContainsUnexpandedParameterPack |=
8587 VD->getType()->containsUnexpandedParameterPack();
8590 Decls.push_back(Transformed);
8593 if (!getDerived().AlwaysRebuild() && !DeclChanged)
8596 return getDerived().RebuildDeclStmt(Decls, S->getBeginLoc(), S->getEndLoc());
8599template<
typename Derived>
8609 bool ExprsChanged =
false;
8611 auto RebuildString = [&](
Expr *E) {
8616 ExprsChanged =
true;
8623 for (
unsigned I = 0, E = S->getNumOutputs(); I != E; ++I) {
8624 Names.push_back(S->getOutputIdentifier(I));
8630 Constraints.push_back(
Result.get());
8633 Expr *OutputExpr = S->getOutputExpr(I);
8634 Result = getDerived().TransformExpr(OutputExpr);
8638 ExprsChanged |=
Result.get() != OutputExpr;
8640 Exprs.push_back(
Result.get());
8644 for (
unsigned I = 0, E = S->getNumInputs(); I != E; ++I) {
8645 Names.push_back(S->getInputIdentifier(I));
8651 Constraints.push_back(
Result.get());
8654 Expr *InputExpr = S->getInputExpr(I);
8655 Result = getDerived().TransformExpr(InputExpr);
8659 ExprsChanged |=
Result.get() != InputExpr;
8661 Exprs.push_back(
Result.get());
8665 for (
unsigned I = 0, E = S->getNumLabels(); I != E; ++I) {
8666 Names.push_back(S->getLabelIdentifier(I));
8671 ExprsChanged |=
Result.get() != S->getLabelExpr(I);
8672 Exprs.push_back(
Result.get());
8676 for (
unsigned I = 0, E = S->getNumClobbers(); I != E; ++I) {
8680 Clobbers.push_back(
Result.get());
8683 ExprResult AsmString = RebuildString(S->getAsmStringExpr());
8684 if (AsmString.isInvalid())
8687 if (!getDerived().AlwaysRebuild() && !ExprsChanged)
8690 return getDerived().RebuildGCCAsmStmt(S->getAsmLoc(), S->isSimple(),
8691 S->isVolatile(), S->getNumOutputs(),
8692 S->getNumInputs(), Names.data(),
8693 Constraints, Exprs, AsmString.get(),
8694 Clobbers, S->getNumLabels(),
8698template<
typename Derived>
8703 bool HadError =
false, HadChange =
false;
8707 TransformedExprs.reserve(SrcExprs.size());
8708 for (
unsigned i = 0, e = SrcExprs.size(); i != e; ++i) {
8710 if (!
Result.isUsable()) {
8713 HadChange |= (
Result.get() != SrcExprs[i]);
8714 TransformedExprs.push_back(
Result.get());
8719 if (!HadChange && !getDerived().AlwaysRebuild())
8722 return getDerived().RebuildMSAsmStmt(S->getAsmLoc(), S->getLBraceLoc(),
8723 AsmToks, S->getAsmString(),
8724 S->getNumOutputs(), S->getNumInputs(),
8725 S->getAllConstraints(), S->getClobbers(),
8726 TransformedExprs, S->getEndLoc());
8730template<
typename Derived>
8735 assert(FD && ScopeInfo && !ScopeInfo->CoroutinePromise &&
8736 ScopeInfo->NeedsCoroutineSuspends &&
8737 ScopeInfo->CoroutineSuspends.first ==
nullptr &&
8738 ScopeInfo->CoroutineSuspends.second ==
nullptr &&
8739 "expected clean scope info");
8743 ScopeInfo->setNeedsCoroutineSuspends(
false);
8756 getDerived().transformedLocalDecl(S->getPromiseDecl(), {Promise});
8757 ScopeInfo->CoroutinePromise = Promise;
8762 StmtResult InitSuspend = getDerived().TransformStmt(S->getInitSuspendStmt());
8763 if (InitSuspend.isInvalid())
8766 getDerived().TransformStmt(S->getFinalSuspendStmt());
8767 if (FinalSuspend.isInvalid() ||
8770 ScopeInfo->setCoroutineSuspends(InitSuspend.get(), FinalSuspend.get());
8773 StmtResult BodyRes = getDerived().TransformStmt(S->getBody());
8774 if (BodyRes.isInvalid())
8778 if (Builder.isInvalid())
8781 Expr *ReturnObject = S->getReturnValueInit();
8782 assert(ReturnObject &&
"the return object is expected to be valid");
8783 ExprResult Res = getDerived().TransformInitializer(ReturnObject,
8785 if (Res.isInvalid())
8787 Builder.ReturnValue = Res.get();
8792 if (S->hasDependentPromiseType()) {
8795 if (!Promise->getType()->isDependentType()) {
8796 assert(!S->getFallthroughHandler() && !S->getExceptionHandler() &&
8797 !S->getReturnStmtOnAllocFailure() && !S->getDeallocate() &&
8798 "these nodes should not have been built yet");
8799 if (!Builder.buildDependentStatements())
8803 if (
auto *OnFallthrough = S->getFallthroughHandler()) {
8804 StmtResult Res = getDerived().TransformStmt(OnFallthrough);
8805 if (Res.isInvalid())
8807 Builder.OnFallthrough = Res.get();
8810 if (
auto *OnException = S->getExceptionHandler()) {
8811 StmtResult Res = getDerived().TransformStmt(OnException);
8812 if (Res.isInvalid())
8814 Builder.OnException = Res.get();
8817 if (
auto *OnAllocFailure = S->getReturnStmtOnAllocFailure()) {
8818 StmtResult Res = getDerived().TransformStmt(OnAllocFailure);
8819 if (Res.isInvalid())
8821 Builder.ReturnStmtOnAllocFailure = Res.get();
8825 assert(S->getAllocate() && S->getDeallocate() &&
8826 "allocation and deallocation calls must already be built");
8827 ExprResult AllocRes = getDerived().TransformExpr(S->getAllocate());
8828 if (AllocRes.isInvalid())
8830 Builder.Allocate = AllocRes.get();
8832 ExprResult DeallocRes = getDerived().TransformExpr(S->getDeallocate());
8833 if (DeallocRes.isInvalid())
8835 Builder.Deallocate = DeallocRes.get();
8837 if (
auto *ResultDecl = S->getResultDecl()) {
8838 StmtResult Res = getDerived().TransformStmt(ResultDecl);
8839 if (Res.isInvalid())
8841 Builder.ResultDecl = Res.get();
8846 if (Res.isInvalid())
8848 Builder.ReturnStmt = Res.get();
8852 return getDerived().RebuildCoroutineBodyStmt(Builder);
8855template<
typename Derived>
8865 return getDerived().RebuildCoreturnStmt(S->getKeywordLoc(),
Result.get(),
8869template <
typename Derived>
8882 ExprResult Lookup = getSema().BuildOperatorCoawaitLookupExpr(
8883 getSema().getCurScope(), E->getKeywordLoc());
8887 return getDerived().RebuildCoawaitExpr(
8888 E->getKeywordLoc(),
Operand.get(),
8892template <
typename Derived>
8895 ExprResult OperandResult = getDerived().TransformInitializer(E->getOperand(),
8897 if (OperandResult.isInvalid())
8901 E->getOperatorCoawaitLookup());
8908 return getDerived().RebuildDependentCoawaitExpr(
8909 E->getKeywordLoc(), OperandResult.get(),
8913template<
typename Derived>
8923 return getDerived().RebuildCoyieldExpr(E->getKeywordLoc(),
Result.get());
8928template<
typename Derived>
8932 StmtResult TryBody = getDerived().TransformStmt(S->getTryBody());
8933 if (TryBody.isInvalid())
8937 bool AnyCatchChanged =
false;
8939 for (
unsigned I = 0, N = S->getNumCatchStmts(); I != N; ++I) {
8940 StmtResult Catch = getDerived().TransformStmt(S->getCatchStmt(I));
8941 if (Catch.isInvalid())
8943 if (Catch.get() != S->getCatchStmt(I))
8944 AnyCatchChanged =
true;
8945 CatchStmts.push_back(Catch.get());
8950 if (S->getFinallyStmt()) {
8951 Finally = getDerived().TransformStmt(S->getFinallyStmt());
8952 if (Finally.isInvalid())
8957 if (!getDerived().AlwaysRebuild() &&
8958 TryBody.get() == S->getTryBody() &&
8960 Finally.get() == S->getFinallyStmt())
8964 return getDerived().RebuildObjCAtTryStmt(S->getAtTryLoc(), TryBody.get(),
8965 CatchStmts, Finally.get());
8968template<
typename Derived>
8973 if (
VarDecl *FromVar = S->getCatchParamDecl()) {
8975 if (FromVar->getTypeSourceInfo()) {
8976 TSInfo = getDerived().TransformType(FromVar->getTypeSourceInfo());
8983 T = TSInfo->getType();
8985 T = getDerived().TransformType(FromVar->getType());
8990 Var = getDerived().RebuildObjCExceptionDecl(FromVar, TSInfo,
T);
8995 StmtResult Body = getDerived().TransformStmt(S->getCatchBody());
8996 if (Body.isInvalid())
8999 return getDerived().RebuildObjCAtCatchStmt(S->getAtCatchLoc(),
9004template<
typename Derived>
9008 StmtResult Body = getDerived().TransformStmt(S->getFinallyBody());
9009 if (Body.isInvalid())
9013 if (!getDerived().AlwaysRebuild() &&
9014 Body.get() == S->getFinallyBody())
9018 return getDerived().RebuildObjCAtFinallyStmt(S->getAtFinallyLoc(),
9022template<
typename Derived>
9026 if (S->getThrowExpr()) {
9027 Operand = getDerived().TransformExpr(S->getThrowExpr());
9032 if (!getDerived().AlwaysRebuild() &&
9033 Operand.get() == S->getThrowExpr())
9036 return getDerived().RebuildObjCAtThrowStmt(S->getThrowLoc(),
Operand.get());
9039template<
typename Derived>
9048 getDerived().RebuildObjCAtSynchronizedOperand(S->getAtSynchronizedLoc(),
9054 StmtResult Body = getDerived().TransformStmt(S->getSynchBody());
9055 if (Body.isInvalid())
9059 if (!getDerived().AlwaysRebuild() &&
9060 Object.get() == S->getSynchExpr() &&
9061 Body.get() == S->getSynchBody())
9065 return getDerived().RebuildObjCAtSynchronizedStmt(S->getAtSynchronizedLoc(),
9066 Object.get(), Body.get());
9069template<
typename Derived>
9074 StmtResult Body = getDerived().TransformStmt(S->getSubStmt());
9075 if (Body.isInvalid())
9079 if (!getDerived().AlwaysRebuild() &&
9080 Body.get() == S->getSubStmt())
9084 return getDerived().RebuildObjCAutoreleasePoolStmt(
9085 S->getAtLoc(), Body.get());
9088template<
typename Derived>
9093 StmtResult Element = getDerived().TransformStmt(
9094 S->getElement(), StmtDiscardKind::NotDiscarded);
9095 if (Element.isInvalid())
9099 ExprResult Collection = getDerived().TransformExpr(S->getCollection());
9100 if (Collection.isInvalid())
9104 StmtResult Body = getDerived().TransformStmt(S->getBody());
9105 if (Body.isInvalid())
9109 if (!getDerived().AlwaysRebuild() &&
9110 Element.get() == S->getElement() &&
9111 Collection.get() == S->getCollection() &&
9112 Body.get() == S->getBody())
9116 return getDerived().RebuildObjCForCollectionStmt(S->getForLoc(),
9123template <
typename Derived>
9127 if (
VarDecl *ExceptionDecl = S->getExceptionDecl()) {
9129 getDerived().TransformType(ExceptionDecl->getTypeSourceInfo());
9133 Var = getDerived().RebuildExceptionDecl(
9134 ExceptionDecl,
T, ExceptionDecl->getInnerLocStart(),
9135 ExceptionDecl->getLocation(), ExceptionDecl->getIdentifier());
9136 if (!Var || Var->isInvalidDecl())
9141 StmtResult Handler = getDerived().TransformStmt(S->getHandlerBlock());
9142 if (Handler.isInvalid())
9145 if (!getDerived().AlwaysRebuild() && !Var &&
9146 Handler.get() == S->getHandlerBlock())
9149 return getDerived().RebuildCXXCatchStmt(S->getCatchLoc(), Var, Handler.get());
9152template <
typename Derived>
9155 StmtResult TryBlock = getDerived().TransformCompoundStmt(S->getTryBlock());
9156 if (TryBlock.isInvalid())
9160 bool HandlerChanged =
false;
9162 for (
unsigned I = 0, N = S->getNumHandlers(); I != N; ++I) {
9163 StmtResult Handler = getDerived().TransformCXXCatchStmt(S->getHandler(I));
9164 if (Handler.isInvalid())
9167 HandlerChanged = HandlerChanged || Handler.get() != S->getHandler(I);
9168 Handlers.push_back(Handler.getAs<
Stmt>());
9171 getSema().DiagnoseExceptionUse(S->getTryLoc(),
true);
9173 if (!getDerived().AlwaysRebuild() && TryBlock.get() == S->getTryBlock() &&
9177 return getDerived().RebuildCXXTryStmt(S->getTryLoc(), TryBlock.get(),
9181template<
typename Derived>
9192 auto &LastRecord = getSema().currentEvaluationContext();
9193 LastRecord.InLifetimeExtendingContext =
true;
9194 LastRecord.RebuildDefaultArgOrDefaultInit =
true;
9197 S->getInit() ? getDerived().TransformStmt(S->getInit()) :
StmtResult();
9198 if (
Init.isInvalid())
9202 if (
Range.isInvalid())
9207 getSema().ExprEvalContexts.back().ForRangeLifetimeExtendTemps.empty());
9208 auto ForRangeLifetimeExtendTemps =
9209 getSema().ExprEvalContexts.back().ForRangeLifetimeExtendTemps;
9211 StmtResult Begin = getDerived().TransformStmt(S->getBeginStmt());
9212 if (Begin.isInvalid())
9214 StmtResult End = getDerived().TransformStmt(S->getEndStmt());
9215 if (End.isInvalid())
9219 if (
Cond.isInvalid())
9223 if (
Cond.isInvalid())
9229 if (
Inc.isInvalid())
9234 StmtResult LoopVar = getDerived().TransformStmt(S->getLoopVarStmt());
9235 if (LoopVar.isInvalid())
9239 if (getDerived().AlwaysRebuild() ||
9240 Init.get() != S->getInit() ||
9241 Range.get() != S->getRangeStmt() ||
9242 Begin.get() != S->getBeginStmt() ||
9243 End.get() != S->getEndStmt() ||
9244 Cond.get() != S->getCond() ||
9245 Inc.get() != S->getInc() ||
9246 LoopVar.get() != S->getLoopVarStmt()) {
9247 NewStmt = getDerived().RebuildCXXForRangeStmt(
9248 S->getForLoc(), S->getCoawaitLoc(),
Init.get(), S->getColonLoc(),
9249 Range.get(), Begin.get(), End.get(),
Cond.get(),
Inc.get(),
9250 LoopVar.get(), S->getRParenLoc(), ForRangeLifetimeExtendTemps);
9251 if (NewStmt.isInvalid() && LoopVar.get() != S->getLoopVarStmt()) {
9253 getSema().ActOnInitializerError(
9264 StmtResult Body = getDerived().TransformStmt(S->getBody());
9265 if (Body.isInvalid())
9272 if (Body.get() != S->getBody() && NewStmt.get() == S) {
9273 NewStmt = getDerived().RebuildCXXForRangeStmt(
9274 S->getForLoc(), S->getCoawaitLoc(),
Init.get(), S->getColonLoc(),
9275 Range.get(), Begin.get(), End.get(),
Cond.get(),
Inc.get(),
9276 LoopVar.get(), S->getRParenLoc(), ForRangeLifetimeExtendTemps);
9277 if (NewStmt.isInvalid())
9281 if (NewStmt.get() == S)
9284 return FinishCXXForRangeStmt(NewStmt.get(), Body.get());
9287template<
typename Derived>
9293 if (S->getQualifierLoc()) {
9295 = getDerived().TransformNestedNameSpecifierLoc(S->getQualifierLoc());
9302 if (NameInfo.getName()) {
9303 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
9304 if (!NameInfo.getName())
9309 if (!getDerived().AlwaysRebuild() &&
9310 QualifierLoc == S->getQualifierLoc() &&
9311 NameInfo.getName() == S->getNameInfo().getName())
9316 SS.
Adopt(QualifierLoc);
9318 switch (getSema().CheckMicrosoftIfExistsSymbol(
nullptr, SS, NameInfo)) {
9320 if (S->isIfExists())
9323 return new (getSema().Context)
NullStmt(S->getKeywordLoc());
9326 if (S->isIfNotExists())
9329 return new (getSema().Context)
NullStmt(S->getKeywordLoc());
9340 StmtResult SubStmt = getDerived().TransformCompoundStmt(S->getSubStmt());
9341 if (SubStmt.isInvalid())
9349 return getDerived().RebuildMSDependentExistsStmt(S->getKeywordLoc(),
9356template<
typename Derived>
9360 if (E->getQualifierLoc()) {
9362 = getDerived().TransformNestedNameSpecifierLoc(E->getQualifierLoc());
9368 getDerived().TransformDecl(E->getMemberLoc(), E->getPropertyDecl()));
9373 if (
Base.isInvalid())
9379 QualifierLoc, E->getMemberLoc());
9382template <
typename Derived>
9386 if (BaseRes.isInvalid())
9388 auto IdxRes = getDerived().TransformExpr(E->getIdx());
9389 if (IdxRes.isInvalid())
9392 if (!getDerived().AlwaysRebuild() &&
9393 BaseRes.get() == E->getBase() &&
9394 IdxRes.get() == E->getIdx())
9397 return getDerived().RebuildArraySubscriptExpr(
9398 BaseRes.get(),
SourceLocation(), IdxRes.get(), E->getRBracketLoc());
9401template <
typename Derived>
9403 StmtResult TryBlock = getDerived().TransformCompoundStmt(S->getTryBlock());
9404 if (TryBlock.isInvalid())
9407 StmtResult Handler = getDerived().TransformSEHHandler(S->getHandler());
9408 if (Handler.isInvalid())
9411 if (!getDerived().AlwaysRebuild() && TryBlock.get() == S->getTryBlock() &&
9412 Handler.get() == S->getHandler())
9415 return getDerived().RebuildSEHTryStmt(S->getIsCXXTry(), S->getTryLoc(),
9416 TryBlock.get(), Handler.get());
9419template <
typename Derived>
9422 if (
Block.isInvalid())
9425 return getDerived().RebuildSEHFinallyStmt(S->getFinallyLoc(),
Block.get());
9428template <
typename Derived>
9430 ExprResult FilterExpr = getDerived().TransformExpr(S->getFilterExpr());
9431 if (FilterExpr.isInvalid())
9435 if (
Block.isInvalid())
9438 return getDerived().RebuildSEHExceptStmt(S->getExceptLoc(), FilterExpr.get(),
9442template <
typename Derived>
9450template<
typename Derived>
9460template <
typename Derived>
9462TreeTransform<Derived>::TransformOMPCanonicalLoop(OMPCanonicalLoop *L) {
9466 return getDerived().TransformStmt(L->getLoopStmt());
9469template <
typename Derived>
9476 TClauses.reserve(Clauses.size());
9480 getDerived().getSema().OpenMP().StartOpenMPClause((*I)->getClauseKind());
9482 getDerived().getSema().OpenMP().EndOpenMPClause();
9484 TClauses.push_back(Clause);
9486 TClauses.push_back(
nullptr);
9490 if (D->hasAssociatedStmt() && D->getAssociatedStmt()) {
9491 getDerived().getSema().OpenMP().ActOnOpenMPRegionStart(
9492 D->getDirectiveKind(),
9498 if (D->getDirectiveKind() == OMPD_atomic ||
9499 D->getDirectiveKind() == OMPD_critical ||
9500 D->getDirectiveKind() == OMPD_section ||
9501 D->getDirectiveKind() == OMPD_master)
9502 CS = D->getAssociatedStmt();
9504 CS = D->getRawStmt();
9507 getSema().getLangOpts().OpenMPIRBuilder)
9511 getDerived().getSema().OpenMP().ActOnOpenMPRegionEnd(Body, TClauses);
9516 if (TClauses.size() != Clauses.size()) {
9522 if (D->getDirectiveKind() == OMPD_critical) {
9524 DirName =
getDerived().TransformDeclarationNameInfo(DirName);
9527 if (D->getDirectiveKind() == OMPD_cancellation_point) {
9529 }
else if (D->getDirectiveKind() == OMPD_cancel) {
9533 return getDerived().RebuildOMPExecutableDirective(
9534 D->getDirectiveKind(), DirName, CancelRegion, TClauses,
9535 AssociatedStmt.
get(), D->getBeginLoc(), D->getEndLoc());
9543template <
typename Derived>
9550 TClauses.reserve(Clauses.size());
9553 getDerived().getSema().OpenMP().StartOpenMPClause(
C->getClauseKind());
9555 getDerived().getSema().OpenMP().EndOpenMPClause();
9557 TClauses.push_back(Clause);
9559 TClauses.push_back(
nullptr);
9563 if (D->hasAssociatedStmt() && D->getAssociatedStmt()) {
9564 getDerived().getSema().OpenMP().ActOnOpenMPRegionStart(
9565 D->getDirectiveKind(),
9570 assert(D->getDirectiveKind() == OMPD_assume &&
9571 "Unexpected informational directive");
9572 Stmt *CS = D->getAssociatedStmt();
9576 getDerived().getSema().OpenMP().ActOnOpenMPRegionEnd(Body, TClauses);
9580 if (TClauses.size() != Clauses.size())
9585 return getDerived().RebuildOMPInformationalDirective(
9586 D->getDirectiveKind(), DirName, TClauses, AssociatedStmt.
get(),
9587 D->getBeginLoc(), D->getEndLoc());
9590template <
typename Derived>
9595 SemaRef.
Diag(D->getBeginLoc(), diag::err_omp_instantiation_not_supported)
9596 << getOpenMPDirectiveName(D->getDirectiveKind(), OMPVersion);
9600template <
typename Derived>
9602TreeTransform<Derived>::TransformOMPParallelDirective(OMPParallelDirective *D) {
9603 DeclarationNameInfo DirName;
9604 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9605 OMPD_parallel, DirName,
nullptr, D->getBeginLoc());
9606 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9607 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9611template <
typename Derived>
9615 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9616 OMPD_simd, DirName,
nullptr, D->getBeginLoc());
9617 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9618 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9622template <
typename Derived>
9626 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9627 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
9628 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9629 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9633template <
typename Derived>
9637 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9638 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
9639 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9640 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9644template <
typename Derived>
9648 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9649 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
9650 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9651 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9655template <
typename Derived>
9659 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9660 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
9661 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9662 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9666template <
typename Derived>
9668 OMPInterchangeDirective *D) {
9670 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9671 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
9672 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9673 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9677template <
typename Derived>
9681 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9682 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
9683 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9684 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9688template <
typename Derived>
9692 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9693 OMPD_for, DirName,
nullptr, D->getBeginLoc());
9694 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9695 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9699template <
typename Derived>
9703 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9704 OMPD_for_simd, DirName,
nullptr, D->getBeginLoc());
9705 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9706 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9710template <
typename Derived>
9714 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9715 OMPD_sections, DirName,
nullptr, D->getBeginLoc());
9716 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9717 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9721template <
typename Derived>
9725 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9726 OMPD_section, DirName,
nullptr, D->getBeginLoc());
9727 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9728 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9732template <
typename Derived>
9736 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9737 OMPD_scope, DirName,
nullptr, D->getBeginLoc());
9738 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9739 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9743template <
typename Derived>
9747 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9748 OMPD_single, DirName,
nullptr, D->getBeginLoc());
9749 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9750 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9754template <
typename Derived>
9758 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9759 OMPD_master, DirName,
nullptr, D->getBeginLoc());
9760 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9761 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9765template <
typename Derived>
9769 OMPD_critical, D->getDirectiveName(),
nullptr, D->getBeginLoc());
9770 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9771 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9775template <
typename Derived>
9777 OMPParallelForDirective *D) {
9779 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9780 OMPD_parallel_for, DirName,
nullptr, D->getBeginLoc());
9781 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9782 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9786template <
typename Derived>
9788 OMPParallelForSimdDirective *D) {
9790 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9791 OMPD_parallel_for_simd, DirName,
nullptr, D->getBeginLoc());
9792 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9793 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9797template <
typename Derived>
9799 OMPParallelMasterDirective *D) {
9801 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9802 OMPD_parallel_master, DirName,
nullptr, D->getBeginLoc());
9803 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9804 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9808template <
typename Derived>
9810 OMPParallelMaskedDirective *D) {
9812 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9813 OMPD_parallel_masked, DirName,
nullptr, D->getBeginLoc());
9814 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9815 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9819template <
typename Derived>
9821 OMPParallelSectionsDirective *D) {
9823 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9824 OMPD_parallel_sections, DirName,
nullptr, D->getBeginLoc());
9825 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9826 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9830template <
typename Derived>
9834 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9835 OMPD_task, DirName,
nullptr, D->getBeginLoc());
9836 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9837 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9841template <
typename Derived>
9843 OMPTaskyieldDirective *D) {
9845 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9846 OMPD_taskyield, DirName,
nullptr, D->getBeginLoc());
9847 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9848 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9852template <
typename Derived>
9856 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9857 OMPD_barrier, DirName,
nullptr, D->getBeginLoc());
9858 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9859 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9863template <
typename Derived>
9867 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9868 OMPD_taskwait, DirName,
nullptr, D->getBeginLoc());
9869 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9870 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9874template <
typename Derived>
9878 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9879 OMPD_assume, DirName,
nullptr, D->getBeginLoc());
9880 StmtResult Res = getDerived().TransformOMPInformationalDirective(D);
9881 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9885template <
typename Derived>
9889 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9890 OMPD_error, DirName,
nullptr, D->getBeginLoc());
9891 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9892 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9896template <
typename Derived>
9898 OMPTaskgroupDirective *D) {
9900 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9901 OMPD_taskgroup, DirName,
nullptr, D->getBeginLoc());
9902 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9903 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9907template <
typename Derived>
9911 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9912 OMPD_flush, DirName,
nullptr, D->getBeginLoc());
9913 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9914 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9918template <
typename Derived>
9922 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9923 OMPD_depobj, DirName,
nullptr, D->getBeginLoc());
9924 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9925 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9929template <
typename Derived>
9933 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9934 OMPD_scan, DirName,
nullptr, D->getBeginLoc());
9935 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9936 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9940template <
typename Derived>
9944 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9945 OMPD_ordered, DirName,
nullptr, D->getBeginLoc());
9946 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9947 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9951template <
typename Derived>
9955 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9956 OMPD_atomic, DirName,
nullptr, D->getBeginLoc());
9957 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9958 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9962template <
typename Derived>
9966 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9967 OMPD_target, DirName,
nullptr, D->getBeginLoc());
9968 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9969 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9973template <
typename Derived>
9975 OMPTargetDataDirective *D) {
9977 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9978 OMPD_target_data, DirName,
nullptr, D->getBeginLoc());
9979 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9980 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9984template <
typename Derived>
9986 OMPTargetEnterDataDirective *D) {
9988 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9989 OMPD_target_enter_data, DirName,
nullptr, D->getBeginLoc());
9990 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9991 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9995template <
typename Derived>
9997 OMPTargetExitDataDirective *D) {
9999 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10000 OMPD_target_exit_data, DirName,
nullptr, D->getBeginLoc());
10001 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10002 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10006template <
typename Derived>
10008 OMPTargetParallelDirective *D) {
10010 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10011 OMPD_target_parallel, DirName,
nullptr, D->getBeginLoc());
10012 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10013 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10017template <
typename Derived>
10019 OMPTargetParallelForDirective *D) {
10021 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10022 OMPD_target_parallel_for, DirName,
nullptr, D->getBeginLoc());
10023 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10024 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10028template <
typename Derived>
10030 OMPTargetUpdateDirective *D) {
10032 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10033 OMPD_target_update, DirName,
nullptr, D->getBeginLoc());
10034 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10035 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10039template <
typename Derived>
10043 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10044 OMPD_teams, DirName,
nullptr, D->getBeginLoc());
10045 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10046 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10050template <
typename Derived>
10052 OMPCancellationPointDirective *D) {
10054 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10055 OMPD_cancellation_point, DirName,
nullptr, D->getBeginLoc());
10056 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10057 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10061template <
typename Derived>
10065 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10066 OMPD_cancel, DirName,
nullptr, D->getBeginLoc());
10067 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10068 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10072template <
typename Derived>
10076 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10077 OMPD_taskloop, DirName,
nullptr, D->getBeginLoc());
10078 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10079 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10083template <
typename Derived>
10085 OMPTaskLoopSimdDirective *D) {
10087 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10088 OMPD_taskloop_simd, DirName,
nullptr, D->getBeginLoc());
10089 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10090 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10094template <
typename Derived>
10096 OMPMasterTaskLoopDirective *D) {
10098 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10099 OMPD_master_taskloop, DirName,
nullptr, D->getBeginLoc());
10100 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10101 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10105template <
typename Derived>
10107 OMPMaskedTaskLoopDirective *D) {
10109 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10110 OMPD_masked_taskloop, DirName,
nullptr, D->getBeginLoc());
10111 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10112 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10116template <
typename Derived>
10118 OMPMasterTaskLoopSimdDirective *D) {
10120 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10121 OMPD_master_taskloop_simd, DirName,
nullptr, D->getBeginLoc());
10122 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10123 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10127template <
typename Derived>
10129 OMPMaskedTaskLoopSimdDirective *D) {
10131 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10132 OMPD_masked_taskloop_simd, DirName,
nullptr, D->getBeginLoc());
10133 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10134 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10138template <
typename Derived>
10140 OMPParallelMasterTaskLoopDirective *D) {
10142 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10143 OMPD_parallel_master_taskloop, DirName,
nullptr, D->getBeginLoc());
10144 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10145 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10149template <
typename Derived>
10151 OMPParallelMaskedTaskLoopDirective *D) {
10153 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10154 OMPD_parallel_masked_taskloop, DirName,
nullptr, D->getBeginLoc());
10155 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10156 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10160template <
typename Derived>
10163 OMPParallelMasterTaskLoopSimdDirective *D) {
10165 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10166 OMPD_parallel_master_taskloop_simd, DirName,
nullptr, D->getBeginLoc());
10167 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10168 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10172template <
typename Derived>
10175 OMPParallelMaskedTaskLoopSimdDirective *D) {
10177 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10178 OMPD_parallel_masked_taskloop_simd, DirName,
nullptr, D->getBeginLoc());
10179 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10180 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10184template <
typename Derived>
10186 OMPDistributeDirective *D) {
10188 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10189 OMPD_distribute, DirName,
nullptr, D->getBeginLoc());
10190 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10191 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10195template <
typename Derived>
10197 OMPDistributeParallelForDirective *D) {
10199 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10200 OMPD_distribute_parallel_for, DirName,
nullptr, D->getBeginLoc());
10201 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10202 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10206template <
typename Derived>
10209 OMPDistributeParallelForSimdDirective *D) {
10211 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10212 OMPD_distribute_parallel_for_simd, DirName,
nullptr, D->getBeginLoc());
10213 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10214 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10218template <
typename Derived>
10220 OMPDistributeSimdDirective *D) {
10222 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10223 OMPD_distribute_simd, DirName,
nullptr, D->getBeginLoc());
10224 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10225 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10229template <
typename Derived>
10231 OMPTargetParallelForSimdDirective *D) {
10233 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10234 OMPD_target_parallel_for_simd, DirName,
nullptr, D->getBeginLoc());
10235 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10236 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10240template <
typename Derived>
10242 OMPTargetSimdDirective *D) {
10244 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10245 OMPD_target_simd, DirName,
nullptr, D->getBeginLoc());
10246 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10247 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10251template <
typename Derived>
10253 OMPTeamsDistributeDirective *D) {
10255 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10256 OMPD_teams_distribute, DirName,
nullptr, D->getBeginLoc());
10257 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10258 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10262template <
typename Derived>
10264 OMPTeamsDistributeSimdDirective *D) {
10266 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10267 OMPD_teams_distribute_simd, DirName,
nullptr, D->getBeginLoc());
10268 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10269 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10273template <
typename Derived>
10275 OMPTeamsDistributeParallelForSimdDirective *D) {
10277 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10278 OMPD_teams_distribute_parallel_for_simd, DirName,
nullptr,
10280 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10281 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10285template <
typename Derived>
10287 OMPTeamsDistributeParallelForDirective *D) {
10289 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10290 OMPD_teams_distribute_parallel_for, DirName,
nullptr, D->getBeginLoc());
10291 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10292 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10296template <
typename Derived>
10298 OMPTargetTeamsDirective *D) {
10300 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10301 OMPD_target_teams, DirName,
nullptr, D->getBeginLoc());
10302 auto Res = getDerived().TransformOMPExecutableDirective(D);
10303 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10307template <
typename Derived>
10309 OMPTargetTeamsDistributeDirective *D) {
10311 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10312 OMPD_target_teams_distribute, DirName,
nullptr, D->getBeginLoc());
10313 auto Res = getDerived().TransformOMPExecutableDirective(D);
10314 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10318template <
typename Derived>
10321 OMPTargetTeamsDistributeParallelForDirective *D) {
10323 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10324 OMPD_target_teams_distribute_parallel_for, DirName,
nullptr,
10326 auto Res = getDerived().TransformOMPExecutableDirective(D);
10327 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10331template <
typename Derived>
10334 OMPTargetTeamsDistributeParallelForSimdDirective *D) {
10336 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10337 OMPD_target_teams_distribute_parallel_for_simd, DirName,
nullptr,
10339 auto Res = getDerived().TransformOMPExecutableDirective(D);
10340 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10344template <
typename Derived>
10347 OMPTargetTeamsDistributeSimdDirective *D) {
10349 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10350 OMPD_target_teams_distribute_simd, DirName,
nullptr, D->getBeginLoc());
10351 auto Res = getDerived().TransformOMPExecutableDirective(D);
10352 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10356template <
typename Derived>
10360 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10361 OMPD_interop, DirName,
nullptr, D->getBeginLoc());
10362 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10363 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10367template <
typename Derived>
10371 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10372 OMPD_dispatch, DirName,
nullptr, D->getBeginLoc());
10373 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10374 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10378template <
typename Derived>
10382 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10383 OMPD_masked, DirName,
nullptr, D->getBeginLoc());
10384 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10385 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10389template <
typename Derived>
10391 OMPGenericLoopDirective *D) {
10393 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10394 OMPD_loop, DirName,
nullptr, D->getBeginLoc());
10395 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10396 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10400template <
typename Derived>
10402 OMPTeamsGenericLoopDirective *D) {
10404 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10405 OMPD_teams_loop, DirName,
nullptr, D->getBeginLoc());
10406 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10407 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10411template <
typename Derived>
10413 OMPTargetTeamsGenericLoopDirective *D) {
10415 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10416 OMPD_target_teams_loop, DirName,
nullptr, D->getBeginLoc());
10417 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10418 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10422template <
typename Derived>
10424 OMPParallelGenericLoopDirective *D) {
10426 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10427 OMPD_parallel_loop, DirName,
nullptr, D->getBeginLoc());
10428 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10429 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10433template <
typename Derived>
10436 OMPTargetParallelGenericLoopDirective *D) {
10438 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10439 OMPD_target_parallel_loop, DirName,
nullptr, D->getBeginLoc());
10440 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10441 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10448template <
typename Derived>
10451 if (
Cond.isInvalid())
10453 return getDerived().RebuildOMPIfClause(
10454 C->getNameModifier(),
Cond.get(),
C->getBeginLoc(),
C->getLParenLoc(),
10455 C->getNameModifierLoc(),
C->getColonLoc(),
C->getEndLoc());
10458template <
typename Derived>
10461 if (
Cond.isInvalid())
10463 return getDerived().RebuildOMPFinalClause(
Cond.get(),
C->getBeginLoc(),
10464 C->getLParenLoc(),
C->getEndLoc());
10467template <
typename Derived>
10470 ExprResult NumThreads = getDerived().TransformExpr(
C->getNumThreads());
10471 if (NumThreads.isInvalid())
10473 return getDerived().RebuildOMPNumThreadsClause(
10474 C->getModifier(), NumThreads.get(),
C->getBeginLoc(),
C->getLParenLoc(),
10475 C->getModifierLoc(),
C->getEndLoc());
10478template <
typename Derived>
10481 ExprResult E = getDerived().TransformExpr(
C->getSafelen());
10484 return getDerived().RebuildOMPSafelenClause(
10485 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10488template <
typename Derived>
10491 ExprResult E = getDerived().TransformExpr(
C->getAllocator());
10494 return getDerived().RebuildOMPAllocatorClause(
10495 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10498template <
typename Derived>
10501 ExprResult E = getDerived().TransformExpr(
C->getSimdlen());
10504 return getDerived().RebuildOMPSimdlenClause(
10505 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10508template <
typename Derived>
10511 TransformedSizes.reserve(
C->getNumSizes());
10513 for (
Expr *E :
C->getSizesRefs()) {
10515 TransformedSizes.push_back(
nullptr);
10524 TransformedSizes.push_back(
T.get());
10527 if (!Changed && !getDerived().AlwaysRebuild())
10529 return RebuildOMPSizesClause(TransformedSizes,
C->getBeginLoc(),
10530 C->getLParenLoc(),
C->getEndLoc());
10533template <
typename Derived>
10537 TransformedArgs.reserve(
C->getNumLoops());
10539 for (
Expr *E :
C->getArgsRefs()) {
10541 TransformedArgs.push_back(
nullptr);
10550 TransformedArgs.push_back(
T.get());
10553 if (!Changed && !getDerived().AlwaysRebuild())
10555 return RebuildOMPPermutationClause(TransformedArgs,
C->getBeginLoc(),
10556 C->getLParenLoc(),
C->getEndLoc());
10559template <
typename Derived>
10561 if (!getDerived().AlwaysRebuild())
10563 return RebuildOMPFullClause(
C->getBeginLoc(),
C->getEndLoc());
10566template <
typename Derived>
10569 ExprResult T = getDerived().TransformExpr(
C->getFactor());
10572 Expr *Factor =
T.get();
10573 bool Changed = Factor !=
C->getFactor();
10575 if (!Changed && !getDerived().AlwaysRebuild())
10577 return RebuildOMPPartialClause(Factor,
C->getBeginLoc(),
C->getLParenLoc(),
10581template <
typename Derived>
10584 ExprResult F = getDerived().TransformExpr(
C->getFirst());
10588 ExprResult Cn = getDerived().TransformExpr(
C->getCount());
10589 if (Cn.isInvalid())
10593 Expr *Count = Cn.get();
10595 bool Changed = (
First !=
C->getFirst()) || (Count !=
C->getCount());
10598 if (!Changed && !getDerived().AlwaysRebuild())
10601 return RebuildOMPLoopRangeClause(
First, Count,
C->getBeginLoc(),
10602 C->getLParenLoc(),
C->getFirstLoc(),
10603 C->getCountLoc(),
C->getEndLoc());
10606template <
typename Derived>
10609 ExprResult E = getDerived().TransformExpr(
C->getNumForLoops());
10612 return getDerived().RebuildOMPCollapseClause(
10613 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10616template <
typename Derived>
10620 C->getDefaultKind(),
C->getDefaultKindKwLoc(),
C->getDefaultVC(),
10621 C->getDefaultVCLoc(),
C->getBeginLoc(),
C->getLParenLoc(),
10625template <
typename Derived>
10629 C->getProcBindKind(),
C->getProcBindKindKwLoc(),
C->getBeginLoc(),
10630 C->getLParenLoc(),
C->getEndLoc());
10633template <
typename Derived>
10636 ExprResult E = getDerived().TransformExpr(
C->getChunkSize());
10639 return getDerived().RebuildOMPScheduleClause(
10640 C->getFirstScheduleModifier(),
C->getSecondScheduleModifier(),
10641 C->getScheduleKind(), E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
10642 C->getFirstScheduleModifierLoc(),
C->getSecondScheduleModifierLoc(),
10643 C->getScheduleKindLoc(),
C->getCommaLoc(),
C->getEndLoc());
10646template <
typename Derived>
10650 if (
auto *
Num =
C->getNumForLoops()) {
10651 E = getDerived().TransformExpr(
Num);
10655 return getDerived().RebuildOMPOrderedClause(
C->getBeginLoc(),
C->getEndLoc(),
10656 C->getLParenLoc(), E.get());
10659template <
typename Derived>
10663 if (
Expr *Evt =
C->getEventHandler()) {
10664 E = getDerived().TransformExpr(Evt);
10668 return getDerived().RebuildOMPDetachClause(E.get(),
C->getBeginLoc(),
10669 C->getLParenLoc(),
C->getEndLoc());
10672template <
typename Derived>
10678 if (
Cond.isInvalid())
10681 return getDerived().RebuildOMPNowaitClause(
Cond.get(),
C->getBeginLoc(),
10682 C->getLParenLoc(),
C->getEndLoc());
10685template <
typename Derived>
10692template <
typename Derived>
10699template <
typename Derived>
10705template <
typename Derived>
10711template <
typename Derived>
10718template <
typename Derived>
10725template <
typename Derived>
10732template <
typename Derived>
10738template <
typename Derived>
10744template <
typename Derived>
10746 ExprResult E = getDerived().TransformExpr(
C->getExpr());
10749 return getDerived().RebuildOMPHoldsClause(E.get(),
C->getBeginLoc(),
10750 C->getLParenLoc(),
C->getEndLoc());
10753template <
typename Derived>
10759template <
typename Derived>
10764template <
typename Derived>
10769template <
typename Derived>
10774template <
typename Derived>
10780template <
typename Derived>
10787template <
typename Derived>
10794template <
typename Derived>
10801template <
typename Derived>
10808template <
typename Derived>
10815template <
typename Derived>
10821template <
typename Derived>
10828template <
typename Derived>
10834template <
typename Derived>
10841template <
typename Derived>
10843 ExprResult IVR = getDerived().TransformExpr(
C->getInteropVar());
10844 if (IVR.isInvalid())
10848 InteropInfo.PreferTypes.reserve(
C->varlist_size() - 1);
10849 for (
Expr *E : llvm::drop_begin(
C->varlist())) {
10851 if (ER.isInvalid())
10853 InteropInfo.PreferTypes.push_back(ER.get());
10855 return getDerived().RebuildOMPInitClause(IVR.get(), InteropInfo,
10856 C->getBeginLoc(),
C->getLParenLoc(),
10857 C->getVarLoc(),
C->getEndLoc());
10860template <
typename Derived>
10862 ExprResult ER = getDerived().TransformExpr(
C->getInteropVar());
10863 if (ER.isInvalid())
10865 return getDerived().RebuildOMPUseClause(ER.get(),
C->getBeginLoc(),
10866 C->getLParenLoc(),
C->getVarLoc(),
10870template <
typename Derived>
10874 if (
Expr *IV =
C->getInteropVar()) {
10875 ER = getDerived().TransformExpr(IV);
10876 if (ER.isInvalid())
10879 return getDerived().RebuildOMPDestroyClause(ER.get(),
C->getBeginLoc(),
10880 C->getLParenLoc(),
C->getVarLoc(),
10884template <
typename Derived>
10888 if (
Cond.isInvalid())
10890 return getDerived().RebuildOMPNovariantsClause(
10891 Cond.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10894template <
typename Derived>
10898 if (
Cond.isInvalid())
10900 return getDerived().RebuildOMPNocontextClause(
10901 Cond.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10904template <
typename Derived>
10907 ExprResult ThreadID = getDerived().TransformExpr(
C->getThreadID());
10908 if (ThreadID.isInvalid())
10910 return getDerived().RebuildOMPFilterClause(ThreadID.get(),
C->getBeginLoc(),
10911 C->getLParenLoc(),
C->getEndLoc());
10914template <
typename Derived>
10916 ExprResult E = getDerived().TransformExpr(
C->getAlignment());
10919 return getDerived().RebuildOMPAlignClause(E.get(),
C->getBeginLoc(),
10920 C->getLParenLoc(),
C->getEndLoc());
10923template <
typename Derived>
10926 llvm_unreachable(
"unified_address clause cannot appear in dependent context");
10929template <
typename Derived>
10933 "unified_shared_memory clause cannot appear in dependent context");
10936template <
typename Derived>
10939 llvm_unreachable(
"reverse_offload clause cannot appear in dependent context");
10942template <
typename Derived>
10946 "dynamic_allocators clause cannot appear in dependent context");
10949template <
typename Derived>
10953 "atomic_default_mem_order clause cannot appear in dependent context");
10956template <
typename Derived>
10959 llvm_unreachable(
"self_maps clause cannot appear in dependent context");
10962template <
typename Derived>
10965 C->getBeginLoc(),
C->getLParenLoc(),
10969template <
typename Derived>
10973 C->getSeverityKind(),
C->getSeverityKindKwLoc(),
C->getBeginLoc(),
10974 C->getLParenLoc(),
C->getEndLoc());
10977template <
typename Derived>
10980 ExprResult E = getDerived().TransformExpr(
C->getMessageString());
10983 return getDerived().RebuildOMPMessageClause(
10984 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10987template <
typename Derived>
10991 Vars.reserve(
C->varlist_size());
10992 for (
auto *
VE :
C->varlist()) {
10994 if (EVar.isInvalid())
10996 Vars.push_back(EVar.get());
10998 return getDerived().RebuildOMPPrivateClause(
10999 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11002template <
typename Derived>
11006 Vars.reserve(
C->varlist_size());
11007 for (
auto *
VE :
C->varlist()) {
11009 if (EVar.isInvalid())
11011 Vars.push_back(EVar.get());
11013 return getDerived().RebuildOMPFirstprivateClause(
11014 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11017template <
typename Derived>
11021 Vars.reserve(
C->varlist_size());
11022 for (
auto *
VE :
C->varlist()) {
11024 if (EVar.isInvalid())
11026 Vars.push_back(EVar.get());
11028 return getDerived().RebuildOMPLastprivateClause(
11029 Vars,
C->getKind(),
C->getKindLoc(),
C->getColonLoc(),
C->getBeginLoc(),
11030 C->getLParenLoc(),
C->getEndLoc());
11033template <
typename Derived>
11037 Vars.reserve(
C->varlist_size());
11038 for (
auto *
VE :
C->varlist()) {
11040 if (EVar.isInvalid())
11042 Vars.push_back(EVar.get());
11044 return getDerived().RebuildOMPSharedClause(Vars,
C->getBeginLoc(),
11045 C->getLParenLoc(),
C->getEndLoc());
11048template <
typename Derived>
11052 Vars.reserve(
C->varlist_size());
11053 for (
auto *
VE :
C->varlist()) {
11055 if (EVar.isInvalid())
11057 Vars.push_back(EVar.get());
11060 ReductionIdScopeSpec.
Adopt(
C->getQualifierLoc());
11063 if (NameInfo.getName()) {
11064 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
11065 if (!NameInfo.getName())
11071 for (
auto *E :
C->reduction_ops()) {
11076 for (
auto *D : ULE->decls()) {
11079 Decls.addDecl(InstD, InstD->getAccess());
11083 ReductionIdScopeSpec.getWithLocInContext(SemaRef.
Context), NameInfo,
11084 true, Decls.begin(), Decls.end(),
11087 UnresolvedReductions.push_back(
nullptr);
11089 return getDerived().RebuildOMPReductionClause(
11090 Vars,
C->getModifier(),
C->getOriginalSharingModifier(),
C->getBeginLoc(),
11091 C->getLParenLoc(),
C->getModifierLoc(),
C->getColonLoc(),
C->getEndLoc(),
11092 ReductionIdScopeSpec, NameInfo, UnresolvedReductions);
11095template <
typename Derived>
11099 Vars.reserve(
C->varlist_size());
11100 for (
auto *
VE :
C->varlist()) {
11102 if (EVar.isInvalid())
11104 Vars.push_back(EVar.get());
11107 ReductionIdScopeSpec.
Adopt(
C->getQualifierLoc());
11110 if (NameInfo.getName()) {
11111 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
11112 if (!NameInfo.getName())
11118 for (
auto *E :
C->reduction_ops()) {
11123 for (
auto *D : ULE->decls()) {
11126 Decls.addDecl(InstD, InstD->getAccess());
11130 ReductionIdScopeSpec.getWithLocInContext(SemaRef.
Context), NameInfo,
11131 true, Decls.begin(), Decls.end(),
11134 UnresolvedReductions.push_back(
nullptr);
11136 return getDerived().RebuildOMPTaskReductionClause(
11137 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getColonLoc(),
11138 C->getEndLoc(), ReductionIdScopeSpec, NameInfo, UnresolvedReductions);
11141template <
typename Derived>
11145 Vars.reserve(
C->varlist_size());
11146 for (
auto *
VE :
C->varlist()) {
11148 if (EVar.isInvalid())
11150 Vars.push_back(EVar.get());
11153 ReductionIdScopeSpec.
Adopt(
C->getQualifierLoc());
11156 if (NameInfo.getName()) {
11157 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
11158 if (!NameInfo.getName())
11164 for (
auto *E :
C->reduction_ops()) {
11169 for (
auto *D : ULE->decls()) {
11172 Decls.addDecl(InstD, InstD->getAccess());
11176 ReductionIdScopeSpec.getWithLocInContext(SemaRef.
Context), NameInfo,
11177 true, Decls.begin(), Decls.end(),
11180 UnresolvedReductions.push_back(
nullptr);
11182 return getDerived().RebuildOMPInReductionClause(
11183 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getColonLoc(),
11184 C->getEndLoc(), ReductionIdScopeSpec, NameInfo, UnresolvedReductions);
11187template <
typename Derived>
11191 Vars.reserve(
C->varlist_size());
11192 for (
auto *
VE :
C->varlist()) {
11194 if (EVar.isInvalid())
11196 Vars.push_back(EVar.get());
11198 ExprResult Step = getDerived().TransformExpr(
C->getStep());
11199 if (Step.isInvalid())
11201 return getDerived().RebuildOMPLinearClause(
11202 Vars, Step.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getModifier(),
11203 C->getModifierLoc(),
C->getColonLoc(),
C->getStepModifierLoc(),
11207template <
typename Derived>
11211 Vars.reserve(
C->varlist_size());
11212 for (
auto *
VE :
C->varlist()) {
11214 if (EVar.isInvalid())
11216 Vars.push_back(EVar.get());
11218 ExprResult Alignment = getDerived().TransformExpr(
C->getAlignment());
11219 if (Alignment.isInvalid())
11221 return getDerived().RebuildOMPAlignedClause(
11222 Vars, Alignment.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11223 C->getColonLoc(),
C->getEndLoc());
11226template <
typename Derived>
11230 Vars.reserve(
C->varlist_size());
11231 for (
auto *
VE :
C->varlist()) {
11233 if (EVar.isInvalid())
11235 Vars.push_back(EVar.get());
11237 return getDerived().RebuildOMPCopyinClause(Vars,
C->getBeginLoc(),
11238 C->getLParenLoc(),
C->getEndLoc());
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 return getDerived().RebuildOMPCopyprivateClause(
11253 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11256template <
typename Derived>
11259 Vars.reserve(
C->varlist_size());
11260 for (
auto *
VE :
C->varlist()) {
11262 if (EVar.isInvalid())
11264 Vars.push_back(EVar.get());
11266 return getDerived().RebuildOMPFlushClause(Vars,
C->getBeginLoc(),
11267 C->getLParenLoc(),
C->getEndLoc());
11270template <
typename Derived>
11273 ExprResult E = getDerived().TransformExpr(
C->getDepobj());
11276 return getDerived().RebuildOMPDepobjClause(E.get(),
C->getBeginLoc(),
11277 C->getLParenLoc(),
C->getEndLoc());
11280template <
typename Derived>
11284 Expr *DepModifier =
C->getModifier();
11286 ExprResult DepModRes = getDerived().TransformExpr(DepModifier);
11287 if (DepModRes.isInvalid())
11289 DepModifier = DepModRes.get();
11291 Vars.reserve(
C->varlist_size());
11292 for (
auto *
VE :
C->varlist()) {
11294 if (EVar.isInvalid())
11296 Vars.push_back(EVar.get());
11298 return getDerived().RebuildOMPDependClause(
11299 {
C->getDependencyKind(),
C->getDependencyLoc(),
C->getColonLoc(),
11300 C->getOmpAllMemoryLoc()},
11301 DepModifier, Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11304template <
typename Derived>
11307 ExprResult E = getDerived().TransformExpr(
C->getDevice());
11310 return getDerived().RebuildOMPDeviceClause(
11311 C->getModifier(), E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11312 C->getModifierLoc(),
C->getEndLoc());
11315template <
typename Derived,
class T>
11322 Vars.reserve(
C->varlist_size());
11323 for (
auto *
VE :
C->varlist()) {
11327 Vars.push_back(EVar.
get());
11331 if (
C->getMapperQualifierLoc()) {
11332 QualifierLoc = TT.
getDerived().TransformNestedNameSpecifierLoc(
11333 C->getMapperQualifierLoc());
11337 MapperIdScopeSpec.
Adopt(QualifierLoc);
11338 MapperIdInfo =
C->getMapperIdInfo();
11339 if (MapperIdInfo.
getName()) {
11340 MapperIdInfo = TT.
getDerived().TransformDeclarationNameInfo(MapperIdInfo);
11346 for (
auto *E :
C->mapperlists()) {
11351 for (
auto *D : ULE->decls()) {
11354 Decls.addDecl(InstD, InstD->
getAccess());
11359 MapperIdInfo,
true, Decls.begin(), Decls.end(),
11362 UnresolvedMappers.push_back(
nullptr);
11368template <
typename Derived>
11369OMPClause *TreeTransform<Derived>::TransformOMPMapClause(OMPMapClause *
C) {
11370 OMPVarListLocTy Locs(
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11372 Expr *IteratorModifier =
C->getIteratorModifier();
11373 if (IteratorModifier) {
11374 ExprResult MapModRes = getDerived().TransformExpr(IteratorModifier);
11375 if (MapModRes.isInvalid())
11377 IteratorModifier = MapModRes.
get();
11383 *
this,
C, Vars, MapperIdScopeSpec, MapperIdInfo, UnresolvedMappers))
11385 return getDerived().RebuildOMPMapClause(
11386 IteratorModifier,
C->getMapTypeModifiers(),
C->getMapTypeModifiersLoc(),
11387 MapperIdScopeSpec, MapperIdInfo,
C->getMapType(),
C->isImplicitMapType(),
11388 C->getMapLoc(),
C->getColonLoc(), Vars, Locs, UnresolvedMappers);
11391template <
typename Derived>
11394 Expr *Allocator =
C->getAllocator();
11396 ExprResult AllocatorRes = getDerived().TransformExpr(Allocator);
11397 if (AllocatorRes.isInvalid())
11399 Allocator = AllocatorRes.get();
11401 Expr *Alignment =
C->getAlignment();
11403 ExprResult AlignmentRes = getDerived().TransformExpr(Alignment);
11404 if (AlignmentRes.isInvalid())
11406 Alignment = AlignmentRes.get();
11409 Vars.reserve(
C->varlist_size());
11410 for (
auto *
VE :
C->varlist()) {
11412 if (EVar.isInvalid())
11414 Vars.push_back(EVar.get());
11416 return getDerived().RebuildOMPAllocateClause(
11417 Allocator, Alignment,
C->getFirstAllocateModifier(),
11418 C->getFirstAllocateModifierLoc(),
C->getSecondAllocateModifier(),
11419 C->getSecondAllocateModifierLoc(), Vars,
C->getBeginLoc(),
11420 C->getLParenLoc(),
C->getColonLoc(),
C->getEndLoc());
11423template <
typename Derived>
11427 Vars.reserve(
C->varlist_size());
11428 for (
auto *
VE :
C->varlist()) {
11430 if (EVar.isInvalid())
11432 Vars.push_back(EVar.get());
11434 return getDerived().RebuildOMPNumTeamsClause(
11435 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11438template <
typename Derived>
11442 Vars.reserve(
C->varlist_size());
11443 for (
auto *
VE :
C->varlist()) {
11445 if (EVar.isInvalid())
11447 Vars.push_back(EVar.get());
11449 return getDerived().RebuildOMPThreadLimitClause(
11450 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11453template <
typename Derived>
11456 ExprResult E = getDerived().TransformExpr(
C->getPriority());
11459 return getDerived().RebuildOMPPriorityClause(
11460 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11463template <
typename Derived>
11466 ExprResult E = getDerived().TransformExpr(
C->getGrainsize());
11469 return getDerived().RebuildOMPGrainsizeClause(
11470 C->getModifier(), E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11471 C->getModifierLoc(),
C->getEndLoc());
11474template <
typename Derived>
11477 ExprResult E = getDerived().TransformExpr(
C->getNumTasks());
11480 return getDerived().RebuildOMPNumTasksClause(
11481 C->getModifier(), E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11482 C->getModifierLoc(),
C->getEndLoc());
11485template <
typename Derived>
11487 ExprResult E = getDerived().TransformExpr(
C->getHint());
11490 return getDerived().RebuildOMPHintClause(E.get(),
C->getBeginLoc(),
11491 C->getLParenLoc(),
C->getEndLoc());
11494template <
typename Derived>
11497 ExprResult E = getDerived().TransformExpr(
C->getChunkSize());
11500 return getDerived().RebuildOMPDistScheduleClause(
11501 C->getDistScheduleKind(), E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11502 C->getDistScheduleKindLoc(),
C->getCommaLoc(),
C->getEndLoc());
11505template <
typename Derived>
11511 C->getDefaultmapKind(),
11514 C->getDefaultmapModifierLoc(),
11515 C->getDefaultmapKindLoc(),
11519template <
typename Derived>
11527 *
this,
C, Vars, MapperIdScopeSpec, MapperIdInfo, UnresolvedMappers))
11529 return getDerived().RebuildOMPToClause(
11530 C->getMotionModifiers(),
C->getMotionModifiersLoc(), MapperIdScopeSpec,
11531 MapperIdInfo,
C->getColonLoc(), Vars, Locs, UnresolvedMappers);
11534template <
typename Derived>
11542 *
this,
C, Vars, MapperIdScopeSpec, MapperIdInfo, UnresolvedMappers))
11544 return getDerived().RebuildOMPFromClause(
11545 C->getMotionModifiers(),
C->getMotionModifiersLoc(), MapperIdScopeSpec,
11546 MapperIdInfo,
C->getColonLoc(), Vars, Locs, UnresolvedMappers);
11549template <
typename Derived>
11553 Vars.reserve(
C->varlist_size());
11554 for (
auto *
VE :
C->varlist()) {
11556 if (EVar.isInvalid())
11558 Vars.push_back(EVar.get());
11561 return getDerived().RebuildOMPUseDevicePtrClause(Vars, Locs);
11564template <
typename Derived>
11568 Vars.reserve(
C->varlist_size());
11569 for (
auto *
VE :
C->varlist()) {
11571 if (EVar.isInvalid())
11573 Vars.push_back(EVar.get());
11576 return getDerived().RebuildOMPUseDeviceAddrClause(Vars, Locs);
11579template <
typename Derived>
11583 Vars.reserve(
C->varlist_size());
11584 for (
auto *
VE :
C->varlist()) {
11586 if (EVar.isInvalid())
11588 Vars.push_back(EVar.get());
11591 return getDerived().RebuildOMPIsDevicePtrClause(Vars, Locs);
11594template <
typename Derived>
11598 Vars.reserve(
C->varlist_size());
11599 for (
auto *
VE :
C->varlist()) {
11601 if (EVar.isInvalid())
11603 Vars.push_back(EVar.get());
11606 return getDerived().RebuildOMPHasDeviceAddrClause(Vars, Locs);
11609template <
typename Derived>
11613 Vars.reserve(
C->varlist_size());
11614 for (
auto *
VE :
C->varlist()) {
11616 if (EVar.isInvalid())
11618 Vars.push_back(EVar.get());
11620 return getDerived().RebuildOMPNontemporalClause(
11621 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11624template <
typename Derived>
11628 Vars.reserve(
C->varlist_size());
11629 for (
auto *
VE :
C->varlist()) {
11631 if (EVar.isInvalid())
11633 Vars.push_back(EVar.get());
11635 return getDerived().RebuildOMPInclusiveClause(
11636 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11639template <
typename Derived>
11643 Vars.reserve(
C->varlist_size());
11644 for (
auto *
VE :
C->varlist()) {
11646 if (EVar.isInvalid())
11648 Vars.push_back(EVar.get());
11650 return getDerived().RebuildOMPExclusiveClause(
11651 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11654template <
typename Derived>
11658 Data.reserve(
C->getNumberOfAllocators());
11659 for (
unsigned I = 0, E =
C->getNumberOfAllocators(); I < E; ++I) {
11661 ExprResult Allocator = getDerived().TransformExpr(D.Allocator);
11662 if (Allocator.isInvalid())
11665 if (
Expr *AT = D.AllocatorTraits) {
11666 AllocatorTraits = getDerived().TransformExpr(AT);
11667 if (AllocatorTraits.isInvalid())
11671 NewD.Allocator = Allocator.get();
11672 NewD.AllocatorTraits = AllocatorTraits.get();
11673 NewD.LParenLoc = D.LParenLoc;
11674 NewD.RParenLoc = D.RParenLoc;
11676 return getDerived().RebuildOMPUsesAllocatorsClause(
11677 Data,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11680template <
typename Derived>
11684 Locators.reserve(
C->varlist_size());
11686 if (
Expr *Modifier =
C->getModifier()) {
11687 ModifierRes = getDerived().TransformExpr(Modifier);
11688 if (ModifierRes.isInvalid())
11691 for (
Expr *E :
C->varlist()) {
11692 ExprResult Locator = getDerived().TransformExpr(E);
11693 if (Locator.isInvalid())
11695 Locators.push_back(Locator.get());
11697 return getDerived().RebuildOMPAffinityClause(
11698 C->getBeginLoc(),
C->getLParenLoc(),
C->getColonLoc(),
C->getEndLoc(),
11699 ModifierRes.get(), Locators);
11702template <
typename Derived>
11705 C->getKind(),
C->getKindKwLoc(),
C->getBeginLoc(),
C->getLParenLoc(),
11706 C->getEndLoc(),
C->getModifier(),
C->getModifierKwLoc());
11709template <
typename Derived>
11712 C->getBindKind(),
C->getBindKindLoc(),
C->getBeginLoc(),
11713 C->getLParenLoc(),
C->getEndLoc());
11716template <
typename Derived>
11720 if (
Size.isInvalid())
11722 return getDerived().RebuildOMPXDynCGroupMemClause(
11723 Size.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11726template <
typename Derived>
11730 Vars.reserve(
C->varlist_size());
11731 for (
auto *
VE :
C->varlist()) {
11733 if (EVar.isInvalid())
11735 Vars.push_back(EVar.get());
11737 return getDerived().RebuildOMPDoacrossClause(
11738 C->getDependenceType(),
C->getDependenceLoc(),
C->getColonLoc(), Vars,
11739 C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11742template <
typename Derived>
11746 for (
auto *A :
C->getAttrs())
11747 NewAttrs.push_back(getDerived().TransformAttr(A));
11748 return getDerived().RebuildOMPXAttributeClause(
11749 NewAttrs,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11752template <
typename Derived>
11761template <
typename Derived>
11762class OpenACCClauseTransform final
11764 TreeTransform<Derived> &Self;
11765 ArrayRef<const OpenACCClause *> ExistingClauses;
11766 SemaOpenACC::OpenACCParsedClause &ParsedClause;
11767 OpenACCClause *NewClause =
nullptr;
11770 ExprResult Res = Self.TransformExpr(VarRef);
11772 if (!Res.isUsable())
11775 Res = Self.getSema().OpenACC().ActOnVar(ParsedClause.getDirectiveKind(),
11776 ParsedClause.getClauseKind(),
11782 llvm::SmallVector<Expr *> VisitVarList(ArrayRef<Expr *> VarList) {
11783 llvm::SmallVector<Expr *> InstantiatedVarList;
11784 for (Expr *CurVar : VarList) {
11787 if (VarRef.isUsable())
11788 InstantiatedVarList.push_back(VarRef.get());
11791 return InstantiatedVarList;
11795 OpenACCClauseTransform(TreeTransform<Derived> &Self,
11796 ArrayRef<const OpenACCClause *> ExistingClauses,
11797 SemaOpenACC::OpenACCParsedClause &PC)
11798 : Self(Self), ExistingClauses(ExistingClauses), ParsedClause(PC) {}
11800 OpenACCClause *CreatedClause()
const {
return NewClause; }
11802#define VISIT_CLAUSE(CLAUSE_NAME) \
11803 void Visit##CLAUSE_NAME##Clause(const OpenACC##CLAUSE_NAME##Clause &Clause);
11804#include "clang/Basic/OpenACCClauses.def"
11807template <
typename Derived>
11808void OpenACCClauseTransform<Derived>::VisitDefaultClause(
11810 ParsedClause.setDefaultDetails(
C.getDefaultClauseKind());
11813 Self.getSema().getASTContext(), ParsedClause.getDefaultClauseKind(),
11814 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
11815 ParsedClause.getEndLoc());
11818template <
typename Derived>
11819void OpenACCClauseTransform<Derived>::VisitIfClause(
const OpenACCIfClause &
C) {
11821 assert(
Cond &&
"If constructed with invalid Condition");
11825 if (Res.isInvalid() || !Res.get().second)
11828 ParsedClause.setConditionDetails(Res.get().second);
11831 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
11832 ParsedClause.getLParenLoc(), ParsedClause.getConditionExpr(),
11833 ParsedClause.getEndLoc());
11836template <
typename Derived>
11837void OpenACCClauseTransform<Derived>::VisitSelfClause(
11843 for (
Expr *CurVar :
C.getVarList()) {
11846 if (!Res.isUsable())
11849 Res =
Self.getSema().OpenACC().ActOnVar(ParsedClause.getDirectiveKind(),
11850 ParsedClause.getClauseKind(),
11853 if (Res.isUsable())
11854 InstantiatedVarList.push_back(Res.get());
11857 ParsedClause.setVarListDetails(InstantiatedVarList,
11861 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
11862 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
11863 ParsedClause.getEndLoc());
11866 if (
C.hasConditionExpr()) {
11869 Self.TransformCondition(
Cond->getExprLoc(),
nullptr,
Cond,
11872 if (Res.isInvalid() || !Res.get().second)
11875 ParsedClause.setConditionDetails(Res.get().second);
11879 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
11880 ParsedClause.getLParenLoc(), ParsedClause.getConditionExpr(),
11881 ParsedClause.getEndLoc());
11885template <
typename Derived>
11886void OpenACCClauseTransform<Derived>::VisitNumGangsClause(
11890 for (
Expr *CurIntExpr :
C.getIntExprs()) {
11893 if (!Res.isUsable())
11898 C.getBeginLoc(), Res.get());
11899 if (!Res.isUsable())
11902 InstantiatedIntExprs.push_back(Res.get());
11905 ParsedClause.setIntExprDetails(InstantiatedIntExprs);
11907 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
11908 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs(),
11909 ParsedClause.getEndLoc());
11912template <
typename Derived>
11913void OpenACCClauseTransform<Derived>::VisitPrivateClause(
11918 for (
const auto [RefExpr, InitRecipe] :
11919 llvm::zip(
C.getVarList(),
C.getInitRecipes())) {
11922 if (VarRef.isUsable()) {
11923 InstantiatedVarList.push_back(VarRef.get());
11927 if (InitRecipe.isSet())
11928 InitRecipes.push_back(InitRecipe);
11930 InitRecipes.push_back(
11931 Self.getSema().OpenACC().CreatePrivateInitRecipe(VarRef.get()));
11934 ParsedClause.setVarListDetails(InstantiatedVarList,
11938 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
11939 ParsedClause.getLParenLoc(), ParsedClause.getVarList(), InitRecipes,
11940 ParsedClause.getEndLoc());
11943template <
typename Derived>
11944void OpenACCClauseTransform<Derived>::VisitHostClause(
11946 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
11950 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
11951 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
11952 ParsedClause.getEndLoc());
11955template <
typename Derived>
11956void OpenACCClauseTransform<Derived>::VisitDeviceClause(
11958 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
11962 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
11963 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
11964 ParsedClause.getEndLoc());
11967template <
typename Derived>
11968void OpenACCClauseTransform<Derived>::VisitFirstPrivateClause(
11973 for (
const auto [RefExpr, InitRecipe] :
11974 llvm::zip(
C.getVarList(),
C.getInitRecipes())) {
11977 if (VarRef.isUsable()) {
11978 InstantiatedVarList.push_back(VarRef.get());
11982 if (InitRecipe.isSet())
11983 InitRecipes.push_back(InitRecipe);
11985 InitRecipes.push_back(
11986 Self.getSema().OpenACC().CreateFirstPrivateInitRecipe(
11990 ParsedClause.setVarListDetails(InstantiatedVarList,
11994 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
11995 ParsedClause.getLParenLoc(), ParsedClause.getVarList(), InitRecipes,
11996 ParsedClause.getEndLoc());
11999template <
typename Derived>
12000void OpenACCClauseTransform<Derived>::VisitNoCreateClause(
12002 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12006 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12007 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12008 ParsedClause.getEndLoc());
12011template <
typename Derived>
12012void OpenACCClauseTransform<Derived>::VisitPresentClause(
12014 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12018 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12019 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12020 ParsedClause.getEndLoc());
12023template <
typename Derived>
12024void OpenACCClauseTransform<Derived>::VisitCopyClause(
12026 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12027 C.getModifierList());
12030 Self.getSema().getASTContext(), ParsedClause.getClauseKind(),
12031 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12032 ParsedClause.getModifierList(), ParsedClause.getVarList(),
12033 ParsedClause.getEndLoc());
12036template <
typename Derived>
12037void OpenACCClauseTransform<Derived>::VisitLinkClause(
12039 llvm_unreachable(
"link clause not valid unless a decl transform");
12042template <
typename Derived>
12043void OpenACCClauseTransform<Derived>::VisitDeviceResidentClause(
12045 llvm_unreachable(
"device_resident clause not valid unless a decl transform");
12047template <
typename Derived>
12048void OpenACCClauseTransform<Derived>::VisitNoHostClause(
12050 llvm_unreachable(
"nohost clause not valid unless a decl transform");
12052template <
typename Derived>
12053void OpenACCClauseTransform<Derived>::VisitBindClause(
12055 llvm_unreachable(
"bind clause not valid unless a decl transform");
12058template <
typename Derived>
12059void OpenACCClauseTransform<Derived>::VisitCopyInClause(
12061 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12062 C.getModifierList());
12065 Self.getSema().getASTContext(), ParsedClause.getClauseKind(),
12066 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12067 ParsedClause.getModifierList(), ParsedClause.getVarList(),
12068 ParsedClause.getEndLoc());
12071template <
typename Derived>
12072void OpenACCClauseTransform<Derived>::VisitCopyOutClause(
12074 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12075 C.getModifierList());
12078 Self.getSema().getASTContext(), ParsedClause.getClauseKind(),
12079 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12080 ParsedClause.getModifierList(), ParsedClause.getVarList(),
12081 ParsedClause.getEndLoc());
12084template <
typename Derived>
12085void OpenACCClauseTransform<Derived>::VisitCreateClause(
12087 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12088 C.getModifierList());
12091 Self.getSema().getASTContext(), ParsedClause.getClauseKind(),
12092 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12093 ParsedClause.getModifierList(), ParsedClause.getVarList(),
12094 ParsedClause.getEndLoc());
12096template <
typename Derived>
12097void OpenACCClauseTransform<Derived>::VisitAttachClause(
12102 llvm::erase_if(VarList, [&](
Expr *E) {
12103 return Self.getSema().OpenACC().CheckVarIsPointerType(
12109 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12110 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12111 ParsedClause.getEndLoc());
12114template <
typename Derived>
12115void OpenACCClauseTransform<Derived>::VisitDetachClause(
12120 llvm::erase_if(VarList, [&](
Expr *E) {
12121 return Self.getSema().OpenACC().CheckVarIsPointerType(
12127 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12128 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12129 ParsedClause.getEndLoc());
12132template <
typename Derived>
12133void OpenACCClauseTransform<Derived>::VisitDeleteClause(
12135 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12138 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12139 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12140 ParsedClause.getEndLoc());
12143template <
typename Derived>
12144void OpenACCClauseTransform<Derived>::VisitUseDeviceClause(
12146 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12149 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12150 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12151 ParsedClause.getEndLoc());
12154template <
typename Derived>
12155void OpenACCClauseTransform<Derived>::VisitDevicePtrClause(
12160 llvm::erase_if(VarList, [&](
Expr *E) {
12161 return Self.getSema().OpenACC().CheckVarIsPointerType(
12167 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12168 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12169 ParsedClause.getEndLoc());
12172template <
typename Derived>
12173void OpenACCClauseTransform<Derived>::VisitNumWorkersClause(
12175 Expr *IntExpr =
const_cast<Expr *
>(
C.getIntExpr());
12176 assert(IntExpr &&
"num_workers clause constructed with invalid int expr");
12179 if (!Res.isUsable())
12184 C.getBeginLoc(), Res.get());
12185 if (!Res.isUsable())
12188 ParsedClause.setIntExprDetails(Res.get());
12190 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12191 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs()[0],
12192 ParsedClause.getEndLoc());
12195template <
typename Derived>
12196void OpenACCClauseTransform<Derived>::VisitDeviceNumClause (
12198 Expr *IntExpr =
const_cast<Expr *
>(
C.getIntExpr());
12199 assert(IntExpr &&
"device_num clause constructed with invalid int expr");
12202 if (!Res.isUsable())
12207 C.getBeginLoc(), Res.get());
12208 if (!Res.isUsable())
12211 ParsedClause.setIntExprDetails(Res.get());
12213 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12214 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs()[0],
12215 ParsedClause.getEndLoc());
12218template <
typename Derived>
12219void OpenACCClauseTransform<Derived>::VisitDefaultAsyncClause(
12221 Expr *IntExpr =
const_cast<Expr *
>(
C.getIntExpr());
12222 assert(IntExpr &&
"default_async clause constructed with invalid int expr");
12225 if (!Res.isUsable())
12230 C.getBeginLoc(), Res.get());
12231 if (!Res.isUsable())
12234 ParsedClause.setIntExprDetails(Res.get());
12236 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12237 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs()[0],
12238 ParsedClause.getEndLoc());
12241template <
typename Derived>
12242void OpenACCClauseTransform<Derived>::VisitVectorLengthClause(
12244 Expr *IntExpr =
const_cast<Expr *
>(
C.getIntExpr());
12245 assert(IntExpr &&
"vector_length clause constructed with invalid int expr");
12248 if (!Res.isUsable())
12253 C.getBeginLoc(), Res.get());
12254 if (!Res.isUsable())
12257 ParsedClause.setIntExprDetails(Res.get());
12259 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12260 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs()[0],
12261 ParsedClause.getEndLoc());
12264template <
typename Derived>
12265void OpenACCClauseTransform<Derived>::VisitAsyncClause(
12267 if (
C.hasIntExpr()) {
12269 if (!Res.isUsable())
12274 C.getBeginLoc(), Res.get());
12275 if (!Res.isUsable())
12277 ParsedClause.setIntExprDetails(Res.get());
12281 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12282 ParsedClause.getLParenLoc(),
12283 ParsedClause.getNumIntExprs() != 0 ? ParsedClause.getIntExprs()[0]
12285 ParsedClause.getEndLoc());
12288template <
typename Derived>
12289void OpenACCClauseTransform<Derived>::VisitWorkerClause(
12291 if (
C.hasIntExpr()) {
12296 if (!Res.isUsable())
12301 C.getBeginLoc(), Res.get());
12302 if (!Res.isUsable())
12304 ParsedClause.setIntExprDetails(Res.get());
12308 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12309 ParsedClause.getLParenLoc(),
12310 ParsedClause.getNumIntExprs() != 0 ? ParsedClause.getIntExprs()[0]
12312 ParsedClause.getEndLoc());
12315template <
typename Derived>
12316void OpenACCClauseTransform<Derived>::VisitVectorClause(
12318 if (
C.hasIntExpr()) {
12323 if (!Res.isUsable())
12328 C.getBeginLoc(), Res.get());
12329 if (!Res.isUsable())
12331 ParsedClause.setIntExprDetails(Res.get());
12335 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12336 ParsedClause.getLParenLoc(),
12337 ParsedClause.getNumIntExprs() != 0 ? ParsedClause.getIntExprs()[0]
12339 ParsedClause.getEndLoc());
12342template <
typename Derived>
12343void OpenACCClauseTransform<Derived>::VisitWaitClause(
12345 if (
C.hasExprs()) {
12346 Expr *DevNumExpr =
nullptr;
12350 if (
C.getDevNumExpr()) {
12352 if (!Res.isUsable())
12356 C.getBeginLoc(), Res.get());
12357 if (!Res.isUsable())
12360 DevNumExpr = Res.get();
12364 for (
Expr *CurQueueIdExpr :
C.getQueueIdExprs()) {
12366 if (!Res.isUsable())
12370 C.getBeginLoc(), Res.get());
12371 if (!Res.isUsable())
12374 InstantiatedQueueIdExprs.push_back(Res.get());
12377 ParsedClause.setWaitDetails(DevNumExpr,
C.getQueuesLoc(),
12378 std::move(InstantiatedQueueIdExprs));
12382 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12383 ParsedClause.getLParenLoc(), ParsedClause.getDevNumExpr(),
12384 ParsedClause.getQueuesLoc(), ParsedClause.getQueueIdExprs(),
12385 ParsedClause.getEndLoc());
12388template <
typename Derived>
12389void OpenACCClauseTransform<Derived>::VisitDeviceTypeClause(
12393 Self.getSema().getASTContext(),
C.getClauseKind(),
12394 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12395 C.getArchitectures(), ParsedClause.getEndLoc());
12398template <
typename Derived>
12399void OpenACCClauseTransform<Derived>::VisitAutoClause(
12403 ParsedClause.getBeginLoc(),
12404 ParsedClause.getEndLoc());
12407template <
typename Derived>
12408void OpenACCClauseTransform<Derived>::VisitIndependentClause(
12411 ParsedClause.getBeginLoc(),
12412 ParsedClause.getEndLoc());
12415template <
typename Derived>
12416void OpenACCClauseTransform<Derived>::VisitSeqClause(
12419 ParsedClause.getBeginLoc(),
12420 ParsedClause.getEndLoc());
12422template <
typename Derived>
12423void OpenACCClauseTransform<Derived>::VisitFinalizeClause(
12426 ParsedClause.getBeginLoc(),
12427 ParsedClause.getEndLoc());
12430template <
typename Derived>
12431void OpenACCClauseTransform<Derived>::VisitIfPresentClause(
12434 ParsedClause.getBeginLoc(),
12435 ParsedClause.getEndLoc());
12438template <
typename Derived>
12439void OpenACCClauseTransform<Derived>::VisitReductionClause(
12445 for (
const auto [Var, OrigRecipe] :
12446 llvm::zip(TransformedVars,
C.getRecipes())) {
12448 ParsedClause.getDirectiveKind(),
C.getReductionOp(), Var);
12449 if (Res.isUsable()) {
12450 ValidVars.push_back(Res.get());
12452 if (OrigRecipe.isSet())
12453 Recipes.emplace_back(OrigRecipe.AllocaDecl, OrigRecipe.CombinerRecipes);
12455 Recipes.push_back(
Self.getSema().OpenACC().CreateReductionInitRecipe(
12456 C.getReductionOp(), Res.get()));
12460 NewClause =
Self.getSema().OpenACC().CheckReductionClause(
12461 ExistingClauses, ParsedClause.getDirectiveKind(),
12462 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12463 C.getReductionOp(), ValidVars, Recipes, ParsedClause.getEndLoc());
12466template <
typename Derived>
12467void OpenACCClauseTransform<Derived>::VisitCollapseClause(
12469 Expr *LoopCount =
const_cast<Expr *
>(
C.getLoopCount());
12470 assert(LoopCount &&
"collapse clause constructed with invalid loop count");
12474 NewLoopCount =
Self.getSema().OpenACC().ActOnIntExpr(
12476 NewLoopCount.get()->getBeginLoc(), NewLoopCount.get());
12479 Self.getSema().OpenACC().CheckCollapseLoopCount(NewLoopCount.get());
12481 ParsedClause.setCollapseDetails(
C.hasForce(), NewLoopCount.get());
12483 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12484 ParsedClause.getLParenLoc(), ParsedClause.isForce(),
12485 ParsedClause.getLoopCount(), ParsedClause.getEndLoc());
12488template <
typename Derived>
12489void OpenACCClauseTransform<Derived>::VisitTileClause(
12494 for (
Expr *E :
C.getSizeExprs()) {
12497 if (!NewSizeExpr.isUsable())
12500 NewSizeExpr =
Self.getSema().OpenACC().ActOnIntExpr(
12502 NewSizeExpr.get()->getBeginLoc(), NewSizeExpr.get());
12504 NewSizeExpr =
Self.getSema().OpenACC().CheckTileSizeExpr(NewSizeExpr.get());
12506 if (!NewSizeExpr.isUsable())
12508 TransformedExprs.push_back(NewSizeExpr.get());
12511 ParsedClause.setIntExprDetails(TransformedExprs);
12513 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12514 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs(),
12515 ParsedClause.getEndLoc());
12517template <
typename Derived>
12518void OpenACCClauseTransform<Derived>::VisitGangClause(
12523 for (
unsigned I = 0; I <
C.getNumExprs(); ++I) {
12525 if (!ER.isUsable())
12528 ER =
Self.getSema().OpenACC().CheckGangExpr(ExistingClauses,
12529 ParsedClause.getDirectiveKind(),
12530 C.getExpr(I).first, ER.get());
12531 if (!ER.isUsable())
12533 TransformedGangKinds.push_back(
C.getExpr(I).first);
12534 TransformedIntExprs.push_back(ER.get());
12537 NewClause =
Self.getSema().OpenACC().CheckGangClause(
12538 ParsedClause.getDirectiveKind(), ExistingClauses,
12539 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12540 TransformedGangKinds, TransformedIntExprs, ParsedClause.getEndLoc());
12543template <
typename Derived>
12544OpenACCClause *TreeTransform<Derived>::TransformOpenACCClause(
12549 DirKind, OldClause->getClauseKind(), OldClause->getBeginLoc());
12550 ParsedClause.setEndLoc(OldClause->getEndLoc());
12552 if (
const auto *WithParms = dyn_cast<OpenACCClauseWithParams>(OldClause))
12553 ParsedClause.setLParenLoc(WithParms->getLParenLoc());
12555 OpenACCClauseTransform<Derived> Transform{*
this, ExistingClauses,
12557 Transform.Visit(OldClause);
12559 return Transform.CreatedClause();
12562template <
typename Derived>
12564TreeTransform<Derived>::TransformOpenACCClauseList(
12567 for (
const auto *Clause : OldClauses) {
12568 if (
OpenACCClause *TransformedClause = getDerived().TransformOpenACCClause(
12569 TransformedClauses, DirKind, Clause))
12570 TransformedClauses.push_back(TransformedClause);
12572 return TransformedClauses;
12575template <
typename Derived>
12578 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12581 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12584 if (getSema().OpenACC().ActOnStartStmtDirective(
12585 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12590 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
12591 C->clauses(), TransformedClauses);
12592 StmtResult StrBlock = getDerived().TransformStmt(
C->getStructuredBlock());
12593 StrBlock = getSema().OpenACC().ActOnAssociatedStmt(
12594 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses, StrBlock);
12596 return getDerived().RebuildOpenACCComputeConstruct(
12597 C->getDirectiveKind(),
C->getBeginLoc(),
C->getDirectiveLoc(),
12598 C->getEndLoc(), TransformedClauses, StrBlock);
12601template <
typename Derived>
12605 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12608 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12611 if (getSema().OpenACC().ActOnStartStmtDirective(
12612 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12617 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
12618 C->clauses(), TransformedClauses);
12620 Loop = getSema().OpenACC().ActOnAssociatedStmt(
12621 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses,
Loop);
12623 return getDerived().RebuildOpenACCLoopConstruct(
12624 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12625 TransformedClauses,
Loop);
12628template <
typename Derived>
12630 OpenACCCombinedConstruct *
C) {
12631 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12634 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12637 if (getSema().OpenACC().ActOnStartStmtDirective(
12638 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12643 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
12644 C->clauses(), TransformedClauses);
12646 Loop = getSema().OpenACC().ActOnAssociatedStmt(
12647 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses,
Loop);
12649 return getDerived().RebuildOpenACCCombinedConstruct(
12650 C->getDirectiveKind(),
C->getBeginLoc(),
C->getDirectiveLoc(),
12651 C->getEndLoc(), TransformedClauses,
Loop);
12654template <
typename Derived>
12657 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12660 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12662 if (getSema().OpenACC().ActOnStartStmtDirective(
12663 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12667 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
12668 C->clauses(), TransformedClauses);
12669 StmtResult StrBlock = getDerived().TransformStmt(
C->getStructuredBlock());
12670 StrBlock = getSema().OpenACC().ActOnAssociatedStmt(
12671 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses, StrBlock);
12673 return getDerived().RebuildOpenACCDataConstruct(
12674 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12675 TransformedClauses, StrBlock);
12678template <
typename Derived>
12680 OpenACCEnterDataConstruct *
C) {
12681 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12684 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12686 if (getSema().OpenACC().ActOnStartStmtDirective(
12687 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12690 return getDerived().RebuildOpenACCEnterDataConstruct(
12691 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12692 TransformedClauses);
12695template <
typename Derived>
12697 OpenACCExitDataConstruct *
C) {
12698 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12701 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12703 if (getSema().OpenACC().ActOnStartStmtDirective(
12704 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12707 return getDerived().RebuildOpenACCExitDataConstruct(
12708 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12709 TransformedClauses);
12712template <
typename Derived>
12714 OpenACCHostDataConstruct *
C) {
12715 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12718 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12720 if (getSema().OpenACC().ActOnStartStmtDirective(
12721 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12725 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
12726 C->clauses(), TransformedClauses);
12727 StmtResult StrBlock = getDerived().TransformStmt(
C->getStructuredBlock());
12728 StrBlock = getSema().OpenACC().ActOnAssociatedStmt(
12729 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses, StrBlock);
12731 return getDerived().RebuildOpenACCHostDataConstruct(
12732 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12733 TransformedClauses, StrBlock);
12736template <
typename Derived>
12739 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12742 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12744 if (getSema().OpenACC().ActOnStartStmtDirective(
12745 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12748 return getDerived().RebuildOpenACCInitConstruct(
12749 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12750 TransformedClauses);
12753template <
typename Derived>
12755 OpenACCShutdownConstruct *
C) {
12756 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12759 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12761 if (getSema().OpenACC().ActOnStartStmtDirective(
12762 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12765 return getDerived().RebuildOpenACCShutdownConstruct(
12766 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12767 TransformedClauses);
12769template <
typename Derived>
12772 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12775 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12777 if (getSema().OpenACC().ActOnStartStmtDirective(
12778 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12781 return getDerived().RebuildOpenACCSetConstruct(
12782 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12783 TransformedClauses);
12786template <
typename Derived>
12788 OpenACCUpdateConstruct *
C) {
12789 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12792 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12794 if (getSema().OpenACC().ActOnStartStmtDirective(
12795 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12798 return getDerived().RebuildOpenACCUpdateConstruct(
12799 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12800 TransformedClauses);
12803template <
typename Derived>
12806 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12809 if (
C->hasDevNumExpr()) {
12810 DevNumExpr = getDerived().TransformExpr(
C->getDevNumExpr());
12812 if (DevNumExpr.isUsable())
12813 DevNumExpr = getSema().OpenACC().ActOnIntExpr(
12815 C->getBeginLoc(), DevNumExpr.get());
12820 for (
Expr *QE :
C->getQueueIdExprs()) {
12821 assert(QE &&
"Null queue id expr?");
12822 ExprResult NewEQ = getDerived().TransformExpr(QE);
12824 if (!NewEQ.isUsable())
12828 C->getBeginLoc(), NewEQ.get());
12829 if (NewEQ.isUsable())
12830 QueueIdExprs.push_back(NewEQ.get());
12834 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12837 if (getSema().OpenACC().ActOnStartStmtDirective(
12838 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12841 return getDerived().RebuildOpenACCWaitConstruct(
12842 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getLParenLoc(),
12843 DevNumExpr.isUsable() ? DevNumExpr.get() :
nullptr,
C->getQueuesLoc(),
12844 QueueIdExprs,
C->getRParenLoc(),
C->getEndLoc(), TransformedClauses);
12846template <
typename Derived>
12848 OpenACCCacheConstruct *
C) {
12849 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12852 for (
Expr *Var :
C->getVarList()) {
12853 assert(Var &&
"Null var listexpr?");
12855 ExprResult NewVar = getDerived().TransformExpr(Var);
12857 if (!NewVar.isUsable())
12860 NewVar = getSema().OpenACC().ActOnVar(
12862 if (!NewVar.isUsable())
12865 TransformedVarList.push_back(NewVar.get());
12868 if (getSema().OpenACC().ActOnStartStmtDirective(
C->getDirectiveKind(),
12869 C->getBeginLoc(), {}))
12872 return getDerived().RebuildOpenACCCacheConstruct(
12873 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getLParenLoc(),
12874 C->getReadOnlyLoc(), TransformedVarList,
C->getRParenLoc(),
12878template <
typename Derived>
12880 OpenACCAtomicConstruct *
C) {
12881 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12884 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12887 if (getSema().OpenACC().ActOnStartStmtDirective(
C->getDirectiveKind(),
12888 C->getBeginLoc(), {}))
12893 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(), {}, {});
12895 StmtResult AssocStmt = getDerived().TransformStmt(
C->getAssociatedStmt());
12896 AssocStmt = getSema().OpenACC().ActOnAssociatedStmt(
12897 C->getBeginLoc(),
C->getDirectiveKind(),
C->getAtomicKind(), {},
12900 return getDerived().RebuildOpenACCAtomicConstruct(
12901 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getAtomicKind(),
12902 C->getEndLoc(), TransformedClauses, AssocStmt);
12905template <
typename Derived>
12908 if (getDerived().AlwaysRebuild())
12917template<
typename Derived>
12920 return TransformExpr(E->getSubExpr());
12923template <
typename Derived>
12926 if (!E->isTypeDependent())
12929 TypeSourceInfo *NewT = getDerived().TransformType(E->getTypeSourceInfo());
12934 if (!getDerived().AlwaysRebuild() && E->getTypeSourceInfo() == NewT)
12937 return getDerived().RebuildSYCLUniqueStableNameExpr(
12938 E->getLocation(), E->getLParenLocation(), E->getRParenLocation(), NewT);
12941template<
typename Derived>
12944 if (!E->isTypeDependent())
12948 E->getIdentKind());
12951template<
typename Derived>
12955 if (E->getQualifierLoc()) {
12957 = getDerived().TransformNestedNameSpecifierLoc(E->getQualifierLoc());
12963 = cast_or_null<ValueDecl>(getDerived().TransformDecl(E->getLocation(),
12965 if (!ND || ND->isInvalidDecl())
12969 if (E->getFoundDecl() != E->getDecl()) {
12970 Found = cast_or_null<NamedDecl>(
12971 getDerived().TransformDecl(E->getLocation(), E->getFoundDecl()));
12977 if (NameInfo.getName()) {
12978 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
12979 if (!NameInfo.getName())
12983 if (!getDerived().AlwaysRebuild() &&
12984 !E->isCapturedByCopyInLambdaWithExplicitObjectParameter() &&
12985 QualifierLoc == E->getQualifierLoc() && ND == E->getDecl() &&
12986 Found == E->getFoundDecl() &&
12987 NameInfo.getName() == E->getDecl()->getDeclName() &&
12988 !E->hasExplicitTemplateArgs()) {
12998 if (E->hasExplicitTemplateArgs()) {
12999 TemplateArgs = &TransArgs;
13000 TransArgs.setLAngleLoc(E->getLAngleLoc());
13001 TransArgs.setRAngleLoc(E->getRAngleLoc());
13002 if (getDerived().TransformTemplateArguments(E->getTemplateArgs(),
13003 E->getNumTemplateArgs(),
13008 return getDerived().RebuildDeclRefExpr(QualifierLoc, ND, NameInfo,
13009 Found, TemplateArgs);
13012template<
typename Derived>
13018template <
typename Derived>
13024template<
typename Derived>
13030template<
typename Derived>
13036template<
typename Derived>
13042template<
typename Derived>
13048template<
typename Derived>
13051 return getDerived().TransformCallExpr(E);
13054template<
typename Derived>
13059 if (E->isExprPredicate())
13060 ControllingExpr = getDerived().TransformExpr(E->getControllingExpr());
13062 ControllingType = getDerived().TransformType(E->getControllingType());
13064 if (ControllingExpr.isInvalid() && !ControllingType)
13075 AssocTypes.push_back(AssocType);
13077 AssocTypes.push_back(
nullptr);
13081 getDerived().TransformExpr(Assoc.getAssociationExpr());
13082 if (AssocExpr.isInvalid())
13084 AssocExprs.push_back(AssocExpr.get());
13087 if (!ControllingType)
13088 return getDerived().RebuildGenericSelectionExpr(E->getGenericLoc(),
13089 E->getDefaultLoc(),
13091 ControllingExpr.get(),
13094 return getDerived().RebuildGenericSelectionExpr(
13095 E->getGenericLoc(), E->getDefaultLoc(), E->getRParenLoc(),
13096 ControllingType, AssocTypes, AssocExprs);
13099template<
typename Derived>
13102 ExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
13103 if (SubExpr.isInvalid())
13106 if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getSubExpr())
13109 return getDerived().RebuildParenExpr(SubExpr.get(), E->getLParen(),
13116template<
typename Derived>
13120 return getDerived().TransformDependentScopeDeclRefExpr(
13121 DRE,
true,
nullptr);
13123 return getDerived().TransformUnresolvedLookupExpr(
13129template<
typename Derived>
13134 SubExpr = TransformAddressOfOperand(E->
getSubExpr());
13140 if (!getDerived().AlwaysRebuild() && SubExpr.
get() == E->
getSubExpr())
13148template<
typename Derived>
13150TreeTransform<Derived>::TransformOffsetOfExpr(OffsetOfExpr *E) {
13152 TypeSourceInfo *Type = getDerived().TransformType(E->getTypeSourceInfo());
13162 bool ExprChanged =
false;
13163 typedef Sema::OffsetOfComponent Component;
13165 for (
unsigned I = 0, N = E->getNumComponents(); I != N; ++I) {
13166 const OffsetOfNode &ON = E->getComponent(I);
13168 Comp.isBrackets =
true;
13169 Comp.LocStart = ON.getSourceRange().getBegin();
13170 Comp.LocEnd = ON.getSourceRange().getEnd();
13171 switch (ON.getKind()) {
13173 Expr *FromIndex = E->getIndexExpr(ON.getArrayExprIndex());
13174 ExprResult Index = getDerived().TransformExpr(FromIndex);
13175 if (Index.isInvalid())
13178 ExprChanged = ExprChanged || Index.get() != FromIndex;
13179 Comp.isBrackets =
true;
13180 Comp.U.E = Index.get();
13186 Comp.isBrackets =
false;
13187 Comp.U.IdentInfo = ON.getFieldName();
13188 if (!
Comp.U.IdentInfo)
13198 Components.push_back(Comp);
13202 if (!getDerived().AlwaysRebuild() &&
13203 Type == E->getTypeSourceInfo() &&
13208 return getDerived().RebuildOffsetOfExpr(E->getOperatorLoc(),
Type,
13209 Components, E->getRParenLoc());
13212template<
typename Derived>
13215 assert((!E->getSourceExpr() || getDerived().AlreadyTransformed(E->getType())) &&
13216 "opaque value expression requires transformation");
13220template <
typename Derived>
13224 for (
Expr *
C : E->subExpressions()) {
13226 if (NewC.isInvalid())
13232 if (!getDerived().AlwaysRebuild() && !Changed)
13234 return getDerived().RebuildRecoveryExpr(E->getBeginLoc(), E->getEndLoc(),
13238template<
typename Derived>
13248 ExprResult result = getDerived().TransformExpr(newSyntacticForm);
13249 if (result.isInvalid())
return ExprError();
13254 if (result.get()->hasPlaceholderType(BuiltinType::PseudoObject))
13260template<
typename Derived>
13264 if (E->isArgumentType()) {
13271 if (!getDerived().AlwaysRebuild() && OldT == NewT)
13274 return getDerived().RebuildUnaryExprOrTypeTrait(NewT, E->getOperatorLoc(),
13276 E->getSourceRange());
13290 auto *PE = dyn_cast<ParenExpr>(E->getArgumentExpr());
13292 PE ? dyn_cast<DependentScopeDeclRefExpr>(PE->getSubExpr()) :
nullptr)
13293 SubExpr = getDerived().TransformParenDependentScopeDeclRefExpr(
13294 PE, DRE,
false, &RecoveryTSI);
13296 SubExpr = getDerived().TransformExpr(E->getArgumentExpr());
13299 return getDerived().RebuildUnaryExprOrTypeTrait(
13300 RecoveryTSI, E->getOperatorLoc(), E->getKind(), E->getSourceRange());
13301 }
else if (SubExpr.isInvalid())
13304 if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getArgumentExpr())
13307 return getDerived().RebuildUnaryExprOrTypeTrait(SubExpr.get(),
13308 E->getOperatorLoc(),
13310 E->getSourceRange());
13313template<
typename Derived>
13316 ExprResult LHS = getDerived().TransformExpr(E->getLHS());
13317 if (LHS.isInvalid())
13320 ExprResult RHS = getDerived().TransformExpr(E->getRHS());
13321 if (RHS.isInvalid())
13325 if (!getDerived().AlwaysRebuild() &&
13326 LHS.get() == E->getLHS() &&
13327 RHS.get() == E->getRHS())
13330 return getDerived().RebuildArraySubscriptExpr(
13332 E->getLHS()->getBeginLoc(), RHS.get(), E->getRBracketLoc());
13335template <
typename Derived>
13339 if (
Base.isInvalid())
13342 ExprResult RowIdx = getDerived().TransformExpr(E->getRowIdx());
13343 if (RowIdx.isInvalid())
13346 ExprResult ColumnIdx = getDerived().TransformExpr(E->getColumnIdx());
13347 if (ColumnIdx.isInvalid())
13350 if (!getDerived().AlwaysRebuild() &&
Base.get() == E->getBase() &&
13351 RowIdx.get() == E->getRowIdx() && ColumnIdx.get() == E->getColumnIdx())
13354 return getDerived().RebuildMatrixSubscriptExpr(
13355 Base.get(), RowIdx.get(), ColumnIdx.get(), E->getRBracketLoc());
13358template <
typename Derived>
13362 if (
Base.isInvalid())
13366 if (E->getLowerBound()) {
13367 LowerBound = getDerived().TransformExpr(E->getLowerBound());
13368 if (LowerBound.isInvalid())
13373 if (E->getLength()) {
13374 Length = getDerived().TransformExpr(E->getLength());
13375 if (Length.isInvalid())
13380 if (E->isOMPArraySection()) {
13381 if (
Expr *Str = E->getStride()) {
13382 Stride = getDerived().TransformExpr(Str);
13383 if (Stride.isInvalid())
13388 if (!getDerived().AlwaysRebuild() &&
Base.get() == E->getBase() &&
13389 LowerBound.get() == E->getLowerBound() &&
13390 Length.get() == E->getLength() &&
13391 (E->isOpenACCArraySection() || Stride.get() == E->getStride()))
13394 return getDerived().RebuildArraySectionExpr(
13395 E->isOMPArraySection(),
Base.get(), E->getBase()->getEndLoc(),
13396 LowerBound.get(), E->getColonLocFirst(),
13397 E->isOMPArraySection() ? E->getColonLocSecond() :
SourceLocation{},
13398 Length.get(), Stride.get(), E->getRBracketLoc());
13401template <
typename Derived>
13405 if (
Base.isInvalid())
13409 bool ErrorFound =
false;
13410 for (
Expr *
Dim : E->getDimensions()) {
13412 if (DimRes.isInvalid()) {
13416 Dims.push_back(DimRes.get());
13421 return getDerived().RebuildOMPArrayShapingExpr(
Base.get(), E->getLParenLoc(),
13422 E->getRParenLoc(), Dims,
13423 E->getBracketsRanges());
13426template <
typename Derived>
13429 unsigned NumIterators = E->numOfIterators();
13432 bool ErrorFound =
false;
13433 bool NeedToRebuild = getDerived().AlwaysRebuild();
13434 for (
unsigned I = 0; I < NumIterators; ++I) {
13436 Data[I].DeclIdent = D->getIdentifier();
13437 Data[I].DeclIdentLoc = D->getLocation();
13438 if (D->getLocation() == D->getBeginLoc()) {
13440 "Implicit type must be int.");
13442 TypeSourceInfo *TSI = getDerived().TransformType(D->getTypeSourceInfo());
13450 ErrorFound = ErrorFound ||
13451 !(!D->getTypeSourceInfo() || (
Data[I].
Type.getAsOpaquePtr() &&
13452 !
Data[I].Type.get().isNull())) ||
13453 Begin.isInvalid() || End.isInvalid() || Step.isInvalid();
13456 Data[I].Range.Begin = Begin.get();
13457 Data[I].Range.End = End.get();
13458 Data[I].Range.Step = Step.get();
13459 Data[I].AssignLoc = E->getAssignLoc(I);
13460 Data[I].ColonLoc = E->getColonLoc(I);
13461 Data[I].SecColonLoc = E->getSecondColonLoc(I);
13464 (D->getTypeSourceInfo() &&
Data[I].
Type.get().getTypePtrOrNull() !=
13465 D->getType().getTypePtrOrNull()) ||
13471 if (!NeedToRebuild)
13474 ExprResult Res = getDerived().RebuildOMPIteratorExpr(
13475 E->getIteratorKwLoc(), E->getLParenLoc(), E->getRParenLoc(),
Data);
13476 if (!Res.isUsable())
13479 for (
unsigned I = 0; I < NumIterators; ++I)
13480 getDerived().transformedLocalDecl(E->getIteratorDecl(I),
13481 IE->getIteratorDecl(I));
13485template<
typename Derived>
13494 bool ArgChanged =
false;
13496 if (getDerived().TransformExprs(E->getArgs(), E->getNumArgs(),
true, Args,
13500 if (!getDerived().AlwaysRebuild() &&
13501 Callee.get() == E->getCallee() &&
13507 = ((
Expr *)
Callee.get())->getSourceRange().getBegin();
13510 if (E->hasStoredFPFeatures()) {
13512 getSema().CurFPFeatures =
13514 getSema().FpPragmaStack.CurrentValue = NewOverrides;
13517 return getDerived().RebuildCallExpr(
Callee.get(), FakeLParenLoc,
13519 E->getRParenLoc());
13522template<
typename Derived>
13526 if (
Base.isInvalid())
13530 if (E->hasQualifier()) {
13532 = getDerived().TransformNestedNameSpecifierLoc(E->getQualifierLoc());
13540 = cast_or_null<ValueDecl>(getDerived().TransformDecl(E->getMemberLoc(),
13541 E->getMemberDecl()));
13545 NamedDecl *FoundDecl = E->getFoundDecl();
13546 if (FoundDecl == E->getMemberDecl()) {
13549 FoundDecl = cast_or_null<NamedDecl>(
13550 getDerived().TransformDecl(E->getMemberLoc(), FoundDecl));
13555 if (!getDerived().AlwaysRebuild() &&
13556 Base.get() == E->getBase() &&
13557 QualifierLoc == E->getQualifierLoc() &&
13558 Member == E->getMemberDecl() &&
13559 FoundDecl == E->getFoundDecl() &&
13560 !E->hasExplicitTemplateArgs()) {
13565 getSema().OpenMP().isOpenMPRebuildMemberExpr(
13575 if (E->hasExplicitTemplateArgs()) {
13576 TransArgs.setLAngleLoc(E->getLAngleLoc());
13577 TransArgs.setRAngleLoc(E->getRAngleLoc());
13578 if (getDerived().TransformTemplateArguments(E->getTemplateArgs(),
13579 E->getNumTemplateArgs(),
13592 NamedDecl *FirstQualifierInScope =
nullptr;
13594 if (MemberNameInfo.getName()) {
13595 MemberNameInfo = getDerived().TransformDeclarationNameInfo(MemberNameInfo);
13596 if (!MemberNameInfo.getName())
13600 return getDerived().RebuildMemberExpr(
Base.get(), FakeOperatorLoc,
13607 (E->hasExplicitTemplateArgs()
13608 ? &TransArgs :
nullptr),
13609 FirstQualifierInScope);
13612template<
typename Derived>
13615 ExprResult LHS = getDerived().TransformExpr(E->getLHS());
13616 if (LHS.isInvalid())
13620 getDerived().TransformInitializer(E->getRHS(),
false);
13621 if (RHS.isInvalid())
13624 if (!getDerived().AlwaysRebuild() &&
13625 LHS.get() == E->getLHS() &&
13626 RHS.get() == E->getRHS())
13629 if (E->isCompoundAssignmentOp())
13631 return getDerived().RebuildBinaryOperator(
13632 E->getOperatorLoc(), E->getOpcode(), LHS.get(), RHS.get());
13635 getSema().CurFPFeatures =
13636 NewOverrides.applyOverrides(getSema().getLangOpts());
13637 getSema().FpPragmaStack.CurrentValue = NewOverrides;
13638 return getDerived().RebuildBinaryOperator(E->getOperatorLoc(), E->getOpcode(),
13639 LHS.get(), RHS.get());
13642template <
typename Derived>
13647 ExprResult LHS = getDerived().TransformExpr(
const_cast<Expr*
>(Decomp.LHS));
13648 if (LHS.isInvalid())
13651 ExprResult RHS = getDerived().TransformExpr(
const_cast<Expr*
>(Decomp.RHS));
13652 if (RHS.isInvalid())
13658 bool ChangedAnyLookups =
false;
13659 Expr *PossibleBinOps[] = {E->getSemanticForm(),
13660 const_cast<Expr *
>(Decomp.InnerBinOp)};
13661 for (
Expr *PossibleBinOp : PossibleBinOps) {
13662 auto *Op = dyn_cast<CXXOperatorCallExpr>(PossibleBinOp->IgnoreImplicit());
13665 auto *
Callee = dyn_cast<DeclRefExpr>(Op->getCallee()->IgnoreImplicit());
13671 NamedDecl *
Found = cast_or_null<NamedDecl>(getDerived().TransformDecl(
13672 E->getOperatorLoc(),
Callee->getFoundDecl()));
13676 ChangedAnyLookups =
true;
13677 UnqualLookups.addDecl(
Found);
13680 if (!getDerived().AlwaysRebuild() && !ChangedAnyLookups &&
13681 LHS.get() == Decomp.LHS && RHS.get() == Decomp.RHS) {
13687 const Expr *StopAt[] = {Decomp.LHS, Decomp.RHS};
13692 return getDerived().RebuildCXXRewrittenBinaryOperator(
13693 E->getOperatorLoc(), Decomp.Opcode, UnqualLookups, LHS.get(), RHS.get());
13696template<
typename Derived>
13702 getSema().CurFPFeatures =
13703 NewOverrides.applyOverrides(getSema().getLangOpts());
13704 getSema().FpPragmaStack.CurrentValue = NewOverrides;
13705 return getDerived().TransformBinaryOperator(E);
13708template<
typename Derived>
13714 ExprResult commonExpr = getDerived().TransformExpr(e->getCommon());
13715 if (commonExpr.isInvalid())
13718 ExprResult rhs = getDerived().TransformExpr(e->getFalseExpr());
13719 if (rhs.isInvalid())
13722 if (!getDerived().AlwaysRebuild() &&
13723 commonExpr.get() == e->getCommon() &&
13724 rhs.get() == e->getFalseExpr())
13727 return getDerived().RebuildConditionalOperator(commonExpr.get(),
13728 e->getQuestionLoc(),
13734template<
typename Derived>
13738 if (
Cond.isInvalid())
13741 ExprResult LHS = getDerived().TransformExpr(E->getLHS());
13742 if (LHS.isInvalid())
13745 ExprResult RHS = getDerived().TransformExpr(E->getRHS());
13746 if (RHS.isInvalid())
13749 if (!getDerived().AlwaysRebuild() &&
13750 Cond.get() == E->getCond() &&
13751 LHS.get() == E->getLHS() &&
13752 RHS.get() == E->getRHS())
13755 return getDerived().RebuildConditionalOperator(
Cond.get(),
13756 E->getQuestionLoc(),
13762template<
typename Derived>
13767 return getDerived().
TransformExpr(E->getSubExprAsWritten());
13770template<
typename Derived>
13778 = getDerived().TransformExpr(E->getSubExprAsWritten());
13779 if (SubExpr.isInvalid())
13782 if (!getDerived().AlwaysRebuild() &&
13783 Type == E->getTypeInfoAsWritten() &&
13784 SubExpr.get() == E->getSubExpr())
13787 return getDerived().RebuildCStyleCastExpr(E->getLParenLoc(),
13793template<
typename Derived>
13801 ExprResult Init = getDerived().TransformExpr(E->getInitializer());
13802 if (
Init.isInvalid())
13805 if (!getDerived().AlwaysRebuild() &&
13807 Init.get() == E->getInitializer())
13814 return getDerived().RebuildCompoundLiteralExpr(
13815 E->getLParenLoc(), NewT,
13816 E->getInitializer()->getEndLoc(),
Init.get());
13819template<
typename Derived>
13823 if (
Base.isInvalid())
13826 if (!getDerived().AlwaysRebuild() &&
13827 Base.get() == E->getBase())
13833 return getDerived().RebuildExtVectorElementExpr(
13834 Base.get(), FakeOperatorLoc, E->isArrow(), E->getAccessorLoc(),
13838template<
typename Derived>
13844 bool InitChanged =
false;
13850 if (getDerived().TransformExprs(E->getInits(), E->getNumInits(),
false,
13851 Inits, &InitChanged))
13854 if (!getDerived().AlwaysRebuild() && !InitChanged) {
13861 return getDerived().RebuildInitList(E->getLBraceLoc(), Inits,
13862 E->getRBraceLoc());
13865template<
typename Derived>
13872 if (
Init.isInvalid())
13877 bool ExprChanged =
false;
13879 if (D.isFieldDesignator()) {
13880 if (D.getFieldDecl()) {
13882 getDerived().TransformDecl(D.getFieldLoc(), D.getFieldDecl()));
13883 if (Field != D.getFieldDecl())
13886 ExprChanged =
true;
13887 if (
Field->isAnonymousStructOrUnion())
13893 ExprChanged =
true;
13896 D.getFieldName(), D.getDotLoc(), D.getFieldLoc()));
13900 if (D.isArrayDesignator()) {
13901 ExprResult Index = getDerived().TransformExpr(E->getArrayIndex(D));
13902 if (Index.isInvalid())
13905 Desig.AddDesignator(
13908 ExprChanged = ExprChanged || Index.get() != E->getArrayIndex(D);
13909 ArrayExprs.push_back(Index.get());
13913 assert(D.isArrayRangeDesignator() &&
"New kind of designator?");
13915 = getDerived().TransformExpr(E->getArrayRangeStart(D));
13916 if (Start.isInvalid())
13919 ExprResult End = getDerived().TransformExpr(E->getArrayRangeEnd(D));
13920 if (End.isInvalid())
13924 Start.get(), End.get(), D.getLBracketLoc(), D.getEllipsisLoc()));
13926 ExprChanged = ExprChanged || Start.get() != E->getArrayRangeStart(D) ||
13927 End.get() != E->getArrayRangeEnd(D);
13929 ArrayExprs.push_back(Start.get());
13930 ArrayExprs.push_back(End.get());
13933 if (!getDerived().AlwaysRebuild() &&
13934 Init.get() == E->getInit() &&
13938 return getDerived().RebuildDesignatedInitExpr(Desig, ArrayExprs,
13939 E->getEqualOrColonLoc(),
13940 E->usesGNUSyntax(),
Init.get());
13945template<
typename Derived>
13949 llvm_unreachable(
"Unexpected DesignatedInitUpdateExpr in syntactic form of "
13954template<
typename Derived>
13958 llvm_unreachable(
"Unexpected NoInitExpr in syntactic form of initializer");
13962template<
typename Derived>
13965 llvm_unreachable(
"Unexpected ArrayInitLoopExpr outside of initializer");
13969template<
typename Derived>
13972 llvm_unreachable(
"Unexpected ArrayInitIndexExpr outside of initializer");
13976template<
typename Derived>
13984 QualType T = getDerived().TransformType(E->getType());
13988 if (!getDerived().AlwaysRebuild() &&
13992 return getDerived().RebuildImplicitValueInitExpr(
T);
13995template<
typename Derived>
13998 TypeSourceInfo *TInfo = getDerived().TransformType(E->getWrittenTypeInfo());
14002 ExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
14003 if (SubExpr.isInvalid())
14006 if (!getDerived().AlwaysRebuild() &&
14007 TInfo == E->getWrittenTypeInfo() &&
14008 SubExpr.get() == E->getSubExpr())
14011 return getDerived().RebuildVAArgExpr(E->getBuiltinLoc(), SubExpr.get(),
14012 TInfo, E->getRParenLoc());
14015template<
typename Derived>
14018 bool ArgumentChanged =
false;
14020 if (TransformExprs(E->getExprs(), E->getNumExprs(),
true, Inits,
14024 return getDerived().RebuildParenListExpr(E->getLParenLoc(),
14026 E->getRParenLoc());
14034template<
typename Derived>
14037 Decl *LD = getDerived().TransformDecl(E->getLabel()->getLocation(),
14042 return getDerived().RebuildAddrLabelExpr(E->getAmpAmpLoc(), E->getLabelLoc(),
14046template<
typename Derived>
14051 = getDerived().TransformCompoundStmt(E->getSubStmt(),
true);
14052 if (SubStmt.isInvalid()) {
14057 unsigned OldDepth = E->getTemplateDepth();
14058 unsigned NewDepth = getDerived().TransformTemplateDepth(OldDepth);
14060 if (!getDerived().AlwaysRebuild() && OldDepth == NewDepth &&
14061 SubStmt.get() == E->getSubStmt()) {
14067 return getDerived().RebuildStmtExpr(E->getLParenLoc(), SubStmt.get(),
14068 E->getRParenLoc(), NewDepth);
14071template<
typename Derived>
14075 if (
Cond.isInvalid())
14078 ExprResult LHS = getDerived().TransformExpr(E->getLHS());
14079 if (LHS.isInvalid())
14082 ExprResult RHS = getDerived().TransformExpr(E->getRHS());
14083 if (RHS.isInvalid())
14086 if (!getDerived().AlwaysRebuild() &&
14087 Cond.get() == E->getCond() &&
14088 LHS.get() == E->getLHS() &&
14089 RHS.get() == E->getRHS())
14092 return getDerived().RebuildChooseExpr(E->getBuiltinLoc(),
14093 Cond.get(), LHS.get(), RHS.get(),
14094 E->getRParenLoc());
14097template<
typename Derived>
14103template<
typename Derived>
14106 switch (E->getOperator()) {
14110 case OO_Array_Delete:
14111 llvm_unreachable(
"new and delete operators cannot use CXXOperatorCallExpr");
14116 assert(E->getNumArgs() >= 1 &&
"Object call is missing arguments");
14129 if (FakeLParenLoc.isInvalid() && EndLoc.isValid())
14130 FakeLParenLoc = EndLoc;
14134 if (getDerived().TransformExprs(E->getArgs() + 1, E->getNumArgs() - 1,
true,
14138 if (E->getOperator() == OO_Subscript)
14139 return getDerived().RebuildCxxSubscriptExpr(
Object.get(), FakeLParenLoc,
14140 Args, E->getEndLoc());
14142 return getDerived().RebuildCallExpr(
Object.get(), FakeLParenLoc, Args,
14146#define OVERLOADED_OPERATOR(Name, Spelling, Token, Unary, Binary, MemberOnly) \
14150#define OVERLOADED_OPERATOR_MULTI(Name,Spelling,Unary,Binary,MemberOnly)
14151#include "clang/Basic/OperatorKinds.def"
14153 case OO_Conditional:
14154 llvm_unreachable(
"conditional operator is not actually overloadable");
14158 llvm_unreachable(
"not an overloaded operator?");
14162 if (E->getNumArgs() == 1 && E->getOperator() == OO_Amp)
14163 First = getDerived().TransformAddressOfOperand(E->getArg(0));
14165 First = getDerived().TransformExpr(E->getArg(0));
14166 if (
First.isInvalid())
14170 if (E->getNumArgs() == 2) {
14172 getDerived().TransformInitializer(E->getArg(1),
false);
14173 if (Second.isInvalid())
14179 getSema().CurFPFeatures =
14180 NewOverrides.applyOverrides(getSema().getLangOpts());
14181 getSema().FpPragmaStack.CurrentValue = NewOverrides;
14185 LookupResult R(SemaRef, ULE->getName(), ULE->getNameLoc(),
14187 if (getDerived().TransformOverloadExprDecls(ULE, ULE->requiresADL(), R))
14190 return getDerived().RebuildCXXOperatorCallExpr(
14191 E->getOperator(), E->getOperatorLoc(),
Callee->getBeginLoc(),
14192 ULE->requiresADL(), R.asUnresolvedSet(),
First.get(), Second.get());
14197 Callee = ICE->getSubExprAsWritten();
14199 ValueDecl *VD = cast_or_null<ValueDecl>(
14200 getDerived().TransformDecl(DR->getLocation(), DR));
14205 Functions.addDecl(VD);
14207 return getDerived().RebuildCXXOperatorCallExpr(
14208 E->getOperator(), E->getOperatorLoc(),
Callee->getBeginLoc(),
14209 false, Functions,
First.get(), Second.get());
14212template<
typename Derived>
14215 return getDerived().TransformCallExpr(E);
14218template <
typename Derived>
14221 getSema().CurContext != E->getParentContext();
14223 if (!getDerived().AlwaysRebuild() && !NeedRebuildFunc)
14226 return getDerived().RebuildSourceLocExpr(E->getIdentKind(), E->getType(),
14227 E->getBeginLoc(), E->getEndLoc(),
14228 getSema().CurContext);
14231template <
typename Derived>
14236template<
typename Derived>
14245 ExprResult EC = getDerived().TransformCallExpr(E->getConfig());
14246 if (EC.isInvalid())
14250 bool ArgChanged =
false;
14252 if (getDerived().TransformExprs(E->getArgs(), E->getNumArgs(),
true, Args,
14256 if (!getDerived().AlwaysRebuild() &&
14257 Callee.get() == E->getCallee() &&
14263 = ((
Expr *)
Callee.get())->getSourceRange().getBegin();
14264 return getDerived().RebuildCallExpr(
Callee.get(), FakeLParenLoc,
14266 E->getRParenLoc(), EC.get());
14269template<
typename Derived>
14285 return getDerived().RebuildCXXNamedCastExpr(
14292template<
typename Derived>
14301 if (Sub.isInvalid())
14304 return getDerived().RebuildBuiltinBitCastExpr(BCE->
getBeginLoc(), TSI,
14308template<
typename Derived>
14310TreeTransform<Derived>::TransformCXXStaticCastExpr(CXXStaticCastExpr *E) {
14311 return getDerived().TransformCXXNamedCastExpr(E);
14314template<
typename Derived>
14320template<
typename Derived>
14327template<
typename Derived>
14333template<
typename Derived>
14339template<
typename Derived>
14344 getDerived().TransformTypeWithDeducedTST(E->getTypeInfoAsWritten());
14349 = getDerived().TransformExpr(E->getSubExprAsWritten());
14350 if (SubExpr.isInvalid())
14353 if (!getDerived().AlwaysRebuild() &&
14354 Type == E->getTypeInfoAsWritten() &&
14355 SubExpr.get() == E->getSubExpr())
14358 return getDerived().RebuildCXXFunctionalCastExpr(
Type,
14362 E->isListInitialization());
14365template<
typename Derived>
14368 if (E->isTypeOperand()) {
14370 = getDerived().TransformType(E->getTypeOperandSourceInfo());
14374 if (!getDerived().AlwaysRebuild() &&
14375 TInfo == E->getTypeOperandSourceInfo())
14378 return getDerived().RebuildCXXTypeidExpr(E->getType(), E->getBeginLoc(),
14379 TInfo, E->getEndLoc());
14385 Expr *Op = E->getExprOperand();
14387 if (E->isGLValue())
14388 if (
auto *RD = Op->getType()->getAsCXXRecordDecl();
14389 RD && RD->isPolymorphic())
14395 ExprResult SubExpr = getDerived().TransformExpr(Op);
14396 if (SubExpr.isInvalid())
14399 if (!getDerived().AlwaysRebuild() &&
14400 SubExpr.get() == E->getExprOperand())
14403 return getDerived().RebuildCXXTypeidExpr(E->getType(), E->getBeginLoc(),
14404 SubExpr.get(), E->getEndLoc());
14407template<
typename Derived>
14410 if (E->isTypeOperand()) {
14412 = getDerived().TransformType(E->getTypeOperandSourceInfo());
14416 if (!getDerived().AlwaysRebuild() &&
14417 TInfo == E->getTypeOperandSourceInfo())
14420 return getDerived().RebuildCXXUuidofExpr(E->getType(), E->getBeginLoc(),
14421 TInfo, E->getEndLoc());
14427 ExprResult SubExpr = getDerived().TransformExpr(E->getExprOperand());
14428 if (SubExpr.isInvalid())
14431 if (!getDerived().AlwaysRebuild() &&
14432 SubExpr.get() == E->getExprOperand())
14435 return getDerived().RebuildCXXUuidofExpr(E->getType(), E->getBeginLoc(),
14436 SubExpr.get(), E->getEndLoc());
14439template<
typename Derived>
14445template<
typename Derived>
14452template<
typename Derived>
14468 auto &S = getSema();
14469 if (E->isCapturedByCopyInLambdaWithExplicitObjectParameter())
14470 return S.getCurrentThisType();
14471 if (S.getCurLambda())
14472 return getDerived().TransformType(E->getType());
14473 return S.getCurrentThisType();
14476 if (!getDerived().AlwaysRebuild() &&
T == E->getType() &&
14477 !E->isCapturedByCopyInLambdaWithExplicitObjectParameter()) {
14480 getSema().MarkThisReferenced(E);
14484 return getDerived().RebuildCXXThisExpr(E->getBeginLoc(),
T, E->isImplicit());
14487template<
typename Derived>
14490 ExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
14491 if (SubExpr.isInvalid())
14494 getSema().DiagnoseExceptionUse(E->getThrowLoc(),
false);
14496 if (!getDerived().AlwaysRebuild() &&
14497 SubExpr.get() == E->getSubExpr())
14500 return getDerived().RebuildCXXThrowExpr(E->getThrowLoc(), SubExpr.get(),
14501 E->isThrownVariableInScope());
14504template<
typename Derived>
14508 getDerived().TransformDecl(E->getBeginLoc(), E->getParam()));
14513 if (E->hasRewrittenInit()) {
14514 InitRes = getDerived().TransformExpr(E->getRewrittenExpr());
14515 if (InitRes.isInvalid())
14519 if (!getDerived().AlwaysRebuild() && Param == E->getParam() &&
14520 E->getUsedContext() == SemaRef.
CurContext &&
14521 InitRes.get() == E->getRewrittenExpr())
14524 return getDerived().RebuildCXXDefaultArgExpr(E->getUsedLocation(), Param,
14528template<
typename Derived>
14532 getDerived().TransformDecl(E->getBeginLoc(), E->getField()));
14536 if (!getDerived().AlwaysRebuild() && Field == E->getField() &&
14540 return getDerived().RebuildCXXDefaultInitExpr(E->getExprLoc(), Field);
14543template<
typename Derived>
14547 TypeSourceInfo *
T = getDerived().TransformType(E->getTypeSourceInfo());
14551 if (!getDerived().AlwaysRebuild() &&
14552 T == E->getTypeSourceInfo())
14555 return getDerived().RebuildCXXScalarValueInitExpr(
T,
14556 T->getTypeLoc().getEndLoc(),
14557 E->getRParenLoc());
14560template<
typename Derived>
14565 getDerived().TransformTypeWithDeducedTST(E->getAllocatedTypeSourceInfo());
14566 if (!AllocTypeInfo)
14570 std::optional<Expr *> ArraySize;
14571 if (E->isArray()) {
14573 if (std::optional<Expr *> OldArraySize = E->getArraySize()) {
14574 NewArraySize = getDerived().TransformExpr(*OldArraySize);
14575 if (NewArraySize.isInvalid())
14578 ArraySize = NewArraySize.get();
14582 bool ArgumentChanged =
false;
14584 if (getDerived().TransformExprs(E->getPlacementArgs(),
14585 E->getNumPlacementArgs(),
true,
14586 PlacementArgs, &ArgumentChanged))
14590 Expr *OldInit = E->getInitializer();
14593 NewInit = getDerived().TransformInitializer(OldInit,
true);
14594 if (NewInit.isInvalid())
14599 if (E->getOperatorNew()) {
14600 OperatorNew = cast_or_null<FunctionDecl>(
14601 getDerived().TransformDecl(E->getBeginLoc(), E->getOperatorNew()));
14607 if (E->getOperatorDelete()) {
14608 OperatorDelete = cast_or_null<FunctionDecl>(
14609 getDerived().TransformDecl(E->getBeginLoc(), E->getOperatorDelete()));
14610 if (!OperatorDelete)
14614 if (!getDerived().AlwaysRebuild() &&
14615 AllocTypeInfo == E->getAllocatedTypeSourceInfo() &&
14616 ArraySize == E->getArraySize() &&
14617 NewInit.get() == OldInit &&
14618 OperatorNew == E->getOperatorNew() &&
14619 OperatorDelete == E->getOperatorDelete() &&
14620 !ArgumentChanged) {
14625 if (OperatorDelete)
14628 if (E->isArray() && !E->getAllocatedType()->isDependentType()) {
14640 QualType AllocType = AllocTypeInfo->getType();
14651 = dyn_cast<ConstantArrayType>(ArrayT)) {
14655 AllocType = ConsArrayT->getElementType();
14657 = dyn_cast<DependentSizedArrayType>(ArrayT)) {
14658 if (DepArrayT->getSizeExpr()) {
14659 ArraySize = DepArrayT->getSizeExpr();
14660 AllocType = DepArrayT->getElementType();
14665 return getDerived().RebuildCXXNewExpr(
14666 E->getBeginLoc(), E->isGlobalNew(),
14667 E->getBeginLoc(), PlacementArgs,
14668 E->getBeginLoc(), E->getTypeIdParens(), AllocType,
14669 AllocTypeInfo, ArraySize, E->getDirectInitRange(), NewInit.get());
14672template<
typename Derived>
14681 if (E->getOperatorDelete()) {
14682 OperatorDelete = cast_or_null<FunctionDecl>(
14683 getDerived().TransformDecl(E->getBeginLoc(), E->getOperatorDelete()));
14684 if (!OperatorDelete)
14688 if (!getDerived().AlwaysRebuild() &&
14689 Operand.get() == E->getArgument() &&
14690 OperatorDelete == E->getOperatorDelete()) {
14693 if (OperatorDelete)
14696 if (!E->getArgument()->isTypeDependent()) {
14698 E->getDestroyedType());
14699 if (
auto *
Record = Destroyed->getAsCXXRecordDecl())
14707 return getDerived().RebuildCXXDeleteExpr(
14708 E->getBeginLoc(), E->isGlobalDelete(), E->isArrayForm(),
Operand.get());
14711template<
typename Derived>
14716 if (
Base.isInvalid())
14720 bool MayBePseudoDestructor =
false;
14722 E->getOperatorLoc(),
14723 E->isArrow()? tok::arrow : tok::period,
14725 MayBePseudoDestructor);
14726 if (
Base.isInvalid())
14729 QualType ObjectType = ObjectTypePtr.get();
14731 if (QualifierLoc) {
14733 = getDerived().TransformNestedNameSpecifierLoc(QualifierLoc, ObjectType);
14738 SS.
Adopt(QualifierLoc);
14741 if (E->getDestroyedTypeInfo()) {
14742 TypeSourceInfo *DestroyedTypeInfo = getDerived().TransformTypeInObjectScope(
14743 E->getDestroyedTypeInfo(), ObjectType,
14745 if (!DestroyedTypeInfo)
14747 Destroyed = DestroyedTypeInfo;
14748 }
else if (!ObjectType.isNull() && ObjectType->isDependentType()) {
14752 E->getDestroyedTypeLoc());
14756 *E->getDestroyedTypeIdentifier(), E->getDestroyedTypeLoc(),
14757 nullptr, SS, ObjectTypePtr,
false);
14763 E->getDestroyedTypeLoc());
14767 if (E->getScopeTypeInfo()) {
14768 ScopeTypeInfo = getDerived().TransformTypeInObjectScope(
14769 E->getScopeTypeInfo(), ObjectType,
nullptr);
14770 if (!ScopeTypeInfo)
14774 return getDerived().RebuildCXXPseudoDestructorExpr(
Base.get(),
14775 E->getOperatorLoc(),
14779 E->getColonColonLoc(),
14784template <
typename Derived>
14789 bool AllEmptyPacks =
true;
14790 for (
auto *OldD : Old->
decls()) {
14806 if (
auto *UPD = dyn_cast<UsingPackDecl>(InstD))
14807 Decls = UPD->expansions();
14810 for (
auto *D : Decls) {
14811 if (
auto *UD = dyn_cast<UsingDecl>(D)) {
14812 for (
auto *SD : UD->shadows())
14819 AllEmptyPacks &= Decls.empty();
14828 if (AllEmptyPacks && !RequiresADL) {
14840 getSema().FilterAcceptableTemplateNames(R,
14847 diag::err_template_kw_refers_to_non_template)
14851 diag::note_template_kw_refers_to_non_template)
14860template <
typename Derived>
14866template <
typename Derived>
14869 bool IsAddressOfOperand) {
14874 if (TransformOverloadExprDecls(Old, Old->
requiresADL(), R))
14881 = getDerived().TransformNestedNameSpecifierLoc(Old->
getQualifierLoc());
14885 SS.
Adopt(QualifierLoc);
14889 CXXRecordDecl *NamingClass
14890 = cast_or_null<CXXRecordDecl>(getDerived().TransformDecl(
14893 if (!NamingClass) {
14898 R.setNamingClass(NamingClass);
14919 SS, TemplateKWLoc, R,
14926 return getDerived().RebuildDeclarationNameExpr(SS, R, Old->
requiresADL());
14929 return getDerived().RebuildTemplateIdExpr(SS, TemplateKWLoc, R,
14933template<
typename Derived>
14936 bool ArgChanged =
false;
14938 for (
unsigned I = 0, N = E->getNumArgs(); I != N; ++I) {
14940 TypeLoc FromTL = From->getTypeLoc();
14943 TLB.
reserve(FromTL.getFullDataSize());
14944 QualType To = getDerived().TransformType(TLB, FromTL);
14948 if (To == From->getType())
14949 Args.push_back(From);
14951 Args.push_back(TLB.getTypeSourceInfo(SemaRef.
Context, To));
14961 TypeLoc PatternTL = ExpansionTL.getPatternLoc();
14967 bool Expand =
true;
14968 bool RetainExpansion =
false;
14970 ExpansionTL.getTypePtr()->getNumExpansions();
14972 if (getDerived().TryExpandParameterPacks(
14973 ExpansionTL.getEllipsisLoc(), PatternTL.getSourceRange(),
14974 Unexpanded,
true, Expand,
14975 RetainExpansion, NumExpansions))
14985 TLB.
reserve(From->getTypeLoc().getFullDataSize());
14987 QualType To = getDerived().TransformType(TLB, PatternTL);
14991 To = getDerived().RebuildPackExpansionType(To,
14992 PatternTL.getSourceRange(),
14993 ExpansionTL.getEllipsisLoc(),
15001 Args.push_back(TLB.getTypeSourceInfo(SemaRef.
Context, To));
15007 for (
unsigned I = 0; I != *NumExpansions; ++I) {
15010 TLB.
reserve(PatternTL.getFullDataSize());
15011 QualType To = getDerived().TransformType(TLB, PatternTL);
15015 if (To->containsUnexpandedParameterPack()) {
15016 To = getDerived().RebuildPackExpansionType(To,
15017 PatternTL.getSourceRange(),
15018 ExpansionTL.getEllipsisLoc(),
15028 Args.push_back(TLB.getTypeSourceInfo(SemaRef.
Context, To));
15031 if (!RetainExpansion)
15036 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
15039 TLB.
reserve(From->getTypeLoc().getFullDataSize());
15041 QualType To = getDerived().TransformType(TLB, PatternTL);
15045 To = getDerived().RebuildPackExpansionType(To,
15046 PatternTL.getSourceRange(),
15047 ExpansionTL.getEllipsisLoc(),
15055 Args.push_back(TLB.getTypeSourceInfo(SemaRef.
Context, To));
15058 if (!getDerived().AlwaysRebuild() && !ArgChanged)
15061 return getDerived().RebuildTypeTrait(E->getTrait(), E->getBeginLoc(), Args,
15065template<
typename Derived>
15071 if (getDerived().TransformTemplateArguments(Old->getTemplateArgs(),
15072 Old->NumTemplateArgs, TransArgs))
15075 return getDerived().RebuildConceptSpecializationExpr(
15076 E->getNestedNameSpecifierLoc(), E->getTemplateKWLoc(),
15077 E->getConceptNameInfo(), E->getFoundDecl(), E->getNamedConcept(),
15081template<
typename Derived>
15095 getSema().Context, getSema().CurContext,
15096 E->getBody()->getBeginLoc());
15100 ExprResult TypeParamResult = getDerived().TransformRequiresTypeParams(
15101 E->getRequiresKWLoc(), E->getRBraceLoc(), E, Body,
15102 E->getLocalParameters(), TransParamTypes, TransParams, ExtParamInfos);
15106 Param->setDeclContext(Body);
15112 if (!TypeParamResult.isUnset())
15113 return TypeParamResult;
15116 if (getDerived().TransformRequiresExprRequirements(E->getRequirements(),
15121 if (
auto *ER = dyn_cast<concepts::ExprRequirement>(Req)) {
15122 if (ER->getReturnTypeRequirement().isTypeConstraint()) {
15123 ER->getReturnTypeRequirement()
15124 .getTypeConstraintTemplateParameterList()->getParam(0)
15125 ->setDeclContext(Body);
15130 return getDerived().RebuildRequiresExpr(
15131 E->getRequiresKWLoc(), Body, E->getLParenLoc(), TransParams,
15132 E->getRParenLoc(), TransReqs, E->getRBraceLoc());
15135template<
typename Derived>
15141 if (
auto *TypeReq = dyn_cast<concepts::TypeRequirement>(Req))
15142 TransReq =
getDerived().TransformTypeRequirement(TypeReq);
15143 else if (
auto *ExprReq = dyn_cast<concepts::ExprRequirement>(Req))
15144 TransReq =
getDerived().TransformExprRequirement(ExprReq);
15146 TransReq =
getDerived().TransformNestedRequirement(
15150 Transformed.push_back(TransReq);
15155template<
typename Derived>
15168 return getDerived().RebuildTypeRequirement(TransType);
15171template<
typename Derived>
15174 llvm::PointerUnion<Expr *, concepts::Requirement::SubstitutionDiagnostic *> TransExpr;
15180 TransExprRes =
SemaRef.CheckPlaceholderExpr(TransExprRes.
get());
15183 TransExpr = TransExprRes.
get();
15186 std::optional<concepts::ExprRequirement::ReturnTypeRequirement> TransRetReq;
15188 if (RetReq.isEmpty())
15189 TransRetReq.emplace();
15190 else if (RetReq.isSubstitutionFailure())
15191 TransRetReq.emplace(RetReq.getSubstitutionDiagnostic());
15192 else if (RetReq.isTypeConstraint()) {
15194 RetReq.getTypeConstraintTemplateParameterList();
15196 getDerived().TransformTemplateParameterList(OrigTPL);
15199 TransRetReq.emplace(TPL);
15201 assert(TransRetReq &&
"All code paths leading here must set TransRetReq");
15202 if (
Expr *E = dyn_cast<Expr *>(TransExpr))
15205 std::move(*TransRetReq));
15211template<
typename Derived>
15217 return getDerived().RebuildNestedRequirement(
15225 return getDerived().RebuildNestedRequirement(TransConstraint.
get());
15228template<
typename Derived>
15235 if (!getDerived().AlwaysRebuild() &&
15252template<
typename Derived>
15259 SubExpr = getDerived().TransformExpr(E->getQueriedExpression());
15260 if (SubExpr.isInvalid())
15263 if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getQueriedExpression())
15267 return getDerived().RebuildExpressionTrait(E->getTrait(), E->getBeginLoc(),
15268 SubExpr.get(), E->getEndLoc());
15271template <
typename Derived>
15276 DRE, AddrTaken, RecoveryTSI);
15289template <
typename Derived>
15296template <
typename Derived>
15312 getDerived().TransformDeclarationNameInfo(E->
getNameInfo());
15317 if (!getDerived().AlwaysRebuild() && QualifierLoc == E->
getQualifierLoc() &&
15323 return getDerived().RebuildDependentScopeDeclRefExpr(
15324 QualifierLoc, TemplateKWLoc, NameInfo,
nullptr,
15325 IsAddressOfOperand, RecoveryTSI);
15329 if (getDerived().TransformTemplateArguments(
15333 return getDerived().RebuildDependentScopeDeclRefExpr(
15334 QualifierLoc, TemplateKWLoc, NameInfo, &TransArgs, IsAddressOfOperand,
15338template<
typename Derived>
15344 if (getDerived().AllowSkippingCXXConstructExpr() &&
15345 ((E->getNumArgs() == 1 ||
15346 (E->getNumArgs() > 1 && getDerived().DropCallArgument(E->getArg(1)))) &&
15347 (!getDerived().DropCallArgument(E->getArg(0))) &&
15348 !E->isListInitialization()))
15354 QualType T = getDerived().TransformType(E->getType());
15359 getDerived().TransformDecl(E->getBeginLoc(), E->getConstructor()));
15363 bool ArgumentChanged =
false;
15368 E->isListInitialization());
15369 if (getDerived().TransformExprs(E->getArgs(), E->getNumArgs(),
true, Args,
15374 if (!getDerived().AlwaysRebuild() &&
15375 T == E->getType() &&
15377 !ArgumentChanged) {
15384 return getDerived().RebuildCXXConstructExpr(
15385 T, E->getBeginLoc(),
Constructor, E->isElidable(), Args,
15386 E->hadMultipleCandidates(), E->isListInitialization(),
15387 E->isStdInitListInitialization(), E->requiresZeroInitialization(),
15388 E->getConstructionKind(), E->getParenOrBraceRange());
15391template<
typename Derived>
15394 QualType T = getDerived().TransformType(E->getType());
15399 getDerived().TransformDecl(E->getBeginLoc(), E->getConstructor()));
15403 if (!getDerived().AlwaysRebuild() &&
15404 T == E->getType() &&
15412 return getDerived().RebuildCXXInheritedCtorInitExpr(
15414 E->constructsVBase(), E->inheritedFromVBase());
15421template<
typename Derived>
15424 if (
auto *Dtor = E->getTemporary()->getDestructor())
15427 return getDerived().TransformExpr(E->getSubExpr());
15435template<
typename Derived>
15441template<
typename Derived>
15446 getDerived().TransformTypeWithDeducedTST(E->getTypeSourceInfo());
15451 getDerived().TransformDecl(E->getBeginLoc(), E->getConstructor()));
15455 bool ArgumentChanged =
false;
15457 Args.reserve(E->getNumArgs());
15461 E->isListInitialization());
15462 if (TransformExprs(E->getArgs(), E->getNumArgs(),
true, Args,
15466 if (E->isListInitialization() && !E->isStdInitListInitialization()) {
15467 ExprResult Res = RebuildInitList(E->getBeginLoc(), Args, E->getEndLoc());
15468 if (Res.isInvalid())
15470 Args = {Res.get()};
15474 if (!getDerived().AlwaysRebuild() &&
15475 T == E->getTypeSourceInfo() &&
15477 !ArgumentChanged) {
15484 return getDerived().RebuildCXXTemporaryObjectExpr(
15485 T, LParenLoc, Args, E->getEndLoc(), E->isListInitialization());
15488template<
typename Derived>
15493 typedef std::pair<ExprResult, QualType> InitCaptureInfoTy;
15494 struct TransformedInitCapture {
15496 SourceLocation EllipsisLoc;
15498 SmallVector<InitCaptureInfoTy, 4> Expansions;
15501 InitCaptures.resize(E->explicit_capture_end() - E->explicit_capture_begin());
15503 CEnd = E->capture_end();
15505 if (!E->isInitCapture(
C))
15508 TransformedInitCapture &
Result = InitCaptures[
C - E->capture_begin()];
15513 ExprResult NewExprInitResult = getDerived().TransformInitializer(
15516 if (NewExprInitResult.isInvalid()) {
15520 Expr *NewExprInit = NewExprInitResult.get();
15523 getSema().buildLambdaInitCaptureInitialization(
15524 C->getLocation(),
C->getCaptureKind() ==
LCK_ByRef,
15525 EllipsisLoc, NumExpansions, OldVD->getIdentifier(),
15529 Result.Expansions.push_back(
15530 InitCaptureInfoTy(NewExprInit, NewInitCaptureType));
15534 if (OldVD->isParameterPack()) {
15543 bool Expand =
true;
15544 bool RetainExpansion =
false;
15546 ExpansionTL.getTypePtr()->getNumExpansions();
15548 if (getDerived().TryExpandParameterPacks(
15549 ExpansionTL.getEllipsisLoc(), OldVD->getInit()->getSourceRange(),
15550 Unexpanded,
true, Expand,
15551 RetainExpansion, NumExpansions))
15553 assert(!RetainExpansion &&
"Should not need to retain expansion after a "
15554 "capture since it cannot be extended");
15556 for (
unsigned I = 0; I != *NumExpansions; ++I) {
15561 SubstInitCapture(ExpansionTL.getEllipsisLoc(), NumExpansions);
15562 Result.EllipsisLoc = ExpansionTL.getEllipsisLoc();
15599 while (DC->isRequiresExprBody())
15601 if ((getSema().isUnevaluatedContext() ||
15602 getSema().isConstantEvaluatedContext()) &&
15603 (DC->isFileContext() || !DC->getParent()->isDependentContext()))
15608 E->getIntroducerRange(),
nullptr, DependencyKind,
15609 E->getCaptureDefault());
15610 getDerived().transformedLocalDecl(OldClass, {
Class});
15613 getSema().CreateLambdaCallOperator(E->getIntroducerRange(),
Class);
15616 getSema().buildLambdaScope(LSI, NewCallOperator, E->getIntroducerRange(),
15617 E->getCaptureDefault(), E->getCaptureDefaultLoc(),
15618 E->hasExplicitParameters(), E->isMutable());
15628 CEnd = E->capture_end();
15632 if (
C->isImplicit())
15636 if (
C->capturesThis()) {
15644 dyn_cast_if_present<CXXRecordDecl>(
15645 getSema().getFunctionLevelDeclContext()),
15647 getSema().CheckCXXThisCapture(
C->getLocation(),
C->isExplicit(),
15654 if (
C->capturesVLAType())
15658 if (E->isInitCapture(
C)) {
15659 TransformedInitCapture &NewC = InitCaptures[
C - E->capture_begin()];
15664 for (InitCaptureInfoTy &Info : NewC.Expansions) {
15666 QualType InitQualType = Info.second;
15667 if (
Init.isInvalid() || InitQualType.isNull()) {
15671 VarDecl *NewVD = getSema().createLambdaInitCaptureVarDecl(
15672 OldVD->getLocation(), InitQualType, NewC.EllipsisLoc,
15673 OldVD->getIdentifier(), OldVD->getInitStyle(),
Init.get(),
15674 getSema().CurContext);
15679 NewVDs.push_back(NewVD);
15680 getSema().addInitCapture(LSI, NewVD,
C->getCaptureKind() ==
LCK_ByRef);
15685 if (NewC.EllipsisLoc.isInvalid())
15686 LSI->ContainsUnexpandedParameterPack |=
15687 Init.get()->containsUnexpandedParameterPack();
15693 getDerived().transformedLocalDecl(OldVD, NewVDs);
15697 assert(
C->capturesVariable() &&
"unexpected kind of lambda capture");
15705 if (
C->isPackExpansion()) {
15707 bool ShouldExpand =
false;
15708 bool RetainExpansion =
false;
15710 if (getDerived().TryExpandParameterPacks(
15711 C->getEllipsisLoc(),
C->getLocation(), Unexpanded,
15712 true, ShouldExpand,
15713 RetainExpansion, NumExpansions)) {
15718 if (ShouldExpand) {
15723 for (
unsigned I = 0; I != *NumExpansions; ++I) {
15725 ValueDecl *CapturedVar = cast_if_present<ValueDecl>(
15726 getDerived().TransformDecl(
C->getLocation(), Pack));
15727 if (!CapturedVar) {
15733 getSema().tryCaptureVariable(CapturedVar,
C->getLocation(), Kind);
15741 EllipsisLoc =
C->getEllipsisLoc();
15745 auto *CapturedVar = cast_or_null<ValueDecl>(
15746 getDerived().TransformDecl(
C->getLocation(),
C->getCapturedVar()));
15747 if (!CapturedVar || CapturedVar->isInvalidDecl()) {
15754 if (
auto *VD = dyn_cast<VarDecl>(CapturedVar); VD && !
C->isPackExpansion())
15755 LSI->ContainsUnexpandedParameterPack |= VD->isParameterPack();
15758 getSema().tryCaptureVariable(CapturedVar,
C->getLocation(), Kind,
15761 getSema().finishLambdaExplicitCaptures(LSI);
15765 auto TPL = getDerived().TransformTemplateParameterList(
15766 E->getTemplateParameterList());
15767 LSI->GLTemplateParameterList = TPL;
15769 getSema().AddTemplateParametersToLambdaCallOperator(NewCallOperator,
Class,
15771 LSI->ContainsUnexpandedParameterPack |=
15772 TPL->containsUnexpandedParameterPack();
15777 E->getCallOperator()->getTypeSourceInfo()->getTypeLoc();
15779 getDerived().TransformType(NewCallOpTLBuilder, OldCallOpTypeLoc);
15780 if (NewCallOpType.isNull())
15782 LSI->ContainsUnexpandedParameterPack |=
15783 NewCallOpType->containsUnexpandedParameterPack();
15785 NewCallOpTLBuilder.getTypeSourceInfo(getSema().Context, NewCallOpType);
15790 assert(FPTL &&
"Not a FunctionProtoType?");
15793 if (!TRC.ArgPackSubstIndex)
15796 getSema().CompleteLambdaCallOperator(
15797 NewCallOperator, E->getCallOperator()->getLocation(),
15798 E->getCallOperator()->getInnerLocStart(), TRC, NewCallOpTSI,
15799 E->getCallOperator()->getConstexprKind(),
15800 E->getCallOperator()->getStorageClass(), FPTL.getParams(),
15801 E->hasExplicitResultType());
15803 getDerived().transformAttrs(E->getCallOperator(), NewCallOperator);
15804 getDerived().transformedLocalDecl(E->getCallOperator(), {NewCallOperator});
15810 std::optional<CXXRecordDecl::LambdaNumbering> Numbering;
15811 if (getDerived().ReplacingOriginal()) {
15812 Numbering = OldClass->getLambdaNumbering();
15815 getSema().handleLambdaNumbering(
Class, NewCallOperator, Numbering);
15820 getSema().PushExpressionEvaluationContextForFunction(
15822 E->getCallOperator());
15826 C.PointOfInstantiation = E->getBody()->getBeginLoc();
15827 getSema().pushCodeSynthesisContext(
C);
15831 Invalid ?
StmtError() : getDerived().TransformLambdaBody(E, E->getBody());
15833 getSema().popCodeSynthesisContext();
15836 FuncScopeCleanup.disable();
15838 if (Body.isInvalid()) {
15839 SavedContext.pop();
15840 getSema().ActOnLambdaError(E->getBeginLoc(),
nullptr,
15845 getSema().ActOnFinishFunctionBody(NewCallOperator, Body.get(),
15848 SavedContext.pop();
15883 DependencyKind = getDerived().ComputeLambdaDependency(LSI);
15884 Class->setLambdaDependencyKind(DependencyKind);
15886 return getDerived().RebuildLambdaExpr(E->getBeginLoc(),
15887 Body.get()->getEndLoc(), LSI);
15890template<
typename Derived>
15896template<
typename Derived>
15905 if (!
C->isImplicit())
15909 if (
C->capturesThis()) {
15910 getSema().CheckCXXThisCapture(
C->getLocation(),
C->isExplicit(),
15917 if (
C->capturesVLAType())
15920 assert(
C->capturesVariable() &&
"unexpected kind of lambda capture");
15924 VarDecl *CapturedVar = cast_or_null<VarDecl>(
15930 getSema().tryCaptureVariable(CapturedVar,
C->getLocation());
15936template<
typename Derived>
15945 bool ArgumentChanged =
false;
15957 if (!getDerived().AlwaysRebuild() &&
15963 return getDerived().RebuildCXXUnresolvedConstructExpr(
15967template<
typename Derived>
15976 if (!E->isImplicitAccess()) {
15977 OldBase = E->getBase();
15978 Base = getDerived().TransformExpr(OldBase);
15979 if (
Base.isInvalid())
15984 bool MayBePseudoDestructor =
false;
15986 E->getOperatorLoc(),
15987 E->isArrow()? tok::arrow : tok::period,
15989 MayBePseudoDestructor);
15990 if (
Base.isInvalid())
15993 ObjectType = ObjectTy.get();
15994 BaseType = ((
Expr*)
Base.get())->getType();
15997 BaseType = getDerived().TransformType(E->getBaseType());
16004 = getDerived().TransformFirstQualifierInScope(
16005 E->getFirstQualifierFoundInScope(),
16006 E->getQualifierLoc().getBeginLoc());
16009 if (E->getQualifier()) {
16011 = getDerived().TransformNestedNameSpecifierLoc(E->getQualifierLoc(),
16013 FirstQualifierInScope);
16025 = getDerived().TransformDeclarationNameInfo(E->getMemberNameInfo());
16026 if (!NameInfo.getName())
16029 if (!E->hasExplicitTemplateArgs()) {
16032 if (!getDerived().AlwaysRebuild() &&
16033 Base.get() == OldBase &&
16034 BaseType == E->getBaseType() &&
16035 QualifierLoc == E->getQualifierLoc() &&
16036 NameInfo.getName() == E->getMember() &&
16037 FirstQualifierInScope == E->getFirstQualifierFoundInScope())
16040 return getDerived().RebuildCXXDependentScopeMemberExpr(
Base.get(),
16043 E->getOperatorLoc(),
16046 FirstQualifierInScope,
16052 if (getDerived().TransformTemplateArguments(E->getTemplateArgs(),
16053 E->getNumTemplateArgs(),
16057 return getDerived().RebuildCXXDependentScopeMemberExpr(
Base.get(),
16060 E->getOperatorLoc(),
16063 FirstQualifierInScope,
16068template <
typename Derived>
16074 if (!Old->isImplicitAccess()) {
16075 Base = getDerived().TransformExpr(Old->getBase());
16076 if (
Base.isInvalid())
16079 getSema().PerformMemberExprBaseConversion(
Base.get(), Old->isArrow());
16080 if (
Base.isInvalid())
16082 BaseType =
Base.get()->getType();
16084 BaseType = getDerived().TransformType(Old->getBaseType());
16088 if (Old->getQualifierLoc()) {
16090 getDerived().TransformNestedNameSpecifierLoc(Old->getQualifierLoc());
16100 if (TransformOverloadExprDecls(Old,
false, R))
16104 if (Old->getNamingClass()) {
16106 getDerived().TransformDecl(Old->getMemberLoc(), Old->getNamingClass()));
16110 R.setNamingClass(NamingClass);
16114 if (Old->hasExplicitTemplateArgs()) {
16115 TransArgs.setLAngleLoc(Old->getLAngleLoc());
16116 TransArgs.setRAngleLoc(Old->getRAngleLoc());
16117 if (getDerived().TransformTemplateArguments(
16118 Old->getTemplateArgs(), Old->getNumTemplateArgs(), TransArgs))
16126 NamedDecl *FirstQualifierInScope =
nullptr;
16128 return getDerived().RebuildUnresolvedMemberExpr(
16129 Base.get(), BaseType, Old->getOperatorLoc(), Old->isArrow(), QualifierLoc,
16130 TemplateKWLoc, FirstQualifierInScope, R,
16131 (Old->hasExplicitTemplateArgs() ? &TransArgs :
nullptr));
16134template<
typename Derived>
16139 ExprResult SubExpr = getDerived().TransformExpr(E->getOperand());
16140 if (SubExpr.isInvalid())
16143 if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getOperand())
16146 return getDerived().RebuildCXXNoexceptExpr(E->getSourceRange(),SubExpr.get());
16149template<
typename Derived>
16152 ExprResult Pattern = getDerived().TransformExpr(E->getPattern());
16153 if (Pattern.isInvalid())
16156 if (!getDerived().AlwaysRebuild() && Pattern.get() == E->getPattern())
16159 return getDerived().RebuildPackExpansion(Pattern.get(), E->getEllipsisLoc(),
16160 E->getNumExpansions());
16163template <
typename Derived>
16168 if (!Arg.isPackExpansion()) {
16180 getSema().getTemplateArgumentPackExpansionPattern(ArgLoc, Ellipsis,
16181 OrigNumExpansions);
16193 if (!NumExpansions) {
16205template<
typename Derived>
16224 bool ShouldExpand =
false;
16225 bool RetainExpansion =
false;
16226 UnsignedOrNone NumExpansions = std::nullopt;
16227 if (getDerived().TryExpandParameterPacks(
16229 true, ShouldExpand,
16230 RetainExpansion, NumExpansions))
16235 if (ShouldExpand) {
16237 if (
auto *TTPD = dyn_cast<TemplateTypeParmDecl>(Pack)) {
16238 ArgStorage = getSema().Context.getPackExpansionType(
16239 getSema().Context.getTypeDeclType(TTPD), std::nullopt);
16240 }
else if (
auto *TTPD = dyn_cast<TemplateTemplateParmDecl>(Pack)) {
16244 ExprResult DRE = getSema().BuildDeclRefExpr(
16245 VD, VD->getType().getNonLValueExprType(getSema().Context),
16248 if (DRE.isInvalid())
16251 new (getSema().Context)
16255 PackArgs = ArgStorage;
16260 if (!PackArgs.size()) {
16261 auto *Pack = cast_or_null<NamedDecl>(
16265 return getDerived().RebuildSizeOfPackExpr(
16272 getDerived().ComputeSizeOfPackExprWithoutSubstitution(PackArgs);
16284 TemporaryBase Rebase(*
this, E->
getPackLoc(), getBaseEntity());
16287 if (TransformTemplateArguments(PackLocIterator(*
this, PackArgs.begin()),
16288 PackLocIterator(*
this, PackArgs.end()),
16289 TransformedPackArgs,
true))
16296 bool PartialSubstitution =
false;
16297 for (
auto &Loc : TransformedPackArgs.arguments()) {
16298 Args.push_back(Loc.getArgument());
16299 if (Loc.getArgument().isPackExpansion())
16300 PartialSubstitution =
true;
16303 if (PartialSubstitution)
16304 return getDerived().RebuildSizeOfPackExpr(
16306 std::nullopt, Args);
16308 return getDerived().RebuildSizeOfPackExpr(
16310 static_cast<unsigned>(Args.size()),
16314template <
typename Derived>
16317 if (!E->isValueDependent())
16325 IndexExpr = getDerived().TransformExpr(E->getIndexExpr());
16326 if (IndexExpr.isInvalid())
16331 bool FullySubstituted =
true;
16332 if (!E->expandsToEmptyPack() && E->getExpressions().empty()) {
16333 Expr *Pattern = E->getPackIdExpression();
16335 getSema().collectUnexpandedParameterPacks(E->getPackIdExpression(),
16337 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
16341 bool ShouldExpand =
true;
16342 bool RetainExpansion =
false;
16344 NumExpansions = std::nullopt;
16345 if (getDerived().TryExpandParameterPacks(
16346 E->getEllipsisLoc(), Pattern->getSourceRange(), Unexpanded,
16347 true, ShouldExpand,
16348 RetainExpansion, NumExpansions))
16350 if (!ShouldExpand) {
16352 ExprResult Pack = getDerived().TransformExpr(Pattern);
16353 if (Pack.isInvalid())
16355 return getDerived().RebuildPackIndexingExpr(
16356 E->getEllipsisLoc(), E->getRSquareLoc(), Pack.get(), IndexExpr.get(),
16359 for (
unsigned I = 0; I != *NumExpansions; ++I) {
16362 if (
Out.isInvalid())
16364 if (
Out.get()->containsUnexpandedParameterPack()) {
16365 Out = getDerived().RebuildPackExpansion(
Out.get(), E->getEllipsisLoc(),
16366 OrigNumExpansions);
16367 if (
Out.isInvalid())
16369 FullySubstituted =
false;
16371 ExpandedExprs.push_back(
Out.get());
16375 if (RetainExpansion) {
16376 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
16379 if (
Out.isInvalid())
16382 Out = getDerived().RebuildPackExpansion(
Out.get(), E->getEllipsisLoc(),
16383 OrigNumExpansions);
16384 if (
Out.isInvalid())
16386 FullySubstituted =
false;
16387 ExpandedExprs.push_back(
Out.get());
16389 }
else if (!E->expandsToEmptyPack()) {
16390 if (getDerived().TransformExprs(E->getExpressions().data(),
16391 E->getExpressions().size(),
false,
16396 return getDerived().RebuildPackIndexingExpr(
16397 E->getEllipsisLoc(), E->getRSquareLoc(), E->getPackIdExpression(),
16398 IndexExpr.get(), ExpandedExprs, FullySubstituted);
16401template <
typename Derived>
16404 if (!getSema().ArgPackSubstIndex)
16411 E->getAssociatedDecl(), E->getParameterPack(),
16412 E->getParameterPackLocation(), Arg, SemaRef.
getPackIndex(Pack),
16416template <
typename Derived>
16420 ExprResult Replacement = getDerived().TransformExpr(OrigReplacement);
16421 if (Replacement.isInvalid())
16424 Decl *AssociatedDecl =
16425 getDerived().TransformDecl(E->getNameLoc(), E->getAssociatedDecl());
16426 if (!AssociatedDecl)
16429 if (Replacement.get() == OrigReplacement &&
16430 AssociatedDecl == E->getAssociatedDecl())
16433 auto getParamAndType = [E](
Decl *AssociatedDecl)
16434 -> std::tuple<NonTypeTemplateParmDecl *, QualType> {
16435 auto [PDecl, Arg] =
16439 return {Param, Param->getType()};
16441 Arg = Arg.getPackAsArray()[*PackIndex];
16442 return {Param, Arg.getNonTypeTemplateArgumentType()};
16448 if (
auto [Param, ParamType] = getParamAndType(AssociatedDecl);
16450 ParamType, std::get<1>(getParamAndType(E->getAssociatedDecl()))) ||
16451 Replacement.get() != OrigReplacement) {
16458 Param, ParamType, Replacement.get(), SugaredConverted,
16459 CanonicalConverted,
16461 if (Replacement.isInvalid())
16465 Replacement = E->getReplacement();
16469 Replacement.get()->getType(), Replacement.get()->getValueKind(),
16470 E->getNameLoc(), Replacement.get(), AssociatedDecl, E->getIndex(),
16471 E->getPackIndex(), E->isReferenceParameter(), E->getFinal());
16474template<
typename Derived>
16481template<
typename Derived>
16488template<
typename Derived>
16492 if (
Expr *OldCallee = E->getCallee()) {
16493 ExprResult CalleeResult = getDerived().TransformExpr(OldCallee);
16494 if (CalleeResult.isInvalid())
16499 Expr *Pattern = E->getPattern();
16502 getSema().collectUnexpandedParameterPacks(Pattern, Unexpanded);
16503 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
16507 bool Expand =
true;
16508 bool RetainExpansion =
false;
16510 NumExpansions = OrigNumExpansions;
16511 if (getDerived().TryExpandParameterPacks(
16512 E->getEllipsisLoc(), Pattern->getSourceRange(), Unexpanded,
16513 true, Expand, RetainExpansion,
16523 E->getLHS() ? getDerived().TransformExpr(E->getLHS()) :
ExprResult();
16524 if (LHS.isInvalid())
16528 E->getRHS() ? getDerived().TransformExpr(E->getRHS()) :
ExprResult();
16529 if (RHS.isInvalid())
16532 if (!getDerived().AlwaysRebuild() &&
16533 LHS.get() == E->getLHS() && RHS.get() == E->getRHS())
16536 return getDerived().RebuildCXXFoldExpr(
16537 Callee, E->getBeginLoc(), LHS.get(), E->getOperator(),
16538 E->getEllipsisLoc(), RHS.get(), E->getEndLoc(), NumExpansions);
16544 if (NumExpansions && SemaRef.
getLangOpts().BracketDepth < *NumExpansions) {
16545 SemaRef.
Diag(E->getEllipsisLoc(),
16546 clang::diag::err_fold_expression_limit_exceeded)
16547 << *NumExpansions << SemaRef.
getLangOpts().BracketDepth
16548 << E->getSourceRange();
16549 SemaRef.
Diag(E->getEllipsisLoc(), diag::note_bracket_depth);
16558 bool LeftFold = E->isLeftFold();
16562 if (!LeftFold && RetainExpansion) {
16563 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
16566 if (
Out.isInvalid())
16569 Result = getDerived().RebuildCXXFoldExpr(
16570 Callee, E->getBeginLoc(),
Out.get(), E->getOperator(),
16571 E->getEllipsisLoc(),
Result.get(), E->getEndLoc(), OrigNumExpansions);
16576 bool WarnedOnComparison =
false;
16577 for (
unsigned I = 0; I != *NumExpansions; ++I) {
16579 getSema(), LeftFold ? I : *NumExpansions - I - 1);
16581 if (
Out.isInvalid())
16584 if (
Out.get()->containsUnexpandedParameterPack()) {
16586 Result = getDerived().RebuildCXXFoldExpr(
16587 Callee, E->getBeginLoc(), LeftFold ?
Result.get() :
Out.get(),
16588 E->getOperator(), E->getEllipsisLoc(),
16589 LeftFold ?
Out.get() :
Result.get(), E->getEndLoc(),
16590 OrigNumExpansions);
16591 }
else if (
Result.isUsable()) {
16598 Result = getDerived().RebuildCXXOperatorCallExpr(
16600 E->getEllipsisLoc(),
Callee->getBeginLoc(),
Callee->requiresADL(),
16601 Functions, LHS, RHS);
16603 Result = getDerived().RebuildBinaryOperator(E->getEllipsisLoc(),
16604 E->getOperator(), LHS, RHS,
16606 if (!WarnedOnComparison &&
Result.isUsable()) {
16607 if (
auto *BO = dyn_cast<BinaryOperator>(
Result.get());
16608 BO && BO->isComparisonOp()) {
16609 WarnedOnComparison =
true;
16610 SemaRef.
Diag(BO->getBeginLoc(),
16611 diag::warn_comparison_in_fold_expression)
16612 << BO->getOpcodeStr();
16625 if (LeftFold && RetainExpansion) {
16626 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
16629 if (
Out.isInvalid())
16632 Result = getDerived().RebuildCXXFoldExpr(
16633 Callee, E->getBeginLoc(),
Result.get(), E->getOperator(),
16634 E->getEllipsisLoc(),
Out.get(), E->getEndLoc(), OrigNumExpansions);
16640 PE->setIsProducedByFoldExpansion();
16645 return getDerived().RebuildEmptyCXXFoldExpr(E->getEllipsisLoc(),
16650template <
typename Derived>
16656 QualType T = getDerived().TransformType(E->getType());
16658 bool ArgChanged =
false;
16660 if (getDerived().TransformExprs(InitExprs.data(), InitExprs.size(),
true,
16661 TransformedInits, &ArgChanged))
16664 if (!getDerived().AlwaysRebuild() && !ArgChanged &&
T == E->getType())
16667 return getDerived().RebuildCXXParenListInitExpr(
16668 TransformedInits,
T, E->getUserSpecifiedInitExprs().size(),
16669 E->getInitLoc(), E->getBeginLoc(), E->getEndLoc());
16672template<
typename Derived>
16679template<
typename Derived>
16685template<
typename Derived>
16691template<
typename Derived>
16694 ExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
16695 if (SubExpr.isInvalid())
16698 if (!getDerived().AlwaysRebuild() &&
16699 SubExpr.get() == E->getSubExpr())
16702 return getDerived().RebuildObjCBoxedExpr(E->getSourceRange(), SubExpr.get());
16705template<
typename Derived>
16710 bool ArgChanged =
false;
16711 if (getDerived().TransformExprs(E->getElements(), E->getNumElements(),
16712 false, Elements, &ArgChanged))
16715 if (!getDerived().AlwaysRebuild() && !ArgChanged)
16718 return getDerived().RebuildObjCArrayLiteral(E->getSourceRange(),
16723template<
typename Derived>
16729 bool ArgChanged =
false;
16730 for (
unsigned I = 0, N = E->getNumElements(); I != N; ++I) {
16733 if (OrigElement.isPackExpansion()) {
16736 getSema().collectUnexpandedParameterPacks(OrigElement.Key, Unexpanded);
16737 getSema().collectUnexpandedParameterPacks(OrigElement.Value, Unexpanded);
16738 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
16742 bool Expand =
true;
16743 bool RetainExpansion =
false;
16746 SourceRange PatternRange(OrigElement.Key->getBeginLoc(),
16747 OrigElement.Value->getEndLoc());
16748 if (getDerived().TryExpandParameterPacks(
16749 OrigElement.EllipsisLoc, PatternRange, Unexpanded,
16750 true, Expand, RetainExpansion,
16759 ExprResult Key = getDerived().TransformExpr(OrigElement.Key);
16760 if (Key.isInvalid())
16763 if (Key.get() != OrigElement.Key)
16767 if (
Value.isInvalid())
16774 Key.get(),
Value.get(), OrigElement.EllipsisLoc, NumExpansions
16776 Elements.push_back(Expansion);
16786 for (
unsigned I = 0; I != *NumExpansions; ++I) {
16788 ExprResult Key = getDerived().TransformExpr(OrigElement.Key);
16789 if (Key.isInvalid())
16793 if (
Value.isInvalid())
16803 if (Key.get()->containsUnexpandedParameterPack() ||
16804 Value.get()->containsUnexpandedParameterPack())
16805 Element.EllipsisLoc = OrigElement.EllipsisLoc;
16807 Elements.push_back(Element);
16817 ExprResult Key = getDerived().TransformExpr(OrigElement.Key);
16818 if (Key.isInvalid())
16821 if (Key.get() != OrigElement.Key)
16826 = getDerived().TransformExpr(OrigElement.Value);
16827 if (
Value.isInvalid())
16835 Elements.push_back(Element);
16838 if (!getDerived().AlwaysRebuild() && !ArgChanged)
16841 return getDerived().RebuildObjCDictionaryLiteral(E->getSourceRange(),
16845template<
typename Derived>
16849 = getDerived().TransformType(E->getEncodedTypeSourceInfo());
16850 if (!EncodedTypeInfo)
16853 if (!getDerived().AlwaysRebuild() &&
16854 EncodedTypeInfo == E->getEncodedTypeSourceInfo())
16857 return getDerived().RebuildObjCEncodeExpr(E->getAtLoc(),
16859 E->getRParenLoc());
16862template<
typename Derived>
16872template<
typename Derived>
16876 = getDerived().TransformType(E->getTypeInfoAsWritten());
16884 if (!getDerived().AlwaysRebuild() &&
16885 TSInfo == E->getTypeInfoAsWritten() &&
16886 Result.get() == E->getSubExpr())
16890 E->getLParenLoc(), E->getBridgeKind(), E->getBridgeKeywordLoc(), TSInfo,
16894template <
typename Derived>
16900template<
typename Derived>
16904 bool ArgChanged =
false;
16906 Args.reserve(E->getNumArgs());
16907 if (getDerived().TransformExprs(E->getArgs(), E->getNumArgs(),
false, Args,
16914 = getDerived().TransformType(E->getClassReceiverTypeInfo());
16915 if (!ReceiverTypeInfo)
16919 if (!getDerived().AlwaysRebuild() &&
16920 ReceiverTypeInfo == E->getClassReceiverTypeInfo() && !ArgChanged)
16925 E->getSelectorLocs(SelLocs);
16926 return getDerived().RebuildObjCMessageExpr(ReceiverTypeInfo,
16929 E->getMethodDecl(),
16936 if (!E->getMethodDecl())
16941 E->getSelectorLocs(SelLocs);
16942 return getDerived().RebuildObjCMessageExpr(E->getSuperLoc(),
16945 E->getReceiverType(),
16946 E->getMethodDecl(),
16954 "Only class and instance messages may be instantiated");
16956 = getDerived().TransformExpr(E->getInstanceReceiver());
16957 if (Receiver.isInvalid())
16961 if (!getDerived().AlwaysRebuild() &&
16962 Receiver.get() == E->getInstanceReceiver() && !ArgChanged)
16967 E->getSelectorLocs(SelLocs);
16968 return getDerived().RebuildObjCMessageExpr(Receiver.get(),
16971 E->getMethodDecl(),
16977template<
typename Derived>
16983template<
typename Derived>
16989template<
typename Derived>
16994 if (
Base.isInvalid())
17000 if (!getDerived().AlwaysRebuild() &&
17001 Base.get() == E->getBase())
17004 return getDerived().RebuildObjCIvarRefExpr(
Base.get(), E->getDecl(),
17006 E->isArrow(), E->isFreeIvar());
17009template<
typename Derived>
17014 if (!E->isObjectReceiver())
17019 if (
Base.isInvalid())
17025 if (!getDerived().AlwaysRebuild() &&
17026 Base.get() == E->getBase())
17029 if (E->isExplicitProperty())
17030 return getDerived().RebuildObjCPropertyRefExpr(
Base.get(),
17031 E->getExplicitProperty(),
17034 return getDerived().RebuildObjCPropertyRefExpr(
Base.get(),
17036 E->getImplicitPropertyGetter(),
17037 E->getImplicitPropertySetter(),
17041template<
typename Derived>
17046 if (
Base.isInvalid())
17050 ExprResult Key = getDerived().TransformExpr(E->getKeyExpr());
17051 if (Key.isInvalid())
17055 if (!getDerived().AlwaysRebuild() &&
17056 Key.get() == E->getKeyExpr() &&
Base.get() == E->getBaseExpr())
17059 return getDerived().RebuildObjCSubscriptRefExpr(E->getRBracket(),
17060 Base.get(), Key.get(),
17061 E->getAtIndexMethodDecl(),
17062 E->setAtIndexMethodDecl());
17065template<
typename Derived>
17070 if (
Base.isInvalid())
17074 if (!getDerived().AlwaysRebuild() &&
17075 Base.get() == E->getBase())
17078 return getDerived().RebuildObjCIsaExpr(
Base.get(), E->getIsaMemberLoc(),
17083template<
typename Derived>
17086 bool ArgumentChanged =
false;
17088 SubExprs.reserve(E->getNumSubExprs());
17089 if (getDerived().TransformExprs(E->getSubExprs(), E->getNumSubExprs(),
false,
17090 SubExprs, &ArgumentChanged))
17093 if (!getDerived().AlwaysRebuild() &&
17097 return getDerived().RebuildShuffleVectorExpr(E->getBuiltinLoc(),
17099 E->getRParenLoc());
17102template<
typename Derived>
17105 ExprResult SrcExpr = getDerived().TransformExpr(E->getSrcExpr());
17106 if (SrcExpr.isInvalid())
17113 if (!getDerived().AlwaysRebuild() &&
17114 Type == E->getTypeSourceInfo() &&
17115 SrcExpr.get() == E->getSrcExpr())
17118 return getDerived().RebuildConvertVectorExpr(E->getBuiltinLoc(),
17119 SrcExpr.get(),
Type,
17120 E->getRParenLoc());
17123template<
typename Derived>
17126 BlockDecl *oldBlock = E->getBlockDecl();
17132 blockScope->TheDecl->setBlockMissingReturnType(
17133 oldBlock->blockMissingReturnType());
17142 if (getDerived().TransformFunctionTypeParams(
17143 E->getCaretLocation(), oldBlock->parameters(),
nullptr,
17144 exprFunctionType->getExtParameterInfosOrNull(), paramTypes, ¶ms,
17146 getSema().ActOnBlockError(E->getCaretLocation(),
nullptr);
17151 getDerived().TransformType(exprFunctionType->getReturnType());
17153 auto epi = exprFunctionType->getExtProtoInfo();
17154 epi.ExtParameterInfos = extParamInfos.getPointerOrNull(paramTypes.size());
17157 getDerived().RebuildFunctionProtoType(exprResultType, paramTypes, epi);
17161 if (!params.empty())
17162 blockScope->TheDecl->setParams(params);
17164 if (!oldBlock->blockMissingReturnType()) {
17165 blockScope->HasImplicitReturnType =
false;
17166 blockScope->ReturnType = exprResultType;
17170 StmtResult body = getDerived().TransformStmt(E->getBody());
17171 if (body.isInvalid()) {
17172 getSema().ActOnBlockError(E->getCaretLocation(),
nullptr);
17180 for (
const auto &I : oldBlock->captures()) {
17181 VarDecl *oldCapture = I.getVariable();
17184 if (oldCapture->isParameterPack())
17188 cast<VarDecl>(getDerived().TransformDecl(E->getCaretLocation(),
17190 assert(blockScope->CaptureMap.count(newCapture));
17196 assert((!blockScope->isCXXThisCaptured() || oldBlock->capturesCXXThis()) &&
17197 "this pointer isn't captured in the old block");
17205template<
typename Derived>
17208 ExprResult SrcExpr = getDerived().TransformExpr(E->getSrcExpr());
17209 if (SrcExpr.isInvalid())
17212 QualType Type = getDerived().TransformType(E->getType());
17215 E->getRParenLoc());
17218template<
typename Derived>
17221 bool ArgumentChanged =
false;
17223 SubExprs.reserve(E->getNumSubExprs());
17224 if (getDerived().TransformExprs(E->getSubExprs(), E->getNumSubExprs(),
false,
17225 SubExprs, &ArgumentChanged))
17228 if (!getDerived().AlwaysRebuild() &&
17232 return getDerived().RebuildAtomicExpr(E->getBuiltinLoc(), SubExprs,
17233 E->getOp(), E->getRParenLoc());
17240template<
typename Derived>
17243 return SemaRef.BuildPointerType(PointeeType,
Star,
17247template<
typename Derived>
17250 return SemaRef.BuildBlockPointerType(PointeeType,
Star,
17254template<
typename Derived>
17257 bool WrittenAsLValue,
17259 return SemaRef.BuildReferenceType(ReferentType, WrittenAsLValue,
17263template <
typename Derived>
17267 return SemaRef.BuildMemberPointerType(PointeeType, SS, Cls, Sigil,
17271template<
typename Derived>
17278 return SemaRef.ObjC().BuildObjCTypeParamType(
17279 Decl, ProtocolLAngleLoc, Protocols, ProtocolLocs, ProtocolRAngleLoc,
17283template<
typename Derived>
17294 return SemaRef.ObjC().BuildObjCObjectType(
17295 BaseType, Loc, TypeArgsLAngleLoc, TypeArgs, TypeArgsRAngleLoc,
17296 ProtocolLAngleLoc, Protocols, ProtocolLocs, ProtocolRAngleLoc,
17301template<
typename Derived>
17305 return SemaRef.Context.getObjCObjectPointerType(PointeeType);
17308template <
typename Derived>
17311 Expr *SizeExpr,
unsigned IndexTypeQuals,
SourceRange BracketsRange) {
17312 if (SizeExpr || !Size)
17313 return SemaRef.BuildArrayType(ElementType, SizeMod, SizeExpr,
17314 IndexTypeQuals, BracketsRange,
17318 SemaRef.Context.UnsignedCharTy,
SemaRef.Context.UnsignedShortTy,
17320 SemaRef.Context.UnsignedLongLongTy,
SemaRef.Context.UnsignedInt128Ty
17323 for (
const auto &
T : Types)
17324 if (Size->getBitWidth() ==
SemaRef.Context.getIntWidth(
T)) {
17334 return SemaRef.BuildArrayType(ElementType, SizeMod, ArraySize,
17335 IndexTypeQuals, BracketsRange,
17339template <
typename Derived>
17342 Expr *SizeExpr,
unsigned IndexTypeQuals,
SourceRange BracketsRange) {
17343 return getDerived().RebuildArrayType(ElementType, SizeMod, &Size, SizeExpr,
17344 IndexTypeQuals, BracketsRange);
17347template <
typename Derived>
17351 return getDerived().RebuildArrayType(ElementType, SizeMod,
nullptr,
nullptr,
17352 IndexTypeQuals, BracketsRange);
17355template <
typename Derived>
17358 unsigned IndexTypeQuals,
SourceRange BracketsRange) {
17359 return getDerived().RebuildArrayType(ElementType, SizeMod,
nullptr,
17361 IndexTypeQuals, BracketsRange);
17364template <
typename Derived>
17367 unsigned IndexTypeQuals,
SourceRange BracketsRange) {
17368 return getDerived().RebuildArrayType(ElementType, SizeMod,
nullptr,
17370 IndexTypeQuals, BracketsRange);
17373template <
typename Derived>
17376 return SemaRef.BuildAddressSpaceAttr(PointeeType, AddrSpaceExpr,
17380template <
typename Derived>
17382 unsigned NumElements,
17385 return SemaRef.Context.getVectorType(ElementType, NumElements, VecKind);
17388template <
typename Derived>
17392 return SemaRef.BuildVectorType(ElementType, SizeExpr, AttributeLoc);
17395template<
typename Derived>
17397 unsigned NumElements,
17399 llvm::APInt numElements(
SemaRef.Context.getIntWidth(
SemaRef.Context.IntTy),
17400 NumElements,
true);
17404 return SemaRef.BuildExtVectorType(ElementType, VectorSize, AttributeLoc);
17407template<
typename Derived>
17412 return SemaRef.BuildExtVectorType(ElementType, SizeExpr, AttributeLoc);
17415template <
typename Derived>
17417 QualType ElementType,
unsigned NumRows,
unsigned NumColumns) {
17418 return SemaRef.Context.getConstantMatrixType(ElementType, NumRows,
17422template <
typename Derived>
17426 return SemaRef.BuildMatrixType(ElementType, RowExpr, ColumnExpr,
17430template <
typename Derived>
17434 return SemaRef.BuildFunctionType(
T, ParamTypes,
17440template<
typename Derived>
17442 return SemaRef.Context.getFunctionNoProtoType(
T);
17445template <
typename Derived>
17449 assert(D &&
"no decl found");
17453 if (
auto *UPD = dyn_cast<UsingPackDecl>(D)) {
17457 if (UPD->expansions().empty()) {
17458 getSema().Diag(NameLoc, diag::err_using_pack_expansion_empty)
17459 << UPD->isCXXClassMember() << UPD;
17468 for (
auto *E : UPD->expansions()) {
17475 else if (
T.isNull())
17478 assert(
getSema().Context.hasSameType(ThisT,
T) &&
17479 "mismatched resolved types in using pack expansion");
17481 return T.isNull() ? FallbackT :
T;
17483 if (
auto *Using = dyn_cast<UsingDecl>(D)) {
17484 assert(Using->hasTypename() &&
17485 "UnresolvedUsingTypenameDecl transformed to non-typename using");
17488 assert(++Using->shadow_begin() == Using->shadow_end());
17493 return SemaRef.Context.getUsingType(
Keyword, Qualifier, Shadow);
17496 "UnresolvedUsingTypenameDecl transformed to non-using decl");
17497 return SemaRef.Context.getUnresolvedUsingType(
17501template <
typename Derived>
17504 return SemaRef.BuildTypeofExprType(E, Kind);
17507template<
typename Derived>
17510 return SemaRef.Context.getTypeOfType(Underlying, Kind);
17513template <
typename Derived>
17515 return SemaRef.BuildDecltypeType(E);
17518template <
typename Derived>
17523 return SemaRef.BuildPackIndexingType(Pattern, IndexExpr, Loc, EllipsisLoc,
17524 FullySubstituted, Expansions);
17527template<
typename Derived>
17529 UnaryTransformType::UTTKind UKind,
17531 return SemaRef.BuildUnaryTransformType(BaseType, UKind, Loc);
17534template <
typename Derived>
17538 return SemaRef.CheckTemplateIdType(
17543template<
typename Derived>
17546 return SemaRef.BuildAtomicType(ValueType, KWLoc);
17549template<
typename Derived>
17553 return isReadPipe ?
SemaRef.BuildReadPipeType(ValueType, KWLoc)
17554 :
SemaRef.BuildWritePipeType(ValueType, KWLoc);
17557template <
typename Derived>
17561 llvm::APInt NumBitsAP(
SemaRef.Context.getIntWidth(
SemaRef.Context.IntTy),
17565 return SemaRef.BuildBitIntType(IsUnsigned, Bits, Loc);
17568template <
typename Derived>
17571 return SemaRef.BuildBitIntType(IsUnsigned, NumBitsExpr, Loc);
17574template <
typename Derived>
17582template <
typename Derived>
17589 getSema().ActOnTemplateName(
nullptr, SS, TemplateKWLoc,
17592 AllowInjectedClassName);
17596template<
typename Derived>
17603 bool AllowInjectedClassName) {
17606 SourceLocation SymbolLocations[3] = { NameLoc, NameLoc, NameLoc };
17611 false,
Template, AllowInjectedClassName);
17615template <
typename Derived>
17620 bool isPostIncDec = Second && (Op == OO_PlusPlus || Op == OO_MinusMinus);
17625 return SemaRef.PseudoObject().checkAssignment(
nullptr, OpLoc,
17626 Opc,
First, Second);
17641 if (Op == OO_Subscript) {
17642 if (!
First->getType()->isOverloadableType() &&
17644 return getSema().CreateBuiltinArraySubscriptExpr(
First, CalleeLoc, Second,
17646 }
else if (Op == OO_Arrow) {
17649 if (
First->getType()->isDependentType())
17652 return SemaRef.BuildOverloadedArrowExpr(
nullptr,
First, OpLoc);
17653 }
else if (Second ==
nullptr || isPostIncDec) {
17654 if (!
First->getType()->isOverloadableType() ||
17655 (Op == OO_Amp &&
getSema().isQualifiedMemberAccess(
First))) {
17662 return getSema().CreateBuiltinUnaryOp(OpLoc, Opc,
First);
17666 !
First->getType()->isOverloadableType() &&
17672 =
SemaRef.CreateBuiltinBinOp(OpLoc, Opc,
First, Second);
17681 if (!Second || isPostIncDec) {
17684 return SemaRef.CreateOverloadedUnaryOp(OpLoc, Opc, Functions,
First,
17691 First, Second, RequiresADL);
17698template<
typename Derived>
17708 QualType CanonicalBaseType =
Base->getType().getCanonicalType();
17714 ->getAsCanonical<RecordType>())) {
17716 return SemaRef.BuildPseudoDestructorExpr(
17717 Base, OperatorLoc, isArrow ? tok::arrow : tok::period, SS, ScopeType,
17718 CCLoc, TildeLoc, Destroyed);
17730 if (!
isa<TagType>(ScopeType->getType().getCanonicalType())) {
17731 getSema().Diag(ScopeType->getTypeLoc().getBeginLoc(),
17732 diag::err_expected_class_or_namespace)
17733 << ScopeType->getType() <<
getSema().getLangOpts().CPlusPlus;
17737 SS.
Make(
SemaRef.Context, ScopeType->getTypeLoc(), CCLoc);
17741 return getSema().BuildMemberReferenceExpr(
17742 Base,
Base->getType(), OperatorLoc, isArrow, SS, TemplateKWLoc,
17748template<
typename Derived>
17756 for (
unsigned I = 0; I < NumParams; ++I) {
17757 if (I != ContextParamPos) {
17763 Params.push_back(std::make_pair(StringRef(), QualType()));
17766 getSema().ActOnCapturedRegionStart(Loc,
nullptr,
17774 if (Body.isInvalid()) {
17775 getSema().ActOnCapturedRegionError();
17779 return getSema().ActOnCapturedRegionEnd(Body.get());
17782template <
typename Derived>
17788 llvm_unreachable(
"SYCL kernel call statement cannot appear in dependent "
17792template <
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
Stmt * getStmtExprResult()
SourceLocation getRBracLoc() const
Declaration of a C++20 concept.
static ConceptReference * Create(const ASTContext &C, NestedNameSpecifierLoc NNS, SourceLocation TemplateKWLoc, DeclarationNameInfo ConceptNameInfo, NamedDecl *FoundDecl, TemplateDecl *NamedConcept, const ASTTemplateArgumentListInfo *ArgsAsWritten)
Represents the specialization of a concept - evaluates to a prvalue of type bool.
const TypeClass * getTypePtr() const
ConditionalOperator - The ?
Represents the canonical version of C arrays with a specified constant size.
ConstantExpr - An expression that occurs in a constant context and optionally the result of evaluatin...
Represents a concrete matrix type with constant number of rows and columns.
ContinueStmt - This represents a continue.
ConvertVectorExpr - Clang builtin function __builtin_convertvector This AST node provides support for...
Represents a 'co_return' statement in the C++ Coroutines TS.
Represents the body of a coroutine.
Represents a sugar type with __counted_by or __sized_by annotations, including their _or_null variant...
Represents a 'co_yield' expression.
Wrapper for source info for pointers decayed from arrays and functions.
static DeclAccessPair make(NamedDecl *D, AccessSpecifier AS)
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
DeclContext * getParent()
getParent - Returns the containing DeclContext.
DeclContextLookupResult lookup_result
lookup_result lookup(DeclarationName Name) const
lookup - Find the declarations (if any) with the given Name in this context.
void addDecl(Decl *D)
Add the declaration D into this context.
A reference to a declared variable, function, enum, etc.
DeclStmt - Adaptor class for mixing declarations with statements and expressions.
Decl - This represents one declaration (or definition), e.g.
bool isInvalidDecl() const
SourceLocation getLocation() const
DeclContext * getDeclContext()
AccessSpecifier getAccess() const
The name of a declaration.
TemplateDecl * getCXXDeductionGuideTemplate() const
If this name is the name of a C++ deduction guide, return the template associated with that name.
@ CXXConversionFunctionName
QualType getCXXNameType() const
If this name is one of the C++ names (of a constructor, destructor, or conversion function),...
NameKind getNameKind() const
Determine what kind of name this is.
SourceLocation getInnerLocStart() const
Return start of source range ignoring outer template declarations.
TypeSourceInfo * getTypeSourceInfo() const
Information about one declarator, including the parsed type information and the identifier.
void setDecltypeLoc(SourceLocation Loc)
void setElaboratedKeywordLoc(SourceLocation Loc)
void setAttrOperandParensRange(SourceRange range)
Represents an extended address space qualifier where the input address space value is dependent.
Represents a 'co_await' expression while the type of the promise is dependent.
void setElaboratedKeywordLoc(SourceLocation Loc)
A qualified reference to a name whose declaration cannot yet be resolved.
SourceLocation getRAngleLoc() const
Retrieve the location of the right angle bracket ending the explicit template argument list following...
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies the name, with source location information.
SourceLocation getLAngleLoc() const
Retrieve the location of the left angle bracket starting the explicit template argument list followin...
bool hasExplicitTemplateArgs() const
Determines whether this lookup had explicit template arguments.
SourceLocation getTemplateKeywordLoc() const
Retrieve the location of the template keyword preceding this name, if any.
unsigned getNumTemplateArgs() const
DeclarationName getDeclName() const
Retrieve the name that this expression refers to.
TemplateArgumentLoc const * getTemplateArgs() const
const DeclarationNameInfo & getNameInfo() const
Retrieve the name that this expression refers to.
Represents an array type in C++ whose size is a value-dependent expression.
void setNameLoc(SourceLocation Loc)
Represents an extended vector type where either the type or size is dependent.
Represents a matrix type where the type and the number of rows and columns is dependent on a template...
void setNameLoc(SourceLocation Loc)
Represents a vector type where either the type or size is dependent.
Represents a single C99 designator.
Represents a C99 designated initializer expression.
Designation - Represent a full designation, which is a sequence of designators.
static Designator CreateArrayRangeDesignator(Expr *Start, Expr *End, SourceLocation LBracketLoc, SourceLocation EllipsisLoc)
Creates a GNU array-range designator.
static Designator CreateArrayDesignator(Expr *Index, SourceLocation LBracketLoc)
Creates an array designator.
static Designator CreateFieldDesignator(const IdentifierInfo *FieldName, SourceLocation DotLoc, SourceLocation FieldLoc)
Creates a field designator.
bool hasErrorOccurred() const
DoStmt - This represents a 'do/while' stmt.
Wrap a function effect's condition expression in another struct so that FunctionProtoType's TrailingO...
Expr * getCondition() const
void set(SourceLocation ElaboratedKeywordLoc, NestedNameSpecifierLoc QualifierLoc, SourceLocation NameLoc)
Represents a reference to emded data.
RAII object that enters a new expression evaluation context.
Wrapper for source info for enum types.
TypeSourceInfo * getTypeInfoAsWritten() const
getTypeInfoAsWritten - Returns the type source info for the type that this expression is casting to.
Represents an expression – generally a full-expression – that introduces cleanups to be run at the en...
This represents one expression.
bool isValueDependent() const
Determines whether the value of this expression depends on.
bool isTypeDependent() const
Determines whether the type of this expression depends on.
ExprObjectKind getObjectKind() const
getObjectKind - The object kind that this expression produces.
Expr * IgnoreImplicitAsWritten() LLVM_READONLY
Skip past any implicit AST nodes which might surround this expression until reaching a fixed point.
bool isDefaultArgument() const
Determine whether this expression is a default function argument.
bool hasPlaceholderType() const
Returns whether this expression has a placeholder type.
static ExprValueKind getValueKindForType(QualType T)
getValueKindForType - Given a formal return or parameter type, give its value kind.
An expression trait intrinsic.
ExtVectorElementExpr - This represents access to specific elements of a vector, and may occur on the ...
Represents difference between two FPOptions values.
FPOptions applyOverrides(FPOptions Base)
Represents a member of a struct/union/class.
ForStmt - This represents a 'for (init;cond;inc)' stmt.
Represents a function declaration or definition.
ArrayRef< ParmVarDecl * > parameters() const
SmallVector< Conflict > Conflicts
Represents an abstract function effect, using just an enumeration describing its kind.
StringRef name() const
The description printed in diagnostics, e.g. 'nonblocking'.
Kind oppositeKind() const
Return the opposite kind, for effects which have opposites.
ArrayRef< EffectConditionExpr > conditions() const
Represents a K&R-style 'int foo()' function, which has no information available about its arguments.
Represents a reference to a function parameter pack, init-capture pack, or binding pack that has been...
Represents a prototype with parameter type info, e.g.
param_type_iterator param_type_begin() const
unsigned getNumParams() const
SourceLocation getLocalRangeEnd() const
void setLocalRangeBegin(SourceLocation L)
void setLParenLoc(SourceLocation Loc)
SourceRange getExceptionSpecRange() const
void setParam(unsigned i, ParmVarDecl *VD)
ArrayRef< ParmVarDecl * > getParams() const
void setRParenLoc(SourceLocation Loc)
void setLocalRangeEnd(SourceLocation L)
void setExceptionSpecRange(SourceRange R)
TypeLoc getReturnLoc() const
SourceLocation getLocalRangeBegin() const
SourceLocation getLParenLoc() const
SourceLocation getRParenLoc() const
Interesting information about a specific parameter that can't simply be reflected in parameter's type...
This represents a GCC inline-assembly statement extension.
GNUNullExpr - Implements the GNU __null extension, which is a name for a null pointer constant that h...
Represents a C11 generic selection.
AssociationTy< false > Association
GotoStmt - This represents a direct goto.
Type source information for HLSL attributed resource type.
This class represents temporary values used to represent inout and out arguments in HLSL.
One of these records is kept for each identifier that is lexed.
IfStmt - This represents an if/then/else.
ImaginaryLiteral - We support imaginary integer and floating point literals, like "1....
ImplicitCastExpr - Allows us to explicitly represent implicit type conversions, which have no direct ...
Represents an implicitly-generated value initialization of an object of a given type.
Represents a C array with an unspecified size.
IndirectGotoStmt - This represents an indirect goto.
const TypeClass * getTypePtr() const
Describes an C or C++ initializer list.
InitListExpr * getSyntacticForm() const
Wrapper for source info for injected class names of class templates.
static IntegerLiteral * Create(const ASTContext &C, const llvm::APInt &V, QualType type, SourceLocation l)
Returns a new integer literal with value 'V' and type 'type'.
Represents the declaration of a label.
LabelStmt - Represents a label, which has a substatement.
A C++ lambda expression, which produces a function object (of unspecified type) that can be invoked l...
capture_iterator capture_begin() const
Retrieve an iterator pointing to the first lambda capture.
bool isInitCapture(const LambdaCapture *Capture) const
Determine whether one of this lambda's captures is an init-capture.
capture_iterator capture_end() const
Retrieve an iterator pointing past the end of the sequence of lambda captures.
const LambdaCapture * capture_iterator
An iterator that walks over the captures of the lambda, both implicit and explicit.
Represents the results of name lookup.
LLVM_ATTRIBUTE_REINITIALIZES void clear()
Clears out any current state.
void addDecl(NamedDecl *D)
Add a declaration to these results with its natural access.
bool empty() const
Return true if no decls were found.
void resolveKind()
Resolves the result kind of the lookup, possibly hiding decls.
SourceLocation getNameLoc() const
Gets the location of the identifier.
NamedDecl * getRepresentativeDecl() const
Fetches a representative decl. Useful for lazy diagnostics.
DeclarationName getLookupName() const
Gets the name to look up.
This represents a Microsoft inline-assembly statement extension.
Representation of a Microsoft __if_exists or __if_not_exists statement with a dependent name.
An instance of this class represents the declaration of a property member.
A member reference to an MSPropertyDecl.
MS property subscript expression.
void setExpansionLoc(SourceLocation Loc)
Represents a prvalue temporary that is written into memory so that a reference can bind to it.
MatrixSubscriptExpr - Matrix subscript expression for the MatrixType extension.
void setAttrNameLoc(SourceLocation loc)
MemberExpr - [C99 6.5.2.3] Structure and Union Members.
Wrapper for source info for member pointers.
A pointer to member type per C++ 8.3.3 - Pointers to members.
Data structure that captures multiple levels of template argument lists for use in template instantia...
This represents a decl that may have a name.
NamedDecl * getUnderlyingDecl()
Looks through UsingDecls and ObjCCompatibleAliasDecls for the underlying named decl.
IdentifierInfo * getIdentifier() const
Get the identifier that names this declaration, if there is one.
StringRef getName() const
Get the name of identifier for this declaration as a StringRef.
DeclarationName getDeclName() const
Get the actual, stored name of the declaration, which may be a special name.
Represents C++ namespaces and their aliases.
Class that aids in the construction of nested-name-specifiers along with source-location information ...
void MakeTrivial(ASTContext &Context, NestedNameSpecifier Qualifier, SourceRange R)
Make a new nested-name-specifier from incomplete source-location information.
A C++ nested-name-specifier augmented with source location information.
NestedNameSpecifier getNestedNameSpecifier() const
Retrieve the nested-name-specifier to which this instance refers.
SourceLocation getLocalEndLoc() const
Retrieve the location of the end of this component of the nested-name-specifier.
SourceRange getSourceRange() const LLVM_READONLY
Retrieve the source range covering the entirety of this nested-name-specifier.
SourceLocation getEndLoc() const
Retrieve the location of the end of this nested-name-specifier.
SourceLocation getBeginLoc() const
Retrieve the location of the beginning of this nested-name-specifier.
TypeLoc castAsTypeLoc() const
For a nested-name-specifier that refers to a type, retrieve the type with source-location information...
void * getOpaqueData() const
Retrieve the opaque pointer that refers to source-location data.
SourceLocation getLocalBeginLoc() const
Retrieve the location of the beginning of this component of the nested-name-specifier.
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
NamespaceAndPrefix getAsNamespaceAndPrefix() const
CXXRecordDecl * getAsRecordDecl() const
Retrieve the record declaration stored in this nested name specifier, or null.
bool isDependent() const
Whether this nested name specifier refers to a dependent type or not.
@ MicrosoftSuper
Microsoft's '__super' specifier, stored as a CXXRecordDecl* of the class it appeared in.
@ Global
The global specifier '::'. There is no stored value.
@ Type
A type, stored as a Type*.
@ Namespace
A namespace-like entity, stored as a NamespaceBaseDecl*.
Represents a place-holder for an object not to be initialized by anything.
NullStmt - This is the null statement ";": C99 6.8.3p3.
This represents the 'absent' clause in the 'pragma omp assume' directive.
This represents 'acq_rel' clause in the 'pragma omp atomic|flush' directives.
This represents 'acquire' clause in the 'pragma omp atomic|flush' directives.
This represents clause 'affinity' in the 'pragma omp task'-based directives.
This represents the 'align' clause in the 'pragma omp allocate' directive.
This represents clause 'aligned' in the 'pragma omp ...' directives.
This represents clause 'allocate' in the 'pragma omp ...' directives.
This represents 'allocator' clause in the 'pragma omp ...' directive.
An explicit cast in C or a C-style cast in C++, which uses the syntax ([s1][s2]......
This represents 'at' clause in the 'pragma omp error' directive.
This represents 'atomic_default_mem_order' clause in the 'pragma omp requires' directive.
This represents 'bind' clause in the 'pragma omp ...' directives.
This represents 'capture' clause in the 'pragma omp atomic' directive.
This is a basic class for representing single OpenMP clause.
OpenMPClauseKind getClauseKind() const
Returns kind of OpenMP clause (private, shared, reduction, etc.).
This represents 'collapse' clause in the 'pragma omp ...' directive.
This represents 'compare' clause in the 'pragma omp atomic' directive.
This represents the 'contains' clause in the 'pragma omp assume' directive.
This represents clause 'copyin' in the 'pragma omp ...' directives.
This represents clause 'copyprivate' in the 'pragma omp ...' directives.
This represents 'default' clause in the 'pragma omp ...' directive.
This represents 'defaultmap' clause in the 'pragma omp ...' directive.
This represents implicit clause 'depend' for the 'pragma omp task' directive.
This represents implicit clause 'depobj' for the 'pragma omp depobj' directive.
This represents 'destroy' clause in the 'pragma omp depobj' directive or the 'pragma omp interop' dir...
This represents 'detach' clause in the 'pragma omp task' directive.
This represents 'device' clause in the 'pragma omp ...' directive.
This represents 'dist_schedule' clause in the 'pragma omp ...' directive.
This represents the 'doacross' clause for the 'pragma omp ordered' directive.
This represents 'dynamic_allocators' clause in the 'pragma omp requires' directive.
This represents clause 'exclusive' in the 'pragma omp scan' directive.
This represents 'fail' clause in the 'pragma omp atomic' directive.
This represents 'filter' clause in the 'pragma omp ...' directive.
This represents 'final' clause in the 'pragma omp ...' directive.
This represents clause 'firstprivate' in the 'pragma omp ...' directives.
This represents implicit clause 'flush' for the 'pragma omp flush' directive.
This represents clause 'from' in the 'pragma omp ...' directives.
Representation of the 'full' clause of the 'pragma omp unroll' directive.
This represents 'grainsize' clause in the 'pragma omp ...' directive.
This represents clause 'has_device_ptr' in the 'pragma omp ...' directives.
This represents 'hint' clause in the 'pragma omp ...' directive.
This represents the 'holds' clause in the 'pragma omp assume' directive.
This represents 'if' clause in the 'pragma omp ...' directive.
This represents clause 'in_reduction' in the 'pragma omp task' directives.
This represents clause 'inclusive' in the 'pragma omp scan' directive.
This represents the 'init' clause in 'pragma omp ...' directives.
This represents clause 'is_device_ptr' in the 'pragma omp ...' directives.
OpenMP 5.0 [2.1.6 Iterators] Iterators are identifiers that expand to multiple values in the clause o...
This represents clause 'lastprivate' in the 'pragma omp ...' directives.
This represents clause 'linear' in the 'pragma omp ...' directives.
This class represents the 'looprange' clause in the 'pragma omp fuse' directive.
This represents clauses with a list of expressions that are mappable.
This represents 'mergeable' clause in the 'pragma omp ...' directive.
This represents the 'message' clause in the 'pragma omp error' and the 'pragma omp parallel' directiv...
This represents the 'no_openmp' clause in the 'pragma omp assume' directive.
This represents the 'no_openmp_constructs' clause in the.
This represents the 'no_openmp_routines' clause in the 'pragma omp assume' directive.
This represents the 'no_parallelism' clause in the 'pragma omp assume' directive.
This represents 'nocontext' clause in the 'pragma omp ...' directive.
This represents 'nogroup' clause in the 'pragma omp ...' directive.
This represents clause 'nontemporal' in the 'pragma omp ...' directives.
This represents 'novariants' clause in the 'pragma omp ...' directive.
This represents 'nowait' clause in the 'pragma omp ...' directive.
This represents 'num_tasks' clause in the 'pragma omp ...' directive.
This represents 'num_teams' clause in the 'pragma omp ...' directive.
This represents 'num_threads' clause in the 'pragma omp ...' directive.
This represents 'order' clause in the 'pragma omp ...' directive.
This represents 'ordered' clause in the 'pragma omp ...' directive.
Representation of the 'partial' clause of the 'pragma omp unroll' directive.
This class represents the 'permutation' clause in the 'pragma omp interchange' directive.
This represents 'priority' clause in the 'pragma omp ...' directive.
This represents clause 'private' in the 'pragma omp ...' directives.
This represents 'proc_bind' clause in the 'pragma omp ...' directive.
This represents 'read' clause in the 'pragma omp atomic' directive.
This represents clause 'reduction' in the 'pragma omp ...' directives.
This represents 'relaxed' clause in the 'pragma omp atomic' directives.
This represents 'release' clause in the 'pragma omp atomic|flush' directives.
This represents 'reverse_offload' clause in the 'pragma omp requires' directive.
This represents 'simd' clause in the 'pragma omp ...' directive.
This represents 'safelen' clause in the 'pragma omp ...' directive.
This represents 'schedule' clause in the 'pragma omp ...' directive.
This represents 'self_maps' clause in the 'pragma omp requires' directive.
This represents 'seq_cst' clause in the 'pragma omp atomic|flush' directives.
This represents the 'severity' clause in the 'pragma omp error' and the 'pragma omp parallel' directi...
This represents clause 'shared' in the 'pragma omp ...' directives.
This represents 'simdlen' clause in the 'pragma omp ...' directive.
This represents the 'sizes' clause in the 'pragma omp tile' directive.
This represents clause 'task_reduction' in the 'pragma omp taskgroup' directives.
This represents 'thread_limit' clause in the 'pragma omp ...' directive.
This represents 'threads' clause in the 'pragma omp ...' directive.
This represents clause 'to' in the 'pragma omp ...' directives.
This represents 'unified_address' clause in the 'pragma omp requires' directive.
This represents 'unified_shared_memory' clause in the 'pragma omp requires' directive.
This represents 'untied' clause in the 'pragma omp ...' directive.
This represents 'update' clause in the 'pragma omp atomic' directive.
This represents the 'use' clause in 'pragma omp ...' directives.
This represents clause 'use_device_addr' in the 'pragma omp ...' directives.
This represents clause 'use_device_ptr' in the 'pragma omp ...' directives.
This represents clause 'uses_allocators' in the 'pragma omp target'-based directives.
This represents 'weak' clause in the 'pragma omp atomic' directives.
This represents 'write' clause in the 'pragma omp atomic' directive.
This represents 'ompx_attribute' clause in a directive that might generate an outlined function.
This represents 'ompx_bare' clause in the 'pragma omp target teams ...' directive.
This represents 'ompx_dyn_cgroup_mem' clause in the 'pragma omp target ...' directive.
ObjCArrayLiteral - used for objective-c array containers; as in: @["Hello", NSApp,...
Represents Objective-C's @catch statement.
Represents Objective-C's @finally statement.
Represents Objective-C's @synchronized statement.
Represents Objective-C's @throw statement.
Represents Objective-C's @try ... @catch ... @finally statement.
Represents Objective-C's @autoreleasepool Statement.
A runtime availability query.
ObjCBoolLiteralExpr - Objective-C Boolean Literal.
ObjCBoxedExpr - used for generalized expression boxing.
An Objective-C "bridged" cast expression, which casts between Objective-C pointers and C pointers,...
ObjCDictionaryLiteral - AST node to represent objective-c dictionary literals; as in:"name" : NSUserN...
ObjCEncodeExpr, used for @encode in Objective-C.
Represents Objective-C's collection statement.
ObjCIndirectCopyRestoreExpr - Represents the passing of a function argument by indirect copy-restore ...
Wrapper for source info for ObjC interfaces.
ObjCIsaExpr - Represent X->isa and X.isa when X is an ObjC 'id' type.
ObjCIvarDecl - Represents an ObjC instance variable.
ObjCIvarRefExpr - A reference to an ObjC instance variable.
An expression that sends a message to the given Objective-C object or class.
@ SuperInstance
The receiver is the instance of the superclass object.
@ Instance
The receiver is an object instance.
@ SuperClass
The receiver is a superclass.
@ Class
The receiver is a class.
ObjCMethodDecl - Represents an instance or class method declaration.
Wraps an ObjCPointerType with source location information.
void setStarLoc(SourceLocation Loc)
void setHasBaseTypeAsWritten(bool HasBaseType)
Represents one property declaration in an Objective-C interface.
ObjCPropertyRefExpr - A dot-syntax expression to access an ObjC property.
ObjCProtocolExpr used for protocol expression in Objective-C.
ObjCSelectorExpr used for @selector in Objective-C.
ObjCStringLiteral, used for Objective-C string literals i.e.
ObjCSubscriptRefExpr - used for array and dictionary subscripting.
Represents the declaration of an Objective-C type parameter.
ProtocolLAngleLoc, ProtocolRAngleLoc, and the source locations for protocol qualifiers are stored aft...
@ Array
An index into an array.
@ Identifier
A field in a dependent type, known only by its name.
@ Base
An implicit indirection through a C++ base class, when the field found is in a base class.
static OpaquePtr make(QualType P)
OpaqueValueExpr - An expression referring to an opaque object of a fixed type and value class.
Expr * getSourceExpr() const
The source expression of an opaque value expression is the expression which originally generated the ...
This expression type represents an asterisk in an OpenACC Size-Expr, used in the 'tile' and 'gang' cl...
static OpenACCAsyncClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *IntExpr, SourceLocation EndLoc)
static OpenACCAttachClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCAutoClause * Create(const ASTContext &Ctx, SourceLocation BeginLoc, SourceLocation EndLoc)
This is the base type for all OpenACC Clauses.
Represents a 'collapse' clause on a 'loop' construct.
static OpenACCCollapseClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, bool HasForce, Expr *LoopCount, SourceLocation EndLoc)
static OpenACCCopyClause * Create(const ASTContext &C, OpenACCClauseKind Spelling, SourceLocation BeginLoc, SourceLocation LParenLoc, OpenACCModifierKind Mods, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCCopyInClause * Create(const ASTContext &C, OpenACCClauseKind Spelling, SourceLocation BeginLoc, SourceLocation LParenLoc, OpenACCModifierKind Mods, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCCopyOutClause * Create(const ASTContext &C, OpenACCClauseKind Spelling, SourceLocation BeginLoc, SourceLocation LParenLoc, OpenACCModifierKind Mods, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCCreateClause * Create(const ASTContext &C, OpenACCClauseKind Spelling, SourceLocation BeginLoc, SourceLocation LParenLoc, OpenACCModifierKind Mods, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCDefaultAsyncClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *IntExpr, SourceLocation EndLoc)
A 'default' clause, has the optional 'none' or 'present' argument.
static OpenACCDefaultClause * Create(const ASTContext &C, OpenACCDefaultClauseKind K, SourceLocation BeginLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
static OpenACCDeleteClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCDetachClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCDeviceClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCDeviceNumClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *IntExpr, SourceLocation EndLoc)
static OpenACCDevicePtrClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
A 'device_type' or 'dtype' clause, takes a list of either an 'asterisk' or an identifier.
static OpenACCDeviceTypeClause * Create(const ASTContext &C, OpenACCClauseKind K, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< DeviceTypeArgument > Archs, SourceLocation EndLoc)
static OpenACCFinalizeClause * Create(const ASTContext &Ctx, SourceLocation BeginLoc, SourceLocation EndLoc)
static OpenACCFirstPrivateClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, ArrayRef< OpenACCFirstPrivateRecipe > InitRecipes, SourceLocation EndLoc)
static OpenACCHostClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
An 'if' clause, which has a required condition expression.
static OpenACCIfClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *ConditionExpr, SourceLocation EndLoc)
static OpenACCIfPresentClause * Create(const ASTContext &Ctx, SourceLocation BeginLoc, SourceLocation EndLoc)
static OpenACCIndependentClause * Create(const ASTContext &Ctx, SourceLocation BeginLoc, SourceLocation EndLoc)
static OpenACCNoCreateClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCNumGangsClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > IntExprs, SourceLocation EndLoc)
static OpenACCNumWorkersClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *IntExpr, SourceLocation EndLoc)
static OpenACCPresentClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCPrivateClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, ArrayRef< OpenACCPrivateRecipe > InitRecipes, SourceLocation EndLoc)
A 'self' clause, which has an optional condition expression, or, in the event of an 'update' directiv...
static OpenACCSelfClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *ConditionExpr, SourceLocation EndLoc)
static OpenACCSeqClause * Create(const ASTContext &Ctx, SourceLocation BeginLoc, SourceLocation EndLoc)
static OpenACCTileClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > SizeExprs, SourceLocation EndLoc)
static OpenACCUseDeviceClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCVectorClause * Create(const ASTContext &Ctx, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *IntExpr, SourceLocation EndLoc)
static OpenACCVectorLengthClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *IntExpr, SourceLocation EndLoc)
static OpenACCWaitClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *DevNumExpr, SourceLocation QueuesLoc, ArrayRef< Expr * > QueueIdExprs, SourceLocation EndLoc)
static OpenACCWorkerClause * Create(const ASTContext &Ctx, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *IntExpr, SourceLocation EndLoc)
A reference to an overloaded function set, either an UnresolvedLookupExpr or an UnresolvedMemberExpr.
bool hasExplicitTemplateArgs() const
Determines whether this expression had explicit template arguments.
SourceLocation getLAngleLoc() const
Retrieve the location of the left angle bracket starting the explicit template argument list followin...
SourceLocation getNameLoc() const
Gets the location of the name.
SourceLocation getTemplateKeywordLoc() const
Retrieve the location of the template keyword preceding this name, if any.
NestedNameSpecifierLoc getQualifierLoc() const
Fetches the nested-name qualifier with source-location information, if one was given.
TemplateArgumentLoc const * getTemplateArgs() const
llvm::iterator_range< decls_iterator > decls() const
unsigned getNumTemplateArgs() const
DeclarationName getName() const
Gets the name looked up.
SourceLocation getRAngleLoc() const
Retrieve the location of the right angle bracket ending the explicit template argument list following...
bool hasTemplateKeyword() const
Determines whether the name was preceded by the template keyword.
Represents a C++11 pack expansion that produces a sequence of expressions.
void setEllipsisLoc(SourceLocation Loc)
SourceLocation getEllipsisLoc() const
TypeLoc getPatternLoc() const
void setEllipsisLoc(SourceLocation Loc)
ParenExpr - This represents a parenthesized expression, e.g.
SourceLocation getLParen() const
Get the location of the left parentheses '('.
SourceLocation getRParen() const
Get the location of the right parentheses ')'.
void setLParenLoc(SourceLocation Loc)
Represents a parameter to a function.
unsigned getFunctionScopeIndex() const
Returns the index of this parameter in its prototype or method scope.
void setScopeInfo(unsigned scopeDepth, unsigned parameterIndex)
static ParmVarDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, const IdentifierInfo *Id, QualType T, TypeSourceInfo *TInfo, StorageClass S, Expr *DefArg)
unsigned getFunctionScopeDepth() const
void setKWLoc(SourceLocation Loc)
Pointer-authentication qualifiers.
void setSigilLoc(SourceLocation Loc)
TypeLoc getPointeeLoc() const
SourceLocation getSigilLoc() const
Wrapper for source info for pointers.
PointerType - C99 6.7.5.1 - Pointer Declarators.
[C99 6.4.2.2] - A predefined identifier such as func.
Stores the type being destroyed by a pseudo-destructor expression.
const IdentifierInfo * getIdentifier() const
SourceLocation getLocation() const
TypeSourceInfo * getTypeSourceInfo() const
PseudoObjectExpr - An expression which accesses a pseudo-object l-value.
A (possibly-)qualified type.
bool isNull() const
Return true if this QualType doesn't point to a type yet.
const Type * getTypePtr() const
Retrieves a pointer to the underlying (unqualified) type.
Qualifiers getQualifiers() const
Retrieve the set of qualifiers applied to this type.
QualType getUnqualifiedType() const
Retrieve the unqualified variant of the given type, removing as little sugar as possible.
Qualifiers getLocalQualifiers() const
Retrieve the set of qualifiers local to this particular QualType instance, not including any qualifie...
Represents a template name as written in source code.
Wrapper of type source information for a type with non-trivial direct qualifiers.
The collection of all-type qualifiers we support.
void removeObjCLifetime()
static Qualifiers fromCVRMask(unsigned CVR)
PointerAuthQualifier getPointerAuth() const
bool hasObjCLifetime() const
LangAS getAddressSpace() const
Frontend produces RecoveryExprs on semantic errors that prevent creating other well-formed expression...
Base for LValueReferenceType and RValueReferenceType.
QualType getPointeeTypeAsWritten() const
Represents the body of a requires-expression.
static RequiresExprBodyDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc)
C++2a [expr.prim.req]: A requires-expression provides a concise way to express requirements on templa...
static RequiresExpr * Create(ASTContext &C, SourceLocation RequiresKWLoc, RequiresExprBodyDecl *Body, SourceLocation LParenLoc, ArrayRef< ParmVarDecl * > LocalParameters, SourceLocation RParenLoc, ArrayRef< concepts::Requirement * > Requirements, SourceLocation RBraceLoc)
ReturnStmt - This represents a return, optionally of an expression: return; return 4;.
static SEHFinallyStmt * Create(const ASTContext &C, SourceLocation FinallyLoc, Stmt *Block)
Represents a __leave statement.
SYCLKernelCallStmt represents the transformation that is applied to the body of a function declared w...
Smart pointer class that efficiently represents Objective-C method names.
SemaDiagnosticBuilder Diag(SourceLocation Loc, unsigned DiagID)
Emit a diagnostic.
VarDecl * BuildObjCExceptionDecl(TypeSourceInfo *TInfo, QualType ExceptionType, SourceLocation StartLoc, SourceLocation IdLoc, const IdentifierInfo *Id, bool Invalid=false)
Build a type-check a new Objective-C exception variable declaration.
StmtResult ActOnObjCForCollectionStmt(SourceLocation ForColLoc, Stmt *First, Expr *collection, SourceLocation RParenLoc)
StmtResult FinishObjCForCollectionStmt(Stmt *ForCollection, Stmt *Body)
FinishObjCForCollectionStmt - Attach the body to a objective-C foreach statement.
ExprResult BuildObjCDictionaryLiteral(SourceRange SR, MutableArrayRef< ObjCDictionaryElement > Elements)
StmtResult ActOnObjCAtSynchronizedStmt(SourceLocation AtLoc, Expr *SynchExpr, Stmt *SynchBody)
ExprResult BuildObjCArrayLiteral(SourceRange SR, MultiExprArg Elements)
ExprResult BuildObjCBoxedExpr(SourceRange SR, Expr *ValueExpr)
BuildObjCBoxedExpr - builds an ObjCBoxedExpr AST node for the '@' prefixed parenthesized expression.
StmtResult ActOnObjCAtTryStmt(SourceLocation AtLoc, Stmt *Try, MultiStmtArg Catch, Stmt *Finally)
StmtResult ActOnObjCAtFinallyStmt(SourceLocation AtLoc, Stmt *Body)
StmtResult BuildObjCAtThrowStmt(SourceLocation AtLoc, Expr *Throw)
ExprResult ActOnObjCAtSynchronizedOperand(SourceLocation atLoc, Expr *operand)
ExprResult BuildObjCBridgedCast(SourceLocation LParenLoc, ObjCBridgeCastKind Kind, SourceLocation BridgeKeywordLoc, TypeSourceInfo *TSInfo, Expr *SubExpr)
StmtResult ActOnObjCAtCatchStmt(SourceLocation AtLoc, SourceLocation RParen, Decl *Parm, Stmt *Body)
StmtResult ActOnObjCAutoreleasePoolStmt(SourceLocation AtLoc, Stmt *Body)
ExprResult BuildObjCSubscriptExpression(SourceLocation RB, Expr *BaseExpr, Expr *IndexExpr, ObjCMethodDecl *getterMethod, ObjCMethodDecl *setterMethod)
Build an ObjC subscript pseudo-object expression, given that that's supported by the runtime.
Helper type for the registration/assignment of constructs that need to 'know' about their parent cons...
Helper type to restore the state of various 'loop' constructs when we run into a loop (for,...
A type to represent all the data for an OpenACC Clause that has been parsed, but not yet created/sema...
void ActOnWhileStmt(SourceLocation WhileLoc)
ExprResult ActOnOpenACCAsteriskSizeExpr(SourceLocation AsteriskLoc)
void ActOnDoStmt(SourceLocation DoLoc)
void ActOnRangeForStmtBegin(SourceLocation ForLoc, const Stmt *OldRangeFor, const Stmt *RangeFor)
StmtResult ActOnEndStmtDirective(OpenACCDirectiveKind K, SourceLocation StartLoc, SourceLocation DirLoc, SourceLocation LParenLoc, SourceLocation MiscLoc, ArrayRef< Expr * > Exprs, OpenACCAtomicKind AK, SourceLocation RParenLoc, SourceLocation EndLoc, ArrayRef< OpenACCClause * > Clauses, StmtResult AssocStmt)
Called after the directive has been completely parsed, including the declaration group or associated ...
void ActOnForStmtEnd(SourceLocation ForLoc, StmtResult Body)
void ActOnForStmtBegin(SourceLocation ForLoc, const Stmt *First, const Stmt *Second, const Stmt *Third)
ExprResult ActOnArraySectionExpr(Expr *Base, SourceLocation LBLoc, Expr *LowerBound, SourceLocation ColonLocFirst, Expr *Length, SourceLocation RBLoc)
Checks and creates an Array Section used in an OpenACC construct/clause.
OMPClause * ActOnOpenMPNocontextClause(Expr *Condition, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'nocontext' clause.
OMPClause * ActOnOpenMPXDynCGroupMemClause(Expr *Size, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on a well-formed 'ompx_dyn_cgroup_mem' clause.
OMPClause * ActOnOpenMPSafelenClause(Expr *Length, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'safelen' clause.
OMPClause * ActOnOpenMPHoldsClause(Expr *E, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'holds' clause.
OMPClause * ActOnOpenMPFilterClause(Expr *ThreadID, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'filter' clause.
OMPClause * ActOnOpenMPFullClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-form 'full' clauses.
OMPClause * ActOnOpenMPDetachClause(Expr *Evt, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'detach' clause.
OMPClause * ActOnOpenMPUseClause(Expr *InteropVar, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation VarLoc, SourceLocation EndLoc)
Called on well-formed 'use' clause.
OMPClause * ActOnOpenMPToClause(ArrayRef< OpenMPMotionModifierKind > MotionModifiers, ArrayRef< SourceLocation > MotionModifiersLoc, CXXScopeSpec &MapperIdScopeSpec, DeclarationNameInfo &MapperId, SourceLocation ColonLoc, ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs, ArrayRef< Expr * > UnresolvedMappers={})
Called on well-formed 'to' clause.
OMPClause * ActOnOpenMPPrivateClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'private' clause.
OMPClause * ActOnOpenMPOrderedClause(SourceLocation StartLoc, SourceLocation EndLoc, SourceLocation LParenLoc=SourceLocation(), Expr *NumForLoops=nullptr)
Called on well-formed 'ordered' clause.
OMPClause * ActOnOpenMPIsDevicePtrClause(ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs)
Called on well-formed 'is_device_ptr' clause.
OMPClause * ActOnOpenMPHasDeviceAddrClause(ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs)
Called on well-formed 'has_device_addr' clause.
OMPClause * ActOnOpenMPPartialClause(Expr *FactorExpr, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-form 'partial' clauses.
OMPClause * ActOnOpenMPLastprivateClause(ArrayRef< Expr * > VarList, OpenMPLastprivateModifier LPKind, SourceLocation LPKindLoc, SourceLocation ColonLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'lastprivate' clause.
OMPClause * ActOnOpenMPFirstprivateClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'firstprivate' clause.
OMPClause * ActOnOpenMPPriorityClause(Expr *Priority, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'priority' clause.
OMPClause * ActOnOpenMPDistScheduleClause(OpenMPDistScheduleClauseKind Kind, Expr *ChunkSize, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation KindLoc, SourceLocation CommaLoc, SourceLocation EndLoc)
Called on well-formed 'dist_schedule' clause.
OMPClause * ActOnOpenMPLoopRangeClause(Expr *First, Expr *Count, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation FirstLoc, SourceLocation CountLoc, SourceLocation EndLoc)
Called on well-form 'looprange' clause after parsing its arguments.
OMPClause * ActOnOpenMPPermutationClause(ArrayRef< Expr * > PermExprs, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-form 'permutation' clause after parsing its arguments.
OMPClause * ActOnOpenMPNontemporalClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'nontemporal' clause.
OMPClause * ActOnOpenMPFromClause(ArrayRef< OpenMPMotionModifierKind > MotionModifiers, ArrayRef< SourceLocation > MotionModifiersLoc, CXXScopeSpec &MapperIdScopeSpec, DeclarationNameInfo &MapperId, SourceLocation ColonLoc, ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs, ArrayRef< Expr * > UnresolvedMappers={})
Called on well-formed 'from' clause.
OMPClause * ActOnOpenMPBindClause(OpenMPBindClauseKind Kind, SourceLocation KindLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on a well-formed 'bind' clause.
OMPClause * ActOnOpenMPThreadLimitClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'thread_limit' clause.
OMPClause * ActOnOpenMPSharedClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'shared' clause.
OMPClause * ActOnOpenMPCopyinClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'copyin' clause.
OMPClause * ActOnOpenMPDestroyClause(Expr *InteropVar, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation VarLoc, SourceLocation EndLoc)
Called on well-formed 'destroy' clause.
OMPClause * ActOnOpenMPAffinityClause(SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc, Expr *Modifier, ArrayRef< Expr * > Locators)
Called on well-formed 'affinity' clause.
OMPClause * ActOnOpenMPNumTeamsClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'num_teams' clause.
OMPClause * ActOnOpenMPDependClause(const OMPDependClause::DependDataTy &Data, Expr *DepModifier, ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'depend' clause.
OMPClause * ActOnOpenMPDoacrossClause(OpenMPDoacrossClauseModifier DepType, SourceLocation DepLoc, SourceLocation ColonLoc, ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'doacross' clause.
OMPClause * ActOnOpenMPGrainsizeClause(OpenMPGrainsizeClauseModifier Modifier, Expr *Size, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ModifierLoc, SourceLocation EndLoc)
Called on well-formed 'grainsize' clause.
ExprResult ActOnOMPArraySectionExpr(Expr *Base, SourceLocation LBLoc, Expr *LowerBound, SourceLocation ColonLocFirst, SourceLocation ColonLocSecond, Expr *Length, Expr *Stride, SourceLocation RBLoc)
ExprResult ActOnOMPIteratorExpr(Scope *S, SourceLocation IteratorKwLoc, SourceLocation LLoc, SourceLocation RLoc, ArrayRef< OMPIteratorData > Data)
OMPClause * ActOnOpenMPUsesAllocatorClause(SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc, ArrayRef< UsesAllocatorsData > Data)
Called on well-formed 'uses_allocators' clause.
OMPClause * ActOnOpenMPAllocatorClause(Expr *Allocator, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'allocator' clause.
OMPClause * ActOnOpenMPInclusiveClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'inclusive' clause.
OMPClause * ActOnOpenMPTaskReductionClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc, CXXScopeSpec &ReductionIdScopeSpec, const DeclarationNameInfo &ReductionId, ArrayRef< Expr * > UnresolvedReductions={})
Called on well-formed 'task_reduction' clause.
OMPClause * 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.
void StartOpenMPDSABlock(OpenMPDirectiveKind K, const DeclarationNameInfo &DirName, Scope *CurScope, SourceLocation Loc)
Called on start of new data sharing attribute block.
OMPClause * ActOnOpenMPSeverityClause(OpenMPSeverityClauseKind Kind, SourceLocation KindLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'severity' clause.
OMPClause * ActOnOpenMPLinearClause(ArrayRef< Expr * > VarList, Expr *Step, SourceLocation StartLoc, SourceLocation LParenLoc, OpenMPLinearClauseKind LinKind, SourceLocation LinLoc, SourceLocation ColonLoc, SourceLocation StepModifierLoc, SourceLocation EndLoc)
Called on well-formed 'linear' clause.
OMPClause * ActOnOpenMPDefaultmapClause(OpenMPDefaultmapClauseModifier M, OpenMPDefaultmapClauseKind Kind, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation MLoc, SourceLocation KindLoc, SourceLocation EndLoc)
Called on well-formed 'defaultmap' clause.
OMPClause * ActOnOpenMPReductionClause(ArrayRef< Expr * > VarList, OpenMPVarListDataTy::OpenMPReductionClauseModifiers Modifiers, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ModifierLoc, SourceLocation ColonLoc, SourceLocation EndLoc, CXXScopeSpec &ReductionIdScopeSpec, const DeclarationNameInfo &ReductionId, ArrayRef< Expr * > UnresolvedReductions={})
Called on well-formed 'reduction' clause.
OMPClause * ActOnOpenMPAlignedClause(ArrayRef< Expr * > VarList, Expr *Alignment, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc)
Called on well-formed 'aligned' clause.
OMPClause * ActOnOpenMPDepobjClause(Expr *Depobj, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'depobj' pseudo clause.
OMPClause * ActOnOpenMPNovariantsClause(Expr *Condition, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'novariants' clause.
OMPClause * ActOnOpenMPCopyprivateClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'copyprivate' clause.
OMPClause * ActOnOpenMPCollapseClause(Expr *NumForLoops, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'collapse' clause.
OMPClause * ActOnOpenMPDefaultClause(llvm::omp::DefaultKind M, SourceLocation MLoc, OpenMPDefaultClauseVariableCategory VCKind, SourceLocation VCKindLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'default' clause.
OMPClause * ActOnOpenMPAlignClause(Expr *Alignment, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'align' clause.
OMPClause * ActOnOpenMPXAttributeClause(ArrayRef< const Attr * > Attrs, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on a well-formed 'ompx_attribute' clause.
OMPClause * ActOnOpenMPExclusiveClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'exclusive' clause.
OMPClause * ActOnOpenMPIfClause(OpenMPDirectiveKind NameModifier, Expr *Condition, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation NameModifierLoc, SourceLocation ColonLoc, SourceLocation EndLoc)
Called on well-formed 'if' clause.
Expr * recreateSyntacticForm(PseudoObjectExpr *E)
Given a pseudo-object expression, recreate what it looks like syntactically without the attendant Opa...
ExprResult checkRValue(Expr *E)
ExprResult BuildUniqueStableNameExpr(SourceLocation OpLoc, SourceLocation LParen, SourceLocation RParen, TypeSourceInfo *TSI)
RAII object used to change the argument pack substitution index within a Sema object.
RAII object used to temporarily allow the C++ 'this' expression to be used, with the given qualifiers...
A RAII object to enter scope of a compound statement.
A helper class for building up ExtParameterInfos.
const FunctionProtoType::ExtParameterInfo * getPointerOrNull(unsigned numParams)
Return a pointer (suitable for setting in an ExtProtoInfo) to the ExtParameterInfo array we've built ...
void set(unsigned index, FunctionProtoType::ExtParameterInfo info)
Set the ExtParameterInfo for the parameter at the given index,.
Records and restores the CurFPFeatures state on entry/exit of compound statements.
Sema - This implements semantic analysis and AST building for C.
ParsedType CreateParsedType(QualType T, TypeSourceInfo *TInfo)
Package the given type and TSI into a ParsedType.
ExprResult ActOnCXXParenListInitExpr(ArrayRef< Expr * > Args, QualType T, unsigned NumUserSpecifiedExprs, SourceLocation InitLoc, SourceLocation LParenLoc, SourceLocation RParenLoc)
ExprResult BuildOperatorCoawaitCall(SourceLocation Loc, Expr *E, UnresolvedLookupExpr *Lookup)
Build a call to 'operator co_await' if there is a suitable operator for the given expression.
ExprResult BuildMemberReferenceExpr(Expr *Base, QualType BaseType, SourceLocation OpLoc, bool IsArrow, CXXScopeSpec &SS, SourceLocation TemplateKWLoc, NamedDecl *FirstQualifierInScope, const DeclarationNameInfo &NameInfo, const TemplateArgumentListInfo *TemplateArgs, const Scope *S, ActOnMemberAccessExtraArgs *ExtraArgs=nullptr)
StmtResult BuildMSDependentExistsStmt(SourceLocation KeywordLoc, bool IsIfExists, NestedNameSpecifierLoc QualifierLoc, DeclarationNameInfo NameInfo, Stmt *Nested)
@ LookupOrdinaryName
Ordinary name lookup, which finds ordinary names (functions, variables, typedefs, etc....
@ LookupMemberName
Member name lookup, which finds the names of class/struct/union members.
@ LookupTagName
Tag name lookup, which finds the names of enums, classes, structs, and unions.
bool checkFinalSuspendNoThrow(const Stmt *FinalSuspend)
Check that the expression co_await promise.final_suspend() shall not be potentially-throwing.
ExprResult ActOnConstantExpression(ExprResult Res)
StmtResult ActOnMSAsmStmt(SourceLocation AsmLoc, SourceLocation LBraceLoc, ArrayRef< Token > AsmToks, StringRef AsmString, unsigned NumOutputs, unsigned NumInputs, ArrayRef< StringRef > Constraints, ArrayRef< StringRef > Clobbers, ArrayRef< Expr * > Exprs, SourceLocation EndLoc)
StmtResult BuildCoroutineBodyStmt(CoroutineBodyStmt::CtorArgs)
ExprResult BuildCoyieldExpr(SourceLocation KwLoc, Expr *E)
void ActOnStartStmtExpr()
void ActOnStmtExprError()
void MarkDeclarationsReferencedInExpr(Expr *E, bool SkipLocalVariables=false, ArrayRef< const Expr * > StopAt={})
Mark any declarations that appear within this expression or any potentially-evaluated subexpressions ...
VarDecl * buildCoroutinePromise(SourceLocation Loc)
ExprResult CheckBooleanCondition(SourceLocation Loc, Expr *E, bool IsConstexpr=false)
CheckBooleanCondition - Diagnose problems involving the use of the given expression as a boolean cond...
@ Boolean
A boolean condition, from 'if', 'while', 'for', or 'do'.
@ Switch
An integral condition for a 'switch' statement.
@ ConstexprIf
A constant boolean condition from 'if constexpr'.
ExprResult BuildSubstNonTypeTemplateParmExpr(Decl *AssociatedDecl, const NonTypeTemplateParmDecl *NTTP, SourceLocation loc, TemplateArgument Replacement, UnsignedOrNone PackIndex, bool Final)
ExprResult BuildBuiltinBitCastExpr(SourceLocation KWLoc, TypeSourceInfo *TSI, Expr *Operand, SourceLocation RParenLoc)
StmtResult ActOnGotoStmt(SourceLocation GotoLoc, SourceLocation LabelLoc, LabelDecl *TheDecl)
ExprResult MaybeBindToTemporary(Expr *E)
MaybeBindToTemporary - If the passed in expression has a record type with a non-trivial destructor,...
StmtResult BuildCoreturnStmt(SourceLocation KwLoc, Expr *E, bool IsImplicit=false)
ExprResult ActOnStartCXXMemberReference(Scope *S, Expr *Base, SourceLocation OpLoc, tok::TokenKind OpKind, ParsedType &ObjectType, bool &MayBePseudoDestructor)
ExprResult ActOnCaseExpr(SourceLocation CaseLoc, ExprResult Val)
ExprResult BuildStmtExpr(SourceLocation LPLoc, Stmt *SubStmt, SourceLocation RPLoc, unsigned TemplateDepth)
ExprResult BuildResolvedCoawaitExpr(SourceLocation KwLoc, Expr *Operand, Expr *Awaiter, bool IsImplicit=false)
ExprResult BuildVAArgExpr(SourceLocation BuiltinLoc, Expr *E, TypeSourceInfo *TInfo, SourceLocation RPLoc)
@ CTAK_Specified
The template argument was specified in the code or was instantiated with some deduced template argume...
ExprResult ActOnCXXDelete(SourceLocation StartLoc, bool UseGlobal, bool ArrayForm, Expr *Operand)
ActOnCXXDelete - Parsed a C++ 'delete' expression (C++ 5.3.5), as in:
ExprResult BuildCXXTypeId(QualType TypeInfoType, SourceLocation TypeidLoc, TypeSourceInfo *Operand, SourceLocation RParenLoc)
Build a C++ typeid expression with a type operand.
ExprResult PerformMemberExprBaseConversion(Expr *Base, bool IsArrow)
Perform conversions on the LHS of a member access expression.
DiagnosticsEngine & getDiagnostics() const
ExprResult BuildPackIndexingExpr(Expr *PackExpression, SourceLocation EllipsisLoc, Expr *IndexExpr, SourceLocation RSquareLoc, ArrayRef< Expr * > ExpandedExprs={}, bool FullySubstituted=false)
ParsedType getDestructorName(const IdentifierInfo &II, SourceLocation NameLoc, Scope *S, CXXScopeSpec &SS, ParsedType ObjectType, bool EnteringContext)
ASTContext & getASTContext() const
CXXDestructorDecl * LookupDestructor(CXXRecordDecl *Class)
Look for the destructor of the given class.
ExprResult BuildUnaryOp(Scope *S, SourceLocation OpLoc, UnaryOperatorKind Opc, Expr *Input, bool IsAfterAmp=false)
ExprResult BuildTemplateIdExpr(const CXXScopeSpec &SS, SourceLocation TemplateKWLoc, LookupResult &R, bool RequiresADL, const TemplateArgumentListInfo *TemplateArgs)
ExprResult CreateOverloadedBinOp(SourceLocation OpLoc, BinaryOperatorKind Opc, const UnresolvedSetImpl &Fns, Expr *LHS, Expr *RHS, bool RequiresADL=true, bool AllowRewrittenCandidates=true, FunctionDecl *DefaultedFn=nullptr)
Create a binary operation that may resolve to an overloaded operator.
StmtResult ActOnSEHTryBlock(bool IsCXXTry, SourceLocation TryLoc, Stmt *TryBlock, Stmt *Handler)
ExprResult BuildPredefinedExpr(SourceLocation Loc, PredefinedIdentKind IK)
ExprResult CheckConceptTemplateId(const CXXScopeSpec &SS, SourceLocation TemplateKWLoc, const DeclarationNameInfo &ConceptNameInfo, NamedDecl *FoundDecl, TemplateDecl *NamedConcept, const TemplateArgumentListInfo *TemplateArgs, bool DoCheckConstraintSatisfaction=true)
ExprResult BuildCompoundLiteralExpr(SourceLocation LParenLoc, TypeSourceInfo *TInfo, SourceLocation RParenLoc, Expr *LiteralExpr)
ExprResult ActOnAddrLabel(SourceLocation OpLoc, SourceLocation LabLoc, LabelDecl *TheDecl)
ActOnAddrLabel - Parse the GNU address of label extension: "&&foo".
ExprResult ActOnParenListExpr(SourceLocation L, SourceLocation R, MultiExprArg Val)
QualType BuildCountAttributedArrayOrPointerType(QualType WrappedTy, Expr *CountExpr, bool CountInBytes, bool OrNull)
ExprResult BuildCXXNew(SourceRange Range, bool UseGlobal, SourceLocation PlacementLParen, MultiExprArg PlacementArgs, SourceLocation PlacementRParen, SourceRange TypeIdParens, QualType AllocType, TypeSourceInfo *AllocTypeInfo, std::optional< Expr * > ArraySize, SourceRange DirectInitRange, Expr *Initializer)
DeclRefExpr * BuildDeclRefExpr(ValueDecl *D, QualType Ty, ExprValueKind VK, SourceLocation Loc, const CXXScopeSpec *SS=nullptr)
ExprResult BuildCXXFoldExpr(UnresolvedLookupExpr *Callee, SourceLocation LParenLoc, Expr *LHS, BinaryOperatorKind Operator, SourceLocation EllipsisLoc, Expr *RHS, SourceLocation RParenLoc, UnsignedOrNone NumExpansions)
ExprResult CreateGenericSelectionExpr(SourceLocation KeyLoc, SourceLocation DefaultLoc, SourceLocation RParenLoc, bool PredicateIsExpr, void *ControllingExprOrType, ArrayRef< TypeSourceInfo * > Types, ArrayRef< Expr * > Exprs)
ControllingExprOrType is either a TypeSourceInfo * or an Expr *.
bool CheckTemplateArgument(NamedDecl *Param, TemplateArgumentLoc &Arg, NamedDecl *Template, SourceLocation TemplateLoc, SourceLocation RAngleLoc, unsigned ArgumentPackIndex, CheckTemplateArgumentInfo &CTAI, CheckTemplateArgumentKind CTAK)
Check that the given template argument corresponds to the given template parameter.
StmtResult ActOnFinishSwitchStmt(SourceLocation SwitchLoc, Stmt *Switch, Stmt *Body)
SourceLocation getLocForEndOfToken(SourceLocation Loc, unsigned Offset=0)
Calls Lexer::getLocForEndOfToken()
const LangOptions & getLangOpts() const
StmtResult ActOnWhileStmt(SourceLocation WhileLoc, SourceLocation LParenLoc, ConditionResult Cond, SourceLocation RParenLoc, Stmt *Body)
bool isPotentialImplicitMemberAccess(const CXXScopeSpec &SS, LookupResult &R, bool IsAddressOfOperand)
Check whether an expression might be an implicit class member access.
void collectUnexpandedParameterPacks(TemplateArgument Arg, SmallVectorImpl< UnexpandedParameterPack > &Unexpanded)
Collect the set of unexpanded parameter packs within the given template argument.
ExprResult BuildSourceLocExpr(SourceLocIdentKind Kind, QualType ResultTy, SourceLocation BuiltinLoc, SourceLocation RPLoc, DeclContext *ParentContext)
ExprResult BuildCXXTypeConstructExpr(TypeSourceInfo *Type, SourceLocation LParenLoc, MultiExprArg Exprs, SourceLocation RParenLoc, bool ListInitialization)
ExprResult BuildBuiltinOffsetOf(SourceLocation BuiltinLoc, TypeSourceInfo *TInfo, ArrayRef< OffsetOfComponent > Components, SourceLocation RParenLoc)
__builtin_offsetof(type, a.b[123][456].c)
ExprResult TemporaryMaterializationConversion(Expr *E)
If E is a prvalue denoting an unmaterialized temporary, materialize it as an xvalue.
ExprResult BuildTypeTrait(TypeTrait Kind, SourceLocation KWLoc, ArrayRef< TypeSourceInfo * > Args, SourceLocation RParenLoc)
TemplateArgument getPackSubstitutedTemplateArgument(TemplateArgument Arg) const
ExprResult BuildUnresolvedCoawaitExpr(SourceLocation KwLoc, Expr *Operand, UnresolvedLookupExpr *Lookup)
ExprResult BuildExpressionTrait(ExpressionTrait OET, SourceLocation KWLoc, Expr *Queried, SourceLocation RParen)
bool buildCoroutineParameterMoves(SourceLocation Loc)
ExprResult BuildCStyleCastExpr(SourceLocation LParenLoc, TypeSourceInfo *Ty, SourceLocation RParenLoc, Expr *Op)
ExprResult BuildCXXUuidof(QualType TypeInfoType, SourceLocation TypeidLoc, TypeSourceInfo *Operand, SourceLocation RParenLoc)
Build a Microsoft __uuidof expression with a type operand.
sema::FunctionScopeInfo * getCurFunction() const
DeclGroupPtrTy BuildDeclaratorGroup(MutableArrayRef< Decl * > Group)
BuildDeclaratorGroup - convert a list of declarations into a declaration group, performing any necess...
Expr * BuildCXXThisExpr(SourceLocation Loc, QualType Type, bool IsImplicit)
Build a CXXThisExpr and mark it referenced in the current context.
UnsignedOrNone getPackIndex(TemplateArgument Pack) const
ExprResult BuildDeclarationNameExpr(const CXXScopeSpec &SS, LookupResult &R, bool NeedsADL, bool AcceptInvalidDecl=false)
sema::BlockScopeInfo * getCurBlock()
Retrieve the current block, if any.
DeclContext * CurContext
CurContext - This is the current declaration context of parsing.
VarDecl * BuildExceptionDeclaration(Scope *S, TypeSourceInfo *TInfo, SourceLocation StartLoc, SourceLocation IdLoc, const IdentifierInfo *Id)
Perform semantic analysis for the variable declaration that occurs within a C++ catch clause,...
void MarkDeclRefReferenced(DeclRefExpr *E, const Expr *Base=nullptr)
Perform reference-marking and odr-use handling for a DeclRefExpr.
ExprResult BuildQualifiedDeclarationNameExpr(CXXScopeSpec &SS, const DeclarationNameInfo &NameInfo, bool IsAddressOfOperand, TypeSourceInfo **RecoveryTSI=nullptr)
BuildQualifiedDeclarationNameExpr - Build a C++ qualified declaration name, generally during template...
StmtResult ActOnForStmt(SourceLocation ForLoc, SourceLocation LParenLoc, Stmt *First, ConditionResult Second, FullExprArg Third, SourceLocation RParenLoc, Stmt *Body)
StmtResult ActOnIndirectGotoStmt(SourceLocation GotoLoc, SourceLocation StarLoc, Expr *DestExp)
ExprResult ActOnParenExpr(SourceLocation L, SourceLocation R, Expr *E)
ExprResult BuildCXXConstructExpr(SourceLocation ConstructLoc, QualType DeclInitType, NamedDecl *FoundDecl, CXXConstructorDecl *Constructor, MultiExprArg Exprs, bool HadMultipleCandidates, bool IsListInitialization, bool IsStdInitListInitialization, bool RequiresZeroInit, CXXConstructionKind ConstructKind, SourceRange ParenRange)
BuildCXXConstructExpr - Creates a complete call to a constructor, including handling of its default a...
ExprResult BuildAsTypeExpr(Expr *E, QualType DestTy, SourceLocation BuiltinLoc, SourceLocation RParenLoc)
Create a new AsTypeExpr node (bitcast) from the arguments.
ExprResult BuildFieldReferenceExpr(Expr *BaseExpr, bool IsArrow, SourceLocation OpLoc, const CXXScopeSpec &SS, FieldDecl *Field, DeclAccessPair FoundDecl, const DeclarationNameInfo &MemberNameInfo)
ExprResult ActOnConditionalOp(SourceLocation QuestionLoc, SourceLocation ColonLoc, Expr *CondExpr, Expr *LHSExpr, Expr *RHSExpr)
ActOnConditionalOp - Parse a ?
ExprResult BuildPossibleImplicitMemberExpr(const CXXScopeSpec &SS, SourceLocation TemplateKWLoc, LookupResult &R, const TemplateArgumentListInfo *TemplateArgs, const Scope *S)
Builds an expression which might be an implicit member expression.
UnsignedOrNone ArgPackSubstIndex
The current index into pack expansion arguments that will be used for substitution of parameter packs...
StmtResult BuildReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp, bool AllowRecovery=false)
StmtResult BuildCXXForRangeStmt(SourceLocation ForLoc, SourceLocation CoawaitLoc, Stmt *InitStmt, SourceLocation ColonLoc, Stmt *RangeDecl, Stmt *Begin, Stmt *End, Expr *Cond, Expr *Inc, Stmt *LoopVarDecl, SourceLocation RParenLoc, BuildForRangeKind Kind, ArrayRef< MaterializeTemporaryExpr * > LifetimeExtendTemps={})
BuildCXXForRangeStmt - Build or instantiate a C++11 for-range statement.
StmtResult ActOnDoStmt(SourceLocation DoLoc, Stmt *Body, SourceLocation WhileLoc, SourceLocation CondLParen, Expr *Cond, SourceLocation CondRParen)
StmtResult ActOnStartOfSwitchStmt(SourceLocation SwitchLoc, SourceLocation LParenLoc, Stmt *InitStmt, ConditionResult Cond, SourceLocation RParenLoc)
ExprResult BuildQualifiedTemplateIdExpr(CXXScopeSpec &SS, SourceLocation TemplateKWLoc, const DeclarationNameInfo &NameInfo, const TemplateArgumentListInfo *TemplateArgs, bool IsAddressOfOperand)
@ ConstantEvaluated
The current context is "potentially evaluated" in C++11 terms, but the expression is evaluated at com...
@ PotentiallyEvaluated
The current expression is potentially evaluated at run time, which means that code may be generated t...
@ Unevaluated
The current expression and its subexpressions occur within an unevaluated operand (C++11 [expr]p7),...
@ ImmediateFunctionContext
In addition of being constant evaluated, the current expression occurs in an immediate function conte...
StmtResult ActOnSEHExceptBlock(SourceLocation Loc, Expr *FilterExpr, Stmt *Block)
ExprResult CreateUnaryExprOrTypeTraitExpr(TypeSourceInfo *TInfo, SourceLocation OpLoc, UnaryExprOrTypeTrait ExprKind, SourceRange R)
Build a sizeof or alignof expression given a type operand.
StmtResult ActOnDeclStmt(DeclGroupPtrTy Decl, SourceLocation StartLoc, SourceLocation EndLoc)
ExprResult PerformObjectMemberConversion(Expr *From, NestedNameSpecifier Qualifier, NamedDecl *FoundDecl, NamedDecl *Member)
Cast a base object to a member's actual type.
Expr * MaybeCreateExprWithCleanups(Expr *SubExpr)
MaybeCreateExprWithCleanups - If the current full-expression requires any cleanups,...
SmallVector< ExpressionEvaluationContextRecord, 8 > ExprEvalContexts
A stack of expression evaluation contexts.
ExprResult BuildEmptyCXXFoldExpr(SourceLocation EllipsisLoc, BinaryOperatorKind Operator)
ExprResult BuildCXXThrow(SourceLocation OpLoc, Expr *Ex, bool IsThrownVarInScope)
ExprResult BuildBinOp(Scope *S, SourceLocation OpLoc, BinaryOperatorKind Opc, Expr *LHSExpr, Expr *RHSExpr, bool ForFoldExpression=false)
ExprResult BuildCXXDefaultInitExpr(SourceLocation Loc, FieldDecl *Field)
ExprResult BuildLambdaExpr(SourceLocation StartLoc, SourceLocation EndLoc)
Complete a lambda-expression having processed and attached the lambda body.
@ BFRK_Rebuild
Instantiation or recovery rebuild of a for-range statement.
void ActOnCaseStmtBody(Stmt *CaseStmt, Stmt *SubStmt)
ActOnCaseStmtBody - This installs a statement as the body of a case.
ExprResult ActOnBlockStmtExpr(SourceLocation CaretLoc, Stmt *Body, Scope *CurScope)
ActOnBlockStmtExpr - This is called when the body of a block statement literal was successfully compl...
ExprResult BuildArrayTypeTrait(ArrayTypeTrait ATT, SourceLocation KWLoc, TypeSourceInfo *TSInfo, Expr *DimExpr, SourceLocation RParen)
void MarkMemberReferenced(MemberExpr *E)
Perform reference-marking and odr-use handling for a MemberExpr.
ExprResult BuildCXXNamedCast(SourceLocation OpLoc, tok::TokenKind Kind, TypeSourceInfo *Ty, Expr *E, SourceRange AngleBrackets, SourceRange Parens)
void MarkFunctionReferenced(SourceLocation Loc, FunctionDecl *Func, bool MightBeOdrUse=true)
Mark a function referenced, and check whether it is odr-used (C++ [basic.def.odr]p2,...
ExprResult CreateRecoveryExpr(SourceLocation Begin, SourceLocation End, ArrayRef< Expr * > SubExprs, QualType T=QualType())
Attempts to produce a RecoveryExpr after some AST node cannot be created.
ExprResult ActOnGCCAsmStmtString(Expr *Stm, bool ForAsmLabel)
StmtResult ActOnIfStmt(SourceLocation IfLoc, IfStatementKind StatementKind, SourceLocation LParenLoc, Stmt *InitStmt, ConditionResult Cond, SourceLocation RParenLoc, Stmt *ThenVal, SourceLocation ElseLoc, Stmt *ElseVal)
void ActOnBlockStart(SourceLocation CaretLoc, Scope *CurScope)
ActOnBlockStart - This callback is invoked when a block literal is started.
ExprResult ActOnArraySubscriptExpr(Scope *S, Expr *Base, SourceLocation LLoc, MultiExprArg ArgExprs, SourceLocation RLoc)
ExprResult BuildAtomicExpr(SourceRange CallRange, SourceRange ExprRange, SourceLocation RParenLoc, MultiExprArg Args, AtomicExpr::AtomicOp Op, AtomicArgumentOrder ArgOrder=AtomicArgumentOrder::API)
ExprResult ActOnCallExpr(Scope *S, Expr *Fn, SourceLocation LParenLoc, MultiExprArg ArgExprs, SourceLocation RParenLoc, Expr *ExecConfig=nullptr)
ActOnCallExpr - Handle a call to Fn with the specified array of arguments.
OpaquePtr< TemplateName > TemplateTy
static QualType GetTypeFromParser(ParsedType Ty, TypeSourceInfo **TInfo=nullptr)
static ConditionResult ConditionError()
StmtResult ActOnCompoundStmt(SourceLocation L, SourceLocation R, ArrayRef< Stmt * > Elts, bool isStmtExpr)
SemaPseudoObject & PseudoObject()
StmtResult ActOnCXXTryBlock(SourceLocation TryLoc, Stmt *TryBlock, ArrayRef< Stmt * > Handlers)
ActOnCXXTryBlock - Takes a try compound-statement and a number of handlers and creates a try statemen...
OpaquePtr< DeclGroupRef > DeclGroupPtrTy
StmtResult ActOnDefaultStmt(SourceLocation DefaultLoc, SourceLocation ColonLoc, Stmt *SubStmt, Scope *CurScope)
ExprResult HandleExprEvaluationContextForTypeof(Expr *E)
StmtResult ActOnCaseStmt(SourceLocation CaseLoc, ExprResult LHS, SourceLocation DotDotDotLoc, ExprResult RHS, SourceLocation ColonLoc)
TypeSourceInfo * CheckPackExpansion(TypeSourceInfo *Pattern, SourceLocation EllipsisLoc, UnsignedOrNone NumExpansions)
Construct a pack expansion type from the pattern of the pack expansion.
StmtResult FinishCXXForRangeStmt(Stmt *ForRange, Stmt *Body)
FinishCXXForRangeStmt - Attach the body to a C++0x for-range statement.
ExprResult ActOnFinishFullExpr(Expr *Expr, bool DiscardedValue)
ExprResult CreateBuiltinMatrixSubscriptExpr(Expr *Base, Expr *RowIdx, Expr *ColumnIdx, SourceLocation RBLoc)
StmtResult ActOnGCCAsmStmt(SourceLocation AsmLoc, bool IsSimple, bool IsVolatile, unsigned NumOutputs, unsigned NumInputs, IdentifierInfo **Names, MultiExprArg Constraints, MultiExprArg Exprs, Expr *AsmString, MultiExprArg Clobbers, unsigned NumLabels, SourceLocation RParenLoc)
ShuffleVectorExpr - clang-specific builtin-in function __builtin_shufflevector.
Represents an expression that computes the length of a parameter pack.
SourceLocation getPackLoc() const
Determine the location of the parameter pack.
bool isPartiallySubstituted() const
Determine whether this represents a partially-substituted sizeof... expression, such as is produced f...
static SizeOfPackExpr * Create(ASTContext &Context, SourceLocation OperatorLoc, NamedDecl *Pack, SourceLocation PackLoc, SourceLocation RParenLoc, UnsignedOrNone Length=std::nullopt, ArrayRef< TemplateArgument > PartialArgs={})
ArrayRef< TemplateArgument > getPartialArguments() const
Get.
SourceLocation getOperatorLoc() const
Determine the location of the 'sizeof' keyword.
SourceLocation getRParenLoc() const
Determine the location of the right parenthesis.
NamedDecl * getPack() const
Retrieve the parameter pack.
Represents a function call to one of __builtin_LINE(), __builtin_COLUMN(), __builtin_FUNCTION(),...
static bool MayBeDependent(SourceLocIdentKind Kind)
Encodes a location in the source.
bool isValid() const
Return true if this is a valid SourceLocation object.
A trivial tuple used to represent a source range.
SourceLocation getEnd() const
SourceLocation getBegin() const
StmtExpr - This is the GNU Statement Expression extension: ({int X=4; X;}).
Stmt - This represents one statement.
SourceLocation getEndLoc() const LLVM_READONLY
StmtClass getStmtClass() const
SourceRange getSourceRange() const LLVM_READONLY
SourceLocation tokens are not useful in isolation - they are low level value objects created/interpre...
StringLiteral - This represents a string literal expression, e.g.
Wrapper for substituted template type parameters.
Represents a reference to a non-type template parameter that has been substituted with a template arg...
Represents a reference to a non-type template parameter pack that has been substituted with a non-tem...
A structure for storing an already-substituted template template parameter pack.
A structure for storing the information associated with a substituted template template parameter.
Wrapper for substituted template type parameters.
SwitchStmt - This represents a 'switch' stmt.
Represents the declaration of a struct/union/class/enum.
SourceLocation getNameLoc() const
SourceLocation getElaboratedKeywordLoc() const
NestedNameSpecifierLoc getQualifierLoc() const
void setQualifierLoc(NestedNameSpecifierLoc QualifierLoc)
void setNameLoc(SourceLocation Loc)
void setElaboratedKeywordLoc(SourceLocation Loc)
A convenient class for passing around template argument information.
void setLAngleLoc(SourceLocation Loc)
void setRAngleLoc(SourceLocation Loc)
void addArgument(const TemplateArgumentLoc &Loc)
const TemplateArgumentLoc * operator->() const
pointer(TemplateArgumentLoc Arg)
Simple iterator that traverses the template arguments in a container that provides a getArgLoc() memb...
TemplateArgumentLoc operator*() const
TemplateArgumentLocContainerIterator operator++(int)
friend bool operator!=(const TemplateArgumentLocContainerIterator &X, const TemplateArgumentLocContainerIterator &Y)
TemplateArgumentLocContainerIterator()
TemplateArgumentLoc value_type
TemplateArgumentLocContainerIterator(ArgLocContainer &Container, unsigned Index)
friend bool operator==(const TemplateArgumentLocContainerIterator &X, const TemplateArgumentLocContainerIterator &Y)
TemplateArgumentLocContainerIterator & operator++()
std::input_iterator_tag iterator_category
TemplateArgumentLoc reference
pointer operator->() const
const TemplateArgumentLoc * operator->() const
pointer(TemplateArgumentLoc Arg)
Iterator adaptor that invents template argument location information for each of the template argumen...
TemplateArgumentLocInventIterator & operator++()
pointer operator->() const
std::iterator_traits< InputIterator >::difference_type difference_type
reference operator*() const
TemplateArgumentLocInventIterator operator++(int)
friend bool operator==(const TemplateArgumentLocInventIterator &X, const TemplateArgumentLocInventIterator &Y)
TemplateArgumentLocInventIterator(TreeTransform< Derived > &Self, InputIterator Iter)
friend bool operator!=(const TemplateArgumentLocInventIterator &X, const TemplateArgumentLocInventIterator &Y)
std::input_iterator_tag iterator_category
TemplateArgumentLoc reference
TemplateArgumentLoc value_type
Location wrapper for a TemplateArgument.
const TemplateArgument & getArgument() const
SourceLocation getTemplateNameLoc() const
SourceLocation getTemplateKWLoc() const
TypeSourceInfo * getTypeSourceInfo() const
Expr * getSourceExpression() const
NestedNameSpecifierLoc getTemplateQualifierLoc() const
Represents a template argument.
Expr * getAsExpr() const
Retrieve the template argument as an expression.
const TemplateArgument * pack_iterator
Iterator that traverses the elements of a template argument pack.
QualType getNonTypeTemplateArgumentType() const
If this is a non-type template argument, get its type.
QualType getAsType() const
Retrieve the type for a type template argument.
llvm::APSInt getAsIntegral() const
Retrieve the template argument as an integral value.
TemplateName getAsTemplate() const
Retrieve the template name for a template name argument.
bool containsUnexpandedParameterPack() const
Whether this template argument contains an unexpanded parameter pack.
ValueDecl * getAsDecl() const
Retrieve the declaration for a declaration non-type template argument.
@ Declaration
The template argument is a declaration that was provided for a pointer, reference,...
@ Template
The template argument is a template name that was provided for a template template parameter.
@ StructuralValue
The template argument is a non-type template argument that can't be represented by the special-case D...
@ Pack
The template argument is actually a parameter pack.
@ TemplateExpansion
The template argument is a pack expansion of a template name that was provided for a template templat...
@ NullPtr
The template argument is a null pointer or null pointer to member that was provided for a non-type te...
@ Type
The template argument is a type.
@ Null
Represents an empty template argument, e.g., one that has not been deduced.
@ Integral
The template argument is an integral value stored in an llvm::APSInt that was provided for an integra...
@ Expression
The template argument is an expression, and we've not resolved it to one of the other forms yet,...
ArgKind getKind() const
Return the kind of stored template argument.
bool isPackExpansion() const
Determine whether this template argument is a pack expansion.
const APValue & getAsStructuralValue() const
Get the value of a StructuralValue.
The base class of all kinds of template declarations (e.g., class, function, etc.).
Represents a C++ template name within the type system.
TemplateDecl * getAsTemplateDecl(bool IgnoreDeduced=false) const
Retrieve the underlying template declaration that this template name refers to, if known.
DeducedTemplateStorage * getAsDeducedTemplateName() const
Retrieve the deduced template info, if any.
bool isNull() const
Determine whether this template name is NULL.
DependentTemplateName * getAsDependentTemplateName() const
Retrieve the underlying dependent template name structure, if any.
QualifiedTemplateName * getAsQualifiedTemplateName() const
Retrieve the underlying qualified template name structure, if any.
NestedNameSpecifier getQualifier() const
SubstTemplateTemplateParmPackStorage * getAsSubstTemplateTemplateParmPack() const
Retrieve the substituted template template parameter pack, if known.
SubstTemplateTemplateParmStorage * getAsSubstTemplateTemplateParm() const
Retrieve the substituted template template parameter, if known.
Stores a list of template parameters for a TemplateDecl and its derived classes.
unsigned getNumArgs() const
SourceLocation getLAngleLoc() const
SourceLocation getRAngleLoc() const
SourceLocation getTemplateNameLoc() const
SourceLocation getTemplateKeywordLoc() const
NestedNameSpecifierLoc getQualifierLoc() const
SourceLocation getElaboratedKeywordLoc() const
Wrapper for template type parameters.
The top declaration context.
TypeLoc getTypeLocInContext(ASTContext &Context, QualType T)
Copies the type-location information to the given AST context and returns a TypeLoc referring into th...
TyLocType push(QualType T)
Pushes space for a new TypeLoc of the given type.
void reserve(size_t Requested)
Ensures that this buffer has at least as much capacity as described.
void TypeWasModifiedSafely(QualType T)
Tell the TypeLocBuilder that the type it is storing has been modified in some safe way that doesn't a...
TypeSourceInfo * getTypeSourceInfo(ASTContext &Context, QualType T)
Creates a TypeSourceInfo for the given type.
Base wrapper for a particular "section" of type source info.
UnqualTypeLoc getUnqualifiedLoc() const
Skips past any qualifiers, if this is qualified.
QualType getType() const
Get the type for which this source info wrapper provides information.
T getAs() const
Convert to the specified TypeLoc type, returning a null TypeLoc if this TypeLoc is not of the desired...
T castAs() const
Convert to the specified TypeLoc type, asserting that this TypeLoc is of the desired type.
SourceRange getSourceRange() const LLVM_READONLY
Get the full source range.
unsigned getFullDataSize() const
Returns the size of the type source info data block.
TypeLocClass getTypeLocClass() const
T getAsAdjusted() const
Convert to the specified TypeLoc type, returning a null TypeLoc if this TypeLoc is not of the desired...
SourceLocation getBeginLoc() const
Get the begin source location.
Represents a typeof (or typeof) expression (a C23 feature and GCC extension) or a typeof_unqual expre...
A container of type source information.
TypeLoc getTypeLoc() const
Return the TypeLoc wrapper for the type source info.
QualType getType() const
Return the type wrapped by this type source info.
void setNameLoc(SourceLocation Loc)
A type trait used in the implementation of various C++11 and Library TR1 trait templates.
The base class of the type hierarchy.
bool isDependentType() const
Whether this type is a dependent type, meaning that its definition somehow depends on a template para...
bool containsUnexpandedParameterPack() const
Whether this type is or contains an unexpanded parameter pack, used to support C++0x variadic templat...
bool isOverloadableType() const
Determines whether this is a type for which one can define an overloaded operator.
bool isObjCObjectPointerType() const
const T * getAs() const
Member-template getAs<specific type>'.
Base class for declarations which introduce a typedef-name.
Wrapper for source info for typedefs.
void setTypeofLoc(SourceLocation Loc)
UnaryExprOrTypeTraitExpr - expression with either a type or (unevaluated) expression operand.
UnaryOperator - This represents the unary-expression's (except sizeof and alignof),...
SourceLocation getOperatorLoc() const
getOperatorLoc - Return the location of the operator.
Expr * getSubExpr() const
static Opcode getOverloadedOpcode(OverloadedOperatorKind OO, bool Postfix)
Retrieve the unary opcode that corresponds to the given overloaded operator.
Represents a C++ unqualified-id that has been parsed.
void setOperatorFunctionId(SourceLocation OperatorLoc, OverloadedOperatorKind Op, SourceLocation SymbolLocations[3])
Specify that this unqualified-id was parsed as an operator-function-id.
A reference to a name which we were able to look up during parsing but could not resolve to a specifi...
CXXRecordDecl * getNamingClass()
Gets the 'naming class' (in the sense of C++0x [class.access.base]p5) of the lookup.
bool requiresADL() const
True if this declaration should be extended by argument-dependent lookup.
static UnresolvedLookupExpr * Create(const ASTContext &Context, CXXRecordDecl *NamingClass, NestedNameSpecifierLoc QualifierLoc, const DeclarationNameInfo &NameInfo, bool RequiresADL, UnresolvedSetIterator Begin, UnresolvedSetIterator End, bool KnownDependent, bool KnownInstantiationDependent)
Represents a C++ member access expression for which lookup produced a set of overloaded functions.
A set of unresolved declarations.
void append(iterator I, iterator E)
A set of unresolved declarations.
Wrapper for source info for unresolved typename using decls.
Represents the dependent type named by a dependently-scoped typename using declaration,...
A call to a literal operator (C++11 [over.literal]) written as a user-defined literal (C++11 [lit....
Represents a shadow declaration implicitly introduced into a scope by a (resolved) using-declaration ...
NamedDecl * getTargetDecl() const
Gets the underlying declaration which has been brought into the local scope.
Wrapper for source info for types used via transparent aliases.
Represents a call to the builtin function __builtin_va_arg.
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
bool isParameterPack() const
Determine whether this value is actually a function parameter pack, init-capture pack,...
Represents a variable declaration or definition.
@ CInit
C-style initialization with assignment.
@ CallInit
Call-style initialization (C++98)
StorageClass getStorageClass() const
Returns the storage class as written in the source.
Represents a C array with a specified size that is not an integer-constant-expression.
void setNameLoc(SourceLocation Loc)
Represents a GCC generic vector type.
WhileStmt - This represents a 'while' stmt.
A requires-expression requirement which queries the validity and properties of an expression ('simple...
SubstitutionDiagnostic * getExprSubstitutionDiagnostic() const
bool isExprSubstitutionFailure() const
const ReturnTypeRequirement & getReturnTypeRequirement() const
SourceLocation getNoexceptLoc() const
A requires-expression requirement which is satisfied when a general constraint expression is satisfie...
const ASTConstraintSatisfaction & getConstraintSatisfaction() const
bool hasInvalidConstraint() const
Expr * getConstraintExpr() const
StringRef getInvalidConstraintEntity()
A static requirement that can be used in a requires-expression to check properties of types and expre...
A requires-expression requirement which queries the existence of a type name or type template special...
bool isSubstitutionFailure() const
SubstitutionDiagnostic * getSubstitutionDiagnostic() const
TypeSourceInfo * getType() const
Retains information about a block that is currently being parsed.
bool ContainsUnexpandedParameterPack
Whether this contains an unexpanded parameter pack.
CXXRecordDecl * Lambda
The class that describes the lambda.
CXXMethodDecl * CallOperator
The lambda's compiler-generated operator().
@ AttributedType
The l-value was considered opaque, so the alignment was determined from a type, but that type was an ...
const AstTypeMatcher< FunctionType > functionType
llvm::PointerUnion< const Decl *, const Expr * > DeclTy
bool Comp(InterpState &S, CodePtr OpPC)
1) Pops the value from the stack.
bool Inc(InterpState &S, CodePtr OpPC, bool CanOverflow)
1) Pops a pointer from the stack 2) Load the value from the pointer 3) Writes the value increased by ...
The JSON file list parser is used to communicate input to InstallAPI.
CanQual< Type > CanQualType
Represents a canonical, potentially-qualified type.
OpenMPOriginalSharingModifier
OpenMP 6.0 original sharing modifiers.
OverloadedOperatorKind
Enumeration specifying the different kinds of C++ overloaded operators.
@ OO_None
Not an overloaded operator.
@ NUM_OVERLOADED_OPERATORS
bool isa(CodeGen::Address addr)
ArrayTypeTrait
Names for the array type traits.
OpenMPDefaultClauseVariableCategory
OpenMP variable-category for 'default' clause.
AutoTypeKeyword
Which keyword(s) were used to create an AutoType.
OpenMPDefaultmapClauseModifier
OpenMP modifiers for 'defaultmap' clause.
OpenMPOrderClauseModifier
OpenMP modifiers for 'order' clause.
@ Ambiguous
Name lookup results in an ambiguity; use getAmbiguityKind to figure out what kind of ambiguity we hav...
@ NotFound
No entity found met the criteria.
@ FoundOverloaded
Name lookup found a set of overloaded functions that met the criteria.
@ Found
Name lookup found a single declaration that met the criteria.
@ FoundUnresolvedValue
Name lookup found an unresolvable value declaration and cannot yet complete.
@ NotFoundInCurrentInstantiation
No entity found met the criteria within the current instantiation,, but there were dependent base cla...
IfStatementKind
In an if statement, this denotes whether the statement is a constexpr or consteval if statement.
@ TemplateName
The identifier is a template name. FIXME: Add an annotation for that.
@ OK_ObjCProperty
An Objective-C property is a logical field of an Objective-C object which is read and written via Obj...
OpenMPAtClauseKind
OpenMP attributes for 'at' clause.
@ LCK_ByCopy
Capturing by copy (a.k.a., by value)
@ LCK_ByRef
Capturing by reference.
@ LCK_StarThis
Capturing the *this object by copy.
NonTagKind
Common ways to introduce type names without a tag for use in diagnostics.
OpenMPReductionClauseModifier
OpenMP modifiers for 'reduction' clause.
std::pair< llvm::PointerUnion< const TemplateTypeParmType *, NamedDecl *, const TemplateSpecializationType *, const SubstBuiltinTemplatePackType * >, SourceLocation > UnexpandedParameterPack
@ DevicePtr
'deviceptr' clause, allowed on Compute and Combined Constructs, plus 'data' and 'declare'.
@ Invalid
Represents an invalid clause, for the purposes of parsing.
@ Attach
'attach' clause, allowed on Compute and Combined constructs, plus 'data' and 'enter data'.
@ Self
'self' clause, allowed on Compute and Combined Constructs, plus 'update'.
@ Detach
'detach' clause, allowed on the 'exit data' construct.
TypeOfKind
The kind of 'typeof' expression we're after.
OpenMPScheduleClauseModifier
OpenMP modifiers for 'schedule' clause.
OpenACCComputeConstruct(OpenACCDirectiveKind K, SourceLocation Start, SourceLocation DirectiveLoc, SourceLocation End, ArrayRef< const OpenACCClause * > Clauses, Stmt *StructuredBlock)
OpenMPDistScheduleClauseKind
OpenMP attributes for 'dist_schedule' clause.
OpenMPDoacrossClauseModifier
OpenMP dependence types for 'doacross' clause.
@ Dependent
Parse the block as a dependent block, which may be used in some template instantiations but not other...
UnaryExprOrTypeTrait
Names for the "expression or type" traits.
std::pair< NullabilityKind, bool > DiagNullabilityKind
A nullability kind paired with a bit indicating whether it used a context-sensitive keyword.
MutableArrayRef< Expr * > MultiExprArg
@ Property
The type of a property.
@ Result
The result type of a method or function.
OpenMPBindClauseKind
OpenMP bindings for the 'bind' clause.
ArraySizeModifier
Capture whether this is a normal array (e.g.
const FunctionProtoType * T
bool isComputedNoexcept(ExceptionSpecificationType ESpecType)
OpenMPLastprivateModifier
OpenMP 'lastprivate' clause modifier.
@ Template
We are parsing a template declaration.
ActionResult< CXXBaseSpecifier * > BaseResult
OpenMPGrainsizeClauseModifier
OpenMPNumTasksClauseModifier
TagTypeKind
The kind of a tag type.
bool transformOMPMappableExprListClause(TreeTransform< Derived > &TT, OMPMappableExprListClause< T > *C, llvm::SmallVectorImpl< Expr * > &Vars, CXXScopeSpec &MapperIdScopeSpec, DeclarationNameInfo &MapperIdInfo, llvm::SmallVectorImpl< Expr * > &UnresolvedMappers)
@ Keyword
The name has been typo-corrected to a keyword.
bool isOpenMPLoopDirective(OpenMPDirectiveKind DKind)
Checks if the specified directive is a directive with an associated loop construct.
OpenMPSeverityClauseKind
OpenMP attributes for 'severity' clause.
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.
@ 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