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);
142 ForgetPartiallySubstitutedPackRAII(
143 const ForgetPartiallySubstitutedPackRAII &) =
delete;
144 ForgetPartiallySubstitutedPackRAII &
145 operator=(
const ForgetPartiallySubstitutedPackRAII &) =
delete;
161 Derived &
getDerived() {
return static_cast<Derived&
>(*this); }
165 return static_cast<const Derived&
>(*this);
233 if (Location.isValid())
234 Self.getDerived().setBase(Location, Entity);
238 Self.getDerived().setBase(OldLocation, OldEntity);
313 bool FailOnPackProducingTemplates,
314 bool &ShouldExpand,
bool &RetainExpansion,
316 ShouldExpand =
false;
344 struct ForgetSubstitutionRAII {
350 Old =
Self.ForgetSubstitution();
353 ~ForgetSubstitutionRAII() {
Self.RememberSubstitution(std::move(Old)); }
453 const X##Attr *Transform##X##Attr(const X##Attr *R) { return R; }
454#include "clang/Basic/AttrList.inc"
464 const X##Attr *TransformStmt##X##Attr(const Stmt *, const Stmt *, \
465 const X##Attr *A) { \
466 return getDerived().Transform##X##Attr(A); \
468#include "clang/Basic/AttrList.inc"
514 bool *ArgChanged =
nullptr);
523 llvm::DenseMap<Decl *, Decl *>::iterator Known
526 return Known->second;
554 assert(
New.size() == 1 &&
555 "must override transformedLocalDecl if performing pack expansion");
593 NamedDecl *FirstQualifierInScope =
nullptr);
638 NamedDecl *FirstQualifierInScope =
nullptr,
639 bool AllowInjectedClassName =
false);
651 bool Uneval =
false);
678 bool Uneval =
false) {
697 template<
typename InputIterator>
701 bool Uneval =
false);
703 template <
typename InputIterator>
707 bool Uneval =
false);
728 return SemaRef.Context.getTrivialTypeSourceInfo(T,
732#define ABSTRACT_TYPELOC(CLASS, PARENT)
733#define TYPELOC(CLASS, PARENT) \
734 QualType Transform##CLASS##Type(TypeLocBuilder &TLB, CLASS##TypeLoc T);
735#include "clang/AST/TypeLocNodes.def"
739 bool SuppressObjCLifetime);
743 bool SuppressObjCLifetime);
745 template<
typename Fn>
763 bool AllowInjectedClassName);
791 return getDerived().TransformFunctionTypeParams(
792 Loc, Params, ParamTypes, ParamInfos, PTypes, PVars, PInfos,
nullptr);
810 KWLoc, Params,
nullptr,
811 nullptr, PTypes, &TransParams, PInfos))
825 bool ExpectParameterPack);
852 bool IsAddressOfOperand,
860 bool IsAddressOfOperand);
868#define STMT(Node, Parent) \
869 LLVM_ATTRIBUTE_NOINLINE \
870 StmtResult Transform##Node(Node *S);
871#define VALUESTMT(Node, Parent) \
872 LLVM_ATTRIBUTE_NOINLINE \
873 StmtResult Transform##Node(Node *S, StmtDiscardKind SDK);
874#define EXPR(Node, Parent) \
875 LLVM_ATTRIBUTE_NOINLINE \
876 ExprResult Transform##Node(Node *E);
877#define ABSTRACT_STMT(Stmt)
878#include "clang/AST/StmtNodes.inc"
880#define GEN_CLANG_CLAUSE_CLASS
881#define CLAUSE_CLASS(Enum, Str, Class) \
882 LLVM_ATTRIBUTE_NOINLINE \
883 OMPClause *Transform##Class(Class *S);
884#include "llvm/Frontend/OpenMP/OMP.inc"
962 const llvm::APInt *Size,
Expr *SizeExpr,
963 unsigned IndexTypeQuals,
SourceRange BracketsRange);
972 const llvm::APInt &Size,
Expr *SizeExpr,
973 unsigned IndexTypeQuals,
983 unsigned IndexTypeQuals,
993 unsigned IndexTypeQuals,
1004 unsigned IndexTypeQuals,
1042 unsigned NumColumns);
1059 Expr *AddrSpaceExpr,
1083 return SemaRef.Context.getUsingType(
Keyword, Qualifier, D, UnderlyingType);
1096 return SemaRef.Context.getMacroQualifiedType(T, MacroII);
1106 return SemaRef.Context.getCanonicalTagType(Tag);
1123 UnaryTransformType::UTTKind UKind,
1135 bool FullySubstituted,
1149 TypeConstraintConcept,
1150 TypeConstraintArgs);
1157 return SemaRef.Context.getDeducedTemplateSpecializationType(
1176 return SemaRef.BuildParenType(InnerType);
1189 bool DeducedTSTContext) {
1191 SS.
Adopt(QualifierLoc);
1195 if (!
SemaRef.computeDeclContext(SS))
1203 return SemaRef.CheckTypenameType(
Keyword, KeywordLoc, QualifierLoc,
1204 *Id, IdLoc, DeducedTSTContext);
1217 if (
SemaRef.RequireCompleteDeclContext(SS, DC))
1222 switch (
Result.getResultKind()) {
1233 llvm_unreachable(
"Tag lookup cannot find non-tags");
1245 switch (
Result.getResultKind()) {
1251 SemaRef.Diag(IdLoc, diag::err_tag_reference_non_tag)
1252 << SomeDecl << NTK << Kind;
1257 SemaRef.Diag(IdLoc, diag::err_not_tag_in_scope)
1263 if (!
SemaRef.isAcceptableTagRedeclaration(Tag, Kind,
false,
1265 SemaRef.Diag(KeywordLoc, diag::err_use_with_wrong_tag) << Id;
1266 SemaRef.Diag(Tag->getLocation(), diag::note_previous_use);
1322 bool AllowInjectedClassName);
1335 bool AllowInjectedClassName);
1341 bool AllowInjectedClassName);
1351 Decl *AssociatedDecl,
unsigned Index,
1354 ArgPack, AssociatedDecl, Index, Final);
1408 return SemaRef.ActOnLabelStmt(IdentLoc, L, ColonLoc, SubStmt);
1418 if (
SemaRef.CheckRebuiltStmtAttributes(Attrs))
1420 return SemaRef.BuildAttributedStmt(AttrLoc, Attrs, SubStmt);
1432 Then, ElseLoc, Else);
1486 Inc, RParenLoc, Body);
1531 bool IsVolatile,
unsigned NumOutputs,
1538 NumInputs, Names, Constraints, Exprs,
1539 AsmString, Clobbers, NumLabels, RParenLoc);
1548 StringRef AsmString,
1549 unsigned NumOutputs,
unsigned NumInputs,
1555 NumOutputs, NumInputs,
1556 Constraints, Clobbers, Exprs, EndLoc);
1585 CoawaitLoc, Operand, OpCoawaitLookup);
1589 Suspend.
get(),
true);
1690 Kind, DirName, CancelRegion, Clauses, AStmt, StartLoc, EndLoc);
1702 Kind, DirName, Clauses, AStmt, StartLoc, EndLoc);
1716 NameModifier,
Condition, StartLoc, LParenLoc, NameModifierLoc, ColonLoc,
1742 Modifier, NumThreads, StartLoc, LParenLoc, ModifierLoc, EndLoc);
1803 First, Count, StartLoc, LParenLoc, FirstLoc, CountLoc, EndLoc);
1839 Kind, KindKwLoc, VCKind, VCLoc, StartLoc, LParenLoc, EndLoc);
1852 Kind, KindKwLoc, StartLoc, LParenLoc, EndLoc);
1859 ImpexTypeArg, StartLoc, LParenLoc, EndLoc);
1872 M1, M2, Kind, ChunkSize, StartLoc, LParenLoc, M1Loc, M2Loc, KindLoc,
1934 VarList, LPKind, LPKindLoc, ColonLoc, StartLoc, LParenLoc, EndLoc);
1962 VarList, {Modifier, OriginalSharingModifier}, StartLoc, LParenLoc,
1963 ModifierLoc, ColonLoc, EndLoc, ReductionIdScopeSpec, ReductionId,
1964 UnresolvedReductions);
1978 VarList, StartLoc, LParenLoc, ColonLoc, EndLoc, ReductionIdScopeSpec,
1979 ReductionId, UnresolvedReductions);
1994 VarList, StartLoc, LParenLoc, ColonLoc, EndLoc, ReductionIdScopeSpec,
1995 ReductionId, UnresolvedReductions);
2008 VarList, Step, StartLoc, LParenLoc, Modifier, ModifierLoc, ColonLoc,
2009 StepModifierLoc, EndLoc);
2022 VarList, Alignment, StartLoc, LParenLoc, ColonLoc, EndLoc);
2082 Data, DepModifier, VarList, StartLoc, LParenLoc, EndLoc);
2095 Modifier,
Device, StartLoc, LParenLoc, ModifierLoc, EndLoc);
2110 IteratorModifier, MapTypeModifiers, MapTypeModifiersLoc,
2111 MapperIdScopeSpec, MapperId, MapType, IsMapTypeImplicit, MapLoc,
2112 ColonLoc, VarList, Locs,
2113 false, UnresolvedMappers);
2130 Allocate, Alignment, FirstModifier, FirstModifierLoc, SecondModifier,
2131 SecondModifierLoc, VarList, StartLoc, LParenLoc, ColonLoc, EndLoc);
2179 Modifier,
Device, StartLoc, LParenLoc, ModifierLoc, EndLoc);
2192 Modifier, NumTasks, StartLoc, LParenLoc, ModifierLoc, EndLoc);
2227 Kind, ChunkSize, StartLoc, LParenLoc, KindLoc, CommaLoc, EndLoc);
2242 MotionModifiers, MotionModifiersLoc, IteratorModifier,
2243 MapperIdScopeSpec, MapperId, ColonLoc, VarList, Locs,
2259 MotionModifiers, MotionModifiersLoc, IteratorModifier,
2260 MapperIdScopeSpec, MapperId, ColonLoc, VarList, Locs,
2273 VarList, Locs, FallbackModifier, FallbackModifierLoc);
2315 M, Kind, StartLoc, LParenLoc, MLoc, KindLoc, EndLoc);
2362 StartLoc, LParenLoc, EndLoc,
Data);
2375 StartLoc, LParenLoc, ColonLoc, EndLoc, Modifier, Locators);
2387 Modifier, Kind, StartLoc, LParenLoc, ModifierKwLoc, KindKwLoc, EndLoc);
2400 InteropVar, InteropInfo, StartLoc, LParenLoc, VarLoc, EndLoc);
2411 LParenLoc, VarLoc, EndLoc);
2423 InteropVar, StartLoc, LParenLoc, VarLoc, EndLoc);
2494 M1, M2, Size, StartLoc, LParenLoc, M1Loc, M2Loc, EndLoc);
2575 DepType, DepLoc, ColonLoc, VarList, StartLoc, LParenLoc, EndLoc);
2623 ForLoc, Element, Collection, RParenLoc);
2641 StartLoc, IdLoc, Id);
2678 if (
DeclStmt *RangeStmt = dyn_cast<DeclStmt>(Range)) {
2679 if (RangeStmt->isSingleDecl()) {
2680 if (
VarDecl *RangeVar = dyn_cast<VarDecl>(RangeStmt->getSingleDecl())) {
2681 if (RangeVar->isInvalidDecl())
2684 Expr *RangeExpr = RangeVar->getInit();
2691 diag::err_objc_for_range_init_stmt)
2692 <<
Init->getSourceRange();
2695 ForLoc, LoopVar, RangeExpr, RParenLoc);
2702 ForLoc, CoawaitLoc,
Init, ColonLoc, Range, Begin, End,
Cond, Inc,
2716 QualifierLoc, NameInfo, Nested);
2778 SS.
Adopt(QualifierLoc);
2900 if (IsOMPArraySection)
2902 Base, LBracketLoc, LowerBound, ColonLocFirst, ColonLocSecond, Length,
2903 Stride, RBracketLoc);
2905 assert(Stride ==
nullptr && !ColonLocSecond.
isValid() &&
2906 "Stride/second colon not allowed for OpenACC");
2909 Base, LBracketLoc, LowerBound, ColonLocFirst, Length, RBracketLoc);
2921 Base, LParenLoc, RParenLoc, Dims, BracketsRanges);
2933 nullptr, IteratorKwLoc, LLoc, RLoc,
Data);
2943 Expr *ExecConfig =
nullptr) {
2945 nullptr, Callee, LParenLoc, Args, RParenLoc, ExecConfig);
2952 nullptr, Callee, LParenLoc, Args, RParenLoc);
2970 if (!
Member->getDeclName()) {
2974 assert(
Member->getType()->isRecordType() &&
2975 "unnamed member not of record type?");
2988 if (!isArrow &&
Base->isPRValue()) {
3003 SS.
Adopt(QualifierLoc);
3006 if (
Base->containsErrors())
3011 if (isArrow && !BaseType->isPointerType())
3017 R.addDecl(FoundDecl);
3020 if (
getSema().isUnevaluatedContext() &&
Base->isImplicitCXXThis() &&
3025 ->getAsCXXRecordDecl()) {
3029 if (!ThisClass->Equals(
Class) && !ThisClass->isDerivedFrom(
Class))
3037 FirstQualifierInScope,
3038 R, ExplicitTemplateArgs,
3048 bool ForFoldExpression =
false) {
3127 return SemaRef.BuildInitList(LBraceLoc,
Inits, RBraceLoc);
3140 =
SemaRef.ActOnDesignatedInitializer(Desig, EqualOrColonLoc, GNUSyntax,
3180 unsigned NumUserSpecifiedExprs,
3185 InitLoc, LParenLoc, RParenLoc);
3215 return SemaRef.ActOnChooseExpr(BuiltinLoc,
3227 Expr *ControllingExpr,
3232 ControllingExpr, Types, Exprs);
3247 ControllingType, Types, Exprs);
3280 case Stmt::CXXStaticCastExprClass:
3281 return getDerived().RebuildCXXStaticCastExpr(OpLoc, LAngleLoc, TInfo,
3282 RAngleLoc, LParenLoc,
3283 SubExpr, RParenLoc);
3285 case Stmt::CXXDynamicCastExprClass:
3286 return getDerived().RebuildCXXDynamicCastExpr(OpLoc, LAngleLoc, TInfo,
3287 RAngleLoc, LParenLoc,
3288 SubExpr, RParenLoc);
3290 case Stmt::CXXReinterpretCastExprClass:
3291 return getDerived().RebuildCXXReinterpretCastExpr(OpLoc, LAngleLoc, TInfo,
3292 RAngleLoc, LParenLoc,
3296 case Stmt::CXXConstCastExprClass:
3297 return getDerived().RebuildCXXConstCastExpr(OpLoc, LAngleLoc, TInfo,
3298 RAngleLoc, LParenLoc,
3299 SubExpr, RParenLoc);
3301 case Stmt::CXXAddrspaceCastExprClass:
3302 return getDerived().RebuildCXXAddrspaceCastExpr(
3303 OpLoc, LAngleLoc, TInfo, RAngleLoc, LParenLoc, SubExpr, RParenLoc);
3306 llvm_unreachable(
"Invalid C++ named cast");
3384 OpLoc, tok::kw_addrspace_cast, TInfo, SubExpr,
3396 bool ListInitialization) {
3400 if (
auto *PLE = dyn_cast<ParenListExpr>(Sub))
3402 TInfo, LParenLoc,
MultiExprArg(PLE->getExprs(), PLE->getNumExprs()),
3403 RParenLoc, ListInitialization);
3405 if (
auto *PLE = dyn_cast<CXXParenListInitExpr>(Sub))
3407 TInfo, LParenLoc, PLE->getInitExprs(), RParenLoc, ListInitialization);
3411 ListInitialization);
3475 if (
getSema().CheckCXXThisType(ThisLoc, ThisType))
3485 bool IsThrownVariableInScope) {
3495 Expr *RewrittenExpr) {
3497 RewrittenExpr,
getSema().CurContext);
3531 std::optional<Expr *> ArraySize,
3550 bool IsGlobalDelete,
3601 bool IsAddressOfOperand,
3604 SS.
Adopt(QualifierLoc);
3606 if (TemplateArgs || TemplateKWLoc.
isValid())
3608 SS, TemplateKWLoc, NameInfo, TemplateArgs, IsAddressOfOperand);
3611 SS, NameInfo, IsAddressOfOperand, RecoveryTSI);
3633 bool IsElidable,
MultiExprArg Args,
bool HadMultipleCandidates,
3634 bool ListInitialization,
bool StdInitListInitialization,
3641 FoundCtor =
Constructor->getInheritedConstructor().getConstructor();
3644 if (
getSema().CompleteConstructorCall(FoundCtor, T, Args, Loc,
3651 HadMultipleCandidates,
3653 StdInitListInitialization,
3654 RequiresZeroInit, ConstructKind,
3662 bool ConstructsVBase,
3663 bool InheritedFromVBase) {
3665 Loc, T,
Constructor, ConstructsVBase, InheritedFromVBase);
3676 bool ListInitialization) {
3678 TSInfo, LParenOrBraceLoc, Args, RParenOrBraceLoc, ListInitialization);
3689 bool ListInitialization) {
3691 RParenLoc, ListInitialization);
3708 SS.
Adopt(QualifierLoc);
3710 return SemaRef.BuildMemberReferenceExpr(BaseE, BaseType,
3711 OperatorLoc, IsArrow,
3713 FirstQualifierInScope,
3715 TemplateArgs,
nullptr);
3731 SS.
Adopt(QualifierLoc);
3733 return SemaRef.BuildMemberReferenceExpr(BaseE, BaseType,
3734 OperatorLoc, IsArrow,
3736 FirstQualifierInScope,
3737 R, TemplateArgs,
nullptr);
3745 return SemaRef.BuildCXXNoexceptExpr(Range.getBegin(), Arg, Range.getEnd());
3758 RParenLoc, Length, PartialArgs);
3763 Expr *PackIdExpression,
Expr *IndexExpr,
3765 bool FullySubstituted =
false) {
3767 IndexExpr, RSquareLoc, ExpandedExprs,
3793 NamedConcept, TALI);
3811 LocalParameters, RParenLoc, Requirements,
3818 return SemaRef.BuildTypeRequirement(SubstDiag);
3822 return SemaRef.BuildTypeRequirement(T);
3830 return SemaRef.BuildExprRequirement(SubstDiag, IsSimple, NoexceptLoc,
3837 return SemaRef.BuildExprRequirement(E, IsSimple, NoexceptLoc,
3844 return SemaRef.BuildNestedRequirement(InvalidConstraintEntity,
3849 return SemaRef.BuildNestedRequirement(Constraint);
3865 Expr **Elements,
unsigned NumElements) {
3875 RB,
Base, Key, getterMethod, setterMethod);
3894 return SemaRef.ObjC().BuildObjCEncodeExpression(AtLoc, EncodeTypeInfo,
3906 return SemaRef.ObjC().BuildClassMessage(
3907 ReceiverTypeInfo, ReceiverTypeInfo->
getType(),
3920 return SemaRef.ObjC().BuildInstanceMessage(Receiver, Receiver->
getType(),
3923 SelectorLocs, RBracLoc, Args);
3935 return Method->isInstanceMethod()
3936 ?
SemaRef.ObjC().BuildInstanceMessage(
3937 nullptr, SuperType, SuperLoc, Sel,
Method, LBracLoc,
3938 SelectorLocs, RBracLoc, Args)
3939 :
SemaRef.ObjC().BuildClassMessage(
nullptr, SuperType, SuperLoc,
3941 SelectorLocs, RBracLoc, Args);
3950 bool IsArrow,
bool IsFreeIvar) {
3959 if (IsFreeIvar &&
Result.isUsable())
3996 PropertyLoc,
Base));
4025 =
SemaRef.Context.Idents.get(
"__builtin_shufflevector");
4028 assert(!Lookup.
empty() &&
"No __builtin_shufflevector?");
4036 Callee =
SemaRef.ImpCastExprToType(Callee, CalleePtrTy,
4037 CK_BuiltinFnToFnPtr).get();
4053 return SemaRef.ConvertVectorExpr(SrcExpr, DstTInfo, BuiltinLoc, RParenLoc);
4068 EllipsisLoc, NumExpansions);
4092 llvm_unreachable(
"Pack expansion pattern has no parameter packs");
4128 EllipsisLoc, RHS, RParenLoc,
4137 Init->containsUnexpandedParameterPack();
4138 else if (PVD->hasUninstantiatedDefaultArg())
4140 PVD->getUninstantiatedDefaultArg()
4141 ->containsUnexpandedParameterPack();
4295 Exprs.push_back(DevNumExpr);
4296 llvm::append_range(Exprs, QueueIdExprs);
4333 AssociatedDecl, NTTP, Loc, Arg, PackIndex, Final);
4357 ObjectType, FirstQualifierInScope);
4363 QualType TransformDependentNameType(TypeLocBuilder &TLB,
4364 DependentNameTypeLoc TL,
4365 bool DeducibleTSTContext,
4366 QualType ObjectType = QualType(),
4367 NamedDecl *UnqualLookup =
nullptr);
4370 TransformOpenACCClauseList(OpenACCDirectiveKind DirKind,
4375 OpenACCDirectiveKind DirKind,
4376 const OpenACCClause *OldClause);
4379template <
typename Derived>
4389#define STMT(Node, Parent) \
4390 case Stmt::Node##Class: return getDerived().Transform##Node(cast<Node>(S));
4391#define VALUESTMT(Node, Parent) \
4392 case Stmt::Node##Class: \
4393 return getDerived().Transform##Node(cast<Node>(S), SDK);
4394#define ABSTRACT_STMT(Node)
4395#define EXPR(Node, Parent)
4396#include "clang/AST/StmtNodes.inc"
4399#define STMT(Node, Parent)
4400#define ABSTRACT_STMT(Stmt)
4401#define EXPR(Node, Parent) case Stmt::Node##Class:
4402#include "clang/AST/StmtNodes.inc"
4407 E =
getSema().ActOnStmtExprResult(E);
4415template<
typename Derived>
4423#define GEN_CLANG_CLAUSE_CLASS
4424#define CLAUSE_CLASS(Enum, Str, Class) \
4426 return getDerived().Transform##Class(cast<Class>(S));
4427#include "llvm/Frontend/OpenMP/OMP.inc"
4434template<
typename Derived>
4441#define STMT(Node, Parent) case Stmt::Node##Class: break;
4442#define ABSTRACT_STMT(Stmt)
4443#define EXPR(Node, Parent) \
4444 case Stmt::Node##Class: return getDerived().Transform##Node(cast<Node>(E));
4445#include "clang/AST/StmtNodes.inc"
4451template<
typename Derived>
4459 if (
auto *FE = dyn_cast<FullExpr>(
Init))
4460 Init = FE->getSubExpr();
4462 if (
auto *AIL = dyn_cast<ArrayInitLoopExpr>(
Init)) {
4468 Init = MTE->getSubExpr();
4471 Init = Binder->getSubExpr();
4474 Init = ICE->getSubExprAsWritten();
4477 dyn_cast<CXXStdInitializerListExpr>(
Init))
4514 getSema().currentEvaluationContext().InLifetimeExtendingContext =
4515 getSema().parentEvaluationContext().InLifetimeExtendingContext;
4516 getSema().currentEvaluationContext().RebuildDefaultArgOrDefaultInit =
4517 getSema().parentEvaluationContext().RebuildDefaultArgOrDefaultInit;
4519 bool ArgChanged =
false;
4521 true, NewArgs, &ArgChanged))
4531 if (
Parens.isInvalid()) {
4534 assert(NewArgs.empty() &&
4535 "no parens or braces but have direct init with arguments?");
4542template<
typename Derived>
4548 for (
unsigned I = 0; I != NumInputs; ++I) {
4558 Expr *Pattern = Expansion->getPattern();
4561 getSema().collectUnexpandedParameterPacks(Pattern, Unexpanded);
4562 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
4567 bool RetainExpansion =
false;
4568 UnsignedOrNone OrigNumExpansions = Expansion->getNumExpansions();
4572 Unexpanded,
true, Expand,
4573 RetainExpansion, NumExpansions))
4586 Expansion->getEllipsisLoc(),
4588 if (Out.isInvalid())
4593 Outputs.push_back(Out.get());
4599 if (ArgChanged) *ArgChanged =
true;
4603 for (
unsigned I = 0; I != *NumExpansions; ++I) {
4606 if (Out.isInvalid())
4609 if (Out.get()->containsUnexpandedParameterPack()) {
4611 Out.get(), Expansion->getEllipsisLoc(), OrigNumExpansions);
4612 if (Out.isInvalid())
4616 Outputs.push_back(Out.get());
4621 if (RetainExpansion) {
4622 ForgetPartiallySubstitutedPackRAII Forget(
getDerived());
4625 if (Out.isInvalid())
4629 Out.get(), Expansion->getEllipsisLoc(), OrigNumExpansions);
4630 if (Out.isInvalid())
4633 Outputs.push_back(Out.get());
4640 IsCall ?
getDerived().TransformInitializer(Inputs[I],
false)
4645 if (
Result.get() != Inputs[I] && ArgChanged)
4648 Outputs.push_back(
Result.get());
4654template <
typename Derived>
4665 VarDecl *ConditionVar = cast_or_null<VarDecl>(
4671 return getSema().ActOnConditionVariable(ConditionVar, Loc, Kind);
4680 return getSema().ActOnCondition(
nullptr, Loc, CondExpr.
get(), Kind,
4687template <
typename Derived>
4695 Qualifier = Qualifier.getAsNamespaceAndPrefix().Prefix)
4707 llvm_unreachable(
"unexpected null nested name specifier");
4738 QualifierLoc =
getDerived().TransformNestedNameSpecifierLoc(
4739 QualifierLoc, ObjectType, FirstQualifierInScope);
4743 FirstQualifierInScope =
nullptr;
4745 SS.
Adopt(QualifierLoc);
4749 if (
SemaRef.BuildCXXNestedNameSpecifier(
nullptr, IdInfo,
4751 FirstQualifierInScope,
false))
4759 T = TransformTypeInObjectScope(TLB, TL, ObjectType,
4760 FirstQualifierInScope);
4766 if (T->isDependentType() || T->isRecordType() ||
4767 (
SemaRef.getLangOpts().CPlusPlus11 && T->isEnumeralType())) {
4768 if (T->isEnumeralType())
4770 diag::warn_cxx98_compat_enum_nested_name_spec);
4777 if (!TTL || !TTL.
getDecl()->isInvalidDecl()) {
4801template<
typename Derived>
4821 TemplateDecl *NewTemplate = cast_or_null<TemplateDecl>(
4828 SemaRef.Context.DeclarationNames.getCXXDeductionGuideName(NewTemplate));
4838 NewTInfo =
getDerived().TransformType(OldTInfo);
4841 NewCanTy =
SemaRef.Context.getCanonicalType(NewTInfo->
getType());
4849 NewCanTy =
SemaRef.Context.getCanonicalType(NewT);
4862 llvm_unreachable(
"Unknown name kind.");
4865template <
typename Derived>
4869 QualType ObjectType,
bool AllowInjectedClassName) {
4871 return getDerived().RebuildTemplateName(SS, TemplateKWLoc, *II, NameLoc,
4872 ObjectType, AllowInjectedClassName);
4874 NameLoc, ObjectType,
4875 AllowInjectedClassName);
4878template <
typename Derived>
4882 NamedDecl *FirstQualifierInScope,
bool AllowInjectedClassName) {
4884 TemplateName UnderlyingName = QTN->getUnderlyingTemplate();
4887 QualifierLoc =
getDerived().TransformNestedNameSpecifierLoc(
4888 QualifierLoc, ObjectType, FirstQualifierInScope);
4895 UnderlyingQualifier, TemplateKWLoc, UnderlyingName, NameLoc, ObjectType,
4896 FirstQualifierInScope, AllowInjectedClassName);
4897 if (NewUnderlyingName.
isNull())
4899 assert(!UnderlyingQualifier &&
"unexpected qualifier");
4903 NewUnderlyingName == UnderlyingName)
4906 SS.
Adopt(QualifierLoc);
4907 return getDerived().RebuildTemplateName(SS, QTN->hasTemplateKeyword(),
4913 QualifierLoc =
getDerived().TransformNestedNameSpecifierLoc(
4914 QualifierLoc, ObjectType, FirstQualifierInScope);
4928 SS.
Adopt(QualifierLoc);
4929 return getDerived().RebuildTemplateName(SS, TemplateKWLoc, DTN->getName(),
4930 NameLoc, ObjectType,
4931 AllowInjectedClassName);
4936 assert(!QualifierLoc &&
"Unexpected qualified SubstTemplateTemplateParm");
4943 ReplacementQualifierLoc = Builder.getWithLocInContext(
SemaRef.Context);
4947 ReplacementQualifierLoc, TemplateKWLoc, ReplacementName, NameLoc,
4948 ObjectType, FirstQualifierInScope, AllowInjectedClassName);
4951 Decl *AssociatedDecl =
4952 getDerived().TransformDecl(NameLoc, S->getAssociatedDecl());
4954 AssociatedDecl == S->getAssociatedDecl())
4956 return SemaRef.Context.getSubstTemplateTemplateParm(
4957 NewName, AssociatedDecl, S->getIndex(), S->getPackIndex(),
4962 "DeducedTemplateName should not escape partial ordering");
4966 assert(!QualifierLoc &&
"Unexpected qualifier");
4973 assert(!QualifierLoc &&
4974 "Unexpected qualified SubstTemplateTemplateParmPack");
4976 SubstPack->getArgumentPack(), SubstPack->getAssociatedDecl(),
4977 SubstPack->getIndex(), SubstPack->getFinal());
4981 llvm_unreachable(
"overloaded function decl survived to here");
4984template <
typename Derived>
4989 QualifierLoc, TemplateKeywordLoc, Name, NameLoc);
4995template<
typename Derived>
4999 Output =
getSema().getTrivialTemplateArgumentLoc(
5003template <
typename Derived>
5011 llvm_unreachable(
"Unexpected TemplateArgument");
5034 if (NewT == T && D == NewD)
5051 llvm_unreachable(
"unexpected template argument kind");
5083 llvm_unreachable(
"Caller should expand pack expansions");
5099 E =
SemaRef.ActOnConstantExpression(E);
5114template<
typename Derived,
typename InputIterator>
5122 typedef typename std::iterator_traits<InputIterator>::difference_type
5137 : Self(Self), Iter(Iter) { }
5152 Self.InventTemplateArgumentLoc(*Iter,
Result);
5160 return X.Iter == Y.Iter;
5165 return X.Iter != Y.Iter;
5169template<
typename Derived>
5170template<
typename InputIterator>
5190 PackLocIterator(*
this, In.getArgument().pack_begin()),
5191 PackLocIterator(*
this, In.getArgument().pack_end()), *PackOutput,
5198 if (In.getArgument().isPackExpansion()) {
5210 std::optional<ForgetSubstitutionRAII> ForgetSubst;
5220 if (Out.getArgument().containsUnexpandedParameterPack()) {
5223 if (Out.getArgument().isNull())
5233 ForgetPartiallySubstitutedPackRAII Forget(
getDerived());
5241 if (Out.getArgument().isNull())
5260template <
typename Derived>
5261template <
typename InputIterator>
5270 return !Arg.isDependent() && Arg.isConceptOrConceptTemplateParameter();
5282 PackLocIterator(*
this, In.getArgument().pack_begin()),
5283 PackLocIterator(*
this, In.getArgument().pack_end()), Outputs,
5289 if (!isNonDependentConceptArgument(In.getArgument())) {
5304template <
typename Derived>
5315 Pattern =
getSema().getTemplateArgumentPackExpansionPattern(
5318 getSema().collectUnexpandedParameterPacks(Pattern, Unexpanded);
5319 if (IsLateExpansionAttempt) {
5324 return P.first.dyn_cast<
const SubstBuiltinTemplatePackType *>();
5326 if (!SawPackTypes) {
5331 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
5339 Info.
Ellipsis, Pattern.getSourceRange(), Unexpanded,
5345 if (ComputeInfo(In,
false, Info, Pattern))
5357 std::optional<Sema::ArgPackSubstIndexRAII> SubstIndex(
5358 std::in_place,
getSema(), std::nullopt);
5364 if (Out.getArgument().isNull())
5401 ForgetSubstitutionRAII ForgetSubst(
getDerived());
5402 if (ComputeInfo(Out,
true, Info, OutPattern))
5415template<
typename Derived>
5433template <
typename Derived>
5453template<
typename Derived>
5456 switch (T.getTypeLocClass()) {
5457#define ABSTRACT_TYPELOC(CLASS, PARENT)
5458#define TYPELOC(CLASS, PARENT) \
5459 case TypeLoc::CLASS: \
5460 return getDerived().Transform##CLASS##Type(TLB, \
5461 T.castAs<CLASS##TypeLoc>());
5462#include "clang/AST/TypeLocNodes.def"
5465 llvm_unreachable(
"unhandled type loc!");
5468template<
typename Derived>
5481template <
typename Derived>
5519template<
typename Derived>
5525 auto SuppressObjCLifetime =
5528 Result = getDerived().TransformTemplateTypeParmType(TLB, TTP,
5529 SuppressObjCLifetime);
5530 }
else if (
auto STTP = UnqualTL.
getAs<SubstTemplateTypeParmPackTypeLoc>()) {
5531 Result = getDerived().TransformSubstTemplateTypeParmPackType(
5532 TLB, STTP, SuppressObjCLifetime);
5534 Result = getDerived().TransformType(TLB, UnqualTL);
5553template <
typename Derived>
5563 SemaRef.Diag(Loc, diag::err_address_space_mismatch_templ_inst)
5570 if (T.getPointerAuth().isPresent()) {
5571 SemaRef.Diag(Loc, diag::err_ptrauth_qualifier_redundant) << TL.
getType();
5574 if (!T->isDependentType()) {
5575 if (!T->isSignableType(
SemaRef.getASTContext())) {
5576 SemaRef.Diag(Loc, diag::err_ptrauth_qualifier_invalid_target) << T;
5584 if (T->isFunctionType()) {
5585 T =
SemaRef.getASTContext().getAddrSpaceQualType(T,
5595 if (T->isReferenceType()) {
5605 if (!T->isObjCLifetimeType() && !T->isDependentType())
5607 else if (T.getObjCLifetime()) {
5611 const AutoType *AutoTy;
5612 if ((AutoTy = dyn_cast<AutoType>(T)) && AutoTy->isDeduced()) {
5614 QualType Deduced = AutoTy->getDeducedType();
5619 T =
SemaRef.Context.getAutoType(Deduced, AutoTy->getKeyword(),
5622 AutoTy->getTypeConstraintConcept(),
5623 AutoTy->getTypeConstraintArguments());
5628 SemaRef.Diag(Loc, diag::err_attr_objc_ownership_redundant) << T;
5634 return SemaRef.BuildQualifiedType(T, Loc, Quals);
5637template <
typename Derived>
5638QualType TreeTransform<Derived>::TransformTypeInObjectScope(
5641 assert(!getDerived().AlreadyTransformed(TL.
getType()));
5644 case TypeLoc::TemplateSpecialization:
5645 return getDerived().TransformTemplateSpecializationType(
5647 FirstQualifierInScope,
true);
5648 case TypeLoc::DependentName:
5649 return getDerived().TransformDependentNameType(
5651 ObjectType, FirstQualifierInScope);
5655 return getDerived().TransformType(TLB, TL);
5659template <
class TyLoc>
static inline
5661 TyLoc NewT = TLB.
push<TyLoc>(T.getType());
5662 NewT.setNameLoc(T.getNameLoc());
5666template<
typename Derived>
5667QualType TreeTransform<Derived>::TransformBuiltinType(TypeLocBuilder &TLB,
5669 BuiltinTypeLoc NewT = TLB.push<BuiltinTypeLoc>(T.getType());
5670 NewT.setBuiltinLoc(T.getBuiltinLoc());
5671 if (T.needsExtraLocalData())
5672 NewT.getWrittenBuiltinSpecs() = T.getWrittenBuiltinSpecs();
5676template<
typename Derived>
5683template <
typename Derived>
5687 return getDerived().
TransformType(TLB, TL.getOriginalLoc());
5690template<
typename Derived>
5693 QualType OriginalType = getDerived().TransformType(TLB, TL.getOriginalLoc());
5694 if (OriginalType.isNull())
5698 if (getDerived().AlwaysRebuild() ||
5699 OriginalType != TL.getOriginalLoc().getType())
5706template <
typename Derived>
5710 QualType OriginalType = getDerived().TransformType(TLB, TL.getElementLoc());
5711 if (OriginalType.isNull())
5715 if (getDerived().AlwaysRebuild() ||
5716 OriginalType != TL.getElementLoc().getType())
5723template<
typename Derived>
5727 = getDerived().TransformType(TLB, TL.getPointeeLoc());
5728 if (PointeeType.isNull())
5732 if (PointeeType->getAs<ObjCObjectType>()) {
5744 if (getDerived().AlwaysRebuild() ||
5745 PointeeType != TL.getPointeeLoc().getType()) {
5746 Result = getDerived().RebuildPointerType(PointeeType, TL.getSigilLoc());
5753 TLB.TypeWasModifiedSafely(
Result->getPointeeType());
5760template<
typename Derived>
5765 = getDerived().TransformType(TLB, TL.getPointeeLoc());
5766 if (PointeeType.isNull())
5770 if (getDerived().AlwaysRebuild() ||
5771 PointeeType != TL.getPointeeLoc().getType()) {
5772 Result = getDerived().RebuildBlockPointerType(PointeeType,
5787template<
typename Derived>
5795 if (PointeeType.
isNull())
5800 PointeeType != T->getPointeeTypeAsWritten()) {
5802 T->isSpelledAsLValue(),
5824template<
typename Derived>
5828 return TransformReferenceType(TLB, TL);
5831template<
typename Derived>
5833TreeTransform<Derived>::TransformRValueReferenceType(TypeLocBuilder &TLB,
5834 RValueReferenceTypeLoc TL) {
5835 return TransformReferenceType(TLB, TL);
5838template<
typename Derived>
5842 QualType PointeeType = getDerived().TransformType(TLB, TL.getPointeeLoc());
5843 if (PointeeType.isNull())
5850 getDerived().TransformNestedNameSpecifierLoc(OldQualifierLoc);
5851 if (!NewQualifierLoc)
5854 CXXRecordDecl *OldCls = T->getMostRecentCXXRecordDecl(), *NewCls =
nullptr;
5856 NewCls = cast_or_null<CXXRecordDecl>(
5857 getDerived().TransformDecl(TL.getStarLoc(), OldCls));
5863 if (getDerived().AlwaysRebuild() || PointeeType != T->getPointeeType() ||
5864 NewQualifierLoc.getNestedNameSpecifier() !=
5865 OldQualifierLoc.getNestedNameSpecifier() ||
5868 SS.
Adopt(NewQualifierLoc);
5869 Result = getDerived().RebuildMemberPointerType(PointeeType, SS, NewCls,
5878 if (MPT && PointeeType != MPT->getPointeeType()) {
5885 NewTL.setQualifierLoc(NewQualifierLoc);
5890template<
typename Derived>
5895 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
5896 if (ElementType.isNull())
5900 Expr *OldSize = TL.getSizeExpr();
5902 OldSize =
const_cast<Expr*
>(T->getSizeExpr());
5903 Expr *NewSize =
nullptr;
5907 NewSize = getDerived().TransformExpr(OldSize).template getAs<Expr>();
5912 if (getDerived().AlwaysRebuild() ||
5913 ElementType != T->getElementType() ||
5914 (T->getSizeExpr() && NewSize != OldSize)) {
5915 Result = getDerived().RebuildConstantArrayType(ElementType,
5916 T->getSizeModifier(),
5917 T->getSize(), NewSize,
5918 T->getIndexTypeCVRQualifiers(),
5919 TL.getBracketsRange());
5930 NewTL.setRBracketLoc(TL.getRBracketLoc());
5931 NewTL.setSizeExpr(NewSize);
5936template<
typename Derived>
5941 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
5942 if (ElementType.isNull())
5946 if (getDerived().AlwaysRebuild() ||
5947 ElementType != T->getElementType()) {
5948 Result = getDerived().RebuildIncompleteArrayType(ElementType,
5949 T->getSizeModifier(),
5950 T->getIndexTypeCVRQualifiers(),
5951 TL.getBracketsRange());
5958 NewTL.setRBracketLoc(TL.getRBracketLoc());
5959 NewTL.setSizeExpr(
nullptr);
5964template<
typename Derived>
5969 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
5970 if (ElementType.isNull())
5977 SizeResult = getDerived().TransformExpr(T->getSizeExpr());
5979 if (SizeResult.isInvalid())
5983 if (SizeResult.isInvalid())
5989 if (getDerived().AlwaysRebuild() ||
5990 ElementType != T->getElementType() ||
5991 Size != T->getSizeExpr()) {
5992 Result = getDerived().RebuildVariableArrayType(ElementType,
5993 T->getSizeModifier(),
5995 T->getIndexTypeCVRQualifiers(),
5996 TL.getBracketsRange());
6005 NewTL.setRBracketLoc(TL.getRBracketLoc());
6006 NewTL.setSizeExpr(Size);
6011template<
typename Derived>
6016 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
6017 if (ElementType.isNull())
6025 SemaRef.
ExprEvalContexts.back().InConditionallyConstantEvaluateContext =
true;
6028 Expr *origSize = TL.getSizeExpr();
6029 if (!origSize) origSize = T->getSizeExpr();
6032 = getDerived().TransformExpr(origSize);
6034 if (sizeResult.isInvalid())
6037 Expr *size = sizeResult.get();
6040 if (getDerived().AlwaysRebuild() ||
6041 ElementType != T->getElementType() ||
6043 Result = getDerived().RebuildDependentSizedArrayType(ElementType,
6044 T->getSizeModifier(),
6046 T->getIndexTypeCVRQualifiers(),
6047 TL.getBracketsRange());
6056 NewTL.setRBracketLoc(TL.getRBracketLoc());
6057 NewTL.setSizeExpr(size);
6062template <
typename Derived>
6066 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
6067 if (ElementType.isNull())
6075 if (
Size.isInvalid())
6079 if (getDerived().AlwaysRebuild() || ElementType != T->getElementType() ||
6080 Size.get() != T->getSizeExpr()) {
6081 Result = getDerived().RebuildDependentVectorType(
6082 ElementType,
Size.get(), T->getAttributeLoc(), T->getVectorKind());
6100template<
typename Derived>
6107 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
6108 if (ElementType.isNull())
6117 if (
Size.isInvalid())
6121 if (getDerived().AlwaysRebuild() ||
6122 ElementType != T->getElementType() ||
6123 Size.get() != T->getSizeExpr()) {
6124 Result = getDerived().RebuildDependentSizedExtVectorType(ElementType,
6126 T->getAttributeLoc());
6144template <
typename Derived>
6149 QualType ElementType = getDerived().TransformType(T->getElementType());
6150 if (ElementType.isNull())
6154 if (getDerived().AlwaysRebuild() || ElementType != T->getElementType()) {
6155 Result = getDerived().RebuildConstantMatrixType(
6156 ElementType, T->getNumRows(), T->getNumColumns());
6163 NewTL.setAttrOperandParensRange(TL.getAttrOperandParensRange());
6164 NewTL.setAttrRowOperand(TL.getAttrRowOperand());
6165 NewTL.setAttrColumnOperand(TL.getAttrColumnOperand());
6170template <
typename Derived>
6175 QualType ElementType = getDerived().TransformType(T->getElementType());
6176 if (ElementType.isNull()) {
6184 Expr *origRows = TL.getAttrRowOperand();
6186 origRows = T->getRowExpr();
6187 Expr *origColumns = TL.getAttrColumnOperand();
6189 origColumns = T->getColumnExpr();
6191 ExprResult rowResult = getDerived().TransformExpr(origRows);
6193 if (rowResult.isInvalid())
6196 ExprResult columnResult = getDerived().TransformExpr(origColumns);
6198 if (columnResult.isInvalid())
6201 Expr *rows = rowResult.get();
6202 Expr *columns = columnResult.get();
6205 if (getDerived().AlwaysRebuild() || ElementType != T->getElementType() ||
6206 rows != origRows || columns != origColumns) {
6207 Result = getDerived().RebuildDependentSizedMatrixType(
6208 ElementType, rows, columns, T->getAttributeLoc());
6218 NewTL.setAttrOperandParensRange(TL.getAttrOperandParensRange());
6219 NewTL.setAttrRowOperand(rows);
6220 NewTL.setAttrColumnOperand(columns);
6224template <
typename Derived>
6230 getDerived().TransformType(TLB, TL.getPointeeTypeLoc());
6232 if (pointeeType.isNull())
6239 ExprResult AddrSpace = getDerived().TransformExpr(T->getAddrSpaceExpr());
6241 if (AddrSpace.isInvalid())
6245 if (getDerived().AlwaysRebuild() || pointeeType != T->getPointeeType() ||
6246 AddrSpace.get() != T->getAddrSpaceExpr()) {
6247 Result = getDerived().RebuildDependentAddressSpaceType(
6248 pointeeType, AddrSpace.get(), T->getAttributeLoc());
6259 NewTL.setAttrExprOperand(TL.getAttrExprOperand());
6260 NewTL.setAttrNameLoc(TL.getAttrNameLoc());
6263 TLB.TypeWasModifiedSafely(
Result);
6269template <
typename Derived>
6273 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
6274 if (ElementType.isNull())
6278 if (getDerived().AlwaysRebuild() ||
6279 ElementType != T->getElementType()) {
6280 Result = getDerived().RebuildVectorType(ElementType, T->getNumElements(),
6281 T->getVectorKind());
6292template<
typename Derived>
6296 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
6297 if (ElementType.isNull())
6301 if (getDerived().AlwaysRebuild() ||
6302 ElementType != T->getElementType()) {
6303 Result = getDerived().RebuildExtVectorType(ElementType,
6304 T->getNumElements(),
6316template <
typename Derived>
6319 bool ExpectParameterPack) {
6354 if (NewTSI == OldTSI && indexAdjustment == 0)
6364 getDerived().transformedLocalDecl(OldParm, {newParm});
6368template <
typename Derived>
6376 unsigned *LastParamTransformed) {
6377 int indexAdjustment = 0;
6379 unsigned NumParams = Params.size();
6380 for (
unsigned i = 0; i != NumParams; ++i) {
6381 if (LastParamTransformed)
6382 *LastParamTransformed = i;
6384 assert(OldParm->getFunctionScopeIndex() == i);
6388 if (OldParm->isParameterPack()) {
6393 TypeLoc TL = OldParm->getTypeSourceInfo()->getTypeLoc();
6396 SemaRef.collectUnexpandedParameterPacks(Pattern, Unexpanded);
6399 bool ShouldExpand =
false;
6400 bool RetainExpansion =
false;
6402 if (Unexpanded.size() > 0) {
6403 OrigNumExpansions = ExpansionTL.
getTypePtr()->getNumExpansions();
6404 NumExpansions = OrigNumExpansions;
6408 ShouldExpand, RetainExpansion, NumExpansions)) {
6413 const AutoType *AT =
6414 Pattern.getType().getTypePtr()->getContainedAutoType();
6415 assert((AT && (!AT->isDeduced() || AT->getDeducedType().isNull())) &&
6416 "Could not find parameter packs or undeduced auto type!");
6423 getDerived().ExpandingFunctionParameterPack(OldParm);
6424 for (
unsigned I = 0; I != *NumExpansions; ++I) {
6427 =
getDerived().TransformFunctionTypeParam(OldParm,
6435 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6436 OutParamTypes.push_back(NewParm->
getType());
6438 PVars->push_back(NewParm);
6443 if (RetainExpansion) {
6444 ForgetPartiallySubstitutedPackRAII Forget(
getDerived());
6446 =
getDerived().TransformFunctionTypeParam(OldParm,
6454 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6455 OutParamTypes.push_back(NewParm->
getType());
6457 PVars->push_back(NewParm);
6473 NewParm =
getDerived().TransformFunctionTypeParam(OldParm,
6478 "Parameter pack no longer a parameter pack after "
6481 NewParm =
getDerived().TransformFunctionTypeParam(
6482 OldParm, indexAdjustment, std::nullopt,
6490 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6491 OutParamTypes.push_back(NewParm->
getType());
6493 PVars->push_back(NewParm);
6501 bool IsPackExpansion =
false;
6504 if (
const PackExpansionType *Expansion
6505 = dyn_cast<PackExpansionType>(OldType)) {
6507 QualType Pattern = Expansion->getPattern();
6509 getSema().collectUnexpandedParameterPacks(Pattern, Unexpanded);
6512 bool ShouldExpand =
false;
6513 bool RetainExpansion =
false;
6517 RetainExpansion, NumExpansions)) {
6524 for (
unsigned I = 0; I != *NumExpansions; ++I) {
6531 NewType =
getSema().getASTContext().getPackExpansionType(
6532 NewType, std::nullopt);
6539 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6540 OutParamTypes.push_back(NewType);
6542 PVars->push_back(
nullptr);
6551 if (RetainExpansion) {
6552 ForgetPartiallySubstitutedPackRAII Forget(
getDerived());
6558 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6559 OutParamTypes.push_back(NewType);
6561 PVars->push_back(
nullptr);
6566 OldType = Expansion->getPattern();
6567 IsPackExpansion =
true;
6569 NewType =
getDerived().TransformType(OldType);
6571 NewType =
getDerived().TransformType(OldType);
6577 if (IsPackExpansion)
6578 NewType =
getSema().Context.getPackExpansionType(NewType,
6582 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6583 OutParamTypes.push_back(NewType);
6585 PVars->push_back(
nullptr);
6590 for (
unsigned i = 0, e = PVars->size(); i != e; ++i)
6592 assert(parm->getFunctionScopeIndex() == i);
6599template<
typename Derived>
6604 return getDerived().TransformFunctionProtoType(
6608 ExceptionStorage, Changed);
6612template<
typename Derived>
template<
typename Fn>
6631 if (T->hasTrailingReturn()) {
6635 T->getExtParameterInfosOrNull(),
6636 ParamTypes, &ParamDecls, ExtParamInfos))
6646 auto *RD = dyn_cast<CXXRecordDecl>(
SemaRef.getCurLexicalContext());
6648 SemaRef, !ThisContext && RD ? RD : ThisContext, ThisTypeQuals);
6663 T->getExtParameterInfosOrNull(),
6664 ParamTypes, &ParamDecls, ExtParamInfos))
6670 bool EPIChanged =
false;
6675 if (
auto NewExtParamInfos =
6691 std::optional<FunctionEffectSet> NewFX;
6703 std::optional<FunctionEffectMode> Mode =
6723 "FunctionEffectMode::None shouldn't be possible here");
6726 if (!
SemaRef.diagnoseConflictingFunctionEffect(*NewFX, NewEC,
6729 NewFX->insert(NewEC, Errs);
6730 assert(Errs.empty());
6739 T->getParamTypes() !=
llvm::ArrayRef(ParamTypes) || EPIChanged) {
6740 Result =
getDerived().RebuildFunctionProtoType(ResultType, ParamTypes, EPI);
6751 for (
unsigned i = 0, e = NewTL.
getNumParams(); i != e; ++i)
6757template<
typename Derived>
6780 getSema().ActOnNoexceptSpec(NoexceptExpr.
get(), EST);
6795 if (
const PackExpansionType *PackExpansion =
6796 T->getAs<PackExpansionType>()) {
6801 SemaRef.collectUnexpandedParameterPacks(PackExpansion->getPattern(),
6803 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
6808 bool Expand =
false;
6809 bool RetainExpansion =
false;
6810 UnsignedOrNone NumExpansions = PackExpansion->getNumExpansions();
6815 true, Expand, RetainExpansion,
6828 U =
SemaRef.Context.getPackExpansionType(
U, NumExpansions);
6829 Exceptions.push_back(
U);
6835 for (
unsigned ArgIdx = 0; ArgIdx != *NumExpansions; ++ArgIdx) {
6839 if (
U.isNull() ||
SemaRef.CheckSpecifiedExceptionType(
U, Loc))
6842 Exceptions.push_back(
U);
6846 if (
U.isNull() ||
SemaRef.CheckSpecifiedExceptionType(
U, Loc))
6851 Exceptions.push_back(
U);
6861template<
typename Derived>
6871 if (getDerived().AlwaysRebuild() || ResultType != T->getReturnType())
6872 Result = getDerived().RebuildFunctionNoProtoType(ResultType);
6883template <
typename Derived>
6884QualType TreeTransform<Derived>::TransformUnresolvedUsingType(
6885 TypeLocBuilder &TLB, UnresolvedUsingTypeLoc TL) {
6887 const UnresolvedUsingType *T = TL.getTypePtr();
6888 bool Changed =
false;
6890 NestedNameSpecifierLoc QualifierLoc = TL.getQualifierLoc();
6891 if (NestedNameSpecifierLoc OldQualifierLoc = QualifierLoc) {
6892 QualifierLoc = getDerived().TransformNestedNameSpecifierLoc(QualifierLoc);
6895 Changed |= QualifierLoc != OldQualifierLoc;
6898 auto *D = getDerived().TransformDecl(TL.getNameLoc(), T->getDecl());
6904 if (getDerived().AlwaysRebuild() || Changed) {
6905 Result = getDerived().RebuildUnresolvedUsingType(
6906 T->getKeyword(), QualifierLoc.getNestedNameSpecifier(), TL.getNameLoc(),
6914 QualifierLoc, TL.getNameLoc());
6917 QualifierLoc, TL.getNameLoc());
6921template <
typename Derived>
6929 QualifierLoc = getDerived().TransformNestedNameSpecifierLoc(QualifierLoc);
6932 Changed |= QualifierLoc != OldQualifierLoc;
6935 auto *D = cast_or_null<UsingShadowDecl>(
6936 getDerived().TransformDecl(TL.getNameLoc(), T->getDecl()));
6941 QualType UnderlyingType = getDerived().TransformType(T->desugar());
6942 if (UnderlyingType.isNull())
6944 Changed |= UnderlyingType != T->desugar();
6947 if (getDerived().AlwaysRebuild() || Changed) {
6948 Result = getDerived().RebuildUsingType(
6949 T->getKeyword(), QualifierLoc.getNestedNameSpecifier(), D,
6959template<
typename Derived>
6967 QualifierLoc = getDerived().TransformNestedNameSpecifierLoc(QualifierLoc);
6970 Changed |= QualifierLoc != OldQualifierLoc;
6973 auto *
Typedef = cast_or_null<TypedefNameDecl>(
6974 getDerived().TransformDecl(TL.getNameLoc(), T->getDecl()));
6982 if (getDerived().AlwaysRebuild() || Changed) {
6983 Result = getDerived().RebuildTypedefType(
6984 T->getKeyword(), QualifierLoc.getNestedNameSpecifier(),
Typedef);
6990 QualifierLoc, TL.getNameLoc());
6994template<
typename Derived>
7002 ExprResult E = getDerived().TransformExpr(TL.getUnderlyingExpr());
7012 if (getDerived().AlwaysRebuild() || E.get() != TL.getUnderlyingExpr()) {
7014 getDerived().RebuildTypeOfExprType(E.get(), TL.getTypeofLoc(), Kind);
7021 NewTL.setLParenLoc(TL.getLParenLoc());
7022 NewTL.setRParenLoc(TL.getRParenLoc());
7027template<
typename Derived>
7031 TypeSourceInfo* New_Under_TI = getDerived().TransformType(Old_Under_TI);
7037 if (getDerived().AlwaysRebuild() || New_Under_TI != Old_Under_TI) {
7038 Result = getDerived().RebuildTypeOfType(New_Under_TI->getType(), Kind);
7045 NewTL.setLParenLoc(TL.getLParenLoc());
7046 NewTL.setRParenLoc(TL.getRParenLoc());
7047 NewTL.setUnmodifiedTInfo(New_Under_TI);
7052template<
typename Derived>
7055 const DecltypeType *T = TL.getTypePtr();
7062 ExprResult E = getDerived().TransformExpr(T->getUnderlyingExpr());
7066 E = getSema().ActOnDecltypeExpression(E.get());
7071 if (getDerived().AlwaysRebuild() ||
7072 E.get() != T->getUnderlyingExpr()) {
7073 Result = getDerived().RebuildDecltypeType(E.get(), TL.getDecltypeLoc());
7081 NewTL.setRParenLoc(TL.getRParenLoc());
7085template <
typename Derived>
7095 IndexExpr = getDerived().TransformExpr(TL.getIndexExpr());
7096 if (IndexExpr.isInvalid())
7099 QualType Pattern = TL.getPattern();
7101 const PackIndexingType *PIT = TL.
getTypePtr();
7105 bool NotYetExpanded = Types.empty();
7106 bool FullySubstituted =
true;
7108 if (Types.empty() && !PIT->expandsToEmptyPack())
7112 if (!T->containsUnexpandedParameterPack()) {
7113 QualType Transformed = getDerived().TransformType(T);
7114 if (Transformed.isNull())
7116 SubtitutedTypes.push_back(Transformed);
7121 getSema().collectUnexpandedParameterPacks(T, Unexpanded);
7122 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
7125 bool ShouldExpand =
true;
7126 bool RetainExpansion =
false;
7128 if (getDerived().TryExpandParameterPacks(
7131 RetainExpansion, NumExpansions))
7133 if (!ShouldExpand) {
7139 QualType Pack = getDerived().TransformType(TLB, TI->getTypeLoc());
7142 if (NotYetExpanded) {
7143 FullySubstituted =
false;
7144 QualType Out = getDerived().RebuildPackIndexingType(
7154 SubtitutedTypes.push_back(Pack);
7157 for (
unsigned I = 0; I != *NumExpansions; ++I) {
7162 SubtitutedTypes.push_back(Out);
7163 FullySubstituted &= !
Out->containsUnexpandedParameterPack();
7167 if (RetainExpansion) {
7168 FullySubstituted =
false;
7169 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
7173 SubtitutedTypes.push_back(Out);
7181 QualType Result = getDerived().TransformType(TLB, TL.getPatternLoc());
7183 QualType Out = getDerived().RebuildPackIndexingType(
7185 FullySubstituted, SubtitutedTypes);
7194template<
typename Derived>
7200 if (
Result->isDependentType()) {
7201 const UnaryTransformType *T = TL.getTypePtr();
7203 NewBaseTSI = getDerived().TransformType(TL.getUnderlyingTInfo());
7206 QualType NewBase = NewBaseTSI->getType();
7208 Result = getDerived().RebuildUnaryTransformType(NewBase,
7217 NewTL.setParensRange(TL.getParensRange());
7218 NewTL.setUnderlyingTInfo(NewBaseTSI);
7222template<
typename Derived>
7225 const DeducedTemplateSpecializationType *T = TL.getTypePtr();
7230 TL.getTemplateNameLoc());
7234 QualType OldDeduced = T->getDeducedType();
7236 if (!OldDeduced.isNull()) {
7237 NewDeduced = getDerived().TransformType(OldDeduced);
7238 if (NewDeduced.isNull())
7242 QualType Result = getDerived().RebuildDeducedTemplateSpecializationType(
7249 NewTL.setTemplateNameLoc(TL.getTemplateNameLoc());
7250 NewTL.setQualifierLoc(QualifierLoc);
7254template <
typename Derived>
7261 QualifierLoc =
getDerived().TransformNestedNameSpecifierLoc(QualifierLoc);
7266 auto *TD = cast_or_null<TagDecl>(
7273 TD != T->getDecl()) {
7274 if (T->isCanonicalUnqualified())
7291template <
typename Derived>
7297template <
typename Derived>
7298QualType TreeTransform<Derived>::TransformRecordType(TypeLocBuilder &TLB,
7300 return getDerived().TransformTagType(TLB, TL);
7303template<
typename Derived>
7310template<
typename Derived>
7314 return getDerived().TransformTemplateTypeParmType(
7319template <
typename Derived>
7325template<
typename Derived>
7326QualType TreeTransform<Derived>::TransformSubstTemplateTypeParmType(
7327 TypeLocBuilder &TLB,
7328 SubstTemplateTypeParmTypeLoc TL) {
7329 const SubstTemplateTypeParmType *T = TL.getTypePtr();
7332 getDerived().TransformDecl(TL.getNameLoc(), T->getAssociatedDecl());
7337 TemporaryBase Rebase(*
this, TL.getNameLoc(), DeclarationName());
7338 QualType Replacement = getDerived().TransformType(T->getReplacementType());
7339 if (Replacement.isNull())
7343 Replacement, NewReplaced, T->getIndex(), T->getPackIndex(),
7347 SubstTemplateTypeParmTypeLoc NewTL
7348 = TLB.push<SubstTemplateTypeParmTypeLoc>(Result);
7349 NewTL.setNameLoc(TL.getNameLoc());
7353template <
typename Derived>
7359template<
typename Derived>
7363 return getDerived().TransformSubstTemplateTypeParmPackType(
7367template <
typename Derived>
7373template<
typename Derived>
7374QualType TreeTransform<Derived>::TransformAtomicType(TypeLocBuilder &TLB,
7376 QualType ValueType = getDerived().TransformType(TLB, TL.getValueLoc());
7377 if (ValueType.isNull())
7380 QualType Result = TL.getType();
7381 if (getDerived().AlwaysRebuild() ||
7382 ValueType != TL.getValueLoc().getType()) {
7383 Result = getDerived().RebuildAtomicType(ValueType, TL.getKWLoc());
7384 if (Result.isNull())
7390 NewTL.setLParenLoc(TL.getLParenLoc());
7391 NewTL.setRParenLoc(TL.getRParenLoc());
7396template <
typename Derived>
7399 QualType ValueType = getDerived().TransformType(TLB, TL.getValueLoc());
7400 if (ValueType.isNull())
7404 if (getDerived().AlwaysRebuild() || ValueType != TL.getValueLoc().getType()) {
7407 Result = getDerived().RebuildPipeType(ValueType, TL.getKWLoc(), isReadPipe);
7418template <
typename Derived>
7424 if (getDerived().AlwaysRebuild()) {
7425 Result = getDerived().RebuildBitIntType(EIT->isUnsigned(),
7426 EIT->getNumBits(), TL.getNameLoc());
7436template <
typename Derived>
7443 ExprResult BitsExpr = getDerived().TransformExpr(EIT->getNumBitsExpr());
7446 if (BitsExpr.isInvalid())
7451 if (getDerived().AlwaysRebuild() || BitsExpr.get() != EIT->getNumBitsExpr()) {
7452 Result = getDerived().RebuildDependentBitIntType(
7453 EIT->isUnsigned(), BitsExpr.get(), TL.getNameLoc());
7469template <
typename Derived>
7472 llvm_unreachable(
"This type does not need to be transformed.");
7480 template<
typename ArgLocContainer>
7482 ArgLocContainer *Container;
7507 : Container(&Container), Index(Index) { }
7521 return Container->getArgLoc(Index);
7525 return pointer(Container->getArgLoc(Index));
7530 return X.Container == Y.Container &&
X.Index == Y.Index;
7539template<
typename Derived>
7540QualType TreeTransform<Derived>::TransformAutoType(TypeLocBuilder &TLB,
7542 const AutoType *T = TL.getTypePtr();
7543 QualType OldDeduced = T->getDeducedType();
7544 QualType NewDeduced;
7545 if (!OldDeduced.isNull()) {
7546 NewDeduced = getDerived().TransformType(OldDeduced);
7547 if (NewDeduced.isNull())
7554 if (T->isConstrained()) {
7555 assert(TL.getConceptReference());
7556 NewCD = cast_or_null<ConceptDecl>(getDerived().TransformDecl(
7557 TL.getConceptNameLoc(), T->getTypeConstraintConcept()));
7559 NewTemplateArgs.setLAngleLoc(TL.getLAngleLoc());
7560 NewTemplateArgs.setRAngleLoc(TL.getRAngleLoc());
7562 if (getDerived().TransformTemplateArguments(
7563 ArgIterator(TL, 0), ArgIterator(TL, TL.getNumArgs()),
7567 if (TL.getNestedNameSpecifierLoc()) {
7569 = getDerived().TransformNestedNameSpecifierLoc(
7570 TL.getNestedNameSpecifierLoc());
7571 if (!NewNestedNameSpec)
7577 if (getDerived().AlwaysRebuild() || NewDeduced != OldDeduced ||
7578 T->isDependentType() || T->isConstrained()) {
7581 NewArgList.reserve(NewTemplateArgs.size());
7582 for (
const auto &ArgLoc : NewTemplateArgs.arguments())
7583 NewArgList.push_back(ArgLoc.getArgument());
7584 Result = getDerived().RebuildAutoType(NewDeduced, T->getKeyword(), NewCD,
7592 NewTL.setRParenLoc(TL.getRParenLoc());
7593 NewTL.setConceptReference(
nullptr);
7595 if (T->isConstrained()) {
7597 TL.getTypePtr()->getTypeConstraintConcept()->getDeclName(),
7598 TL.getConceptNameLoc(),
7599 TL.getTypePtr()->getTypeConstraintConcept()->getDeclName());
7601 SemaRef.
Context, NewNestedNameSpec, TL.getTemplateKWLoc(), DNI,
7602 TL.getFoundDecl(), TL.getTypePtr()->getTypeConstraintConcept(),
7604 NewTL.setConceptReference(CR);
7610template <
typename Derived>
7613 return getDerived().TransformTemplateSpecializationType(
7618template <
typename Derived>
7621 NamedDecl *FirstQualifierInScope,
bool AllowInjectedClassName) {
7622 const TemplateSpecializationType *T = TL.
getTypePtr();
7628 AllowInjectedClassName);
7637 if (getDerived().TransformTemplateArguments(ArgIterator(TL, 0),
7646 QualType Result = getDerived().RebuildTemplateSpecializationType(
7659template <
typename Derived>
7663 QualType modifiedType = getDerived().TransformType(TLB, TL.getModifiedLoc());
7664 if (modifiedType.isNull())
7668 const Attr *oldAttr = TL.getAttr();
7669 const Attr *newAttr = oldAttr ? getDerived().TransformAttr(oldAttr) :
nullptr;
7670 if (oldAttr && !newAttr)
7676 if (getDerived().AlwaysRebuild() ||
7677 modifiedType != oldType->getModifiedType()) {
7690 QualType equivalentType = modifiedType;
7691 if (TL.getModifiedLoc().getType() != TL.getEquivalentTypeLoc().getType()) {
7693 AuxiliaryTLB.
reserve(TL.getFullDataSize());
7695 getDerived().TransformType(AuxiliaryTLB, TL.getEquivalentTypeLoc());
7696 if (equivalentType.isNull())
7702 if (
auto nullability = oldType->getImmediateNullability()) {
7703 if (!modifiedType->canHaveNullability()) {
7704 SemaRef.
Diag((TL.getAttr() ? TL.getAttr()->getLocation()
7705 : TL.getModifiedLoc().getBeginLoc()),
7706 diag::err_nullability_nonpointer)
7723template <
typename Derived>
7727 QualType InnerTy = getDerived().TransformType(TLB, TL.getInnerLoc());
7728 if (InnerTy.isNull())
7731 Expr *OldCount = TL.getCountExpr();
7732 Expr *NewCount =
nullptr;
7734 ExprResult CountResult = getDerived().TransformExpr(OldCount);
7735 if (CountResult.isInvalid())
7737 NewCount = CountResult.get();
7741 if (getDerived().AlwaysRebuild() || InnerTy != OldTy->desugar() ||
7742 OldCount != NewCount) {
7745 InnerTy, NewCount, OldTy->isCountInBytes(), OldTy->isOrNull());
7752template <
typename Derived>
7756 llvm_unreachable(
"Unexpected TreeTransform for BTFTagAttributedType");
7759template <
typename Derived>
7762 const OverflowBehaviorType *OldTy = TL.getTypePtr();
7763 QualType InnerTy = getDerived().TransformType(TLB, TL.getWrappedLoc());
7764 if (InnerTy.isNull())
7768 if (getDerived().AlwaysRebuild() || InnerTy != OldTy->getUnderlyingType()) {
7780template <
typename Derived>
7784 const HLSLAttributedResourceType *oldType = TL.getTypePtr();
7786 QualType WrappedTy = getDerived().TransformType(TLB, TL.getWrappedLoc());
7787 if (WrappedTy.isNull())
7791 QualType OldContainedTy = oldType->getContainedType();
7793 if (!OldContainedTy.isNull()) {
7794 TypeSourceInfo *oldContainedTSI = TL.getContainedTypeSourceInfo();
7795 if (!oldContainedTSI)
7796 oldContainedTSI = getSema().getASTContext().getTrivialTypeSourceInfo(
7798 ContainedTSI = getDerived().TransformType(oldContainedTSI);
7801 ContainedTy = ContainedTSI->getType();
7805 if (getDerived().AlwaysRebuild() || WrappedTy != oldType->getWrappedType() ||
7806 ContainedTy != oldType->getContainedType()) {
7808 WrappedTy, ContainedTy, oldType->getAttrs());
7814 NewTL.setContainedTypeSourceInfo(ContainedTSI);
7818template <
typename Derived>
7822 return TL.getType();
7825template<
typename Derived>
7829 QualType Inner = getDerived().TransformType(TLB, TL.getInnerLoc());
7834 if (getDerived().AlwaysRebuild() ||
7835 Inner != TL.getInnerLoc().getType()) {
7836 Result = getDerived().RebuildParenType(Inner);
7843 NewTL.setRParenLoc(TL.getRParenLoc());
7847template <
typename Derived>
7851 QualType Inner = getDerived().TransformType(TLB, TL.getInnerLoc());
7856 if (getDerived().AlwaysRebuild() || Inner != TL.getInnerLoc().getType()) {
7858 getDerived().RebuildMacroQualifiedType(Inner, TL.getMacroIdentifier());
7868template<
typename Derived>
7869QualType TreeTransform<Derived>::TransformDependentNameType(
7871 return TransformDependentNameType(TLB, TL,
false);
7874template <
typename Derived>
7875QualType TreeTransform<Derived>::TransformDependentNameType(
7878 const DependentNameType *T = TL.
getTypePtr();
7882 QualifierLoc = getDerived().TransformNestedNameSpecifierLoc(
7883 QualifierLoc, ObjectType, UnqualLookup);
7887 assert((ObjectType.isNull() && !UnqualLookup) &&
7888 "must be transformed by TransformNestedNameSpecifierLoc");
7892 = getDerived().RebuildDependentNameType(T->getKeyword(),
7893 TL.getElaboratedKeywordLoc(),
7904 NewTL.setQualifierLoc(QualifierLoc);
7905 NewTL.setNameLoc(TL.getNameLoc());
7909 NewTL.setTemplateNameLoc(TL.getNameLoc());
7910 NewTL.setQualifierLoc(QualifierLoc);
7913 QualifierLoc, TL.getNameLoc());
7916 NewTL.
set(TL.getElaboratedKeywordLoc(), QualifierLoc, TL.getNameLoc());
7920 NewTL.setQualifierLoc(QualifierLoc);
7921 NewTL.setNameLoc(TL.getNameLoc());
7926template<
typename Derived>
7930 = getDerived().TransformType(TLB, TL.getPatternLoc());
7931 if (Pattern.isNull())
7935 if (getDerived().AlwaysRebuild() ||
7936 Pattern != TL.getPatternLoc().getType()) {
7937 Result = getDerived().RebuildPackExpansionType(Pattern,
7938 TL.getPatternLoc().getSourceRange(),
7939 TL.getEllipsisLoc(),
7940 TL.getTypePtr()->getNumExpansions());
7950template<
typename Derived>
7955 TLB.pushFullCopy(TL);
7956 return TL.getType();
7959template<
typename Derived>
7963 const ObjCTypeParamType *T = TL.getTypePtr();
7965 getDerived().TransformDecl(T->getDecl()->getLocation(), T->getDecl()));
7970 if (getDerived().AlwaysRebuild() ||
7971 OTP != T->getDecl()) {
7972 Result = getDerived().RebuildObjCTypeParamType(
7973 OTP, TL.getProtocolLAngleLoc(),
7974 llvm::ArrayRef(TL.getTypePtr()->qual_begin(), TL.getNumProtocols()),
7975 TL.getProtocolLocs(), TL.getProtocolRAngleLoc());
7981 if (TL.getNumProtocols()) {
7982 NewTL.setProtocolLAngleLoc(TL.getProtocolLAngleLoc());
7983 for (
unsigned i = 0, n = TL.getNumProtocols(); i != n; ++i)
7984 NewTL.setProtocolLoc(i, TL.getProtocolLoc(i));
7985 NewTL.setProtocolRAngleLoc(TL.getProtocolRAngleLoc());
7990template<
typename Derived>
7995 QualType BaseType = getDerived().TransformType(TLB, TL.getBaseLoc());
7996 if (BaseType.isNull())
7999 bool AnyChanged = BaseType != TL.getBaseLoc().getType();
8003 for (
unsigned i = 0, n = TL.getNumTypeArgs(); i != n; ++i) {
8005 TypeLoc TypeArgLoc = TypeArgInfo->getTypeLoc();
8006 QualType TypeArg = TypeArgInfo->getType();
8011 const auto *PackExpansion = PackExpansionLoc.getType()
8012 ->castAs<PackExpansionType>();
8016 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
8020 TypeLoc PatternLoc = PackExpansionLoc.getPatternLoc();
8021 bool Expand =
false;
8022 bool RetainExpansion =
false;
8023 UnsignedOrNone NumExpansions = PackExpansion->getNumExpansions();
8024 if (getDerived().TryExpandParameterPacks(
8025 PackExpansionLoc.getEllipsisLoc(), PatternLoc.getSourceRange(),
8026 Unexpanded,
true, Expand,
8027 RetainExpansion, NumExpansions))
8037 TypeArgBuilder.
reserve(PatternLoc.getFullDataSize());
8038 QualType NewPatternType = getDerived().TransformType(TypeArgBuilder,
8040 if (NewPatternType.isNull())
8044 NewPatternType, NumExpansions);
8046 NewExpansionLoc.
setEllipsisLoc(PackExpansionLoc.getEllipsisLoc());
8047 NewTypeArgInfos.push_back(
8048 TypeArgBuilder.getTypeSourceInfo(SemaRef.
Context, NewExpansionType));
8054 for (
unsigned ArgIdx = 0; ArgIdx != *NumExpansions; ++ArgIdx) {
8058 TypeArgBuilder.
reserve(PatternLoc.getFullDataSize());
8060 QualType NewTypeArg = getDerived().TransformType(TypeArgBuilder,
8062 if (NewTypeArg.isNull())
8065 NewTypeArgInfos.push_back(
8066 TypeArgBuilder.getTypeSourceInfo(SemaRef.
Context, NewTypeArg));
8073 TypeArgBuilder.
reserve(TypeArgLoc.getFullDataSize());
8075 getDerived().TransformType(TypeArgBuilder, TypeArgLoc);
8076 if (NewTypeArg.isNull())
8080 if (NewTypeArg == TypeArg) {
8081 NewTypeArgInfos.push_back(TypeArgInfo);
8085 NewTypeArgInfos.push_back(
8086 TypeArgBuilder.getTypeSourceInfo(SemaRef.
Context, NewTypeArg));
8091 if (getDerived().AlwaysRebuild() || AnyChanged) {
8093 Result = getDerived().RebuildObjCObjectType(
8094 BaseType, TL.getBeginLoc(), TL.getTypeArgsLAngleLoc(), NewTypeArgInfos,
8095 TL.getTypeArgsRAngleLoc(), TL.getProtocolLAngleLoc(),
8096 llvm::ArrayRef(TL.getTypePtr()->qual_begin(), TL.getNumProtocols()),
8097 TL.getProtocolLocs(), TL.getProtocolRAngleLoc());
8105 NewT.setTypeArgsLAngleLoc(TL.getTypeArgsLAngleLoc());
8106 for (
unsigned i = 0, n = TL.getNumTypeArgs(); i != n; ++i)
8107 NewT.setTypeArgTInfo(i, NewTypeArgInfos[i]);
8108 NewT.setTypeArgsRAngleLoc(TL.getTypeArgsRAngleLoc());
8109 NewT.setProtocolLAngleLoc(TL.getProtocolLAngleLoc());
8110 for (
unsigned i = 0, n = TL.getNumProtocols(); i != n; ++i)
8111 NewT.setProtocolLoc(i, TL.getProtocolLoc(i));
8112 NewT.setProtocolRAngleLoc(TL.getProtocolRAngleLoc());
8116template<
typename Derived>
8120 QualType PointeeType = getDerived().TransformType(TLB, TL.getPointeeLoc());
8121 if (PointeeType.isNull())
8125 if (getDerived().AlwaysRebuild() ||
8126 PointeeType != TL.getPointeeLoc().getType()) {
8127 Result = getDerived().RebuildObjCObjectPointerType(PointeeType,
8141template<
typename Derived>
8147template<
typename Derived>
8150 return getDerived().TransformCompoundStmt(S,
false);
8153template<
typename Derived>
8160 getSema().resetFPOptions(
8163 bool SubStmtInvalid =
false;
8164 bool SubStmtChanged =
false;
8166 for (
auto *B : S->
body()) {
8168 B, IsStmtExpr && B == S->
body_back() ? StmtDiscardKind::StmtExprResult
8169 : StmtDiscardKind::Discarded);
8171 if (
Result.isInvalid()) {
8178 SubStmtInvalid =
true;
8182 SubStmtChanged = SubStmtChanged || Result.get() != B;
8183 Statements.push_back(Result.getAs<Stmt>());
8189 if (!getDerived().AlwaysRebuild() &&
8193 return getDerived().RebuildCompoundStmt(S->
getLBracLoc(),
8199template<
typename Derived>
8208 LHS = getDerived().TransformExpr(S->getLHS());
8210 if (LHS.isInvalid())
8214 RHS = getDerived().TransformExpr(S->getRHS());
8216 if (RHS.isInvalid())
8223 StmtResult Case = getDerived().RebuildCaseStmt(S->getCaseLoc(),
8225 S->getEllipsisLoc(),
8228 if (Case.isInvalid())
8233 getDerived().TransformStmt(S->getSubStmt());
8234 if (SubStmt.isInvalid())
8238 return getDerived().RebuildCaseStmtBody(Case.get(), SubStmt.get());
8241template <
typename Derived>
8245 getDerived().TransformStmt(S->getSubStmt());
8246 if (SubStmt.isInvalid())
8250 return getDerived().RebuildDefaultStmt(S->getDefaultLoc(), S->getColonLoc(),
8254template<
typename Derived>
8257 StmtResult SubStmt = getDerived().TransformStmt(S->getSubStmt(), SDK);
8258 if (SubStmt.isInvalid())
8261 Decl *LD = getDerived().TransformDecl(S->getDecl()->getLocation(),
8269 if (LD == S->getDecl())
8270 S->getDecl()->setStmt(
nullptr);
8273 return getDerived().RebuildLabelStmt(S->getIdentLoc(),
8278template <
typename Derived>
8283 switch (R->getKind()) {
8287 return getDerived().Transform##X##Attr(cast<X##Attr>(R));
8288#include "clang/Basic/AttrList.inc"
8293template <
typename Derived>
8300 switch (R->getKind()) {
8304 return getDerived().TransformStmt##X##Attr(OrigS, InstS, cast<X##Attr>(R));
8305#include "clang/Basic/AttrList.inc"
8310template <
typename Derived>
8313 StmtDiscardKind SDK) {
8318 bool AttrsChanged =
false;
8322 for (
const auto *I : S->
getAttrs()) {
8324 getDerived().TransformStmtAttr(S->
getSubStmt(), SubStmt.
get(), I);
8325 AttrsChanged |= (I != R);
8338 return getDerived().RebuildAttributedStmt(S->
getAttrLoc(), Attrs,
8342template<
typename Derived>
8347 if (
Init.isInvalid())
8351 if (!S->isConsteval()) {
8353 Cond = getDerived().TransformCondition(
8354 S->getIfLoc(), S->getConditionVariable(), S->getCond(),
8357 if (
Cond.isInvalid())
8362 std::optional<bool> ConstexprConditionValue;
8363 if (S->isConstexpr())
8364 ConstexprConditionValue =
Cond.getKnownValue();
8368 if (!ConstexprConditionValue || *ConstexprConditionValue) {
8372 S->isNonNegatedConsteval());
8374 Then = getDerived().TransformStmt(S->getThen());
8375 if (Then.isInvalid())
8381 Then =
new (getSema().Context)
8382 CompoundStmt(S->getThen()->getBeginLoc(), S->getThen()->getEndLoc());
8387 if (!ConstexprConditionValue || !*ConstexprConditionValue) {
8391 S->isNegatedConsteval());
8393 Else = getDerived().TransformStmt(S->getElse());
8394 if (Else.isInvalid())
8396 }
else if (S->getElse() && ConstexprConditionValue &&
8397 *ConstexprConditionValue) {
8401 Else =
new (getSema().Context)
8402 CompoundStmt(S->getElse()->getBeginLoc(), S->getElse()->getEndLoc());
8405 if (!getDerived().AlwaysRebuild() &&
8406 Init.get() == S->getInit() &&
8407 Cond.get() == std::make_pair(S->getConditionVariable(), S->getCond()) &&
8408 Then.get() == S->getThen() &&
8409 Else.get() == S->getElse())
8412 return getDerived().RebuildIfStmt(
8413 S->getIfLoc(), S->getStatementKind(), S->getLParenLoc(),
Cond,
8414 S->getRParenLoc(),
Init.get(), Then.get(), S->getElseLoc(), Else.get());
8417template<
typename Derived>
8422 if (
Init.isInvalid())
8427 S->getSwitchLoc(), S->getConditionVariable(), S->getCond(),
8429 if (
Cond.isInvalid())
8434 getDerived().RebuildSwitchStmtStart(S->getSwitchLoc(), S->getLParenLoc(),
8435 Init.get(),
Cond, S->getRParenLoc());
8440 StmtResult Body = getDerived().TransformStmt(S->getBody());
8441 if (Body.isInvalid())
8445 return getDerived().RebuildSwitchStmtBody(S->getSwitchLoc(),
Switch.get(),
8449template<
typename Derived>
8454 S->getWhileLoc(), S->getConditionVariable(), S->getCond(),
8456 if (
Cond.isInvalid())
8465 StmtResult Body = getDerived().TransformStmt(S->getBody());
8466 if (Body.isInvalid())
8469 if (!getDerived().AlwaysRebuild() &&
8470 Cond.get() == std::make_pair(S->getConditionVariable(), S->getCond()) &&
8471 Body.get() == S->getBody())
8474 return getDerived().RebuildWhileStmt(S->getWhileLoc(), S->getLParenLoc(),
8475 Cond, S->getRParenLoc(), Body.get());
8478template<
typename Derived>
8487 StmtResult Body = getDerived().TransformStmt(S->getBody());
8488 if (Body.isInvalid())
8493 if (
Cond.isInvalid())
8496 if (!getDerived().AlwaysRebuild() &&
8497 Cond.get() == S->getCond() &&
8498 Body.get() == S->getBody())
8501 return getDerived().RebuildDoStmt(S->getDoLoc(), Body.get(), S->getWhileLoc(),
8502 S->getWhileLoc(),
Cond.get(),
8506template<
typename Derived>
8509 if (getSema().getLangOpts().OpenMP)
8510 getSema().OpenMP().startOpenMPLoop();
8514 if (
Init.isInvalid())
8519 if (getSema().getLangOpts().OpenMP &&
Init.isUsable())
8520 getSema().OpenMP().ActOnOpenMPLoopInitialization(S->getForLoc(),
8525 S->getForLoc(), S->getConditionVariable(), S->getCond(),
8527 if (
Cond.isInvalid())
8532 if (
Inc.isInvalid())
8536 if (S->getInc() && !FullInc.get())
8543 S->getBeginLoc(), S->getInit(),
Init.get(), S->getCond(),
8544 Cond.get().second, S->getInc(),
Inc.get());
8547 StmtResult Body = getDerived().TransformStmt(S->getBody());
8548 if (Body.isInvalid())
8553 if (!getDerived().AlwaysRebuild() &&
8554 Init.get() == S->getInit() &&
8555 Cond.get() == std::make_pair(S->getConditionVariable(), S->getCond()) &&
8556 Inc.get() == S->getInc() &&
8557 Body.get() == S->getBody())
8560 return getDerived().RebuildForStmt(S->getForLoc(), S->getLParenLoc(),
8562 S->getRParenLoc(), Body.get());
8565template<
typename Derived>
8568 Decl *LD = getDerived().TransformDecl(S->getLabel()->getLocation(),
8574 return getDerived().RebuildGotoStmt(S->getGotoLoc(), S->getLabelLoc(),
8578template<
typename Derived>
8586 if (!getDerived().AlwaysRebuild() &&
8587 Target.get() == S->getTarget())
8590 return getDerived().RebuildIndirectGotoStmt(S->getGotoLoc(), S->getStarLoc(),
8594template<
typename Derived>
8597 if (!S->hasLabelTarget())
8600 Decl *LD = getDerived().TransformDecl(S->getLabelDecl()->getLocation(),
8609template<
typename Derived>
8612 if (!S->hasLabelTarget())
8615 Decl *LD = getDerived().TransformDecl(S->getLabelDecl()->getLocation(),
8624template <
typename Derived>
8632template<
typename Derived>
8642 return getDerived().RebuildReturnStmt(S->getReturnLoc(),
Result.get());
8645template<
typename Derived>
8648 bool DeclChanged =
false;
8651 for (
auto *D : S->decls()) {
8652 Decl *Transformed = getDerived().TransformDefinition(D->getLocation(), D);
8656 if (Transformed != D)
8660 if (
auto *TD = dyn_cast<TypeDecl>(Transformed)) {
8661 if (
auto *TN = dyn_cast<TypedefNameDecl>(TD)) {
8662 LSI->ContainsUnexpandedParameterPack |=
8663 TN->getUnderlyingType()->containsUnexpandedParameterPack();
8665 LSI->ContainsUnexpandedParameterPack |=
8668 .getTypeDeclType(TD)
8669 ->containsUnexpandedParameterPack();
8672 if (
auto *VD = dyn_cast<VarDecl>(Transformed))
8673 LSI->ContainsUnexpandedParameterPack |=
8674 VD->getType()->containsUnexpandedParameterPack();
8677 Decls.push_back(Transformed);
8680 if (!getDerived().AlwaysRebuild() && !DeclChanged)
8683 return getDerived().RebuildDeclStmt(Decls, S->getBeginLoc(), S->getEndLoc());
8686template<
typename Derived>
8696 bool ExprsChanged =
false;
8698 auto RebuildString = [&](
Expr *E) {
8703 ExprsChanged =
true;
8710 for (
unsigned I = 0, E = S->getNumOutputs(); I != E; ++I) {
8711 Names.push_back(S->getOutputIdentifier(I));
8717 Constraints.push_back(
Result.get());
8720 Expr *OutputExpr = S->getOutputExpr(I);
8721 Result = getDerived().TransformExpr(OutputExpr);
8725 ExprsChanged |=
Result.get() != OutputExpr;
8727 Exprs.push_back(
Result.get());
8731 for (
unsigned I = 0, E = S->getNumInputs(); I != E; ++I) {
8732 Names.push_back(S->getInputIdentifier(I));
8738 Constraints.push_back(
Result.get());
8741 Expr *InputExpr = S->getInputExpr(I);
8742 Result = getDerived().TransformExpr(InputExpr);
8746 ExprsChanged |=
Result.get() != InputExpr;
8748 Exprs.push_back(
Result.get());
8752 for (
unsigned I = 0, E = S->getNumLabels(); I != E; ++I) {
8753 Names.push_back(S->getLabelIdentifier(I));
8758 ExprsChanged |=
Result.get() != S->getLabelExpr(I);
8759 Exprs.push_back(
Result.get());
8763 for (
unsigned I = 0, E = S->getNumClobbers(); I != E; ++I) {
8767 Clobbers.push_back(
Result.get());
8770 ExprResult AsmString = RebuildString(S->getAsmStringExpr());
8771 if (AsmString.isInvalid())
8774 if (!getDerived().AlwaysRebuild() && !ExprsChanged)
8777 return getDerived().RebuildGCCAsmStmt(S->getAsmLoc(), S->isSimple(),
8778 S->isVolatile(), S->getNumOutputs(),
8779 S->getNumInputs(), Names.data(),
8780 Constraints, Exprs, AsmString.get(),
8781 Clobbers, S->getNumLabels(),
8785template<
typename Derived>
8790 bool HadError =
false, HadChange =
false;
8794 TransformedExprs.reserve(SrcExprs.size());
8795 for (
unsigned i = 0, e = SrcExprs.size(); i != e; ++i) {
8797 if (!
Result.isUsable()) {
8800 HadChange |= (
Result.get() != SrcExprs[i]);
8801 TransformedExprs.push_back(
Result.get());
8806 if (!HadChange && !getDerived().AlwaysRebuild())
8809 return getDerived().RebuildMSAsmStmt(S->getAsmLoc(), S->getLBraceLoc(),
8810 AsmToks, S->getAsmString(),
8811 S->getNumOutputs(), S->getNumInputs(),
8812 S->getAllConstraints(), S->getClobbers(),
8813 TransformedExprs, S->getEndLoc());
8817template<
typename Derived>
8822 assert(FD && ScopeInfo && !ScopeInfo->CoroutinePromise &&
8823 ScopeInfo->NeedsCoroutineSuspends &&
8824 ScopeInfo->CoroutineSuspends.first ==
nullptr &&
8825 ScopeInfo->CoroutineSuspends.second ==
nullptr &&
8826 "expected clean scope info");
8830 ScopeInfo->setNeedsCoroutineSuspends(
false);
8843 getDerived().transformedLocalDecl(S->getPromiseDecl(), {Promise});
8844 ScopeInfo->CoroutinePromise = Promise;
8849 StmtResult InitSuspend = getDerived().TransformStmt(S->getInitSuspendStmt());
8850 if (InitSuspend.isInvalid())
8853 getDerived().TransformStmt(S->getFinalSuspendStmt());
8854 if (FinalSuspend.isInvalid() ||
8857 ScopeInfo->setCoroutineSuspends(InitSuspend.get(), FinalSuspend.get());
8860 StmtResult BodyRes = getDerived().TransformStmt(S->getBody());
8861 if (BodyRes.isInvalid())
8865 if (Builder.isInvalid())
8868 Expr *ReturnObject = S->getReturnValueInit();
8869 assert(ReturnObject &&
"the return object is expected to be valid");
8870 ExprResult Res = getDerived().TransformInitializer(ReturnObject,
8872 if (Res.isInvalid())
8874 Builder.ReturnValue = Res.get();
8879 if (S->hasDependentPromiseType()) {
8882 if (!Promise->getType()->isDependentType()) {
8883 assert(!S->getFallthroughHandler() && !S->getExceptionHandler() &&
8884 !S->getReturnStmtOnAllocFailure() && !S->getDeallocate() &&
8885 "these nodes should not have been built yet");
8886 if (!Builder.buildDependentStatements())
8890 if (
auto *OnFallthrough = S->getFallthroughHandler()) {
8891 StmtResult Res = getDerived().TransformStmt(OnFallthrough);
8892 if (Res.isInvalid())
8894 Builder.OnFallthrough = Res.get();
8897 if (
auto *OnException = S->getExceptionHandler()) {
8898 StmtResult Res = getDerived().TransformStmt(OnException);
8899 if (Res.isInvalid())
8901 Builder.OnException = Res.get();
8904 if (
auto *OnAllocFailure = S->getReturnStmtOnAllocFailure()) {
8905 StmtResult Res = getDerived().TransformStmt(OnAllocFailure);
8906 if (Res.isInvalid())
8908 Builder.ReturnStmtOnAllocFailure = Res.get();
8912 assert(S->getAllocate() && S->getDeallocate() &&
8913 "allocation and deallocation calls must already be built");
8914 ExprResult AllocRes = getDerived().TransformExpr(S->getAllocate());
8915 if (AllocRes.isInvalid())
8917 Builder.Allocate = AllocRes.get();
8919 ExprResult DeallocRes = getDerived().TransformExpr(S->getDeallocate());
8920 if (DeallocRes.isInvalid())
8922 Builder.Deallocate = DeallocRes.get();
8924 if (
auto *ResultDecl = S->getResultDecl()) {
8925 StmtResult Res = getDerived().TransformStmt(ResultDecl);
8926 if (Res.isInvalid())
8928 Builder.ResultDecl = Res.get();
8933 if (Res.isInvalid())
8935 Builder.ReturnStmt = Res.get();
8939 return getDerived().RebuildCoroutineBodyStmt(Builder);
8942template<
typename Derived>
8952 return getDerived().RebuildCoreturnStmt(S->getKeywordLoc(),
Result.get(),
8956template <
typename Derived>
8969 ExprResult Lookup = getSema().BuildOperatorCoawaitLookupExpr(
8970 getSema().getCurScope(), E->getKeywordLoc());
8974 return getDerived().RebuildCoawaitExpr(
8975 E->getKeywordLoc(),
Operand.get(),
8979template <
typename Derived>
8982 ExprResult OperandResult = getDerived().TransformInitializer(E->getOperand(),
8984 if (OperandResult.isInvalid())
8988 E->getOperatorCoawaitLookup());
8995 return getDerived().RebuildDependentCoawaitExpr(
8996 E->getKeywordLoc(), OperandResult.get(),
9000template<
typename Derived>
9010 return getDerived().RebuildCoyieldExpr(E->getKeywordLoc(),
Result.get());
9015template<
typename Derived>
9019 StmtResult TryBody = getDerived().TransformStmt(S->getTryBody());
9020 if (TryBody.isInvalid())
9024 bool AnyCatchChanged =
false;
9026 for (
unsigned I = 0, N = S->getNumCatchStmts(); I != N; ++I) {
9027 StmtResult Catch = getDerived().TransformStmt(S->getCatchStmt(I));
9028 if (Catch.isInvalid())
9030 if (Catch.get() != S->getCatchStmt(I))
9031 AnyCatchChanged =
true;
9032 CatchStmts.push_back(Catch.get());
9037 if (S->getFinallyStmt()) {
9038 Finally = getDerived().TransformStmt(S->getFinallyStmt());
9039 if (Finally.isInvalid())
9044 if (!getDerived().AlwaysRebuild() &&
9045 TryBody.get() == S->getTryBody() &&
9047 Finally.get() == S->getFinallyStmt())
9051 return getDerived().RebuildObjCAtTryStmt(S->getAtTryLoc(), TryBody.get(),
9052 CatchStmts, Finally.get());
9055template<
typename Derived>
9060 if (
VarDecl *FromVar = S->getCatchParamDecl()) {
9062 if (FromVar->getTypeSourceInfo()) {
9063 TSInfo = getDerived().TransformType(FromVar->getTypeSourceInfo());
9070 T = TSInfo->getType();
9072 T = getDerived().TransformType(FromVar->getType());
9077 Var = getDerived().RebuildObjCExceptionDecl(FromVar, TSInfo, T);
9082 StmtResult Body = getDerived().TransformStmt(S->getCatchBody());
9083 if (Body.isInvalid())
9086 return getDerived().RebuildObjCAtCatchStmt(S->getAtCatchLoc(),
9091template<
typename Derived>
9095 StmtResult Body = getDerived().TransformStmt(S->getFinallyBody());
9096 if (Body.isInvalid())
9100 if (!getDerived().AlwaysRebuild() &&
9101 Body.get() == S->getFinallyBody())
9105 return getDerived().RebuildObjCAtFinallyStmt(S->getAtFinallyLoc(),
9109template<
typename Derived>
9113 if (S->getThrowExpr()) {
9114 Operand = getDerived().TransformExpr(S->getThrowExpr());
9119 if (!getDerived().AlwaysRebuild() &&
9120 Operand.get() == S->getThrowExpr())
9123 return getDerived().RebuildObjCAtThrowStmt(S->getThrowLoc(),
Operand.get());
9126template<
typename Derived>
9135 getDerived().RebuildObjCAtSynchronizedOperand(S->getAtSynchronizedLoc(),
9141 StmtResult Body = getDerived().TransformStmt(S->getSynchBody());
9142 if (Body.isInvalid())
9146 if (!getDerived().AlwaysRebuild() &&
9147 Object.get() == S->getSynchExpr() &&
9148 Body.get() == S->getSynchBody())
9152 return getDerived().RebuildObjCAtSynchronizedStmt(S->getAtSynchronizedLoc(),
9153 Object.get(), Body.get());
9156template<
typename Derived>
9161 StmtResult Body = getDerived().TransformStmt(S->getSubStmt());
9162 if (Body.isInvalid())
9166 if (!getDerived().AlwaysRebuild() &&
9167 Body.get() == S->getSubStmt())
9171 return getDerived().RebuildObjCAutoreleasePoolStmt(
9172 S->getAtLoc(), Body.get());
9175template<
typename Derived>
9180 StmtResult Element = getDerived().TransformStmt(
9181 S->getElement(), StmtDiscardKind::NotDiscarded);
9182 if (Element.isInvalid())
9186 ExprResult Collection = getDerived().TransformExpr(S->getCollection());
9187 if (Collection.isInvalid())
9191 StmtResult Body = getDerived().TransformStmt(S->getBody());
9192 if (Body.isInvalid())
9196 if (!getDerived().AlwaysRebuild() &&
9197 Element.get() == S->getElement() &&
9198 Collection.get() == S->getCollection() &&
9199 Body.get() == S->getBody())
9203 return getDerived().RebuildObjCForCollectionStmt(S->getForLoc(),
9210template <
typename Derived>
9214 if (
VarDecl *ExceptionDecl = S->getExceptionDecl()) {
9216 getDerived().TransformType(ExceptionDecl->getTypeSourceInfo());
9220 Var = getDerived().RebuildExceptionDecl(
9221 ExceptionDecl, T, ExceptionDecl->getInnerLocStart(),
9222 ExceptionDecl->getLocation(), ExceptionDecl->getIdentifier());
9223 if (!Var || Var->isInvalidDecl())
9228 StmtResult Handler = getDerived().TransformStmt(S->getHandlerBlock());
9229 if (Handler.isInvalid())
9232 if (!getDerived().AlwaysRebuild() && !Var &&
9233 Handler.get() == S->getHandlerBlock())
9236 return getDerived().RebuildCXXCatchStmt(S->getCatchLoc(), Var, Handler.get());
9239template <
typename Derived>
9242 StmtResult TryBlock = getDerived().TransformCompoundStmt(S->getTryBlock());
9243 if (TryBlock.isInvalid())
9247 bool HandlerChanged =
false;
9249 for (
unsigned I = 0, N = S->getNumHandlers(); I != N; ++I) {
9250 StmtResult Handler = getDerived().TransformCXXCatchStmt(S->getHandler(I));
9251 if (Handler.isInvalid())
9254 HandlerChanged = HandlerChanged || Handler.get() != S->getHandler(I);
9255 Handlers.push_back(Handler.getAs<
Stmt>());
9258 getSema().DiagnoseExceptionUse(S->getTryLoc(),
true);
9260 if (!getDerived().AlwaysRebuild() && TryBlock.get() == S->getTryBlock() &&
9264 return getDerived().RebuildCXXTryStmt(S->getTryLoc(), TryBlock.get(),
9268template<
typename Derived>
9279 auto &LastRecord = getSema().currentEvaluationContext();
9280 LastRecord.InLifetimeExtendingContext =
true;
9281 LastRecord.RebuildDefaultArgOrDefaultInit =
true;
9284 S->getInit() ? getDerived().TransformStmt(S->getInit()) :
StmtResult();
9285 if (
Init.isInvalid())
9289 if (
Range.isInvalid())
9294 getSema().ExprEvalContexts.back().ForRangeLifetimeExtendTemps.empty());
9295 auto ForRangeLifetimeExtendTemps =
9296 getSema().ExprEvalContexts.back().ForRangeLifetimeExtendTemps;
9298 StmtResult Begin = getDerived().TransformStmt(S->getBeginStmt());
9299 if (Begin.isInvalid())
9301 StmtResult End = getDerived().TransformStmt(S->getEndStmt());
9302 if (End.isInvalid())
9306 if (
Cond.isInvalid())
9310 if (
Cond.isInvalid())
9316 if (
Inc.isInvalid())
9321 StmtResult LoopVar = getDerived().TransformStmt(S->getLoopVarStmt());
9322 if (LoopVar.isInvalid())
9326 if (getDerived().AlwaysRebuild() ||
9327 Init.get() != S->getInit() ||
9328 Range.get() != S->getRangeStmt() ||
9329 Begin.get() != S->getBeginStmt() ||
9330 End.get() != S->getEndStmt() ||
9331 Cond.get() != S->getCond() ||
9332 Inc.get() != S->getInc() ||
9333 LoopVar.get() != S->getLoopVarStmt()) {
9334 NewStmt = getDerived().RebuildCXXForRangeStmt(
9335 S->getForLoc(), S->getCoawaitLoc(),
Init.get(), S->getColonLoc(),
9336 Range.get(), Begin.get(), End.get(),
Cond.get(),
Inc.get(),
9337 LoopVar.get(), S->getRParenLoc(), ForRangeLifetimeExtendTemps);
9338 if (NewStmt.isInvalid() && LoopVar.get() != S->getLoopVarStmt()) {
9340 getSema().ActOnInitializerError(
9351 StmtResult Body = getDerived().TransformStmt(S->getBody());
9352 if (Body.isInvalid())
9359 if (Body.get() != S->getBody() && NewStmt.get() == S) {
9360 NewStmt = getDerived().RebuildCXXForRangeStmt(
9361 S->getForLoc(), S->getCoawaitLoc(),
Init.get(), S->getColonLoc(),
9362 Range.get(), Begin.get(), End.get(),
Cond.get(),
Inc.get(),
9363 LoopVar.get(), S->getRParenLoc(), ForRangeLifetimeExtendTemps);
9364 if (NewStmt.isInvalid())
9368 if (NewStmt.get() == S)
9371 return FinishCXXForRangeStmt(NewStmt.get(), Body.get());
9374template<
typename Derived>
9380 if (S->getQualifierLoc()) {
9382 = getDerived().TransformNestedNameSpecifierLoc(S->getQualifierLoc());
9389 if (NameInfo.getName()) {
9390 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
9391 if (!NameInfo.getName())
9396 if (!getDerived().AlwaysRebuild() &&
9397 QualifierLoc == S->getQualifierLoc() &&
9398 NameInfo.getName() == S->getNameInfo().getName())
9403 SS.
Adopt(QualifierLoc);
9405 switch (getSema().CheckMicrosoftIfExistsSymbol(
nullptr, SS, NameInfo)) {
9407 if (S->isIfExists())
9410 return new (getSema().Context)
NullStmt(S->getKeywordLoc());
9413 if (S->isIfNotExists())
9416 return new (getSema().Context)
NullStmt(S->getKeywordLoc());
9427 StmtResult SubStmt = getDerived().TransformCompoundStmt(S->getSubStmt());
9428 if (SubStmt.isInvalid())
9436 return getDerived().RebuildMSDependentExistsStmt(S->getKeywordLoc(),
9443template<
typename Derived>
9447 if (E->getQualifierLoc()) {
9449 = getDerived().TransformNestedNameSpecifierLoc(E->getQualifierLoc());
9455 getDerived().TransformDecl(E->getMemberLoc(), E->getPropertyDecl()));
9460 if (
Base.isInvalid())
9466 QualifierLoc, E->getMemberLoc());
9469template <
typename Derived>
9473 if (BaseRes.isInvalid())
9475 auto IdxRes = getDerived().TransformExpr(E->getIdx());
9476 if (IdxRes.isInvalid())
9479 if (!getDerived().AlwaysRebuild() &&
9480 BaseRes.get() == E->getBase() &&
9481 IdxRes.get() == E->getIdx())
9484 return getDerived().RebuildArraySubscriptExpr(
9485 BaseRes.get(),
SourceLocation(), IdxRes.get(), E->getRBracketLoc());
9488template <
typename Derived>
9490 StmtResult TryBlock = getDerived().TransformCompoundStmt(S->getTryBlock());
9491 if (TryBlock.isInvalid())
9494 StmtResult Handler = getDerived().TransformSEHHandler(S->getHandler());
9495 if (Handler.isInvalid())
9498 if (!getDerived().AlwaysRebuild() && TryBlock.get() == S->getTryBlock() &&
9499 Handler.get() == S->getHandler())
9502 return getDerived().RebuildSEHTryStmt(S->getIsCXXTry(), S->getTryLoc(),
9503 TryBlock.get(), Handler.get());
9506template <
typename Derived>
9509 if (
Block.isInvalid())
9512 return getDerived().RebuildSEHFinallyStmt(S->getFinallyLoc(),
Block.get());
9515template <
typename Derived>
9517 ExprResult FilterExpr = getDerived().TransformExpr(S->getFilterExpr());
9518 if (FilterExpr.isInvalid())
9522 if (
Block.isInvalid())
9525 return getDerived().RebuildSEHExceptStmt(S->getExceptLoc(), FilterExpr.get(),
9529template <
typename Derived>
9537template<
typename Derived>
9547template <
typename Derived>
9549TreeTransform<Derived>::TransformOMPCanonicalLoop(OMPCanonicalLoop *L) {
9553 return getDerived().TransformStmt(L->getLoopStmt());
9556template <
typename Derived>
9563 TClauses.reserve(Clauses.size());
9567 getDerived().getSema().OpenMP().StartOpenMPClause((*I)->getClauseKind());
9569 getDerived().getSema().OpenMP().EndOpenMPClause();
9571 TClauses.push_back(Clause);
9573 TClauses.push_back(
nullptr);
9577 if (D->hasAssociatedStmt() && D->getAssociatedStmt()) {
9578 getDerived().getSema().OpenMP().ActOnOpenMPRegionStart(
9579 D->getDirectiveKind(),
9585 if (D->getDirectiveKind() == OMPD_atomic ||
9586 D->getDirectiveKind() == OMPD_critical ||
9587 D->getDirectiveKind() == OMPD_section ||
9588 D->getDirectiveKind() == OMPD_master)
9589 CS = D->getAssociatedStmt();
9591 CS = D->getRawStmt();
9594 getSema().getLangOpts().OpenMPIRBuilder)
9598 getDerived().getSema().OpenMP().ActOnOpenMPRegionEnd(Body, TClauses);
9603 if (TClauses.size() != Clauses.size()) {
9609 if (D->getDirectiveKind() == OMPD_critical) {
9611 DirName =
getDerived().TransformDeclarationNameInfo(DirName);
9614 if (D->getDirectiveKind() == OMPD_cancellation_point) {
9616 }
else if (D->getDirectiveKind() == OMPD_cancel) {
9620 return getDerived().RebuildOMPExecutableDirective(
9621 D->getDirectiveKind(), DirName, CancelRegion, TClauses,
9622 AssociatedStmt.
get(), D->getBeginLoc(), D->getEndLoc());
9630template <
typename Derived>
9637 TClauses.reserve(Clauses.size());
9640 getDerived().getSema().OpenMP().StartOpenMPClause(
C->getClauseKind());
9642 getDerived().getSema().OpenMP().EndOpenMPClause();
9644 TClauses.push_back(Clause);
9646 TClauses.push_back(
nullptr);
9650 if (D->hasAssociatedStmt() && D->getAssociatedStmt()) {
9651 getDerived().getSema().OpenMP().ActOnOpenMPRegionStart(
9652 D->getDirectiveKind(),
9657 assert(D->getDirectiveKind() == OMPD_assume &&
9658 "Unexpected informational directive");
9659 Stmt *CS = D->getAssociatedStmt();
9663 getDerived().getSema().OpenMP().ActOnOpenMPRegionEnd(Body, TClauses);
9667 if (TClauses.size() != Clauses.size())
9672 return getDerived().RebuildOMPInformationalDirective(
9673 D->getDirectiveKind(), DirName, TClauses, AssociatedStmt.
get(),
9674 D->getBeginLoc(), D->getEndLoc());
9677template <
typename Derived>
9682 SemaRef.
Diag(D->getBeginLoc(), diag::err_omp_instantiation_not_supported)
9683 << getOpenMPDirectiveName(D->getDirectiveKind(), OMPVersion);
9687template <
typename Derived>
9689TreeTransform<Derived>::TransformOMPParallelDirective(OMPParallelDirective *D) {
9690 DeclarationNameInfo DirName;
9691 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9692 OMPD_parallel, DirName,
nullptr, D->getBeginLoc());
9693 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9694 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9698template <
typename Derived>
9702 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9703 OMPD_simd, DirName,
nullptr, D->getBeginLoc());
9704 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9705 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9709template <
typename Derived>
9713 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9714 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
9715 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9716 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9720template <
typename Derived>
9724 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9725 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
9726 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9727 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9731template <
typename Derived>
9735 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9736 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
9737 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9738 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9742template <
typename Derived>
9746 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9747 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
9748 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9749 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9753template <
typename Derived>
9755 OMPInterchangeDirective *D) {
9757 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9758 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
9759 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9760 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9764template <
typename Derived>
9768 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9769 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
9770 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9771 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9775template <
typename Derived>
9779 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9780 OMPD_for, DirName,
nullptr, D->getBeginLoc());
9781 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9782 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9786template <
typename Derived>
9790 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9791 OMPD_for_simd, DirName,
nullptr, D->getBeginLoc());
9792 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9793 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9797template <
typename Derived>
9801 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9802 OMPD_sections, DirName,
nullptr, D->getBeginLoc());
9803 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9804 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9808template <
typename Derived>
9812 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9813 OMPD_section, DirName,
nullptr, D->getBeginLoc());
9814 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9815 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9819template <
typename Derived>
9823 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9824 OMPD_scope, 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_single, DirName,
nullptr, D->getBeginLoc());
9836 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9837 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9841template <
typename Derived>
9845 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9846 OMPD_master, DirName,
nullptr, D->getBeginLoc());
9847 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9848 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9852template <
typename Derived>
9856 OMPD_critical, D->getDirectiveName(),
nullptr, D->getBeginLoc());
9857 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9858 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9862template <
typename Derived>
9864 OMPParallelForDirective *D) {
9866 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9867 OMPD_parallel_for, DirName,
nullptr, D->getBeginLoc());
9868 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9869 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9873template <
typename Derived>
9875 OMPParallelForSimdDirective *D) {
9877 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9878 OMPD_parallel_for_simd, DirName,
nullptr, D->getBeginLoc());
9879 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9880 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9884template <
typename Derived>
9886 OMPParallelMasterDirective *D) {
9888 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9889 OMPD_parallel_master, DirName,
nullptr, D->getBeginLoc());
9890 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9891 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9895template <
typename Derived>
9897 OMPParallelMaskedDirective *D) {
9899 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9900 OMPD_parallel_masked, DirName,
nullptr, D->getBeginLoc());
9901 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9902 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9906template <
typename Derived>
9908 OMPParallelSectionsDirective *D) {
9910 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9911 OMPD_parallel_sections, DirName,
nullptr, D->getBeginLoc());
9912 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9913 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9917template <
typename Derived>
9921 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9922 OMPD_task, DirName,
nullptr, D->getBeginLoc());
9923 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9924 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9928template <
typename Derived>
9930 OMPTaskyieldDirective *D) {
9932 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9933 OMPD_taskyield, DirName,
nullptr, D->getBeginLoc());
9934 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9935 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9939template <
typename Derived>
9943 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9944 OMPD_barrier, DirName,
nullptr, D->getBeginLoc());
9945 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9946 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9950template <
typename Derived>
9954 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9955 OMPD_taskwait, DirName,
nullptr, D->getBeginLoc());
9956 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9957 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9961template <
typename Derived>
9965 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9966 OMPD_assume, DirName,
nullptr, D->getBeginLoc());
9967 StmtResult Res = getDerived().TransformOMPInformationalDirective(D);
9968 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9972template <
typename Derived>
9976 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9977 OMPD_error, DirName,
nullptr, D->getBeginLoc());
9978 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9979 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9983template <
typename Derived>
9985 OMPTaskgroupDirective *D) {
9987 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9988 OMPD_taskgroup, DirName,
nullptr, D->getBeginLoc());
9989 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9990 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9994template <
typename Derived>
9998 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9999 OMPD_flush, DirName,
nullptr, D->getBeginLoc());
10000 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10001 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10005template <
typename Derived>
10009 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10010 OMPD_depobj, DirName,
nullptr, D->getBeginLoc());
10011 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10012 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10016template <
typename Derived>
10020 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10021 OMPD_scan, DirName,
nullptr, D->getBeginLoc());
10022 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10023 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10027template <
typename Derived>
10031 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10032 OMPD_ordered, DirName,
nullptr, D->getBeginLoc());
10033 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10034 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10038template <
typename Derived>
10042 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10043 OMPD_atomic, DirName,
nullptr, D->getBeginLoc());
10044 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10045 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10049template <
typename Derived>
10053 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10054 OMPD_target, DirName,
nullptr, D->getBeginLoc());
10055 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10056 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10060template <
typename Derived>
10062 OMPTargetDataDirective *D) {
10064 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10065 OMPD_target_data, DirName,
nullptr, D->getBeginLoc());
10066 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10067 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10071template <
typename Derived>
10073 OMPTargetEnterDataDirective *D) {
10075 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10076 OMPD_target_enter_data, DirName,
nullptr, D->getBeginLoc());
10077 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10078 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10082template <
typename Derived>
10084 OMPTargetExitDataDirective *D) {
10086 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10087 OMPD_target_exit_data, DirName,
nullptr, D->getBeginLoc());
10088 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10089 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10093template <
typename Derived>
10095 OMPTargetParallelDirective *D) {
10097 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10098 OMPD_target_parallel, DirName,
nullptr, D->getBeginLoc());
10099 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10100 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10104template <
typename Derived>
10106 OMPTargetParallelForDirective *D) {
10108 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10109 OMPD_target_parallel_for, DirName,
nullptr, D->getBeginLoc());
10110 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10111 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10115template <
typename Derived>
10117 OMPTargetUpdateDirective *D) {
10119 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10120 OMPD_target_update, DirName,
nullptr, D->getBeginLoc());
10121 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10122 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10126template <
typename Derived>
10130 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10131 OMPD_teams, DirName,
nullptr, D->getBeginLoc());
10132 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10133 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10137template <
typename Derived>
10139 OMPCancellationPointDirective *D) {
10141 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10142 OMPD_cancellation_point, DirName,
nullptr, D->getBeginLoc());
10143 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10144 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10148template <
typename Derived>
10152 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10153 OMPD_cancel, DirName,
nullptr, D->getBeginLoc());
10154 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10155 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10159template <
typename Derived>
10163 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10164 OMPD_taskloop, DirName,
nullptr, D->getBeginLoc());
10165 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10166 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10170template <
typename Derived>
10172 OMPTaskLoopSimdDirective *D) {
10174 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10175 OMPD_taskloop_simd, DirName,
nullptr, D->getBeginLoc());
10176 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10177 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10181template <
typename Derived>
10183 OMPMasterTaskLoopDirective *D) {
10185 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10186 OMPD_master_taskloop, DirName,
nullptr, D->getBeginLoc());
10187 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10188 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10192template <
typename Derived>
10194 OMPMaskedTaskLoopDirective *D) {
10196 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10197 OMPD_masked_taskloop, DirName,
nullptr, D->getBeginLoc());
10198 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10199 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10203template <
typename Derived>
10205 OMPMasterTaskLoopSimdDirective *D) {
10207 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10208 OMPD_master_taskloop_simd, DirName,
nullptr, D->getBeginLoc());
10209 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10210 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10214template <
typename Derived>
10216 OMPMaskedTaskLoopSimdDirective *D) {
10218 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10219 OMPD_masked_taskloop_simd, DirName,
nullptr, D->getBeginLoc());
10220 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10221 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10225template <
typename Derived>
10227 OMPParallelMasterTaskLoopDirective *D) {
10229 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10230 OMPD_parallel_master_taskloop, DirName,
nullptr, D->getBeginLoc());
10231 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10232 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10236template <
typename Derived>
10238 OMPParallelMaskedTaskLoopDirective *D) {
10240 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10241 OMPD_parallel_masked_taskloop, DirName,
nullptr, D->getBeginLoc());
10242 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10243 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10247template <
typename Derived>
10250 OMPParallelMasterTaskLoopSimdDirective *D) {
10252 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10253 OMPD_parallel_master_taskloop_simd, DirName,
nullptr, D->getBeginLoc());
10254 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10255 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10259template <
typename Derived>
10262 OMPParallelMaskedTaskLoopSimdDirective *D) {
10264 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10265 OMPD_parallel_masked_taskloop_simd, DirName,
nullptr, D->getBeginLoc());
10266 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10267 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10271template <
typename Derived>
10273 OMPDistributeDirective *D) {
10275 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10276 OMPD_distribute, DirName,
nullptr, D->getBeginLoc());
10277 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10278 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10282template <
typename Derived>
10284 OMPDistributeParallelForDirective *D) {
10286 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10287 OMPD_distribute_parallel_for, DirName,
nullptr, D->getBeginLoc());
10288 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10289 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10293template <
typename Derived>
10296 OMPDistributeParallelForSimdDirective *D) {
10298 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10299 OMPD_distribute_parallel_for_simd, DirName,
nullptr, D->getBeginLoc());
10300 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10301 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10305template <
typename Derived>
10307 OMPDistributeSimdDirective *D) {
10309 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10310 OMPD_distribute_simd, DirName,
nullptr, D->getBeginLoc());
10311 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10312 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10316template <
typename Derived>
10318 OMPTargetParallelForSimdDirective *D) {
10320 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10321 OMPD_target_parallel_for_simd, DirName,
nullptr, D->getBeginLoc());
10322 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10323 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10327template <
typename Derived>
10329 OMPTargetSimdDirective *D) {
10331 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10332 OMPD_target_simd, DirName,
nullptr, D->getBeginLoc());
10333 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10334 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10338template <
typename Derived>
10340 OMPTeamsDistributeDirective *D) {
10342 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10343 OMPD_teams_distribute, DirName,
nullptr, D->getBeginLoc());
10344 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10345 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10349template <
typename Derived>
10351 OMPTeamsDistributeSimdDirective *D) {
10353 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10354 OMPD_teams_distribute_simd, DirName,
nullptr, D->getBeginLoc());
10355 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10356 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10360template <
typename Derived>
10362 OMPTeamsDistributeParallelForSimdDirective *D) {
10364 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10365 OMPD_teams_distribute_parallel_for_simd, DirName,
nullptr,
10367 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10368 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10372template <
typename Derived>
10374 OMPTeamsDistributeParallelForDirective *D) {
10376 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10377 OMPD_teams_distribute_parallel_for, DirName,
nullptr, D->getBeginLoc());
10378 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10379 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10383template <
typename Derived>
10385 OMPTargetTeamsDirective *D) {
10387 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10388 OMPD_target_teams, DirName,
nullptr, D->getBeginLoc());
10389 auto Res = getDerived().TransformOMPExecutableDirective(D);
10390 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10394template <
typename Derived>
10396 OMPTargetTeamsDistributeDirective *D) {
10398 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10399 OMPD_target_teams_distribute, DirName,
nullptr, D->getBeginLoc());
10400 auto Res = getDerived().TransformOMPExecutableDirective(D);
10401 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10405template <
typename Derived>
10408 OMPTargetTeamsDistributeParallelForDirective *D) {
10410 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10411 OMPD_target_teams_distribute_parallel_for, DirName,
nullptr,
10413 auto Res = getDerived().TransformOMPExecutableDirective(D);
10414 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10418template <
typename Derived>
10421 OMPTargetTeamsDistributeParallelForSimdDirective *D) {
10423 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10424 OMPD_target_teams_distribute_parallel_for_simd, DirName,
nullptr,
10426 auto Res = getDerived().TransformOMPExecutableDirective(D);
10427 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10431template <
typename Derived>
10434 OMPTargetTeamsDistributeSimdDirective *D) {
10436 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10437 OMPD_target_teams_distribute_simd, DirName,
nullptr, D->getBeginLoc());
10438 auto Res = getDerived().TransformOMPExecutableDirective(D);
10439 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10443template <
typename Derived>
10447 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10448 OMPD_interop, DirName,
nullptr, D->getBeginLoc());
10449 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10450 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10454template <
typename Derived>
10458 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10459 OMPD_dispatch, DirName,
nullptr, D->getBeginLoc());
10460 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10461 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10465template <
typename Derived>
10469 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10470 OMPD_masked, DirName,
nullptr, D->getBeginLoc());
10471 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10472 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10476template <
typename Derived>
10478 OMPGenericLoopDirective *D) {
10480 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10481 OMPD_loop, DirName,
nullptr, D->getBeginLoc());
10482 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10483 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10487template <
typename Derived>
10489 OMPTeamsGenericLoopDirective *D) {
10491 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10492 OMPD_teams_loop, DirName,
nullptr, D->getBeginLoc());
10493 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10494 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10498template <
typename Derived>
10500 OMPTargetTeamsGenericLoopDirective *D) {
10502 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10503 OMPD_target_teams_loop, DirName,
nullptr, D->getBeginLoc());
10504 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10505 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10509template <
typename Derived>
10511 OMPParallelGenericLoopDirective *D) {
10513 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10514 OMPD_parallel_loop, DirName,
nullptr, D->getBeginLoc());
10515 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10516 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10520template <
typename Derived>
10523 OMPTargetParallelGenericLoopDirective *D) {
10525 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10526 OMPD_target_parallel_loop, DirName,
nullptr, D->getBeginLoc());
10527 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10528 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10535template <
typename Derived>
10538 if (
Cond.isInvalid())
10540 return getDerived().RebuildOMPIfClause(
10541 C->getNameModifier(),
Cond.get(),
C->getBeginLoc(),
C->getLParenLoc(),
10542 C->getNameModifierLoc(),
C->getColonLoc(),
C->getEndLoc());
10545template <
typename Derived>
10548 if (
Cond.isInvalid())
10550 return getDerived().RebuildOMPFinalClause(
Cond.get(),
C->getBeginLoc(),
10551 C->getLParenLoc(),
C->getEndLoc());
10554template <
typename Derived>
10557 ExprResult NumThreads = getDerived().TransformExpr(
C->getNumThreads());
10558 if (NumThreads.isInvalid())
10560 return getDerived().RebuildOMPNumThreadsClause(
10561 C->getModifier(), NumThreads.get(),
C->getBeginLoc(),
C->getLParenLoc(),
10562 C->getModifierLoc(),
C->getEndLoc());
10565template <
typename Derived>
10568 ExprResult E = getDerived().TransformExpr(
C->getSafelen());
10571 return getDerived().RebuildOMPSafelenClause(
10572 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10575template <
typename Derived>
10578 ExprResult E = getDerived().TransformExpr(
C->getAllocator());
10581 return getDerived().RebuildOMPAllocatorClause(
10582 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10585template <
typename Derived>
10588 ExprResult E = getDerived().TransformExpr(
C->getSimdlen());
10591 return getDerived().RebuildOMPSimdlenClause(
10592 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10595template <
typename Derived>
10598 TransformedSizes.reserve(
C->getNumSizes());
10600 for (
Expr *E :
C->getSizesRefs()) {
10602 TransformedSizes.push_back(
nullptr);
10606 ExprResult T = getDerived().TransformExpr(E);
10611 TransformedSizes.push_back(T.get());
10614 if (!Changed && !getDerived().AlwaysRebuild())
10616 return RebuildOMPSizesClause(TransformedSizes,
C->getBeginLoc(),
10617 C->getLParenLoc(),
C->getEndLoc());
10620template <
typename Derived>
10624 TransformedArgs.reserve(
C->getNumLoops());
10626 for (
Expr *E :
C->getArgsRefs()) {
10628 TransformedArgs.push_back(
nullptr);
10632 ExprResult T = getDerived().TransformExpr(E);
10637 TransformedArgs.push_back(T.get());
10640 if (!Changed && !getDerived().AlwaysRebuild())
10642 return RebuildOMPPermutationClause(TransformedArgs,
C->getBeginLoc(),
10643 C->getLParenLoc(),
C->getEndLoc());
10646template <
typename Derived>
10648 if (!getDerived().AlwaysRebuild())
10650 return RebuildOMPFullClause(
C->getBeginLoc(),
C->getEndLoc());
10653template <
typename Derived>
10656 ExprResult T = getDerived().TransformExpr(
C->getFactor());
10659 Expr *Factor = T.get();
10660 bool Changed = Factor !=
C->getFactor();
10662 if (!Changed && !getDerived().AlwaysRebuild())
10664 return RebuildOMPPartialClause(Factor,
C->getBeginLoc(),
C->getLParenLoc(),
10668template <
typename Derived>
10671 ExprResult F = getDerived().TransformExpr(
C->getFirst());
10675 ExprResult Cn = getDerived().TransformExpr(
C->getCount());
10676 if (Cn.isInvalid())
10680 Expr *Count = Cn.get();
10682 bool Changed = (
First !=
C->getFirst()) || (Count !=
C->getCount());
10685 if (!Changed && !getDerived().AlwaysRebuild())
10688 return RebuildOMPLoopRangeClause(
First, Count,
C->getBeginLoc(),
10689 C->getLParenLoc(),
C->getFirstLoc(),
10690 C->getCountLoc(),
C->getEndLoc());
10693template <
typename Derived>
10696 ExprResult E = getDerived().TransformExpr(
C->getNumForLoops());
10699 return getDerived().RebuildOMPCollapseClause(
10700 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10703template <
typename Derived>
10707 C->getDefaultKind(),
C->getDefaultKindKwLoc(),
C->getDefaultVC(),
10708 C->getDefaultVCLoc(),
C->getBeginLoc(),
C->getLParenLoc(),
10712template <
typename Derived>
10719template <
typename Derived>
10722 Expr *Impex =
C->getImpexType();
10723 ExprResult TransformedImpex = getDerived().TransformExpr(Impex);
10725 if (TransformedImpex.isInvalid())
10728 return getDerived().RebuildOMPTransparentClause(
10729 TransformedImpex.get(),
C->getBeginLoc(),
C->getLParenLoc(),
10733template <
typename Derived>
10737 C->getProcBindKind(),
C->getProcBindKindKwLoc(),
C->getBeginLoc(),
10738 C->getLParenLoc(),
C->getEndLoc());
10741template <
typename Derived>
10744 ExprResult E = getDerived().TransformExpr(
C->getChunkSize());
10747 return getDerived().RebuildOMPScheduleClause(
10748 C->getFirstScheduleModifier(),
C->getSecondScheduleModifier(),
10749 C->getScheduleKind(), E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
10750 C->getFirstScheduleModifierLoc(),
C->getSecondScheduleModifierLoc(),
10751 C->getScheduleKindLoc(),
C->getCommaLoc(),
C->getEndLoc());
10754template <
typename Derived>
10758 if (
auto *
Num =
C->getNumForLoops()) {
10759 E = getDerived().TransformExpr(
Num);
10763 return getDerived().RebuildOMPOrderedClause(
C->getBeginLoc(),
C->getEndLoc(),
10764 C->getLParenLoc(), E.get());
10767template <
typename Derived>
10771 if (
Expr *Evt =
C->getEventHandler()) {
10772 E = getDerived().TransformExpr(Evt);
10776 return getDerived().RebuildOMPDetachClause(E.get(),
C->getBeginLoc(),
10777 C->getLParenLoc(),
C->getEndLoc());
10780template <
typename Derived>
10786 if (
Cond.isInvalid())
10789 return getDerived().RebuildOMPNowaitClause(
Cond.get(),
C->getBeginLoc(),
10790 C->getLParenLoc(),
C->getEndLoc());
10793template <
typename Derived>
10800template <
typename Derived>
10807template <
typename Derived>
10813template <
typename Derived>
10819template <
typename Derived>
10826template <
typename Derived>
10833template <
typename Derived>
10840template <
typename Derived>
10846template <
typename Derived>
10852template <
typename Derived>
10854 ExprResult E = getDerived().TransformExpr(
C->getExpr());
10857 return getDerived().RebuildOMPHoldsClause(E.get(),
C->getBeginLoc(),
10858 C->getLParenLoc(),
C->getEndLoc());
10861template <
typename Derived>
10867template <
typename Derived>
10872template <
typename Derived>
10874 OMPNoOpenMPRoutinesClause *
C) {
10877template <
typename Derived>
10879 OMPNoOpenMPConstructsClause *
C) {
10882template <
typename Derived>
10884 OMPNoParallelismClause *
C) {
10888template <
typename Derived>
10895template <
typename Derived>
10902template <
typename Derived>
10909template <
typename Derived>
10916template <
typename Derived>
10923template <
typename Derived>
10929template <
typename Derived>
10936template <
typename Derived>
10942template <
typename Derived>
10949template <
typename Derived>
10951 ExprResult IVR = getDerived().TransformExpr(
C->getInteropVar());
10952 if (IVR.isInvalid())
10956 InteropInfo.PreferTypes.reserve(
C->varlist_size() - 1);
10957 for (
Expr *E : llvm::drop_begin(
C->varlist())) {
10959 if (ER.isInvalid())
10961 InteropInfo.PreferTypes.push_back(ER.get());
10963 return getDerived().RebuildOMPInitClause(IVR.get(), InteropInfo,
10964 C->getBeginLoc(),
C->getLParenLoc(),
10965 C->getVarLoc(),
C->getEndLoc());
10968template <
typename Derived>
10970 ExprResult ER = getDerived().TransformExpr(
C->getInteropVar());
10971 if (ER.isInvalid())
10973 return getDerived().RebuildOMPUseClause(ER.get(),
C->getBeginLoc(),
10974 C->getLParenLoc(),
C->getVarLoc(),
10978template <
typename Derived>
10982 if (
Expr *IV =
C->getInteropVar()) {
10983 ER = getDerived().TransformExpr(IV);
10984 if (ER.isInvalid())
10987 return getDerived().RebuildOMPDestroyClause(ER.get(),
C->getBeginLoc(),
10988 C->getLParenLoc(),
C->getVarLoc(),
10992template <
typename Derived>
10996 if (
Cond.isInvalid())
10998 return getDerived().RebuildOMPNovariantsClause(
10999 Cond.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11002template <
typename Derived>
11006 if (
Cond.isInvalid())
11008 return getDerived().RebuildOMPNocontextClause(
11009 Cond.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11012template <
typename Derived>
11015 ExprResult ThreadID = getDerived().TransformExpr(
C->getThreadID());
11016 if (ThreadID.isInvalid())
11018 return getDerived().RebuildOMPFilterClause(ThreadID.get(),
C->getBeginLoc(),
11019 C->getLParenLoc(),
C->getEndLoc());
11022template <
typename Derived>
11024 ExprResult E = getDerived().TransformExpr(
C->getAlignment());
11027 return getDerived().RebuildOMPAlignClause(E.get(),
C->getBeginLoc(),
11028 C->getLParenLoc(),
C->getEndLoc());
11031template <
typename Derived>
11033 OMPUnifiedAddressClause *
C) {
11034 llvm_unreachable(
"unified_address clause cannot appear in dependent context");
11037template <
typename Derived>
11039 OMPUnifiedSharedMemoryClause *
C) {
11041 "unified_shared_memory clause cannot appear in dependent context");
11044template <
typename Derived>
11046 OMPReverseOffloadClause *
C) {
11047 llvm_unreachable(
"reverse_offload clause cannot appear in dependent context");
11050template <
typename Derived>
11052 OMPDynamicAllocatorsClause *
C) {
11054 "dynamic_allocators clause cannot appear in dependent context");
11057template <
typename Derived>
11059 OMPAtomicDefaultMemOrderClause *
C) {
11061 "atomic_default_mem_order clause cannot appear in dependent context");
11064template <
typename Derived>
11067 llvm_unreachable(
"self_maps clause cannot appear in dependent context");
11070template <
typename Derived>
11073 C->getBeginLoc(),
C->getLParenLoc(),
11077template <
typename Derived>
11081 C->getSeverityKind(),
C->getSeverityKindKwLoc(),
C->getBeginLoc(),
11082 C->getLParenLoc(),
C->getEndLoc());
11085template <
typename Derived>
11088 ExprResult E = getDerived().TransformExpr(
C->getMessageString());
11091 return getDerived().RebuildOMPMessageClause(
11092 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
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());
11106 return getDerived().RebuildOMPPrivateClause(
11107 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11110template <
typename Derived>
11112 OMPFirstprivateClause *
C) {
11114 Vars.reserve(
C->varlist_size());
11115 for (
auto *
VE :
C->varlist()) {
11117 if (EVar.isInvalid())
11119 Vars.push_back(EVar.get());
11121 return getDerived().RebuildOMPFirstprivateClause(
11122 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11125template <
typename Derived>
11129 Vars.reserve(
C->varlist_size());
11130 for (
auto *
VE :
C->varlist()) {
11132 if (EVar.isInvalid())
11134 Vars.push_back(EVar.get());
11136 return getDerived().RebuildOMPLastprivateClause(
11137 Vars,
C->getKind(),
C->getKindLoc(),
C->getColonLoc(),
C->getBeginLoc(),
11138 C->getLParenLoc(),
C->getEndLoc());
11141template <
typename Derived>
11145 Vars.reserve(
C->varlist_size());
11146 for (
auto *
VE :
C->varlist()) {
11148 if (EVar.isInvalid())
11150 Vars.push_back(EVar.get());
11152 return getDerived().RebuildOMPSharedClause(Vars,
C->getBeginLoc(),
11153 C->getLParenLoc(),
C->getEndLoc());
11156template <
typename Derived>
11160 Vars.reserve(
C->varlist_size());
11161 for (
auto *
VE :
C->varlist()) {
11163 if (EVar.isInvalid())
11165 Vars.push_back(EVar.get());
11168 ReductionIdScopeSpec.
Adopt(
C->getQualifierLoc());
11171 if (NameInfo.getName()) {
11172 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
11173 if (!NameInfo.getName())
11179 for (
auto *E :
C->reduction_ops()) {
11184 for (
auto *D : ULE->decls()) {
11187 Decls.addDecl(InstD, InstD->getAccess());
11191 ReductionIdScopeSpec.getWithLocInContext(SemaRef.
Context), NameInfo,
11192 true, Decls.begin(), Decls.end(),
11195 UnresolvedReductions.push_back(
nullptr);
11197 return getDerived().RebuildOMPReductionClause(
11198 Vars,
C->getModifier(),
C->getOriginalSharingModifier(),
C->getBeginLoc(),
11199 C->getLParenLoc(),
C->getModifierLoc(),
C->getColonLoc(),
C->getEndLoc(),
11200 ReductionIdScopeSpec, NameInfo, UnresolvedReductions);
11203template <
typename Derived>
11205 OMPTaskReductionClause *
C) {
11207 Vars.reserve(
C->varlist_size());
11208 for (
auto *
VE :
C->varlist()) {
11210 if (EVar.isInvalid())
11212 Vars.push_back(EVar.get());
11215 ReductionIdScopeSpec.
Adopt(
C->getQualifierLoc());
11218 if (NameInfo.getName()) {
11219 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
11220 if (!NameInfo.getName())
11226 for (
auto *E :
C->reduction_ops()) {
11231 for (
auto *D : ULE->decls()) {
11234 Decls.addDecl(InstD, InstD->getAccess());
11238 ReductionIdScopeSpec.getWithLocInContext(SemaRef.
Context), NameInfo,
11239 true, Decls.begin(), Decls.end(),
11242 UnresolvedReductions.push_back(
nullptr);
11244 return getDerived().RebuildOMPTaskReductionClause(
11245 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getColonLoc(),
11246 C->getEndLoc(), ReductionIdScopeSpec, NameInfo, UnresolvedReductions);
11249template <
typename Derived>
11253 Vars.reserve(
C->varlist_size());
11254 for (
auto *
VE :
C->varlist()) {
11256 if (EVar.isInvalid())
11258 Vars.push_back(EVar.get());
11261 ReductionIdScopeSpec.
Adopt(
C->getQualifierLoc());
11264 if (NameInfo.getName()) {
11265 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
11266 if (!NameInfo.getName())
11272 for (
auto *E :
C->reduction_ops()) {
11277 for (
auto *D : ULE->decls()) {
11280 Decls.addDecl(InstD, InstD->getAccess());
11284 ReductionIdScopeSpec.getWithLocInContext(SemaRef.
Context), NameInfo,
11285 true, Decls.begin(), Decls.end(),
11288 UnresolvedReductions.push_back(
nullptr);
11290 return getDerived().RebuildOMPInReductionClause(
11291 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getColonLoc(),
11292 C->getEndLoc(), ReductionIdScopeSpec, NameInfo, UnresolvedReductions);
11295template <
typename Derived>
11299 Vars.reserve(
C->varlist_size());
11300 for (
auto *
VE :
C->varlist()) {
11302 if (EVar.isInvalid())
11304 Vars.push_back(EVar.get());
11306 ExprResult Step = getDerived().TransformExpr(
C->getStep());
11307 if (Step.isInvalid())
11309 return getDerived().RebuildOMPLinearClause(
11310 Vars, Step.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getModifier(),
11311 C->getModifierLoc(),
C->getColonLoc(),
C->getStepModifierLoc(),
11315template <
typename Derived>
11319 Vars.reserve(
C->varlist_size());
11320 for (
auto *
VE :
C->varlist()) {
11322 if (EVar.isInvalid())
11324 Vars.push_back(EVar.get());
11326 ExprResult Alignment = getDerived().TransformExpr(
C->getAlignment());
11327 if (Alignment.isInvalid())
11329 return getDerived().RebuildOMPAlignedClause(
11330 Vars, Alignment.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11331 C->getColonLoc(),
C->getEndLoc());
11334template <
typename Derived>
11338 Vars.reserve(
C->varlist_size());
11339 for (
auto *
VE :
C->varlist()) {
11341 if (EVar.isInvalid())
11343 Vars.push_back(EVar.get());
11345 return getDerived().RebuildOMPCopyinClause(Vars,
C->getBeginLoc(),
11346 C->getLParenLoc(),
C->getEndLoc());
11349template <
typename Derived>
11353 Vars.reserve(
C->varlist_size());
11354 for (
auto *
VE :
C->varlist()) {
11356 if (EVar.isInvalid())
11358 Vars.push_back(EVar.get());
11360 return getDerived().RebuildOMPCopyprivateClause(
11361 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11364template <
typename Derived>
11367 Vars.reserve(
C->varlist_size());
11368 for (
auto *
VE :
C->varlist()) {
11370 if (EVar.isInvalid())
11372 Vars.push_back(EVar.get());
11374 return getDerived().RebuildOMPFlushClause(Vars,
C->getBeginLoc(),
11375 C->getLParenLoc(),
C->getEndLoc());
11378template <
typename Derived>
11381 ExprResult E = getDerived().TransformExpr(
C->getDepobj());
11384 return getDerived().RebuildOMPDepobjClause(E.get(),
C->getBeginLoc(),
11385 C->getLParenLoc(),
C->getEndLoc());
11388template <
typename Derived>
11392 Expr *DepModifier =
C->getModifier();
11394 ExprResult DepModRes = getDerived().TransformExpr(DepModifier);
11395 if (DepModRes.isInvalid())
11397 DepModifier = DepModRes.get();
11399 Vars.reserve(
C->varlist_size());
11400 for (
auto *
VE :
C->varlist()) {
11402 if (EVar.isInvalid())
11404 Vars.push_back(EVar.get());
11406 return getDerived().RebuildOMPDependClause(
11407 {
C->getDependencyKind(),
C->getDependencyLoc(),
C->getColonLoc(),
11408 C->getOmpAllMemoryLoc()},
11409 DepModifier, Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11412template <
typename Derived>
11415 ExprResult E = getDerived().TransformExpr(
C->getDevice());
11418 return getDerived().RebuildOMPDeviceClause(
11419 C->getModifier(), E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11420 C->getModifierLoc(),
C->getEndLoc());
11423template <
typename Derived,
class T>
11430 Vars.reserve(
C->varlist_size());
11431 for (
auto *
VE :
C->varlist()) {
11435 Vars.push_back(EVar.
get());
11439 if (
C->getMapperQualifierLoc()) {
11440 QualifierLoc = TT.
getDerived().TransformNestedNameSpecifierLoc(
11441 C->getMapperQualifierLoc());
11445 MapperIdScopeSpec.
Adopt(QualifierLoc);
11446 MapperIdInfo =
C->getMapperIdInfo();
11447 if (MapperIdInfo.
getName()) {
11448 MapperIdInfo = TT.
getDerived().TransformDeclarationNameInfo(MapperIdInfo);
11454 for (
auto *E :
C->mapperlists()) {
11459 for (
auto *D : ULE->decls()) {
11462 Decls.addDecl(InstD, InstD->
getAccess());
11467 MapperIdInfo,
true, Decls.begin(), Decls.end(),
11470 UnresolvedMappers.push_back(
nullptr);
11476template <
typename Derived>
11478 OMPVarListLocTy Locs(
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11480 Expr *IteratorModifier =
C->getIteratorModifier();
11481 if (IteratorModifier) {
11482 ExprResult MapModRes = getDerived().TransformExpr(IteratorModifier);
11483 if (MapModRes.isInvalid())
11485 IteratorModifier = MapModRes.
get();
11491 *
this,
C, Vars, MapperIdScopeSpec, MapperIdInfo, UnresolvedMappers))
11493 return getDerived().RebuildOMPMapClause(
11494 IteratorModifier,
C->getMapTypeModifiers(),
C->getMapTypeModifiersLoc(),
11495 MapperIdScopeSpec, MapperIdInfo,
C->getMapType(),
C->isImplicitMapType(),
11496 C->getMapLoc(),
C->getColonLoc(), Vars, Locs, UnresolvedMappers);
11499template <
typename Derived>
11502 Expr *Allocator =
C->getAllocator();
11504 ExprResult AllocatorRes = getDerived().TransformExpr(Allocator);
11505 if (AllocatorRes.isInvalid())
11507 Allocator = AllocatorRes.get();
11509 Expr *Alignment =
C->getAlignment();
11511 ExprResult AlignmentRes = getDerived().TransformExpr(Alignment);
11512 if (AlignmentRes.isInvalid())
11514 Alignment = AlignmentRes.get();
11517 Vars.reserve(
C->varlist_size());
11518 for (
auto *
VE :
C->varlist()) {
11520 if (EVar.isInvalid())
11522 Vars.push_back(EVar.get());
11524 return getDerived().RebuildOMPAllocateClause(
11525 Allocator, Alignment,
C->getFirstAllocateModifier(),
11526 C->getFirstAllocateModifierLoc(),
C->getSecondAllocateModifier(),
11527 C->getSecondAllocateModifierLoc(), Vars,
C->getBeginLoc(),
11528 C->getLParenLoc(),
C->getColonLoc(),
C->getEndLoc());
11531template <
typename Derived>
11535 Vars.reserve(
C->varlist_size());
11536 for (
auto *
VE :
C->varlist()) {
11538 if (EVar.isInvalid())
11540 Vars.push_back(EVar.get());
11542 return getDerived().RebuildOMPNumTeamsClause(
11543 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11546template <
typename Derived>
11550 Vars.reserve(
C->varlist_size());
11551 for (
auto *
VE :
C->varlist()) {
11553 if (EVar.isInvalid())
11555 Vars.push_back(EVar.get());
11557 return getDerived().RebuildOMPThreadLimitClause(
11558 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11561template <
typename Derived>
11564 ExprResult E = getDerived().TransformExpr(
C->getPriority());
11567 return getDerived().RebuildOMPPriorityClause(
11568 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11571template <
typename Derived>
11574 ExprResult E = getDerived().TransformExpr(
C->getGrainsize());
11577 return getDerived().RebuildOMPGrainsizeClause(
11578 C->getModifier(), E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11579 C->getModifierLoc(),
C->getEndLoc());
11582template <
typename Derived>
11585 ExprResult E = getDerived().TransformExpr(
C->getNumTasks());
11588 return getDerived().RebuildOMPNumTasksClause(
11589 C->getModifier(), E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11590 C->getModifierLoc(),
C->getEndLoc());
11593template <
typename Derived>
11595 ExprResult E = getDerived().TransformExpr(
C->getHint());
11598 return getDerived().RebuildOMPHintClause(E.get(),
C->getBeginLoc(),
11599 C->getLParenLoc(),
C->getEndLoc());
11602template <
typename Derived>
11604 OMPDistScheduleClause *
C) {
11605 ExprResult E = getDerived().TransformExpr(
C->getChunkSize());
11608 return getDerived().RebuildOMPDistScheduleClause(
11609 C->getDistScheduleKind(), E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11610 C->getDistScheduleKindLoc(),
C->getCommaLoc(),
C->getEndLoc());
11613template <
typename Derived>
11619 C->getDefaultmapKind(),
11622 C->getDefaultmapModifierLoc(),
11623 C->getDefaultmapKindLoc(),
11627template <
typename Derived>
11631 Expr *IteratorModifier =
C->getIteratorModifier();
11632 if (IteratorModifier) {
11633 ExprResult MapModRes = getDerived().TransformExpr(IteratorModifier);
11634 if (MapModRes.isInvalid())
11636 IteratorModifier = MapModRes.get();
11642 *
this,
C, Vars, MapperIdScopeSpec, MapperIdInfo, UnresolvedMappers))
11644 return getDerived().RebuildOMPToClause(
11645 C->getMotionModifiers(),
C->getMotionModifiersLoc(), IteratorModifier,
11646 MapperIdScopeSpec, MapperIdInfo,
C->getColonLoc(), Vars, Locs,
11647 UnresolvedMappers);
11650template <
typename Derived>
11654 Expr *IteratorModifier =
C->getIteratorModifier();
11655 if (IteratorModifier) {
11656 ExprResult MapModRes = getDerived().TransformExpr(IteratorModifier);
11657 if (MapModRes.isInvalid())
11659 IteratorModifier = MapModRes.get();
11665 *
this,
C, Vars, MapperIdScopeSpec, MapperIdInfo, UnresolvedMappers))
11667 return getDerived().RebuildOMPFromClause(
11668 C->getMotionModifiers(),
C->getMotionModifiersLoc(), IteratorModifier,
11669 MapperIdScopeSpec, MapperIdInfo,
C->getColonLoc(), Vars, Locs,
11670 UnresolvedMappers);
11673template <
typename Derived>
11675 OMPUseDevicePtrClause *
C) {
11677 Vars.reserve(
C->varlist_size());
11678 for (
auto *
VE :
C->varlist()) {
11680 if (EVar.isInvalid())
11682 Vars.push_back(EVar.get());
11685 return getDerived().RebuildOMPUseDevicePtrClause(
11686 Vars, Locs,
C->getFallbackModifier(),
C->getFallbackModifierLoc());
11689template <
typename Derived>
11691 OMPUseDeviceAddrClause *
C) {
11693 Vars.reserve(
C->varlist_size());
11694 for (
auto *
VE :
C->varlist()) {
11696 if (EVar.isInvalid())
11698 Vars.push_back(EVar.get());
11701 return getDerived().RebuildOMPUseDeviceAddrClause(Vars, Locs);
11704template <
typename Derived>
11708 Vars.reserve(
C->varlist_size());
11709 for (
auto *
VE :
C->varlist()) {
11711 if (EVar.isInvalid())
11713 Vars.push_back(EVar.get());
11716 return getDerived().RebuildOMPIsDevicePtrClause(Vars, Locs);
11719template <
typename Derived>
11721 OMPHasDeviceAddrClause *
C) {
11723 Vars.reserve(
C->varlist_size());
11724 for (
auto *
VE :
C->varlist()) {
11726 if (EVar.isInvalid())
11728 Vars.push_back(EVar.get());
11731 return getDerived().RebuildOMPHasDeviceAddrClause(Vars, Locs);
11734template <
typename Derived>
11738 Vars.reserve(
C->varlist_size());
11739 for (
auto *
VE :
C->varlist()) {
11741 if (EVar.isInvalid())
11743 Vars.push_back(EVar.get());
11745 return getDerived().RebuildOMPNontemporalClause(
11746 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11749template <
typename Derived>
11753 Vars.reserve(
C->varlist_size());
11754 for (
auto *
VE :
C->varlist()) {
11756 if (EVar.isInvalid())
11758 Vars.push_back(EVar.get());
11760 return getDerived().RebuildOMPInclusiveClause(
11761 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11764template <
typename Derived>
11768 Vars.reserve(
C->varlist_size());
11769 for (
auto *
VE :
C->varlist()) {
11771 if (EVar.isInvalid())
11773 Vars.push_back(EVar.get());
11775 return getDerived().RebuildOMPExclusiveClause(
11776 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11779template <
typename Derived>
11781 OMPUsesAllocatorsClause *
C) {
11783 Data.reserve(
C->getNumberOfAllocators());
11784 for (
unsigned I = 0, E =
C->getNumberOfAllocators(); I < E; ++I) {
11785 OMPUsesAllocatorsClause::Data D =
C->getAllocatorData(I);
11787 if (Allocator.isInvalid())
11791 AllocatorTraits = getDerived().TransformExpr(AT);
11792 if (AllocatorTraits.isInvalid())
11796 NewD.Allocator = Allocator.get();
11797 NewD.AllocatorTraits = AllocatorTraits.get();
11801 return getDerived().RebuildOMPUsesAllocatorsClause(
11802 Data,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11805template <
typename Derived>
11809 Locators.reserve(
C->varlist_size());
11811 if (
Expr *Modifier =
C->getModifier()) {
11812 ModifierRes = getDerived().TransformExpr(Modifier);
11813 if (ModifierRes.isInvalid())
11816 for (
Expr *E :
C->varlist()) {
11817 ExprResult Locator = getDerived().TransformExpr(E);
11818 if (Locator.isInvalid())
11820 Locators.push_back(Locator.get());
11822 return getDerived().RebuildOMPAffinityClause(
11823 C->getBeginLoc(),
C->getLParenLoc(),
C->getColonLoc(),
C->getEndLoc(),
11824 ModifierRes.get(), Locators);
11827template <
typename Derived>
11830 C->getKind(),
C->getKindKwLoc(),
C->getBeginLoc(),
C->getLParenLoc(),
11831 C->getEndLoc(),
C->getModifier(),
C->getModifierKwLoc());
11834template <
typename Derived>
11837 C->getBindKind(),
C->getBindKindLoc(),
C->getBeginLoc(),
11838 C->getLParenLoc(),
C->getEndLoc());
11841template <
typename Derived>
11843 OMPXDynCGroupMemClause *
C) {
11845 if (
Size.isInvalid())
11847 return getDerived().RebuildOMPXDynCGroupMemClause(
11848 Size.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11851template <
typename Derived>
11853 OMPDynGroupprivateClause *
C) {
11855 if (
Size.isInvalid())
11857 return getDerived().RebuildOMPDynGroupprivateClause(
11858 C->getDynGroupprivateModifier(),
C->getDynGroupprivateFallbackModifier(),
11859 Size.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11860 C->getDynGroupprivateModifierLoc(),
11861 C->getDynGroupprivateFallbackModifierLoc(),
C->getEndLoc());
11864template <
typename Derived>
11868 Vars.reserve(
C->varlist_size());
11869 for (
auto *
VE :
C->varlist()) {
11871 if (EVar.isInvalid())
11873 Vars.push_back(EVar.get());
11875 return getDerived().RebuildOMPDoacrossClause(
11876 C->getDependenceType(),
C->getDependenceLoc(),
C->getColonLoc(), Vars,
11877 C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11880template <
typename Derived>
11884 for (
auto *A :
C->getAttrs())
11885 NewAttrs.push_back(getDerived().TransformAttr(A));
11886 return getDerived().RebuildOMPXAttributeClause(
11887 NewAttrs,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11890template <
typename Derived>
11899template <
typename Derived>
11900class OpenACCClauseTransform final
11902 TreeTransform<Derived> &Self;
11903 ArrayRef<const OpenACCClause *> ExistingClauses;
11904 SemaOpenACC::OpenACCParsedClause &ParsedClause;
11905 OpenACCClause *NewClause =
nullptr;
11908 ExprResult Res = Self.TransformExpr(VarRef);
11910 if (!Res.isUsable())
11913 Res = Self.getSema().OpenACC().ActOnVar(ParsedClause.getDirectiveKind(),
11914 ParsedClause.getClauseKind(),
11920 llvm::SmallVector<Expr *> VisitVarList(ArrayRef<Expr *> VarList) {
11921 llvm::SmallVector<Expr *> InstantiatedVarList;
11922 for (Expr *CurVar : VarList) {
11925 if (VarRef.isUsable())
11926 InstantiatedVarList.push_back(VarRef.get());
11929 return InstantiatedVarList;
11933 OpenACCClauseTransform(TreeTransform<Derived> &Self,
11934 ArrayRef<const OpenACCClause *> ExistingClauses,
11935 SemaOpenACC::OpenACCParsedClause &PC)
11936 : Self(Self), ExistingClauses(ExistingClauses), ParsedClause(PC) {}
11938 OpenACCClause *CreatedClause()
const {
return NewClause; }
11940#define VISIT_CLAUSE(CLAUSE_NAME) \
11941 void Visit##CLAUSE_NAME##Clause(const OpenACC##CLAUSE_NAME##Clause &Clause);
11942#include "clang/Basic/OpenACCClauses.def"
11945template <
typename Derived>
11946void OpenACCClauseTransform<Derived>::VisitDefaultClause(
11948 ParsedClause.setDefaultDetails(
C.getDefaultClauseKind());
11951 Self.getSema().getASTContext(), ParsedClause.getDefaultClauseKind(),
11952 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
11953 ParsedClause.getEndLoc());
11956template <
typename Derived>
11957void OpenACCClauseTransform<Derived>::VisitIfClause(
const OpenACCIfClause &
C) {
11959 assert(
Cond &&
"If constructed with invalid Condition");
11963 if (Res.isInvalid() || !Res.get().second)
11966 ParsedClause.setConditionDetails(Res.get().second);
11969 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
11970 ParsedClause.getLParenLoc(), ParsedClause.getConditionExpr(),
11971 ParsedClause.getEndLoc());
11974template <
typename Derived>
11975void OpenACCClauseTransform<Derived>::VisitSelfClause(
11981 for (
Expr *CurVar :
C.getVarList()) {
11984 if (!Res.isUsable())
11987 Res =
Self.getSema().OpenACC().ActOnVar(ParsedClause.getDirectiveKind(),
11988 ParsedClause.getClauseKind(),
11991 if (Res.isUsable())
11992 InstantiatedVarList.push_back(Res.get());
11995 ParsedClause.setVarListDetails(InstantiatedVarList,
11999 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12000 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12001 ParsedClause.getEndLoc());
12004 if (
C.hasConditionExpr()) {
12007 Self.TransformCondition(
Cond->getExprLoc(),
nullptr,
Cond,
12010 if (Res.isInvalid() || !Res.get().second)
12013 ParsedClause.setConditionDetails(Res.get().second);
12017 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12018 ParsedClause.getLParenLoc(), ParsedClause.getConditionExpr(),
12019 ParsedClause.getEndLoc());
12023template <
typename Derived>
12024void OpenACCClauseTransform<Derived>::VisitNumGangsClause(
12028 for (
Expr *CurIntExpr :
C.getIntExprs()) {
12031 if (!Res.isUsable())
12036 C.getBeginLoc(), Res.get());
12037 if (!Res.isUsable())
12040 InstantiatedIntExprs.push_back(Res.get());
12043 ParsedClause.setIntExprDetails(InstantiatedIntExprs);
12045 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12046 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs(),
12047 ParsedClause.getEndLoc());
12050template <
typename Derived>
12051void OpenACCClauseTransform<Derived>::VisitPrivateClause(
12056 for (
const auto [RefExpr, InitRecipe] :
12057 llvm::zip(
C.getVarList(),
C.getInitRecipes())) {
12060 if (VarRef.isUsable()) {
12061 InstantiatedVarList.push_back(VarRef.get());
12065 if (InitRecipe.isSet())
12066 InitRecipes.push_back(InitRecipe);
12068 InitRecipes.push_back(
12069 Self.getSema().OpenACC().CreatePrivateInitRecipe(VarRef.get()));
12072 ParsedClause.setVarListDetails(InstantiatedVarList,
12076 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12077 ParsedClause.getLParenLoc(), ParsedClause.getVarList(), InitRecipes,
12078 ParsedClause.getEndLoc());
12081template <
typename Derived>
12082void OpenACCClauseTransform<Derived>::VisitHostClause(
12084 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12088 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12089 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12090 ParsedClause.getEndLoc());
12093template <
typename Derived>
12094void OpenACCClauseTransform<Derived>::VisitDeviceClause(
12096 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12100 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12101 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12102 ParsedClause.getEndLoc());
12105template <
typename Derived>
12106void OpenACCClauseTransform<Derived>::VisitFirstPrivateClause(
12111 for (
const auto [RefExpr, InitRecipe] :
12112 llvm::zip(
C.getVarList(),
C.getInitRecipes())) {
12115 if (VarRef.isUsable()) {
12116 InstantiatedVarList.push_back(VarRef.get());
12120 if (InitRecipe.isSet())
12121 InitRecipes.push_back(InitRecipe);
12123 InitRecipes.push_back(
12124 Self.getSema().OpenACC().CreateFirstPrivateInitRecipe(
12128 ParsedClause.setVarListDetails(InstantiatedVarList,
12132 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12133 ParsedClause.getLParenLoc(), ParsedClause.getVarList(), InitRecipes,
12134 ParsedClause.getEndLoc());
12137template <
typename Derived>
12138void OpenACCClauseTransform<Derived>::VisitNoCreateClause(
12140 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12144 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12145 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12146 ParsedClause.getEndLoc());
12149template <
typename Derived>
12150void OpenACCClauseTransform<Derived>::VisitPresentClause(
12152 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12156 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12157 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12158 ParsedClause.getEndLoc());
12161template <
typename Derived>
12162void OpenACCClauseTransform<Derived>::VisitCopyClause(
12164 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12165 C.getModifierList());
12168 Self.getSema().getASTContext(), ParsedClause.getClauseKind(),
12169 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12170 ParsedClause.getModifierList(), ParsedClause.getVarList(),
12171 ParsedClause.getEndLoc());
12174template <
typename Derived>
12175void OpenACCClauseTransform<Derived>::VisitLinkClause(
12177 llvm_unreachable(
"link clause not valid unless a decl transform");
12180template <
typename Derived>
12181void OpenACCClauseTransform<Derived>::VisitDeviceResidentClause(
12183 llvm_unreachable(
"device_resident clause not valid unless a decl transform");
12185template <
typename Derived>
12186void OpenACCClauseTransform<Derived>::VisitNoHostClause(
12188 llvm_unreachable(
"nohost clause not valid unless a decl transform");
12190template <
typename Derived>
12191void OpenACCClauseTransform<Derived>::VisitBindClause(
12193 llvm_unreachable(
"bind clause not valid unless a decl transform");
12196template <
typename Derived>
12197void OpenACCClauseTransform<Derived>::VisitCopyInClause(
12199 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12200 C.getModifierList());
12203 Self.getSema().getASTContext(), ParsedClause.getClauseKind(),
12204 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12205 ParsedClause.getModifierList(), ParsedClause.getVarList(),
12206 ParsedClause.getEndLoc());
12209template <
typename Derived>
12210void OpenACCClauseTransform<Derived>::VisitCopyOutClause(
12212 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12213 C.getModifierList());
12216 Self.getSema().getASTContext(), ParsedClause.getClauseKind(),
12217 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12218 ParsedClause.getModifierList(), ParsedClause.getVarList(),
12219 ParsedClause.getEndLoc());
12222template <
typename Derived>
12223void OpenACCClauseTransform<Derived>::VisitCreateClause(
12225 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12226 C.getModifierList());
12229 Self.getSema().getASTContext(), ParsedClause.getClauseKind(),
12230 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12231 ParsedClause.getModifierList(), ParsedClause.getVarList(),
12232 ParsedClause.getEndLoc());
12234template <
typename Derived>
12235void OpenACCClauseTransform<Derived>::VisitAttachClause(
12240 llvm::erase_if(VarList, [&](
Expr *E) {
12241 return Self.getSema().OpenACC().CheckVarIsPointerType(
12247 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12248 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12249 ParsedClause.getEndLoc());
12252template <
typename Derived>
12253void OpenACCClauseTransform<Derived>::VisitDetachClause(
12258 llvm::erase_if(VarList, [&](
Expr *E) {
12259 return Self.getSema().OpenACC().CheckVarIsPointerType(
12265 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12266 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12267 ParsedClause.getEndLoc());
12270template <
typename Derived>
12271void OpenACCClauseTransform<Derived>::VisitDeleteClause(
12273 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12276 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12277 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12278 ParsedClause.getEndLoc());
12281template <
typename Derived>
12282void OpenACCClauseTransform<Derived>::VisitUseDeviceClause(
12284 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12287 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12288 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12289 ParsedClause.getEndLoc());
12292template <
typename Derived>
12293void OpenACCClauseTransform<Derived>::VisitDevicePtrClause(
12298 llvm::erase_if(VarList, [&](
Expr *E) {
12299 return Self.getSema().OpenACC().CheckVarIsPointerType(
12305 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12306 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12307 ParsedClause.getEndLoc());
12310template <
typename Derived>
12311void OpenACCClauseTransform<Derived>::VisitNumWorkersClause(
12313 Expr *IntExpr =
const_cast<Expr *
>(
C.getIntExpr());
12314 assert(IntExpr &&
"num_workers clause constructed with invalid int expr");
12317 if (!Res.isUsable())
12322 C.getBeginLoc(), Res.get());
12323 if (!Res.isUsable())
12326 ParsedClause.setIntExprDetails(Res.get());
12328 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12329 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs()[0],
12330 ParsedClause.getEndLoc());
12333template <
typename Derived>
12334void OpenACCClauseTransform<Derived>::VisitDeviceNumClause (
12336 Expr *IntExpr =
const_cast<Expr *
>(
C.getIntExpr());
12337 assert(IntExpr &&
"device_num clause constructed with invalid int expr");
12340 if (!Res.isUsable())
12345 C.getBeginLoc(), Res.get());
12346 if (!Res.isUsable())
12349 ParsedClause.setIntExprDetails(Res.get());
12351 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12352 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs()[0],
12353 ParsedClause.getEndLoc());
12356template <
typename Derived>
12357void OpenACCClauseTransform<Derived>::VisitDefaultAsyncClause(
12359 Expr *IntExpr =
const_cast<Expr *
>(
C.getIntExpr());
12360 assert(IntExpr &&
"default_async clause constructed with invalid int expr");
12363 if (!Res.isUsable())
12368 C.getBeginLoc(), Res.get());
12369 if (!Res.isUsable())
12372 ParsedClause.setIntExprDetails(Res.get());
12374 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12375 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs()[0],
12376 ParsedClause.getEndLoc());
12379template <
typename Derived>
12380void OpenACCClauseTransform<Derived>::VisitVectorLengthClause(
12382 Expr *IntExpr =
const_cast<Expr *
>(
C.getIntExpr());
12383 assert(IntExpr &&
"vector_length clause constructed with invalid int expr");
12386 if (!Res.isUsable())
12391 C.getBeginLoc(), Res.get());
12392 if (!Res.isUsable())
12395 ParsedClause.setIntExprDetails(Res.get());
12397 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12398 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs()[0],
12399 ParsedClause.getEndLoc());
12402template <
typename Derived>
12403void OpenACCClauseTransform<Derived>::VisitAsyncClause(
12405 if (
C.hasIntExpr()) {
12407 if (!Res.isUsable())
12412 C.getBeginLoc(), Res.get());
12413 if (!Res.isUsable())
12415 ParsedClause.setIntExprDetails(Res.get());
12419 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12420 ParsedClause.getLParenLoc(),
12421 ParsedClause.getNumIntExprs() != 0 ? ParsedClause.getIntExprs()[0]
12423 ParsedClause.getEndLoc());
12426template <
typename Derived>
12427void OpenACCClauseTransform<Derived>::VisitWorkerClause(
12429 if (
C.hasIntExpr()) {
12434 if (!Res.isUsable())
12439 C.getBeginLoc(), Res.get());
12440 if (!Res.isUsable())
12442 ParsedClause.setIntExprDetails(Res.get());
12446 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12447 ParsedClause.getLParenLoc(),
12448 ParsedClause.getNumIntExprs() != 0 ? ParsedClause.getIntExprs()[0]
12450 ParsedClause.getEndLoc());
12453template <
typename Derived>
12454void OpenACCClauseTransform<Derived>::VisitVectorClause(
12456 if (
C.hasIntExpr()) {
12461 if (!Res.isUsable())
12466 C.getBeginLoc(), Res.get());
12467 if (!Res.isUsable())
12469 ParsedClause.setIntExprDetails(Res.get());
12473 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12474 ParsedClause.getLParenLoc(),
12475 ParsedClause.getNumIntExprs() != 0 ? ParsedClause.getIntExprs()[0]
12477 ParsedClause.getEndLoc());
12480template <
typename Derived>
12481void OpenACCClauseTransform<Derived>::VisitWaitClause(
12483 if (
C.hasExprs()) {
12484 Expr *DevNumExpr =
nullptr;
12488 if (
C.getDevNumExpr()) {
12490 if (!Res.isUsable())
12494 C.getBeginLoc(), Res.get());
12495 if (!Res.isUsable())
12498 DevNumExpr = Res.get();
12502 for (
Expr *CurQueueIdExpr :
C.getQueueIdExprs()) {
12504 if (!Res.isUsable())
12508 C.getBeginLoc(), Res.get());
12509 if (!Res.isUsable())
12512 InstantiatedQueueIdExprs.push_back(Res.get());
12515 ParsedClause.setWaitDetails(DevNumExpr,
C.getQueuesLoc(),
12516 std::move(InstantiatedQueueIdExprs));
12520 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12521 ParsedClause.getLParenLoc(), ParsedClause.getDevNumExpr(),
12522 ParsedClause.getQueuesLoc(), ParsedClause.getQueueIdExprs(),
12523 ParsedClause.getEndLoc());
12526template <
typename Derived>
12527void OpenACCClauseTransform<Derived>::VisitDeviceTypeClause(
12531 Self.getSema().getASTContext(),
C.getClauseKind(),
12532 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12533 C.getArchitectures(), ParsedClause.getEndLoc());
12536template <
typename Derived>
12537void OpenACCClauseTransform<Derived>::VisitAutoClause(
12541 ParsedClause.getBeginLoc(),
12542 ParsedClause.getEndLoc());
12545template <
typename Derived>
12546void OpenACCClauseTransform<Derived>::VisitIndependentClause(
12549 ParsedClause.getBeginLoc(),
12550 ParsedClause.getEndLoc());
12553template <
typename Derived>
12554void OpenACCClauseTransform<Derived>::VisitSeqClause(
12557 ParsedClause.getBeginLoc(),
12558 ParsedClause.getEndLoc());
12560template <
typename Derived>
12561void OpenACCClauseTransform<Derived>::VisitFinalizeClause(
12564 ParsedClause.getBeginLoc(),
12565 ParsedClause.getEndLoc());
12568template <
typename Derived>
12569void OpenACCClauseTransform<Derived>::VisitIfPresentClause(
12572 ParsedClause.getBeginLoc(),
12573 ParsedClause.getEndLoc());
12576template <
typename Derived>
12577void OpenACCClauseTransform<Derived>::VisitReductionClause(
12583 for (
const auto [Var, OrigRecipe] :
12584 llvm::zip(TransformedVars,
C.getRecipes())) {
12586 ParsedClause.getDirectiveKind(),
C.getReductionOp(), Var);
12587 if (Res.isUsable()) {
12588 ValidVars.push_back(Res.get());
12590 if (OrigRecipe.isSet())
12591 Recipes.emplace_back(OrigRecipe.AllocaDecl, OrigRecipe.CombinerRecipes);
12593 Recipes.push_back(
Self.getSema().OpenACC().CreateReductionInitRecipe(
12594 C.getReductionOp(), Res.get()));
12598 NewClause =
Self.getSema().OpenACC().CheckReductionClause(
12599 ExistingClauses, ParsedClause.getDirectiveKind(),
12600 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12601 C.getReductionOp(), ValidVars, Recipes, ParsedClause.getEndLoc());
12604template <
typename Derived>
12605void OpenACCClauseTransform<Derived>::VisitCollapseClause(
12607 Expr *LoopCount =
const_cast<Expr *
>(
C.getLoopCount());
12608 assert(LoopCount &&
"collapse clause constructed with invalid loop count");
12612 NewLoopCount =
Self.getSema().OpenACC().ActOnIntExpr(
12614 NewLoopCount.get()->getBeginLoc(), NewLoopCount.get());
12617 Self.getSema().OpenACC().CheckCollapseLoopCount(NewLoopCount.get());
12619 ParsedClause.setCollapseDetails(
C.hasForce(), NewLoopCount.get());
12621 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12622 ParsedClause.getLParenLoc(), ParsedClause.isForce(),
12623 ParsedClause.getLoopCount(), ParsedClause.getEndLoc());
12626template <
typename Derived>
12627void OpenACCClauseTransform<Derived>::VisitTileClause(
12632 for (
Expr *E :
C.getSizeExprs()) {
12635 if (!NewSizeExpr.isUsable())
12638 NewSizeExpr =
Self.getSema().OpenACC().ActOnIntExpr(
12640 NewSizeExpr.get()->getBeginLoc(), NewSizeExpr.get());
12642 NewSizeExpr =
Self.getSema().OpenACC().CheckTileSizeExpr(NewSizeExpr.get());
12644 if (!NewSizeExpr.isUsable())
12646 TransformedExprs.push_back(NewSizeExpr.get());
12649 ParsedClause.setIntExprDetails(TransformedExprs);
12651 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12652 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs(),
12653 ParsedClause.getEndLoc());
12655template <
typename Derived>
12656void OpenACCClauseTransform<Derived>::VisitGangClause(
12661 for (
unsigned I = 0; I <
C.getNumExprs(); ++I) {
12663 if (!ER.isUsable())
12666 ER =
Self.getSema().OpenACC().CheckGangExpr(ExistingClauses,
12667 ParsedClause.getDirectiveKind(),
12668 C.getExpr(I).first, ER.get());
12669 if (!ER.isUsable())
12671 TransformedGangKinds.push_back(
C.getExpr(I).first);
12672 TransformedIntExprs.push_back(ER.get());
12675 NewClause =
Self.getSema().OpenACC().CheckGangClause(
12676 ParsedClause.getDirectiveKind(), ExistingClauses,
12677 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12678 TransformedGangKinds, TransformedIntExprs, ParsedClause.getEndLoc());
12681template <
typename Derived>
12682OpenACCClause *TreeTransform<Derived>::TransformOpenACCClause(
12687 DirKind, OldClause->getClauseKind(), OldClause->getBeginLoc());
12688 ParsedClause.setEndLoc(OldClause->getEndLoc());
12690 if (
const auto *WithParms = dyn_cast<OpenACCClauseWithParams>(OldClause))
12691 ParsedClause.setLParenLoc(WithParms->getLParenLoc());
12693 OpenACCClauseTransform<Derived> Transform{*
this, ExistingClauses,
12695 Transform.Visit(OldClause);
12697 return Transform.CreatedClause();
12700template <
typename Derived>
12702TreeTransform<Derived>::TransformOpenACCClauseList(
12705 for (
const auto *Clause : OldClauses) {
12706 if (
OpenACCClause *TransformedClause = getDerived().TransformOpenACCClause(
12707 TransformedClauses, DirKind, Clause))
12708 TransformedClauses.push_back(TransformedClause);
12710 return TransformedClauses;
12713template <
typename Derived>
12716 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12719 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12722 if (getSema().OpenACC().ActOnStartStmtDirective(
12723 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12728 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
12729 C->clauses(), TransformedClauses);
12730 StmtResult StrBlock = getDerived().TransformStmt(
C->getStructuredBlock());
12731 StrBlock = getSema().OpenACC().ActOnAssociatedStmt(
12732 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses, StrBlock);
12734 return getDerived().RebuildOpenACCComputeConstruct(
12735 C->getDirectiveKind(),
C->getBeginLoc(),
C->getDirectiveLoc(),
12736 C->getEndLoc(), TransformedClauses, StrBlock);
12739template <
typename Derived>
12743 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12746 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12749 if (getSema().OpenACC().ActOnStartStmtDirective(
12750 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12755 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
12756 C->clauses(), TransformedClauses);
12758 Loop = getSema().OpenACC().ActOnAssociatedStmt(
12759 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses,
Loop);
12761 return getDerived().RebuildOpenACCLoopConstruct(
12762 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12763 TransformedClauses,
Loop);
12766template <
typename Derived>
12768 OpenACCCombinedConstruct *
C) {
12769 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12772 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12775 if (getSema().OpenACC().ActOnStartStmtDirective(
12776 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12781 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
12782 C->clauses(), TransformedClauses);
12784 Loop = getSema().OpenACC().ActOnAssociatedStmt(
12785 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses,
Loop);
12787 return getDerived().RebuildOpenACCCombinedConstruct(
12788 C->getDirectiveKind(),
C->getBeginLoc(),
C->getDirectiveLoc(),
12789 C->getEndLoc(), TransformedClauses,
Loop);
12792template <
typename Derived>
12795 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12798 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12800 if (getSema().OpenACC().ActOnStartStmtDirective(
12801 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12805 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
12806 C->clauses(), TransformedClauses);
12807 StmtResult StrBlock = getDerived().TransformStmt(
C->getStructuredBlock());
12808 StrBlock = getSema().OpenACC().ActOnAssociatedStmt(
12809 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses, StrBlock);
12811 return getDerived().RebuildOpenACCDataConstruct(
12812 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12813 TransformedClauses, StrBlock);
12816template <
typename Derived>
12818 OpenACCEnterDataConstruct *
C) {
12819 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12822 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12824 if (getSema().OpenACC().ActOnStartStmtDirective(
12825 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12828 return getDerived().RebuildOpenACCEnterDataConstruct(
12829 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12830 TransformedClauses);
12833template <
typename Derived>
12835 OpenACCExitDataConstruct *
C) {
12836 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12839 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12841 if (getSema().OpenACC().ActOnStartStmtDirective(
12842 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12845 return getDerived().RebuildOpenACCExitDataConstruct(
12846 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12847 TransformedClauses);
12850template <
typename Derived>
12852 OpenACCHostDataConstruct *
C) {
12853 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12856 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12858 if (getSema().OpenACC().ActOnStartStmtDirective(
12859 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12863 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
12864 C->clauses(), TransformedClauses);
12865 StmtResult StrBlock = getDerived().TransformStmt(
C->getStructuredBlock());
12866 StrBlock = getSema().OpenACC().ActOnAssociatedStmt(
12867 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses, StrBlock);
12869 return getDerived().RebuildOpenACCHostDataConstruct(
12870 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12871 TransformedClauses, StrBlock);
12874template <
typename Derived>
12877 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12880 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12882 if (getSema().OpenACC().ActOnStartStmtDirective(
12883 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12886 return getDerived().RebuildOpenACCInitConstruct(
12887 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12888 TransformedClauses);
12891template <
typename Derived>
12893 OpenACCShutdownConstruct *
C) {
12894 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12897 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12899 if (getSema().OpenACC().ActOnStartStmtDirective(
12900 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12903 return getDerived().RebuildOpenACCShutdownConstruct(
12904 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12905 TransformedClauses);
12907template <
typename Derived>
12910 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12913 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12915 if (getSema().OpenACC().ActOnStartStmtDirective(
12916 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12919 return getDerived().RebuildOpenACCSetConstruct(
12920 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12921 TransformedClauses);
12924template <
typename Derived>
12926 OpenACCUpdateConstruct *
C) {
12927 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12930 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12932 if (getSema().OpenACC().ActOnStartStmtDirective(
12933 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12936 return getDerived().RebuildOpenACCUpdateConstruct(
12937 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12938 TransformedClauses);
12941template <
typename Derived>
12944 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12947 if (
C->hasDevNumExpr()) {
12948 DevNumExpr = getDerived().TransformExpr(
C->getDevNumExpr());
12950 if (DevNumExpr.isUsable())
12951 DevNumExpr = getSema().OpenACC().ActOnIntExpr(
12953 C->getBeginLoc(), DevNumExpr.get());
12958 for (
Expr *QE :
C->getQueueIdExprs()) {
12959 assert(QE &&
"Null queue id expr?");
12960 ExprResult NewEQ = getDerived().TransformExpr(QE);
12962 if (!NewEQ.isUsable())
12966 C->getBeginLoc(), NewEQ.get());
12967 if (NewEQ.isUsable())
12968 QueueIdExprs.push_back(NewEQ.get());
12972 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12975 if (getSema().OpenACC().ActOnStartStmtDirective(
12976 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12979 return getDerived().RebuildOpenACCWaitConstruct(
12980 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getLParenLoc(),
12981 DevNumExpr.isUsable() ? DevNumExpr.get() :
nullptr,
C->getQueuesLoc(),
12982 QueueIdExprs,
C->getRParenLoc(),
C->getEndLoc(), TransformedClauses);
12984template <
typename Derived>
12986 OpenACCCacheConstruct *
C) {
12987 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12990 for (
Expr *Var :
C->getVarList()) {
12991 assert(Var &&
"Null var listexpr?");
12993 ExprResult NewVar = getDerived().TransformExpr(Var);
12995 if (!NewVar.isUsable())
12998 NewVar = getSema().OpenACC().ActOnVar(
13000 if (!NewVar.isUsable())
13003 TransformedVarList.push_back(NewVar.get());
13006 if (getSema().OpenACC().ActOnStartStmtDirective(
C->getDirectiveKind(),
13007 C->getBeginLoc(), {}))
13010 return getDerived().RebuildOpenACCCacheConstruct(
13011 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getLParenLoc(),
13012 C->getReadOnlyLoc(), TransformedVarList,
C->getRParenLoc(),
13016template <
typename Derived>
13018 OpenACCAtomicConstruct *
C) {
13019 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13022 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
13025 if (getSema().OpenACC().ActOnStartStmtDirective(
C->getDirectiveKind(),
13026 C->getBeginLoc(), {}))
13031 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(), {}, {});
13033 StmtResult AssocStmt = getDerived().TransformStmt(
C->getAssociatedStmt());
13034 AssocStmt = getSema().OpenACC().ActOnAssociatedStmt(
13035 C->getBeginLoc(),
C->getDirectiveKind(),
C->getAtomicKind(), {},
13038 return getDerived().RebuildOpenACCAtomicConstruct(
13039 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getAtomicKind(),
13040 C->getEndLoc(), TransformedClauses, AssocStmt);
13043template <
typename Derived>
13046 if (getDerived().AlwaysRebuild())
13055template<
typename Derived>
13058 return TransformExpr(E->getSubExpr());
13061template <
typename Derived>
13064 if (!E->isTypeDependent())
13067 TypeSourceInfo *NewT = getDerived().TransformType(E->getTypeSourceInfo());
13072 if (!getDerived().AlwaysRebuild() && E->getTypeSourceInfo() == NewT)
13075 return getDerived().RebuildSYCLUniqueStableNameExpr(
13076 E->getLocation(), E->getLParenLocation(), E->getRParenLocation(), NewT);
13079template <
typename Derived>
13083 const auto *SKEPAttr = FD->template getAttr<SYCLKernelEntryPointAttr>();
13084 if (!SKEPAttr || SKEPAttr->isInvalidAttr())
13087 ExprResult IdExpr = getDerived().TransformExpr(S->getKernelLaunchIdExpr());
13088 if (IdExpr.isInvalid())
13091 StmtResult Body = getDerived().TransformStmt(S->getOriginalStmt());
13092 if (Body.isInvalid())
13098 if (SR.isInvalid())
13104template <
typename Derived>
13107 assert(
false &&
"not implemented yet");
13111template<
typename Derived>
13114 if (!E->isTypeDependent())
13118 E->getIdentKind());
13121template<
typename Derived>
13125 if (E->getQualifierLoc()) {
13127 = getDerived().TransformNestedNameSpecifierLoc(E->getQualifierLoc());
13133 = cast_or_null<ValueDecl>(getDerived().TransformDecl(E->getLocation(),
13135 if (!ND || ND->isInvalidDecl())
13139 if (E->getFoundDecl() != E->getDecl()) {
13140 Found = cast_or_null<NamedDecl>(
13141 getDerived().TransformDecl(E->getLocation(), E->getFoundDecl()));
13147 if (NameInfo.getName()) {
13148 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
13149 if (!NameInfo.getName())
13153 if (!getDerived().AlwaysRebuild() &&
13154 !E->isCapturedByCopyInLambdaWithExplicitObjectParameter() &&
13155 QualifierLoc == E->getQualifierLoc() && ND == E->getDecl() &&
13156 Found == E->getFoundDecl() &&
13157 NameInfo.getName() == E->getDecl()->getDeclName() &&
13158 !E->hasExplicitTemplateArgs()) {
13168 if (E->hasExplicitTemplateArgs()) {
13169 TemplateArgs = &TransArgs;
13170 TransArgs.setLAngleLoc(E->getLAngleLoc());
13171 TransArgs.setRAngleLoc(E->getRAngleLoc());
13172 if (getDerived().TransformTemplateArguments(E->getTemplateArgs(),
13173 E->getNumTemplateArgs(),
13178 return getDerived().RebuildDeclRefExpr(QualifierLoc, ND, NameInfo,
13179 Found, TemplateArgs);
13182template<
typename Derived>
13188template <
typename Derived>
13194template<
typename Derived>
13200template<
typename Derived>
13206template<
typename Derived>
13212template<
typename Derived>
13218template<
typename Derived>
13221 return getDerived().TransformCallExpr(E);
13224template<
typename Derived>
13229 if (E->isExprPredicate())
13230 ControllingExpr = getDerived().TransformExpr(E->getControllingExpr());
13232 ControllingType = getDerived().TransformType(E->getControllingType());
13234 if (ControllingExpr.isInvalid() && !ControllingType)
13245 AssocTypes.push_back(AssocType);
13247 AssocTypes.push_back(
nullptr);
13251 getDerived().TransformExpr(Assoc.getAssociationExpr());
13252 if (AssocExpr.isInvalid())
13254 AssocExprs.push_back(AssocExpr.get());
13257 if (!ControllingType)
13258 return getDerived().RebuildGenericSelectionExpr(E->getGenericLoc(),
13259 E->getDefaultLoc(),
13261 ControllingExpr.get(),
13264 return getDerived().RebuildGenericSelectionExpr(
13265 E->getGenericLoc(), E->getDefaultLoc(), E->getRParenLoc(),
13266 ControllingType, AssocTypes, AssocExprs);
13269template<
typename Derived>
13272 ExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
13273 if (SubExpr.isInvalid())
13276 if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getSubExpr())
13279 return getDerived().RebuildParenExpr(SubExpr.get(), E->getLParen(),
13286template<
typename Derived>
13290 return getDerived().TransformDependentScopeDeclRefExpr(
13291 DRE,
true,
nullptr);
13293 return getDerived().TransformUnresolvedLookupExpr(
13299template<
typename Derived>
13304 SubExpr = TransformAddressOfOperand(E->
getSubExpr());
13310 if (!getDerived().AlwaysRebuild() && SubExpr.
get() == E->
getSubExpr())
13318template<
typename Derived>
13320TreeTransform<Derived>::TransformOffsetOfExpr(OffsetOfExpr *E) {
13322 TypeSourceInfo *Type = getDerived().TransformType(E->getTypeSourceInfo());
13332 bool ExprChanged =
false;
13333 typedef Sema::OffsetOfComponent Component;
13335 for (
unsigned I = 0, N = E->getNumComponents(); I != N; ++I) {
13336 const OffsetOfNode &ON = E->getComponent(I);
13338 Comp.isBrackets =
true;
13339 Comp.LocStart = ON.getSourceRange().getBegin();
13340 Comp.LocEnd = ON.getSourceRange().getEnd();
13341 switch (ON.getKind()) {
13343 Expr *FromIndex = E->getIndexExpr(ON.getArrayExprIndex());
13344 ExprResult Index = getDerived().TransformExpr(FromIndex);
13345 if (Index.isInvalid())
13348 ExprChanged = ExprChanged || Index.get() != FromIndex;
13349 Comp.isBrackets =
true;
13350 Comp.U.E = Index.get();
13356 Comp.isBrackets =
false;
13357 Comp.U.IdentInfo = ON.getFieldName();
13358 if (!
Comp.U.IdentInfo)
13368 Components.push_back(Comp);
13372 if (!getDerived().AlwaysRebuild() &&
13373 Type == E->getTypeSourceInfo() &&
13378 return getDerived().RebuildOffsetOfExpr(E->getOperatorLoc(),
Type,
13379 Components, E->getRParenLoc());
13382template<
typename Derived>
13385 assert((!E->getSourceExpr() || getDerived().AlreadyTransformed(E->getType())) &&
13386 "opaque value expression requires transformation");
13390template <
typename Derived>
13394 for (
Expr *
C : E->subExpressions()) {
13396 if (NewC.isInvalid())
13402 if (!getDerived().AlwaysRebuild() && !Changed)
13404 return getDerived().RebuildRecoveryExpr(E->getBeginLoc(), E->getEndLoc(),
13408template<
typename Derived>
13418 ExprResult result = getDerived().TransformExpr(newSyntacticForm);
13419 if (result.isInvalid())
return ExprError();
13424 if (result.get()->hasPlaceholderType(BuiltinType::PseudoObject))
13430template<
typename Derived>
13434 if (E->isArgumentType()) {
13441 if (!getDerived().AlwaysRebuild() && OldT == NewT)
13444 return getDerived().RebuildUnaryExprOrTypeTrait(NewT, E->getOperatorLoc(),
13446 E->getSourceRange());
13460 auto *PE = dyn_cast<ParenExpr>(E->getArgumentExpr());
13462 PE ? dyn_cast<DependentScopeDeclRefExpr>(PE->getSubExpr()) :
nullptr)
13463 SubExpr = getDerived().TransformParenDependentScopeDeclRefExpr(
13464 PE, DRE,
false, &RecoveryTSI);
13466 SubExpr = getDerived().TransformExpr(E->getArgumentExpr());
13469 return getDerived().RebuildUnaryExprOrTypeTrait(
13470 RecoveryTSI, E->getOperatorLoc(), E->getKind(), E->getSourceRange());
13471 }
else if (SubExpr.isInvalid())
13474 if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getArgumentExpr())
13477 return getDerived().RebuildUnaryExprOrTypeTrait(SubExpr.get(),
13478 E->getOperatorLoc(),
13480 E->getSourceRange());
13483template<
typename Derived>
13486 ExprResult LHS = getDerived().TransformExpr(E->getLHS());
13487 if (LHS.isInvalid())
13490 ExprResult RHS = getDerived().TransformExpr(E->getRHS());
13491 if (RHS.isInvalid())
13495 if (!getDerived().AlwaysRebuild() &&
13496 LHS.get() == E->getLHS() &&
13497 RHS.get() == E->getRHS())
13500 return getDerived().RebuildArraySubscriptExpr(
13502 E->getLHS()->getBeginLoc(), RHS.get(), E->getRBracketLoc());
13505template <
typename Derived>
13509 if (
Base.isInvalid())
13512 ExprResult RowIdx = getDerived().TransformExpr(E->getRowIdx());
13513 if (RowIdx.isInvalid())
13516 if (!getDerived().AlwaysRebuild() &&
Base.get() == E->getBase() &&
13517 RowIdx.get() == E->getRowIdx())
13520 return getDerived().RebuildMatrixSingleSubscriptExpr(
Base.get(), RowIdx.get(),
13521 E->getRBracketLoc());
13524template <
typename Derived>
13528 if (
Base.isInvalid())
13531 ExprResult RowIdx = getDerived().TransformExpr(E->getRowIdx());
13532 if (RowIdx.isInvalid())
13535 ExprResult ColumnIdx = getDerived().TransformExpr(E->getColumnIdx());
13536 if (ColumnIdx.isInvalid())
13539 if (!getDerived().AlwaysRebuild() &&
Base.get() == E->getBase() &&
13540 RowIdx.get() == E->getRowIdx() && ColumnIdx.get() == E->getColumnIdx())
13543 return getDerived().RebuildMatrixSubscriptExpr(
13544 Base.get(), RowIdx.get(), ColumnIdx.get(), E->getRBracketLoc());
13547template <
typename Derived>
13551 if (
Base.isInvalid())
13555 if (E->getLowerBound()) {
13556 LowerBound = getDerived().TransformExpr(E->getLowerBound());
13557 if (LowerBound.isInvalid())
13562 if (E->getLength()) {
13563 Length = getDerived().TransformExpr(E->getLength());
13564 if (Length.isInvalid())
13569 if (E->isOMPArraySection()) {
13570 if (
Expr *Str = E->getStride()) {
13571 Stride = getDerived().TransformExpr(Str);
13572 if (Stride.isInvalid())
13577 if (!getDerived().AlwaysRebuild() &&
Base.get() == E->getBase() &&
13578 LowerBound.get() == E->getLowerBound() &&
13579 Length.get() == E->getLength() &&
13580 (E->isOpenACCArraySection() || Stride.get() == E->getStride()))
13583 return getDerived().RebuildArraySectionExpr(
13584 E->isOMPArraySection(),
Base.get(), E->getBase()->getEndLoc(),
13585 LowerBound.get(), E->getColonLocFirst(),
13586 E->isOMPArraySection() ? E->getColonLocSecond() :
SourceLocation{},
13587 Length.get(), Stride.get(), E->getRBracketLoc());
13590template <
typename Derived>
13594 if (
Base.isInvalid())
13598 bool ErrorFound =
false;
13599 for (
Expr *
Dim : E->getDimensions()) {
13601 if (DimRes.isInvalid()) {
13605 Dims.push_back(DimRes.get());
13610 return getDerived().RebuildOMPArrayShapingExpr(
Base.get(), E->getLParenLoc(),
13611 E->getRParenLoc(), Dims,
13612 E->getBracketsRanges());
13615template <
typename Derived>
13618 unsigned NumIterators = E->numOfIterators();
13621 bool ErrorFound =
false;
13622 bool NeedToRebuild = getDerived().AlwaysRebuild();
13623 for (
unsigned I = 0; I < NumIterators; ++I) {
13625 Data[I].DeclIdent = D->getIdentifier();
13626 Data[I].DeclIdentLoc = D->getLocation();
13627 if (D->getLocation() == D->getBeginLoc()) {
13629 "Implicit type must be int.");
13631 TypeSourceInfo *TSI = getDerived().TransformType(D->getTypeSourceInfo());
13639 ErrorFound = ErrorFound ||
13640 !(!D->getTypeSourceInfo() || (
Data[I].
Type.getAsOpaquePtr() &&
13641 !
Data[I].Type.get().isNull())) ||
13642 Begin.isInvalid() || End.isInvalid() || Step.isInvalid();
13645 Data[I].Range.Begin = Begin.get();
13646 Data[I].Range.End = End.get();
13647 Data[I].Range.Step = Step.get();
13648 Data[I].AssignLoc = E->getAssignLoc(I);
13649 Data[I].ColonLoc = E->getColonLoc(I);
13650 Data[I].SecColonLoc = E->getSecondColonLoc(I);
13653 (D->getTypeSourceInfo() &&
Data[I].
Type.get().getTypePtrOrNull() !=
13654 D->getType().getTypePtrOrNull()) ||
13660 if (!NeedToRebuild)
13663 ExprResult Res = getDerived().RebuildOMPIteratorExpr(
13664 E->getIteratorKwLoc(), E->getLParenLoc(), E->getRParenLoc(),
Data);
13665 if (!Res.isUsable())
13668 for (
unsigned I = 0; I < NumIterators; ++I)
13669 getDerived().transformedLocalDecl(E->getIteratorDecl(I),
13670 IE->getIteratorDecl(I));
13674template<
typename Derived>
13683 bool ArgChanged =
false;
13685 if (getDerived().TransformExprs(E->getArgs(), E->getNumArgs(),
true, Args,
13689 if (!getDerived().AlwaysRebuild() &&
13690 Callee.get() == E->getCallee() &&
13696 = ((
Expr *)
Callee.get())->getSourceRange().getBegin();
13699 if (E->hasStoredFPFeatures()) {
13701 getSema().CurFPFeatures =
13703 getSema().FpPragmaStack.CurrentValue = NewOverrides;
13706 return getDerived().RebuildCallExpr(
Callee.get(), FakeLParenLoc,
13708 E->getRParenLoc());
13711template<
typename Derived>
13715 if (
Base.isInvalid())
13719 if (E->hasQualifier()) {
13721 = getDerived().TransformNestedNameSpecifierLoc(E->getQualifierLoc());
13729 = cast_or_null<ValueDecl>(getDerived().TransformDecl(E->getMemberLoc(),
13730 E->getMemberDecl()));
13734 NamedDecl *FoundDecl = E->getFoundDecl();
13735 if (FoundDecl == E->getMemberDecl()) {
13738 FoundDecl = cast_or_null<NamedDecl>(
13739 getDerived().TransformDecl(E->getMemberLoc(), FoundDecl));
13744 if (!getDerived().AlwaysRebuild() &&
13745 Base.get() == E->getBase() &&
13746 QualifierLoc == E->getQualifierLoc() &&
13747 Member == E->getMemberDecl() &&
13748 FoundDecl == E->getFoundDecl() &&
13749 !E->hasExplicitTemplateArgs()) {
13754 getSema().OpenMP().isOpenMPRebuildMemberExpr(
13764 if (E->hasExplicitTemplateArgs()) {
13765 TransArgs.setLAngleLoc(E->getLAngleLoc());
13766 TransArgs.setRAngleLoc(E->getRAngleLoc());
13767 if (getDerived().TransformTemplateArguments(E->getTemplateArgs(),
13768 E->getNumTemplateArgs(),
13781 NamedDecl *FirstQualifierInScope =
nullptr;
13783 if (MemberNameInfo.getName()) {
13784 MemberNameInfo = getDerived().TransformDeclarationNameInfo(MemberNameInfo);
13785 if (!MemberNameInfo.getName())
13789 return getDerived().RebuildMemberExpr(
Base.get(), FakeOperatorLoc,
13796 (E->hasExplicitTemplateArgs()
13797 ? &TransArgs :
nullptr),
13798 FirstQualifierInScope);
13801template<
typename Derived>
13804 ExprResult LHS = getDerived().TransformExpr(E->getLHS());
13805 if (LHS.isInvalid())
13809 getDerived().TransformInitializer(E->getRHS(),
false);
13810 if (RHS.isInvalid())
13813 if (!getDerived().AlwaysRebuild() &&
13814 LHS.get() == E->getLHS() &&
13815 RHS.get() == E->getRHS())
13818 if (E->isCompoundAssignmentOp())
13820 return getDerived().RebuildBinaryOperator(
13821 E->getOperatorLoc(), E->getOpcode(), LHS.get(), RHS.get());
13824 getSema().CurFPFeatures =
13825 NewOverrides.applyOverrides(getSema().getLangOpts());
13826 getSema().FpPragmaStack.CurrentValue = NewOverrides;
13827 return getDerived().RebuildBinaryOperator(E->getOperatorLoc(), E->getOpcode(),
13828 LHS.get(), RHS.get());
13831template <
typename Derived>
13836 ExprResult LHS = getDerived().TransformExpr(
const_cast<Expr*
>(Decomp.LHS));
13837 if (LHS.isInvalid())
13840 ExprResult RHS = getDerived().TransformExpr(
const_cast<Expr*
>(Decomp.RHS));
13841 if (RHS.isInvalid())
13847 bool ChangedAnyLookups =
false;
13848 Expr *PossibleBinOps[] = {E->getSemanticForm(),
13849 const_cast<Expr *
>(Decomp.InnerBinOp)};
13850 for (
Expr *PossibleBinOp : PossibleBinOps) {
13851 auto *Op = dyn_cast<CXXOperatorCallExpr>(PossibleBinOp->IgnoreImplicit());
13854 auto *
Callee = dyn_cast<DeclRefExpr>(Op->getCallee()->IgnoreImplicit());
13860 NamedDecl *
Found = cast_or_null<NamedDecl>(getDerived().TransformDecl(
13861 E->getOperatorLoc(),
Callee->getFoundDecl()));
13865 ChangedAnyLookups =
true;
13866 UnqualLookups.addDecl(
Found);
13869 if (!getDerived().AlwaysRebuild() && !ChangedAnyLookups &&
13870 LHS.get() == Decomp.LHS && RHS.get() == Decomp.RHS) {
13876 const Expr *StopAt[] = {Decomp.LHS, Decomp.RHS};
13881 return getDerived().RebuildCXXRewrittenBinaryOperator(
13882 E->getOperatorLoc(), Decomp.Opcode, UnqualLookups, LHS.get(), RHS.get());
13885template<
typename Derived>
13891 getSema().CurFPFeatures =
13892 NewOverrides.applyOverrides(getSema().getLangOpts());
13893 getSema().FpPragmaStack.CurrentValue = NewOverrides;
13894 return getDerived().TransformBinaryOperator(E);
13897template<
typename Derived>
13903 ExprResult commonExpr = getDerived().TransformExpr(e->getCommon());
13904 if (commonExpr.isInvalid())
13907 ExprResult rhs = getDerived().TransformExpr(e->getFalseExpr());
13908 if (rhs.isInvalid())
13911 if (!getDerived().AlwaysRebuild() &&
13912 commonExpr.get() == e->getCommon() &&
13913 rhs.get() == e->getFalseExpr())
13916 return getDerived().RebuildConditionalOperator(commonExpr.get(),
13917 e->getQuestionLoc(),
13923template<
typename Derived>
13927 if (
Cond.isInvalid())
13930 ExprResult LHS = getDerived().TransformExpr(E->getLHS());
13931 if (LHS.isInvalid())
13934 ExprResult RHS = getDerived().TransformExpr(E->getRHS());
13935 if (RHS.isInvalid())
13938 if (!getDerived().AlwaysRebuild() &&
13939 Cond.get() == E->getCond() &&
13940 LHS.get() == E->getLHS() &&
13941 RHS.get() == E->getRHS())
13944 return getDerived().RebuildConditionalOperator(
Cond.get(),
13945 E->getQuestionLoc(),
13951template<
typename Derived>
13956 return getDerived().
TransformExpr(E->getSubExprAsWritten());
13959template<
typename Derived>
13967 = getDerived().TransformExpr(E->getSubExprAsWritten());
13968 if (SubExpr.isInvalid())
13971 if (!getDerived().AlwaysRebuild() &&
13972 Type == E->getTypeInfoAsWritten() &&
13973 SubExpr.get() == E->getSubExpr())
13976 return getDerived().RebuildCStyleCastExpr(E->getLParenLoc(),
13982template<
typename Derived>
13990 ExprResult Init = getDerived().TransformExpr(E->getInitializer());
13991 if (
Init.isInvalid())
13994 if (!getDerived().AlwaysRebuild() &&
13996 Init.get() == E->getInitializer())
14003 return getDerived().RebuildCompoundLiteralExpr(
14004 E->getLParenLoc(), NewT,
14005 E->getInitializer()->getEndLoc(),
Init.get());
14008template<
typename Derived>
14012 if (
Base.isInvalid())
14015 if (!getDerived().AlwaysRebuild() &&
14016 Base.get() == E->getBase())
14022 return getDerived().RebuildExtVectorOrMatrixElementExpr(
14023 Base.get(), FakeOperatorLoc, E->isArrow(), E->getAccessorLoc(),
14027template <
typename Derived>
14031 if (
Base.isInvalid())
14034 if (!getDerived().AlwaysRebuild() &&
Base.get() == E->getBase())
14040 return getDerived().RebuildExtVectorOrMatrixElementExpr(
14041 Base.get(), FakeOperatorLoc,
false, E->getAccessorLoc(),
14045template<
typename Derived>
14051 bool InitChanged =
false;
14057 if (getDerived().TransformExprs(E->getInits(), E->getNumInits(),
false,
14058 Inits, &InitChanged))
14061 if (!getDerived().AlwaysRebuild() && !InitChanged) {
14068 return getDerived().RebuildInitList(E->getLBraceLoc(),
Inits,
14069 E->getRBraceLoc());
14072template<
typename Derived>
14079 if (
Init.isInvalid())
14084 bool ExprChanged =
false;
14086 if (D.isFieldDesignator()) {
14087 if (D.getFieldDecl()) {
14089 getDerived().TransformDecl(D.getFieldLoc(), D.getFieldDecl()));
14090 if (Field != D.getFieldDecl())
14093 ExprChanged =
true;
14094 if (
Field->isAnonymousStructOrUnion())
14100 ExprChanged =
true;
14103 D.getFieldName(), D.getDotLoc(), D.getFieldLoc()));
14107 if (D.isArrayDesignator()) {
14108 ExprResult Index = getDerived().TransformExpr(E->getArrayIndex(D));
14109 if (Index.isInvalid())
14112 Desig.AddDesignator(
14115 ExprChanged = ExprChanged || Index.get() != E->getArrayIndex(D);
14116 ArrayExprs.push_back(Index.get());
14120 assert(D.isArrayRangeDesignator() &&
"New kind of designator?");
14122 = getDerived().TransformExpr(E->getArrayRangeStart(D));
14123 if (Start.isInvalid())
14126 ExprResult End = getDerived().TransformExpr(E->getArrayRangeEnd(D));
14127 if (End.isInvalid())
14131 Start.get(), End.get(), D.getLBracketLoc(), D.getEllipsisLoc()));
14133 ExprChanged = ExprChanged || Start.get() != E->getArrayRangeStart(D) ||
14134 End.get() != E->getArrayRangeEnd(D);
14136 ArrayExprs.push_back(Start.get());
14137 ArrayExprs.push_back(End.get());
14140 if (!getDerived().AlwaysRebuild() &&
14141 Init.get() == E->getInit() &&
14145 return getDerived().RebuildDesignatedInitExpr(Desig, ArrayExprs,
14146 E->getEqualOrColonLoc(),
14147 E->usesGNUSyntax(),
Init.get());
14152template<
typename Derived>
14156 llvm_unreachable(
"Unexpected DesignatedInitUpdateExpr in syntactic form of "
14161template<
typename Derived>
14165 llvm_unreachable(
"Unexpected NoInitExpr in syntactic form of initializer");
14169template<
typename Derived>
14172 llvm_unreachable(
"Unexpected ArrayInitLoopExpr outside of initializer");
14176template<
typename Derived>
14179 llvm_unreachable(
"Unexpected ArrayInitIndexExpr outside of initializer");
14183template<
typename Derived>
14191 QualType T = getDerived().TransformType(E->getType());
14195 if (!getDerived().AlwaysRebuild() &&
14199 return getDerived().RebuildImplicitValueInitExpr(T);
14202template<
typename Derived>
14205 TypeSourceInfo *TInfo = getDerived().TransformType(E->getWrittenTypeInfo());
14209 ExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
14210 if (SubExpr.isInvalid())
14213 if (!getDerived().AlwaysRebuild() &&
14214 TInfo == E->getWrittenTypeInfo() &&
14215 SubExpr.get() == E->getSubExpr())
14218 return getDerived().RebuildVAArgExpr(E->getBuiltinLoc(), SubExpr.get(),
14219 TInfo, E->getRParenLoc());
14222template<
typename Derived>
14225 bool ArgumentChanged =
false;
14227 if (TransformExprs(E->getExprs(), E->getNumExprs(),
true,
Inits,
14231 return getDerived().RebuildParenListExpr(E->getLParenLoc(),
14233 E->getRParenLoc());
14241template<
typename Derived>
14244 Decl *LD = getDerived().TransformDecl(E->getLabel()->getLocation(),
14249 return getDerived().RebuildAddrLabelExpr(E->getAmpAmpLoc(), E->getLabelLoc(),
14253template<
typename Derived>
14258 = getDerived().TransformCompoundStmt(E->getSubStmt(),
true);
14259 if (SubStmt.isInvalid()) {
14264 unsigned OldDepth = E->getTemplateDepth();
14265 unsigned NewDepth = getDerived().TransformTemplateDepth(OldDepth);
14267 if (!getDerived().AlwaysRebuild() && OldDepth == NewDepth &&
14268 SubStmt.get() == E->getSubStmt()) {
14274 return getDerived().RebuildStmtExpr(E->getLParenLoc(), SubStmt.get(),
14275 E->getRParenLoc(), NewDepth);
14278template<
typename Derived>
14282 if (
Cond.isInvalid())
14285 ExprResult LHS = getDerived().TransformExpr(E->getLHS());
14286 if (LHS.isInvalid())
14289 ExprResult RHS = getDerived().TransformExpr(E->getRHS());
14290 if (RHS.isInvalid())
14293 if (!getDerived().AlwaysRebuild() &&
14294 Cond.get() == E->getCond() &&
14295 LHS.get() == E->getLHS() &&
14296 RHS.get() == E->getRHS())
14299 return getDerived().RebuildChooseExpr(E->getBuiltinLoc(),
14300 Cond.get(), LHS.get(), RHS.get(),
14301 E->getRParenLoc());
14304template<
typename Derived>
14310template<
typename Derived>
14313 switch (E->getOperator()) {
14317 case OO_Array_Delete:
14318 llvm_unreachable(
"new and delete operators cannot use CXXOperatorCallExpr");
14323 assert(E->getNumArgs() >= 1 &&
"Object call is missing arguments");
14336 if (FakeLParenLoc.isInvalid() && EndLoc.isValid())
14337 FakeLParenLoc = EndLoc;
14341 if (getDerived().TransformExprs(E->getArgs() + 1, E->getNumArgs() - 1,
true,
14345 if (E->getOperator() == OO_Subscript)
14346 return getDerived().RebuildCxxSubscriptExpr(
Object.get(), FakeLParenLoc,
14347 Args, E->getEndLoc());
14349 return getDerived().RebuildCallExpr(
Object.get(), FakeLParenLoc, Args,
14353#define OVERLOADED_OPERATOR(Name, Spelling, Token, Unary, Binary, MemberOnly) \
14357#define OVERLOADED_OPERATOR_MULTI(Name,Spelling,Unary,Binary,MemberOnly)
14358#include "clang/Basic/OperatorKinds.def"
14360 case OO_Conditional:
14361 llvm_unreachable(
"conditional operator is not actually overloadable");
14365 llvm_unreachable(
"not an overloaded operator?");
14369 if (E->getNumArgs() == 1 && E->getOperator() == OO_Amp)
14370 First = getDerived().TransformAddressOfOperand(E->getArg(0));
14372 First = getDerived().TransformExpr(E->getArg(0));
14373 if (
First.isInvalid())
14377 if (E->getNumArgs() == 2) {
14379 getDerived().TransformInitializer(E->getArg(1),
false);
14380 if (Second.isInvalid())
14386 getSema().CurFPFeatures =
14387 NewOverrides.applyOverrides(getSema().getLangOpts());
14388 getSema().FpPragmaStack.CurrentValue = NewOverrides;
14394 if (getDerived().TransformOverloadExprDecls(ULE, ULE->requiresADL(), R))
14397 return getDerived().RebuildCXXOperatorCallExpr(
14398 E->getOperator(), E->getOperatorLoc(),
Callee->getBeginLoc(),
14399 ULE->requiresADL(),
R.asUnresolvedSet(),
First.get(), Second.get());
14404 Callee = ICE->getSubExprAsWritten();
14406 ValueDecl *VD = cast_or_null<ValueDecl>(
14407 getDerived().TransformDecl(DR->getLocation(), DR));
14412 Functions.addDecl(VD);
14414 return getDerived().RebuildCXXOperatorCallExpr(
14415 E->getOperator(), E->getOperatorLoc(),
Callee->getBeginLoc(),
14416 false, Functions,
First.get(), Second.get());
14419template<
typename Derived>
14422 return getDerived().TransformCallExpr(E);
14425template <
typename Derived>
14428 getSema().CurContext != E->getParentContext();
14430 if (!getDerived().AlwaysRebuild() && !NeedRebuildFunc)
14433 return getDerived().RebuildSourceLocExpr(E->getIdentKind(), E->getType(),
14434 E->getBeginLoc(), E->getEndLoc(),
14435 getSema().CurContext);
14438template <
typename Derived>
14443template<
typename Derived>
14452 ExprResult EC = getDerived().TransformCallExpr(E->getConfig());
14453 if (EC.isInvalid())
14457 bool ArgChanged =
false;
14459 if (getDerived().TransformExprs(E->getArgs(), E->getNumArgs(),
true, Args,
14463 if (!getDerived().AlwaysRebuild() &&
14464 Callee.get() == E->getCallee() &&
14470 = ((
Expr *)
Callee.get())->getSourceRange().getBegin();
14471 return getDerived().RebuildCallExpr(
Callee.get(), FakeLParenLoc,
14473 E->getRParenLoc(), EC.get());
14476template<
typename Derived>
14492 return getDerived().RebuildCXXNamedCastExpr(
14499template<
typename Derived>
14508 if (Sub.isInvalid())
14511 return getDerived().RebuildBuiltinBitCastExpr(BCE->
getBeginLoc(), TSI,
14515template<
typename Derived>
14517TreeTransform<Derived>::TransformCXXStaticCastExpr(CXXStaticCastExpr *E) {
14518 return getDerived().TransformCXXNamedCastExpr(E);
14521template<
typename Derived>
14527template<
typename Derived>
14534template<
typename Derived>
14540template<
typename Derived>
14546template<
typename Derived>
14551 getDerived().TransformTypeWithDeducedTST(E->getTypeInfoAsWritten());
14556 = getDerived().TransformExpr(E->getSubExprAsWritten());
14557 if (SubExpr.isInvalid())
14560 if (!getDerived().AlwaysRebuild() &&
14561 Type == E->getTypeInfoAsWritten() &&
14562 SubExpr.get() == E->getSubExpr())
14565 return getDerived().RebuildCXXFunctionalCastExpr(
Type,
14569 E->isListInitialization());
14572template<
typename Derived>
14575 if (E->isTypeOperand()) {
14577 = getDerived().TransformType(E->getTypeOperandSourceInfo());
14581 if (!getDerived().AlwaysRebuild() &&
14582 TInfo == E->getTypeOperandSourceInfo())
14585 return getDerived().RebuildCXXTypeidExpr(E->getType(), E->getBeginLoc(),
14586 TInfo, E->getEndLoc());
14592 Expr *Op = E->getExprOperand();
14594 if (E->isGLValue()) {
14596 if (
auto *RD = OpType->getAsCXXRecordDecl()) {
14598 diag::err_incomplete_typeid))
14601 if (RD->isPolymorphic())
14609 ExprResult SubExpr = getDerived().TransformExpr(Op);
14610 if (SubExpr.isInvalid())
14613 if (!getDerived().AlwaysRebuild() &&
14614 SubExpr.get() == E->getExprOperand())
14617 return getDerived().RebuildCXXTypeidExpr(E->getType(), E->getBeginLoc(),
14618 SubExpr.get(), E->getEndLoc());
14621template<
typename Derived>
14624 if (E->isTypeOperand()) {
14626 = getDerived().TransformType(E->getTypeOperandSourceInfo());
14630 if (!getDerived().AlwaysRebuild() &&
14631 TInfo == E->getTypeOperandSourceInfo())
14634 return getDerived().RebuildCXXUuidofExpr(E->getType(), E->getBeginLoc(),
14635 TInfo, E->getEndLoc());
14641 ExprResult SubExpr = getDerived().TransformExpr(E->getExprOperand());
14642 if (SubExpr.isInvalid())
14645 if (!getDerived().AlwaysRebuild() &&
14646 SubExpr.get() == E->getExprOperand())
14649 return getDerived().RebuildCXXUuidofExpr(E->getType(), E->getBeginLoc(),
14650 SubExpr.get(), E->getEndLoc());
14653template<
typename Derived>
14659template<
typename Derived>
14666template<
typename Derived>
14682 auto &S = getSema();
14683 if (E->isCapturedByCopyInLambdaWithExplicitObjectParameter())
14684 return S.getCurrentThisType();
14685 if (S.getCurLambda())
14686 return getDerived().TransformType(E->getType());
14687 return S.getCurrentThisType();
14690 if (!getDerived().AlwaysRebuild() && T == E->getType() &&
14691 !E->isCapturedByCopyInLambdaWithExplicitObjectParameter()) {
14694 getSema().MarkThisReferenced(E);
14698 return getDerived().RebuildCXXThisExpr(E->getBeginLoc(), T, E->isImplicit());
14701template<
typename Derived>
14704 ExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
14705 if (SubExpr.isInvalid())
14708 getSema().DiagnoseExceptionUse(E->getThrowLoc(),
false);
14710 if (!getDerived().AlwaysRebuild() &&
14711 SubExpr.get() == E->getSubExpr())
14714 return getDerived().RebuildCXXThrowExpr(E->getThrowLoc(), SubExpr.get(),
14715 E->isThrownVariableInScope());
14718template<
typename Derived>
14722 getDerived().TransformDecl(E->getBeginLoc(), E->getParam()));
14727 if (E->hasRewrittenInit()) {
14728 InitRes = getDerived().TransformExpr(E->getRewrittenExpr());
14729 if (InitRes.isInvalid())
14733 if (!getDerived().AlwaysRebuild() && Param == E->getParam() &&
14734 E->getUsedContext() == SemaRef.
CurContext &&
14735 InitRes.get() == E->getRewrittenExpr())
14738 return getDerived().RebuildCXXDefaultArgExpr(E->getUsedLocation(), Param,
14742template<
typename Derived>
14746 getDerived().TransformDecl(E->getBeginLoc(), E->getField()));
14750 if (!getDerived().AlwaysRebuild() && Field == E->getField() &&
14754 return getDerived().RebuildCXXDefaultInitExpr(E->getExprLoc(), Field);
14757template<
typename Derived>
14761 TypeSourceInfo *T = getDerived().TransformType(E->getTypeSourceInfo());
14765 if (!getDerived().AlwaysRebuild() &&
14766 T == E->getTypeSourceInfo())
14769 return getDerived().RebuildCXXScalarValueInitExpr(T,
14770 T->getTypeLoc().getEndLoc(),
14771 E->getRParenLoc());
14774template<
typename Derived>
14779 getDerived().TransformTypeWithDeducedTST(E->getAllocatedTypeSourceInfo());
14780 if (!AllocTypeInfo)
14784 std::optional<Expr *> ArraySize;
14785 if (E->isArray()) {
14787 if (std::optional<Expr *> OldArraySize = E->getArraySize()) {
14788 NewArraySize = getDerived().TransformExpr(*OldArraySize);
14789 if (NewArraySize.isInvalid())
14792 ArraySize = NewArraySize.get();
14796 bool ArgumentChanged =
false;
14798 if (getDerived().TransformExprs(E->getPlacementArgs(),
14799 E->getNumPlacementArgs(),
true,
14800 PlacementArgs, &ArgumentChanged))
14804 Expr *OldInit = E->getInitializer();
14807 NewInit = getDerived().TransformInitializer(OldInit,
true);
14808 if (NewInit.isInvalid())
14813 if (E->getOperatorNew()) {
14814 OperatorNew = cast_or_null<FunctionDecl>(
14815 getDerived().TransformDecl(E->getBeginLoc(), E->getOperatorNew()));
14821 if (E->getOperatorDelete()) {
14822 OperatorDelete = cast_or_null<FunctionDecl>(
14823 getDerived().TransformDecl(E->getBeginLoc(), E->getOperatorDelete()));
14824 if (!OperatorDelete)
14828 if (!getDerived().AlwaysRebuild() &&
14829 AllocTypeInfo == E->getAllocatedTypeSourceInfo() &&
14830 ArraySize == E->getArraySize() &&
14831 NewInit.get() == OldInit &&
14832 OperatorNew == E->getOperatorNew() &&
14833 OperatorDelete == E->getOperatorDelete() &&
14834 !ArgumentChanged) {
14839 if (OperatorDelete)
14842 if (E->isArray() && !E->getAllocatedType()->isDependentType()) {
14854 QualType AllocType = AllocTypeInfo->getType();
14865 = dyn_cast<ConstantArrayType>(ArrayT)) {
14869 AllocType = ConsArrayT->getElementType();
14871 = dyn_cast<DependentSizedArrayType>(ArrayT)) {
14872 if (DepArrayT->getSizeExpr()) {
14873 ArraySize = DepArrayT->getSizeExpr();
14874 AllocType = DepArrayT->getElementType();
14879 return getDerived().RebuildCXXNewExpr(
14880 E->getBeginLoc(), E->isGlobalNew(),
14881 E->getBeginLoc(), PlacementArgs,
14882 E->getBeginLoc(), E->getTypeIdParens(), AllocType,
14883 AllocTypeInfo, ArraySize, E->getDirectInitRange(), NewInit.get());
14886template<
typename Derived>
14895 if (E->getOperatorDelete()) {
14896 OperatorDelete = cast_or_null<FunctionDecl>(
14897 getDerived().TransformDecl(E->getBeginLoc(), E->getOperatorDelete()));
14898 if (!OperatorDelete)
14902 if (!getDerived().AlwaysRebuild() &&
14903 Operand.get() == E->getArgument() &&
14904 OperatorDelete == E->getOperatorDelete()) {
14907 if (OperatorDelete)
14910 if (!E->getArgument()->isTypeDependent()) {
14912 E->getDestroyedType());
14913 if (
auto *
Record = Destroyed->getAsCXXRecordDecl())
14921 return getDerived().RebuildCXXDeleteExpr(
14922 E->getBeginLoc(), E->isGlobalDelete(), E->isArrayForm(),
Operand.get());
14925template<
typename Derived>
14930 if (
Base.isInvalid())
14934 bool MayBePseudoDestructor =
false;
14936 E->getOperatorLoc(),
14937 E->isArrow()? tok::arrow : tok::period,
14939 MayBePseudoDestructor);
14940 if (
Base.isInvalid())
14943 QualType ObjectType = ObjectTypePtr.get();
14945 if (QualifierLoc) {
14947 = getDerived().TransformNestedNameSpecifierLoc(QualifierLoc, ObjectType);
14952 SS.
Adopt(QualifierLoc);
14955 if (E->getDestroyedTypeInfo()) {
14956 TypeSourceInfo *DestroyedTypeInfo = getDerived().TransformTypeInObjectScope(
14957 E->getDestroyedTypeInfo(), ObjectType,
14959 if (!DestroyedTypeInfo)
14961 Destroyed = DestroyedTypeInfo;
14962 }
else if (!ObjectType.isNull() && ObjectType->isDependentType()) {
14966 E->getDestroyedTypeLoc());
14970 *E->getDestroyedTypeIdentifier(), E->getDestroyedTypeLoc(),
14971 nullptr, SS, ObjectTypePtr,
false);
14977 E->getDestroyedTypeLoc());
14981 if (E->getScopeTypeInfo()) {
14982 ScopeTypeInfo = getDerived().TransformTypeInObjectScope(
14983 E->getScopeTypeInfo(), ObjectType,
nullptr);
14984 if (!ScopeTypeInfo)
14988 return getDerived().RebuildCXXPseudoDestructorExpr(
Base.get(),
14989 E->getOperatorLoc(),
14993 E->getColonColonLoc(),
14998template <
typename Derived>
15003 bool AllEmptyPacks =
true;
15004 for (
auto *OldD : Old->
decls()) {
15020 if (
auto *UPD = dyn_cast<UsingPackDecl>(InstD))
15021 Decls = UPD->expansions();
15024 for (
auto *D : Decls) {
15025 if (
auto *UD = dyn_cast<UsingDecl>(D)) {
15026 for (
auto *SD : UD->shadows())
15033 AllEmptyPacks &= Decls.empty();
15042 if (AllEmptyPacks && !RequiresADL) {
15053 NamedDecl *FoundDecl = R.getRepresentativeDecl()->getUnderlyingDecl();
15054 getSema().FilterAcceptableTemplateNames(R,
15060 getSema().Diag(R.getNameLoc(),
15061 diag::err_template_kw_refers_to_non_template)
15065 diag::note_template_kw_refers_to_non_template)
15066 << R.getLookupName();
15074template <
typename Derived>
15080template <
typename Derived>
15083 bool IsAddressOfOperand) {
15088 if (TransformOverloadExprDecls(Old, Old->
requiresADL(), R))
15095 = getDerived().TransformNestedNameSpecifierLoc(Old->
getQualifierLoc());
15099 SS.
Adopt(QualifierLoc);
15103 CXXRecordDecl *NamingClass
15104 = cast_or_null<CXXRecordDecl>(getDerived().TransformDecl(
15107 if (!NamingClass) {
15112 R.setNamingClass(NamingClass);
15133 SS, TemplateKWLoc, R,
15140 return getDerived().RebuildDeclarationNameExpr(SS, R, Old->
requiresADL());
15143 return getDerived().RebuildTemplateIdExpr(SS, TemplateKWLoc, R,
15147template<
typename Derived>
15150 bool ArgChanged =
false;
15152 for (
unsigned I = 0, N = E->getNumArgs(); I != N; ++I) {
15154 TypeLoc FromTL = From->getTypeLoc();
15157 TLB.
reserve(FromTL.getFullDataSize());
15158 QualType To = getDerived().TransformType(TLB, FromTL);
15162 if (To == From->getType())
15163 Args.push_back(From);
15165 Args.push_back(TLB.getTypeSourceInfo(SemaRef.
Context, To));
15175 TypeLoc PatternTL = ExpansionTL.getPatternLoc();
15181 bool Expand =
true;
15182 bool RetainExpansion =
false;
15184 ExpansionTL.getTypePtr()->getNumExpansions();
15186 if (getDerived().TryExpandParameterPacks(
15187 ExpansionTL.getEllipsisLoc(), PatternTL.getSourceRange(),
15188 Unexpanded,
true, Expand,
15189 RetainExpansion, NumExpansions))
15199 TLB.
reserve(From->getTypeLoc().getFullDataSize());
15201 QualType To = getDerived().TransformType(TLB, PatternTL);
15205 To = getDerived().RebuildPackExpansionType(To,
15206 PatternTL.getSourceRange(),
15207 ExpansionTL.getEllipsisLoc(),
15215 Args.push_back(TLB.getTypeSourceInfo(SemaRef.
Context, To));
15221 for (
unsigned I = 0; I != *NumExpansions; ++I) {
15224 TLB.
reserve(PatternTL.getFullDataSize());
15225 QualType To = getDerived().TransformType(TLB, PatternTL);
15229 if (To->containsUnexpandedParameterPack()) {
15230 To = getDerived().RebuildPackExpansionType(To,
15231 PatternTL.getSourceRange(),
15232 ExpansionTL.getEllipsisLoc(),
15242 Args.push_back(TLB.getTypeSourceInfo(SemaRef.
Context, To));
15245 if (!RetainExpansion)
15250 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
15253 TLB.
reserve(From->getTypeLoc().getFullDataSize());
15255 QualType To = getDerived().TransformType(TLB, PatternTL);
15259 To = getDerived().RebuildPackExpansionType(To,
15260 PatternTL.getSourceRange(),
15261 ExpansionTL.getEllipsisLoc(),
15269 Args.push_back(TLB.getTypeSourceInfo(SemaRef.
Context, To));
15272 if (!getDerived().AlwaysRebuild() && !ArgChanged)
15275 return getDerived().RebuildTypeTrait(E->getTrait(), E->getBeginLoc(), Args,
15279template<
typename Derived>
15285 if (getDerived().TransformTemplateArguments(Old->getTemplateArgs(),
15286 Old->NumTemplateArgs, TransArgs))
15289 return getDerived().RebuildConceptSpecializationExpr(
15290 E->getNestedNameSpecifierLoc(), E->getTemplateKWLoc(),
15291 E->getConceptNameInfo(), E->getFoundDecl(), E->getNamedConcept(),
15295template<
typename Derived>
15309 getSema().Context, getSema().CurContext,
15310 E->getBody()->getBeginLoc());
15314 ExprResult TypeParamResult = getDerived().TransformRequiresTypeParams(
15315 E->getRequiresKWLoc(), E->getRBraceLoc(), E, Body,
15316 E->getLocalParameters(), TransParamTypes, TransParams, ExtParamInfos);
15320 Param->setDeclContext(Body);
15326 if (!TypeParamResult.isUnset())
15327 return TypeParamResult;
15330 if (getDerived().TransformRequiresExprRequirements(E->getRequirements(),
15335 if (
auto *ER = dyn_cast<concepts::ExprRequirement>(Req)) {
15336 if (ER->getReturnTypeRequirement().isTypeConstraint()) {
15337 ER->getReturnTypeRequirement()
15338 .getTypeConstraintTemplateParameterList()->getParam(0)
15339 ->setDeclContext(Body);
15344 return getDerived().RebuildRequiresExpr(
15345 E->getRequiresKWLoc(), Body, E->getLParenLoc(), TransParams,
15346 E->getRParenLoc(), TransReqs, E->getRBraceLoc());
15349template<
typename Derived>
15355 if (
auto *TypeReq = dyn_cast<concepts::TypeRequirement>(Req))
15356 TransReq =
getDerived().TransformTypeRequirement(TypeReq);
15357 else if (
auto *ExprReq = dyn_cast<concepts::ExprRequirement>(Req))
15358 TransReq =
getDerived().TransformExprRequirement(ExprReq);
15360 TransReq =
getDerived().TransformNestedRequirement(
15364 Transformed.push_back(TransReq);
15369template<
typename Derived>
15382 return getDerived().RebuildTypeRequirement(TransType);
15385template<
typename Derived>
15388 llvm::PointerUnion<Expr *, concepts::Requirement::SubstitutionDiagnostic *> TransExpr;
15394 TransExprRes =
SemaRef.CheckPlaceholderExpr(TransExprRes.
get());
15397 TransExpr = TransExprRes.
get();
15400 std::optional<concepts::ExprRequirement::ReturnTypeRequirement> TransRetReq;
15402 if (RetReq.isEmpty())
15403 TransRetReq.emplace();
15404 else if (RetReq.isSubstitutionFailure())
15405 TransRetReq.emplace(RetReq.getSubstitutionDiagnostic());
15406 else if (RetReq.isTypeConstraint()) {
15408 RetReq.getTypeConstraintTemplateParameterList();
15410 getDerived().TransformTemplateParameterList(OrigTPL);
15413 TransRetReq.emplace(TPL);
15415 assert(TransRetReq &&
"All code paths leading here must set TransRetReq");
15416 if (
Expr *E = dyn_cast<Expr *>(TransExpr))
15419 std::move(*TransRetReq));
15425template<
typename Derived>
15431 return getDerived().RebuildNestedRequirement(
15439 return getDerived().RebuildNestedRequirement(TransConstraint.
get());
15442template<
typename Derived>
15449 if (!getDerived().AlwaysRebuild() &&
15466template<
typename Derived>
15473 SubExpr = getDerived().TransformExpr(E->getQueriedExpression());
15474 if (SubExpr.isInvalid())
15477 if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getQueriedExpression())
15481 return getDerived().RebuildExpressionTrait(E->getTrait(), E->getBeginLoc(),
15482 SubExpr.get(), E->getEndLoc());
15485template <
typename Derived>
15490 DRE, AddrTaken, RecoveryTSI);
15503template <
typename Derived>
15510template <
typename Derived>
15526 getDerived().TransformDeclarationNameInfo(E->
getNameInfo());
15531 if (!getDerived().AlwaysRebuild() && QualifierLoc == E->
getQualifierLoc() &&
15537 return getDerived().RebuildDependentScopeDeclRefExpr(
15538 QualifierLoc, TemplateKWLoc, NameInfo,
nullptr,
15539 IsAddressOfOperand, RecoveryTSI);
15543 if (getDerived().TransformTemplateArguments(
15547 return getDerived().RebuildDependentScopeDeclRefExpr(
15548 QualifierLoc, TemplateKWLoc, NameInfo, &TransArgs, IsAddressOfOperand,
15552template<
typename Derived>
15558 if (getDerived().AllowSkippingCXXConstructExpr() &&
15559 ((E->getNumArgs() == 1 ||
15560 (E->getNumArgs() > 1 && getDerived().DropCallArgument(E->getArg(1)))) &&
15561 (!getDerived().DropCallArgument(E->getArg(0))) &&
15562 !E->isListInitialization()))
15568 QualType T = getDerived().TransformType(E->getType());
15573 getDerived().TransformDecl(E->getBeginLoc(), E->getConstructor()));
15577 bool ArgumentChanged =
false;
15582 E->isListInitialization());
15583 if (getDerived().TransformExprs(E->getArgs(), E->getNumArgs(),
true, Args,
15588 if (!getDerived().AlwaysRebuild() &&
15589 T == E->getType() &&
15591 !ArgumentChanged) {
15598 return getDerived().RebuildCXXConstructExpr(
15599 T, E->getBeginLoc(),
Constructor, E->isElidable(), Args,
15600 E->hadMultipleCandidates(), E->isListInitialization(),
15601 E->isStdInitListInitialization(), E->requiresZeroInitialization(),
15602 E->getConstructionKind(), E->getParenOrBraceRange());
15605template<
typename Derived>
15608 QualType T = getDerived().TransformType(E->getType());
15613 getDerived().TransformDecl(E->getBeginLoc(), E->getConstructor()));
15617 if (!getDerived().AlwaysRebuild() &&
15618 T == E->getType() &&
15626 return getDerived().RebuildCXXInheritedCtorInitExpr(
15628 E->constructsVBase(), E->inheritedFromVBase());
15635template<
typename Derived>
15638 if (
auto *Dtor = E->getTemporary()->getDestructor())
15641 return getDerived().TransformExpr(E->getSubExpr());
15649template<
typename Derived>
15655template<
typename Derived>
15660 getDerived().TransformTypeWithDeducedTST(E->getTypeSourceInfo());
15665 getDerived().TransformDecl(E->getBeginLoc(), E->getConstructor()));
15669 bool ArgumentChanged =
false;
15671 Args.reserve(E->getNumArgs());
15675 E->isListInitialization());
15676 if (TransformExprs(E->getArgs(), E->getNumArgs(),
true, Args,
15680 if (E->isListInitialization() && !E->isStdInitListInitialization()) {
15681 ExprResult Res = RebuildInitList(E->getBeginLoc(), Args, E->getEndLoc());
15682 if (Res.isInvalid())
15684 Args = {Res.get()};
15688 if (!getDerived().AlwaysRebuild() &&
15689 T == E->getTypeSourceInfo() &&
15691 !ArgumentChanged) {
15698 return getDerived().RebuildCXXTemporaryObjectExpr(
15699 T, LParenLoc, Args, E->getEndLoc(), E->isListInitialization());
15702template<
typename Derived>
15707 typedef std::pair<ExprResult, QualType> InitCaptureInfoTy;
15708 struct TransformedInitCapture {
15710 SourceLocation EllipsisLoc;
15712 SmallVector<InitCaptureInfoTy, 4> Expansions;
15715 InitCaptures.resize(E->explicit_capture_end() - E->explicit_capture_begin());
15717 CEnd = E->capture_end();
15719 if (!E->isInitCapture(
C))
15722 TransformedInitCapture &
Result = InitCaptures[
C - E->capture_begin()];
15727 ExprResult NewExprInitResult = getDerived().TransformInitializer(
15730 if (NewExprInitResult.isInvalid()) {
15734 Expr *NewExprInit = NewExprInitResult.get();
15737 getSema().buildLambdaInitCaptureInitialization(
15738 C->getLocation(),
C->getCaptureKind() ==
LCK_ByRef,
15739 EllipsisLoc, NumExpansions, OldVD->getIdentifier(),
15743 Result.Expansions.push_back(
15744 InitCaptureInfoTy(NewExprInit, NewInitCaptureType));
15748 if (OldVD->isParameterPack()) {
15757 bool Expand =
true;
15758 bool RetainExpansion =
false;
15760 ExpansionTL.getTypePtr()->getNumExpansions();
15762 if (getDerived().TryExpandParameterPacks(
15763 ExpansionTL.getEllipsisLoc(), OldVD->getInit()->getSourceRange(),
15764 Unexpanded,
true, Expand,
15765 RetainExpansion, NumExpansions))
15767 assert(!RetainExpansion &&
"Should not need to retain expansion after a "
15768 "capture since it cannot be extended");
15770 for (
unsigned I = 0; I != *NumExpansions; ++I) {
15775 SubstInitCapture(ExpansionTL.getEllipsisLoc(), NumExpansions);
15776 Result.EllipsisLoc = ExpansionTL.getEllipsisLoc();
15813 while (DC->isRequiresExprBody())
15815 if ((getSema().isUnevaluatedContext() ||
15816 getSema().isConstantEvaluatedContext()) &&
15817 !(dyn_cast_or_null<CXXRecordDecl>(DC->getParent()) &&
15819 (DC->isFileContext() || !DC->getParent()->isDependentContext()))
15824 E->getIntroducerRange(),
nullptr, DependencyKind,
15825 E->getCaptureDefault());
15826 getDerived().transformedLocalDecl(OldClass, {
Class});
15829 getSema().CreateLambdaCallOperator(E->getIntroducerRange(),
Class);
15832 getSema().buildLambdaScope(LSI, NewCallOperator, E->getIntroducerRange(),
15833 E->getCaptureDefault(), E->getCaptureDefaultLoc(),
15834 E->hasExplicitParameters(), E->isMutable());
15844 CEnd = E->capture_end();
15848 if (
C->isImplicit())
15852 if (
C->capturesThis()) {
15860 dyn_cast_if_present<CXXRecordDecl>(
15861 getSema().getFunctionLevelDeclContext()),
15863 getSema().CheckCXXThisCapture(
C->getLocation(),
C->isExplicit(),
15870 if (
C->capturesVLAType())
15874 if (E->isInitCapture(
C)) {
15875 TransformedInitCapture &NewC = InitCaptures[
C - E->capture_begin()];
15880 for (InitCaptureInfoTy &Info : NewC.Expansions) {
15882 QualType InitQualType = Info.second;
15883 if (
Init.isInvalid() || InitQualType.isNull()) {
15887 VarDecl *NewVD = getSema().createLambdaInitCaptureVarDecl(
15888 OldVD->getLocation(), InitQualType, NewC.EllipsisLoc,
15889 OldVD->getIdentifier(), OldVD->getInitStyle(),
Init.get(),
15890 getSema().CurContext);
15895 NewVDs.push_back(NewVD);
15896 getSema().addInitCapture(LSI, NewVD,
C->getCaptureKind() ==
LCK_ByRef);
15901 if (NewC.EllipsisLoc.isInvalid())
15902 LSI->ContainsUnexpandedParameterPack |=
15903 Init.get()->containsUnexpandedParameterPack();
15909 getDerived().transformedLocalDecl(OldVD, NewVDs);
15913 assert(
C->capturesVariable() &&
"unexpected kind of lambda capture");
15921 if (
C->isPackExpansion()) {
15923 bool ShouldExpand =
false;
15924 bool RetainExpansion =
false;
15926 if (getDerived().TryExpandParameterPacks(
15927 C->getEllipsisLoc(),
C->getLocation(), Unexpanded,
15928 true, ShouldExpand,
15929 RetainExpansion, NumExpansions)) {
15934 if (ShouldExpand) {
15939 for (
unsigned I = 0; I != *NumExpansions; ++I) {
15941 ValueDecl *CapturedVar = cast_if_present<ValueDecl>(
15942 getDerived().TransformDecl(
C->getLocation(), Pack));
15943 if (!CapturedVar) {
15949 getSema().tryCaptureVariable(CapturedVar,
C->getLocation(), Kind);
15957 EllipsisLoc =
C->getEllipsisLoc();
15961 auto *CapturedVar = cast_or_null<ValueDecl>(
15962 getDerived().TransformDecl(
C->getLocation(),
C->getCapturedVar()));
15963 if (!CapturedVar || CapturedVar->isInvalidDecl()) {
15970 if (
auto *VD = dyn_cast<VarDecl>(CapturedVar); VD && !
C->isPackExpansion())
15971 LSI->ContainsUnexpandedParameterPack |= VD->isParameterPack();
15974 getSema().tryCaptureVariable(CapturedVar,
C->getLocation(), Kind,
15977 getSema().finishLambdaExplicitCaptures(LSI);
15981 auto TPL = getDerived().TransformTemplateParameterList(
15982 E->getTemplateParameterList());
15983 LSI->GLTemplateParameterList = TPL;
15985 getSema().AddTemplateParametersToLambdaCallOperator(NewCallOperator,
Class,
15987 LSI->ContainsUnexpandedParameterPack |=
15988 TPL->containsUnexpandedParameterPack();
15993 E->getCallOperator()->getTypeSourceInfo()->getTypeLoc();
15995 getDerived().TransformType(NewCallOpTLBuilder, OldCallOpTypeLoc);
15996 if (NewCallOpType.isNull())
15998 LSI->ContainsUnexpandedParameterPack |=
15999 NewCallOpType->containsUnexpandedParameterPack();
16001 NewCallOpTLBuilder.getTypeSourceInfo(getSema().Context, NewCallOpType);
16006 assert(FPTL &&
"Not a FunctionProtoType?");
16009 if (!TRC.ArgPackSubstIndex)
16012 getSema().CompleteLambdaCallOperator(
16013 NewCallOperator, E->getCallOperator()->getLocation(),
16014 E->getCallOperator()->getInnerLocStart(), TRC, NewCallOpTSI,
16015 E->getCallOperator()->getConstexprKind(),
16016 E->getCallOperator()->getStorageClass(), FPTL.getParams(),
16017 E->hasExplicitResultType());
16019 getDerived().transformAttrs(E->getCallOperator(), NewCallOperator);
16020 getDerived().transformedLocalDecl(E->getCallOperator(), {NewCallOperator});
16026 std::optional<CXXRecordDecl::LambdaNumbering> Numbering;
16027 if (getDerived().ReplacingOriginal()) {
16028 Numbering = OldClass->getLambdaNumbering();
16031 getSema().handleLambdaNumbering(
Class, NewCallOperator, Numbering);
16036 getSema().PushExpressionEvaluationContextForFunction(
16038 E->getCallOperator());
16045 C.PointOfInstantiation = E->getBody()->getBeginLoc();
16046 getSema().pushCodeSynthesisContext(
C);
16050 : getDerived().TransformLambdaBody(E, E->getBody());
16052 getSema().popCodeSynthesisContext();
16056 FuncScopeCleanup.disable();
16058 if (Body.isInvalid()) {
16059 SavedContext.pop();
16060 getSema().ActOnLambdaError(E->getBeginLoc(),
nullptr,
16065 getSema().ActOnFinishFunctionBody(NewCallOperator, Body.get(),
16068 SavedContext.pop();
16103 DependencyKind = getDerived().ComputeLambdaDependency(LSI);
16104 Class->setLambdaDependencyKind(DependencyKind);
16106 return getDerived().RebuildLambdaExpr(E->getBeginLoc(),
16107 Body.get()->getEndLoc(), LSI);
16110template<
typename Derived>
16116template<
typename Derived>
16125 if (!
C->isImplicit())
16129 if (
C->capturesThis()) {
16130 getSema().CheckCXXThisCapture(
C->getLocation(),
C->isExplicit(),
16137 if (
C->capturesVLAType())
16140 assert(
C->capturesVariable() &&
"unexpected kind of lambda capture");
16144 VarDecl *CapturedVar = cast_or_null<VarDecl>(
16150 getSema().tryCaptureVariable(CapturedVar,
C->getLocation());
16156template<
typename Derived>
16165 bool ArgumentChanged =
false;
16177 if (!getDerived().AlwaysRebuild() &&
16183 return getDerived().RebuildCXXUnresolvedConstructExpr(
16187template<
typename Derived>
16196 if (!E->isImplicitAccess()) {
16197 OldBase = E->getBase();
16198 Base = getDerived().TransformExpr(OldBase);
16199 if (
Base.isInvalid())
16204 bool MayBePseudoDestructor =
false;
16206 E->getOperatorLoc(),
16207 E->isArrow()? tok::arrow : tok::period,
16209 MayBePseudoDestructor);
16210 if (
Base.isInvalid())
16213 ObjectType = ObjectTy.get();
16214 BaseType = ((
Expr*)
Base.get())->getType();
16217 BaseType = getDerived().TransformType(E->getBaseType());
16224 = getDerived().TransformFirstQualifierInScope(
16225 E->getFirstQualifierFoundInScope(),
16226 E->getQualifierLoc().getBeginLoc());
16229 if (E->getQualifier()) {
16231 = getDerived().TransformNestedNameSpecifierLoc(E->getQualifierLoc(),
16233 FirstQualifierInScope);
16245 = getDerived().TransformDeclarationNameInfo(E->getMemberNameInfo());
16246 if (!NameInfo.getName())
16249 if (!E->hasExplicitTemplateArgs()) {
16252 if (!getDerived().AlwaysRebuild() &&
16253 Base.get() == OldBase &&
16254 BaseType == E->getBaseType() &&
16255 QualifierLoc == E->getQualifierLoc() &&
16256 NameInfo.getName() == E->getMember() &&
16257 FirstQualifierInScope == E->getFirstQualifierFoundInScope())
16260 return getDerived().RebuildCXXDependentScopeMemberExpr(
Base.get(),
16263 E->getOperatorLoc(),
16266 FirstQualifierInScope,
16272 if (getDerived().TransformTemplateArguments(E->getTemplateArgs(),
16273 E->getNumTemplateArgs(),
16277 return getDerived().RebuildCXXDependentScopeMemberExpr(
Base.get(),
16280 E->getOperatorLoc(),
16283 FirstQualifierInScope,
16288template <
typename Derived>
16294 if (!Old->isImplicitAccess()) {
16295 Base = getDerived().TransformExpr(Old->getBase());
16296 if (
Base.isInvalid())
16299 getSema().PerformMemberExprBaseConversion(
Base.get(), Old->isArrow());
16300 if (
Base.isInvalid())
16302 BaseType =
Base.get()->getType();
16304 BaseType = getDerived().TransformType(Old->getBaseType());
16308 if (Old->getQualifierLoc()) {
16310 getDerived().TransformNestedNameSpecifierLoc(Old->getQualifierLoc());
16320 if (TransformOverloadExprDecls(Old,
false, R))
16324 if (Old->getNamingClass()) {
16326 getDerived().TransformDecl(Old->getMemberLoc(), Old->getNamingClass()));
16330 R.setNamingClass(NamingClass);
16334 if (Old->hasExplicitTemplateArgs()) {
16335 TransArgs.setLAngleLoc(Old->getLAngleLoc());
16336 TransArgs.setRAngleLoc(Old->getRAngleLoc());
16337 if (getDerived().TransformTemplateArguments(
16338 Old->getTemplateArgs(), Old->getNumTemplateArgs(), TransArgs))
16346 NamedDecl *FirstQualifierInScope =
nullptr;
16348 return getDerived().RebuildUnresolvedMemberExpr(
16349 Base.get(), BaseType, Old->getOperatorLoc(), Old->isArrow(), QualifierLoc,
16350 TemplateKWLoc, FirstQualifierInScope, R,
16351 (Old->hasExplicitTemplateArgs() ? &TransArgs :
nullptr));
16354template<
typename Derived>
16359 ExprResult SubExpr = getDerived().TransformExpr(E->getOperand());
16360 if (SubExpr.isInvalid())
16363 if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getOperand())
16366 return getDerived().RebuildCXXNoexceptExpr(E->getSourceRange(),SubExpr.get());
16369template<
typename Derived>
16372 ExprResult Pattern = getDerived().TransformExpr(E->getPattern());
16373 if (Pattern.isInvalid())
16376 if (!getDerived().AlwaysRebuild() && Pattern.get() == E->getPattern())
16379 return getDerived().RebuildPackExpansion(Pattern.get(), E->getEllipsisLoc(),
16380 E->getNumExpansions());
16383template <
typename Derived>
16388 if (!Arg.isPackExpansion()) {
16400 getSema().getTemplateArgumentPackExpansionPattern(ArgLoc, Ellipsis,
16401 OrigNumExpansions);
16413 if (!NumExpansions) {
16425template<
typename Derived>
16444 bool ShouldExpand =
false;
16445 bool RetainExpansion =
false;
16446 UnsignedOrNone NumExpansions = std::nullopt;
16447 if (getDerived().TryExpandParameterPacks(
16449 true, ShouldExpand,
16450 RetainExpansion, NumExpansions))
16455 if (ShouldExpand) {
16457 if (
auto *TTPD = dyn_cast<TemplateTypeParmDecl>(Pack)) {
16458 ArgStorage = getSema().Context.getPackExpansionType(
16459 getSema().Context.getTypeDeclType(TTPD), std::nullopt);
16460 }
else if (
auto *TTPD = dyn_cast<TemplateTemplateParmDecl>(Pack)) {
16464 ExprResult DRE = getSema().BuildDeclRefExpr(
16465 VD, VD->getType().getNonLValueExprType(getSema().Context),
16468 if (DRE.isInvalid())
16471 new (getSema().Context)
16475 PackArgs = ArgStorage;
16480 if (!PackArgs.size()) {
16481 auto *Pack = cast_or_null<NamedDecl>(
16485 return getDerived().RebuildSizeOfPackExpr(
16492 getDerived().ComputeSizeOfPackExprWithoutSubstitution(PackArgs);
16504 TemporaryBase Rebase(*
this, E->
getPackLoc(), getBaseEntity());
16507 if (TransformTemplateArguments(PackLocIterator(*
this, PackArgs.begin()),
16508 PackLocIterator(*
this, PackArgs.end()),
16509 TransformedPackArgs,
true))
16516 bool PartialSubstitution =
false;
16517 for (
auto &Loc : TransformedPackArgs.arguments()) {
16518 Args.push_back(Loc.getArgument());
16519 if (Loc.getArgument().isPackExpansion())
16520 PartialSubstitution =
true;
16523 if (PartialSubstitution)
16524 return getDerived().RebuildSizeOfPackExpr(
16526 std::nullopt, Args);
16528 return getDerived().RebuildSizeOfPackExpr(
16530 static_cast<unsigned>(Args.size()),
16534template <
typename Derived>
16537 if (!E->isValueDependent())
16545 IndexExpr = getDerived().TransformExpr(E->getIndexExpr());
16546 if (IndexExpr.isInvalid())
16551 bool FullySubstituted =
true;
16552 if (!E->expandsToEmptyPack() && E->getExpressions().empty()) {
16553 Expr *Pattern = E->getPackIdExpression();
16555 getSema().collectUnexpandedParameterPacks(E->getPackIdExpression(),
16557 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
16561 bool ShouldExpand =
true;
16562 bool RetainExpansion =
false;
16564 NumExpansions = std::nullopt;
16565 if (getDerived().TryExpandParameterPacks(
16566 E->getEllipsisLoc(), Pattern->getSourceRange(), Unexpanded,
16567 true, ShouldExpand,
16568 RetainExpansion, NumExpansions))
16570 if (!ShouldExpand) {
16572 ExprResult Pack = getDerived().TransformExpr(Pattern);
16573 if (Pack.isInvalid())
16575 return getDerived().RebuildPackIndexingExpr(
16576 E->getEllipsisLoc(), E->getRSquareLoc(), Pack.get(), IndexExpr.get(),
16579 for (
unsigned I = 0; I != *NumExpansions; ++I) {
16582 if (
Out.isInvalid())
16584 if (
Out.get()->containsUnexpandedParameterPack()) {
16585 Out = getDerived().RebuildPackExpansion(
Out.get(), E->getEllipsisLoc(),
16586 OrigNumExpansions);
16587 if (
Out.isInvalid())
16589 FullySubstituted =
false;
16591 ExpandedExprs.push_back(
Out.get());
16595 if (RetainExpansion) {
16596 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
16599 if (
Out.isInvalid())
16602 Out = getDerived().RebuildPackExpansion(
Out.get(), E->getEllipsisLoc(),
16603 OrigNumExpansions);
16604 if (
Out.isInvalid())
16606 FullySubstituted =
false;
16607 ExpandedExprs.push_back(
Out.get());
16609 }
else if (!E->expandsToEmptyPack()) {
16610 if (getDerived().TransformExprs(E->getExpressions().data(),
16611 E->getExpressions().size(),
false,
16616 return getDerived().RebuildPackIndexingExpr(
16617 E->getEllipsisLoc(), E->getRSquareLoc(), E->getPackIdExpression(),
16618 IndexExpr.get(), ExpandedExprs, FullySubstituted);
16621template <
typename Derived>
16624 if (!getSema().ArgPackSubstIndex)
16630 return getDerived().RebuildSubstNonTypeTemplateParmExpr(
16631 E->getAssociatedDecl(), E->getParameterPack(),
16632 E->getParameterPackLocation(), Arg, SemaRef.
getPackIndex(Pack),
16636template <
typename Derived>
16640 ExprResult Replacement = getDerived().TransformExpr(OrigReplacement);
16641 if (Replacement.isInvalid())
16644 Decl *AssociatedDecl =
16645 getDerived().TransformDecl(E->getNameLoc(), E->getAssociatedDecl());
16646 if (!AssociatedDecl)
16649 if (Replacement.get() == OrigReplacement &&
16650 AssociatedDecl == E->getAssociatedDecl())
16653 auto getParamAndType = [E](
Decl *AssociatedDecl)
16654 -> std::tuple<NonTypeTemplateParmDecl *, QualType> {
16655 auto [PDecl, Arg] =
16659 return {Param, Param->getType()};
16661 Arg = Arg.getPackAsArray()[*PackIndex];
16662 return {Param, Arg.getNonTypeTemplateArgumentType()};
16668 if (
auto [Param, ParamType] = getParamAndType(AssociatedDecl);
16670 ParamType, std::get<1>(getParamAndType(E->getAssociatedDecl()))) ||
16671 Replacement.get() != OrigReplacement) {
16678 Param, ParamType, Replacement.get(), SugaredConverted,
16679 CanonicalConverted,
16681 if (Replacement.isInvalid())
16685 Replacement = E->getReplacement();
16688 return getDerived().RebuildSubstNonTypeTemplateParmExpr(
16689 AssociatedDecl, E->getParameter(), E->getNameLoc(),
16691 E->getPackIndex(), E->getFinal());
16694template<
typename Derived>
16701template<
typename Derived>
16708template<
typename Derived>
16712 if (
Expr *OldCallee = E->getCallee()) {
16713 ExprResult CalleeResult = getDerived().TransformExpr(OldCallee);
16714 if (CalleeResult.isInvalid())
16719 Expr *Pattern = E->getPattern();
16722 getSema().collectUnexpandedParameterPacks(Pattern, Unexpanded);
16723 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
16727 bool Expand =
true;
16728 bool RetainExpansion =
false;
16730 NumExpansions = OrigNumExpansions;
16731 if (getDerived().TryExpandParameterPacks(
16732 E->getEllipsisLoc(), Pattern->getSourceRange(), Unexpanded,
16733 true, Expand, RetainExpansion,
16743 E->getLHS() ? getDerived().TransformExpr(E->getLHS()) :
ExprResult();
16744 if (LHS.isInvalid())
16748 E->getRHS() ? getDerived().TransformExpr(E->getRHS()) :
ExprResult();
16749 if (RHS.isInvalid())
16752 if (!getDerived().AlwaysRebuild() &&
16753 LHS.get() == E->getLHS() && RHS.get() == E->getRHS())
16756 return getDerived().RebuildCXXFoldExpr(
16757 Callee, E->getBeginLoc(), LHS.get(), E->getOperator(),
16758 E->getEllipsisLoc(), RHS.get(), E->getEndLoc(), NumExpansions);
16764 if (NumExpansions && SemaRef.
getLangOpts().BracketDepth < *NumExpansions) {
16765 SemaRef.
Diag(E->getEllipsisLoc(),
16766 clang::diag::err_fold_expression_limit_exceeded)
16767 << *NumExpansions << SemaRef.
getLangOpts().BracketDepth
16768 << E->getSourceRange();
16769 SemaRef.
Diag(E->getEllipsisLoc(), diag::note_bracket_depth);
16778 bool LeftFold = E->isLeftFold();
16782 if (!LeftFold && RetainExpansion) {
16783 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
16786 if (
Out.isInvalid())
16789 Result = getDerived().RebuildCXXFoldExpr(
16790 Callee, E->getBeginLoc(),
Out.get(), E->getOperator(),
16791 E->getEllipsisLoc(),
Result.get(), E->getEndLoc(), OrigNumExpansions);
16796 bool WarnedOnComparison =
false;
16797 for (
unsigned I = 0; I != *NumExpansions; ++I) {
16799 getSema(), LeftFold ? I : *NumExpansions - I - 1);
16801 if (
Out.isInvalid())
16804 if (
Out.get()->containsUnexpandedParameterPack()) {
16806 Result = getDerived().RebuildCXXFoldExpr(
16807 Callee, E->getBeginLoc(), LeftFold ?
Result.get() :
Out.get(),
16808 E->getOperator(), E->getEllipsisLoc(),
16809 LeftFold ?
Out.get() :
Result.get(), E->getEndLoc(),
16810 OrigNumExpansions);
16811 }
else if (
Result.isUsable()) {
16818 Result = getDerived().RebuildCXXOperatorCallExpr(
16820 E->getEllipsisLoc(),
Callee->getBeginLoc(),
Callee->requiresADL(),
16821 Functions, LHS, RHS);
16823 Result = getDerived().RebuildBinaryOperator(E->getEllipsisLoc(),
16824 E->getOperator(), LHS, RHS,
16826 if (!WarnedOnComparison &&
Result.isUsable()) {
16827 if (
auto *BO = dyn_cast<BinaryOperator>(
Result.get());
16828 BO && BO->isComparisonOp()) {
16829 WarnedOnComparison =
true;
16830 SemaRef.
Diag(BO->getBeginLoc(),
16831 diag::warn_comparison_in_fold_expression)
16832 << BO->getOpcodeStr();
16845 if (LeftFold && RetainExpansion) {
16846 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
16849 if (
Out.isInvalid())
16852 Result = getDerived().RebuildCXXFoldExpr(
16853 Callee, E->getBeginLoc(),
Result.get(), E->getOperator(),
16854 E->getEllipsisLoc(),
Out.get(), E->getEndLoc(), OrigNumExpansions);
16860 PE->setIsProducedByFoldExpansion();
16865 return getDerived().RebuildEmptyCXXFoldExpr(E->getEllipsisLoc(),
16870template <
typename Derived>
16876 QualType T = getDerived().TransformType(E->getType());
16878 bool ArgChanged =
false;
16880 if (getDerived().TransformExprs(InitExprs.data(), InitExprs.size(),
true,
16881 TransformedInits, &ArgChanged))
16884 if (!getDerived().AlwaysRebuild() && !ArgChanged && T == E->getType())
16887 return getDerived().RebuildCXXParenListInitExpr(
16888 TransformedInits, T, E->getUserSpecifiedInitExprs().size(),
16889 E->getInitLoc(), E->getBeginLoc(), E->getEndLoc());
16892template<
typename Derived>
16899template<
typename Derived>
16905template<
typename Derived>
16911template<
typename Derived>
16914 ExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
16915 if (SubExpr.isInvalid())
16918 if (!getDerived().AlwaysRebuild() &&
16919 SubExpr.get() == E->getSubExpr())
16922 return getDerived().RebuildObjCBoxedExpr(E->getSourceRange(), SubExpr.get());
16925template<
typename Derived>
16930 bool ArgChanged =
false;
16931 if (getDerived().TransformExprs(E->getElements(), E->getNumElements(),
16932 false, Elements, &ArgChanged))
16935 if (!getDerived().AlwaysRebuild() && !ArgChanged)
16938 return getDerived().RebuildObjCArrayLiteral(E->getSourceRange(),
16943template<
typename Derived>
16949 bool ArgChanged =
false;
16950 for (
unsigned I = 0, N = E->getNumElements(); I != N; ++I) {
16953 if (OrigElement.isPackExpansion()) {
16956 getSema().collectUnexpandedParameterPacks(OrigElement.Key, Unexpanded);
16957 getSema().collectUnexpandedParameterPacks(OrigElement.Value, Unexpanded);
16958 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
16962 bool Expand =
true;
16963 bool RetainExpansion =
false;
16966 SourceRange PatternRange(OrigElement.Key->getBeginLoc(),
16967 OrigElement.Value->getEndLoc());
16968 if (getDerived().TryExpandParameterPacks(
16969 OrigElement.EllipsisLoc, PatternRange, Unexpanded,
16970 true, Expand, RetainExpansion,
16979 ExprResult Key = getDerived().TransformExpr(OrigElement.Key);
16980 if (Key.isInvalid())
16983 if (Key.get() != OrigElement.Key)
16987 if (
Value.isInvalid())
16994 Key.get(),
Value.get(), OrigElement.EllipsisLoc, NumExpansions
16996 Elements.push_back(Expansion);
17006 for (
unsigned I = 0; I != *NumExpansions; ++I) {
17008 ExprResult Key = getDerived().TransformExpr(OrigElement.Key);
17009 if (Key.isInvalid())
17013 if (
Value.isInvalid())
17023 if (Key.get()->containsUnexpandedParameterPack() ||
17024 Value.get()->containsUnexpandedParameterPack())
17025 Element.EllipsisLoc = OrigElement.EllipsisLoc;
17027 Elements.push_back(Element);
17037 ExprResult Key = getDerived().TransformExpr(OrigElement.Key);
17038 if (Key.isInvalid())
17041 if (Key.get() != OrigElement.Key)
17046 = getDerived().TransformExpr(OrigElement.Value);
17047 if (
Value.isInvalid())
17055 Elements.push_back(Element);
17058 if (!getDerived().AlwaysRebuild() && !ArgChanged)
17061 return getDerived().RebuildObjCDictionaryLiteral(E->getSourceRange(),
17065template<
typename Derived>
17069 = getDerived().TransformType(E->getEncodedTypeSourceInfo());
17070 if (!EncodedTypeInfo)
17073 if (!getDerived().AlwaysRebuild() &&
17074 EncodedTypeInfo == E->getEncodedTypeSourceInfo())
17077 return getDerived().RebuildObjCEncodeExpr(E->getAtLoc(),
17079 E->getRParenLoc());
17082template<
typename Derived>
17092template<
typename Derived>
17096 = getDerived().TransformType(E->getTypeInfoAsWritten());
17104 if (!getDerived().AlwaysRebuild() &&
17105 TSInfo == E->getTypeInfoAsWritten() &&
17106 Result.get() == E->getSubExpr())
17110 E->getLParenLoc(), E->getBridgeKind(), E->getBridgeKeywordLoc(), TSInfo,
17114template <
typename Derived>
17120template<
typename Derived>
17124 bool ArgChanged =
false;
17126 Args.reserve(E->getNumArgs());
17127 if (getDerived().TransformExprs(E->getArgs(), E->getNumArgs(),
false, Args,
17134 = getDerived().TransformType(E->getClassReceiverTypeInfo());
17135 if (!ReceiverTypeInfo)
17139 if (!getDerived().AlwaysRebuild() &&
17140 ReceiverTypeInfo == E->getClassReceiverTypeInfo() && !ArgChanged)
17145 E->getSelectorLocs(SelLocs);
17146 return getDerived().RebuildObjCMessageExpr(ReceiverTypeInfo,
17149 E->getMethodDecl(),
17156 if (!E->getMethodDecl())
17161 E->getSelectorLocs(SelLocs);
17162 return getDerived().RebuildObjCMessageExpr(E->getSuperLoc(),
17165 E->getReceiverType(),
17166 E->getMethodDecl(),
17174 "Only class and instance messages may be instantiated");
17176 = getDerived().TransformExpr(E->getInstanceReceiver());
17177 if (Receiver.isInvalid())
17181 if (!getDerived().AlwaysRebuild() &&
17182 Receiver.get() == E->getInstanceReceiver() && !ArgChanged)
17187 E->getSelectorLocs(SelLocs);
17188 return getDerived().RebuildObjCMessageExpr(Receiver.get(),
17191 E->getMethodDecl(),
17197template<
typename Derived>
17203template<
typename Derived>
17209template<
typename Derived>
17214 if (
Base.isInvalid())
17220 if (!getDerived().AlwaysRebuild() &&
17221 Base.get() == E->getBase())
17224 return getDerived().RebuildObjCIvarRefExpr(
Base.get(), E->getDecl(),
17226 E->isArrow(), E->isFreeIvar());
17229template<
typename Derived>
17234 if (!E->isObjectReceiver())
17239 if (
Base.isInvalid())
17245 if (!getDerived().AlwaysRebuild() &&
17246 Base.get() == E->getBase())
17249 if (E->isExplicitProperty())
17250 return getDerived().RebuildObjCPropertyRefExpr(
Base.get(),
17251 E->getExplicitProperty(),
17254 return getDerived().RebuildObjCPropertyRefExpr(
Base.get(),
17256 E->getImplicitPropertyGetter(),
17257 E->getImplicitPropertySetter(),
17261template<
typename Derived>
17266 if (
Base.isInvalid())
17270 ExprResult Key = getDerived().TransformExpr(E->getKeyExpr());
17271 if (Key.isInvalid())
17275 if (!getDerived().AlwaysRebuild() &&
17276 Key.get() == E->getKeyExpr() &&
Base.get() == E->getBaseExpr())
17279 return getDerived().RebuildObjCSubscriptRefExpr(E->getRBracket(),
17280 Base.get(), Key.get(),
17281 E->getAtIndexMethodDecl(),
17282 E->setAtIndexMethodDecl());
17285template<
typename Derived>
17290 if (
Base.isInvalid())
17294 if (!getDerived().AlwaysRebuild() &&
17295 Base.get() == E->getBase())
17298 return getDerived().RebuildObjCIsaExpr(
Base.get(), E->getIsaMemberLoc(),
17303template<
typename Derived>
17306 bool ArgumentChanged =
false;
17308 SubExprs.reserve(E->getNumSubExprs());
17309 if (getDerived().TransformExprs(E->getSubExprs(), E->getNumSubExprs(),
false,
17310 SubExprs, &ArgumentChanged))
17313 if (!getDerived().AlwaysRebuild() &&
17317 return getDerived().RebuildShuffleVectorExpr(E->getBuiltinLoc(),
17319 E->getRParenLoc());
17322template<
typename Derived>
17325 ExprResult SrcExpr = getDerived().TransformExpr(E->getSrcExpr());
17326 if (SrcExpr.isInvalid())
17333 if (!getDerived().AlwaysRebuild() &&
17334 Type == E->getTypeSourceInfo() &&
17335 SrcExpr.get() == E->getSrcExpr())
17338 return getDerived().RebuildConvertVectorExpr(E->getBuiltinLoc(),
17339 SrcExpr.get(),
Type,
17340 E->getRParenLoc());
17343template<
typename Derived>
17346 BlockDecl *oldBlock = E->getBlockDecl();
17352 blockScope->TheDecl->setBlockMissingReturnType(
17353 oldBlock->blockMissingReturnType());
17362 if (getDerived().TransformFunctionTypeParams(
17363 E->getCaretLocation(), oldBlock->parameters(),
nullptr,
17364 exprFunctionType->getExtParameterInfosOrNull(), paramTypes, ¶ms,
17366 getSema().ActOnBlockError(E->getCaretLocation(),
nullptr);
17371 getDerived().TransformType(exprFunctionType->getReturnType());
17373 auto epi = exprFunctionType->getExtProtoInfo();
17374 epi.ExtParameterInfos = extParamInfos.getPointerOrNull(paramTypes.size());
17377 getDerived().RebuildFunctionProtoType(exprResultType, paramTypes, epi);
17381 if (!params.empty())
17382 blockScope->TheDecl->setParams(params);
17384 if (!oldBlock->blockMissingReturnType()) {
17385 blockScope->HasImplicitReturnType =
false;
17386 blockScope->ReturnType = exprResultType;
17390 StmtResult body = getDerived().TransformStmt(E->getBody());
17391 if (body.isInvalid()) {
17392 getSema().ActOnBlockError(E->getCaretLocation(),
nullptr);
17400 for (
const auto &I : oldBlock->captures()) {
17401 VarDecl *oldCapture = I.getVariable();
17404 if (oldCapture->isParameterPack())
17408 cast<VarDecl>(getDerived().TransformDecl(E->getCaretLocation(),
17410 assert(blockScope->CaptureMap.count(newCapture));
17416 assert((!blockScope->isCXXThisCaptured() || oldBlock->capturesCXXThis()) &&
17417 "this pointer isn't captured in the old block");
17425template<
typename Derived>
17428 ExprResult SrcExpr = getDerived().TransformExpr(E->getSrcExpr());
17429 if (SrcExpr.isInvalid())
17432 QualType Type = getDerived().TransformType(E->getType());
17435 E->getRParenLoc());
17438template<
typename Derived>
17441 bool ArgumentChanged =
false;
17443 SubExprs.reserve(E->getNumSubExprs());
17444 if (getDerived().TransformExprs(E->getSubExprs(), E->getNumSubExprs(),
false,
17445 SubExprs, &ArgumentChanged))
17448 if (!getDerived().AlwaysRebuild() &&
17452 return getDerived().RebuildAtomicExpr(E->getBuiltinLoc(), SubExprs,
17453 E->getOp(), E->getRParenLoc());
17460template<
typename Derived>
17463 return SemaRef.BuildPointerType(PointeeType,
Star,
17467template<
typename Derived>
17470 return SemaRef.BuildBlockPointerType(PointeeType,
Star,
17474template<
typename Derived>
17477 bool WrittenAsLValue,
17479 return SemaRef.BuildReferenceType(ReferentType, WrittenAsLValue,
17483template <
typename Derived>
17487 return SemaRef.BuildMemberPointerType(PointeeType, SS, Cls, Sigil,
17491template<
typename Derived>
17498 return SemaRef.ObjC().BuildObjCTypeParamType(
17499 Decl, ProtocolLAngleLoc, Protocols, ProtocolLocs, ProtocolRAngleLoc,
17503template<
typename Derived>
17514 return SemaRef.ObjC().BuildObjCObjectType(
17515 BaseType, Loc, TypeArgsLAngleLoc, TypeArgs, TypeArgsRAngleLoc,
17516 ProtocolLAngleLoc, Protocols, ProtocolLocs, ProtocolRAngleLoc,
17521template<
typename Derived>
17525 return SemaRef.Context.getObjCObjectPointerType(PointeeType);
17528template <
typename Derived>
17531 Expr *SizeExpr,
unsigned IndexTypeQuals,
SourceRange BracketsRange) {
17532 if (SizeExpr || !Size)
17533 return SemaRef.BuildArrayType(ElementType, SizeMod, SizeExpr,
17534 IndexTypeQuals, BracketsRange,
17538 SemaRef.Context.UnsignedCharTy,
SemaRef.Context.UnsignedShortTy,
17540 SemaRef.Context.UnsignedLongLongTy,
SemaRef.Context.UnsignedInt128Ty
17543 for (
const auto &T : Types)
17544 if (Size->getBitWidth() ==
SemaRef.Context.getIntWidth(T)) {
17554 return SemaRef.BuildArrayType(ElementType, SizeMod, ArraySize,
17555 IndexTypeQuals, BracketsRange,
17559template <
typename Derived>
17562 Expr *SizeExpr,
unsigned IndexTypeQuals,
SourceRange BracketsRange) {
17563 return getDerived().RebuildArrayType(ElementType, SizeMod, &Size, SizeExpr,
17564 IndexTypeQuals, BracketsRange);
17567template <
typename Derived>
17571 return getDerived().RebuildArrayType(ElementType, SizeMod,
nullptr,
nullptr,
17572 IndexTypeQuals, BracketsRange);
17575template <
typename Derived>
17578 unsigned IndexTypeQuals,
SourceRange BracketsRange) {
17579 return getDerived().RebuildArrayType(ElementType, SizeMod,
nullptr,
17581 IndexTypeQuals, BracketsRange);
17584template <
typename Derived>
17587 unsigned IndexTypeQuals,
SourceRange BracketsRange) {
17588 return getDerived().RebuildArrayType(ElementType, SizeMod,
nullptr,
17590 IndexTypeQuals, BracketsRange);
17593template <
typename Derived>
17596 return SemaRef.BuildAddressSpaceAttr(PointeeType, AddrSpaceExpr,
17600template <
typename Derived>
17602 unsigned NumElements,
17605 return SemaRef.Context.getVectorType(ElementType, NumElements, VecKind);
17608template <
typename Derived>
17612 return SemaRef.BuildVectorType(ElementType, SizeExpr, AttributeLoc);
17615template<
typename Derived>
17617 unsigned NumElements,
17619 llvm::APInt numElements(
SemaRef.Context.getIntWidth(
SemaRef.Context.IntTy),
17620 NumElements,
true);
17624 return SemaRef.BuildExtVectorType(ElementType, VectorSize, AttributeLoc);
17627template<
typename Derived>
17632 return SemaRef.BuildExtVectorType(ElementType, SizeExpr, AttributeLoc);
17635template <
typename Derived>
17637 QualType ElementType,
unsigned NumRows,
unsigned NumColumns) {
17638 return SemaRef.Context.getConstantMatrixType(ElementType, NumRows,
17642template <
typename Derived>
17646 return SemaRef.BuildMatrixType(ElementType, RowExpr, ColumnExpr,
17650template <
typename Derived>
17654 return SemaRef.BuildFunctionType(T, ParamTypes,
17660template<
typename Derived>
17662 return SemaRef.Context.getFunctionNoProtoType(T);
17665template <
typename Derived>
17669 assert(D &&
"no decl found");
17673 if (
auto *UPD = dyn_cast<UsingPackDecl>(D)) {
17677 if (UPD->expansions().empty()) {
17678 getSema().Diag(NameLoc, diag::err_using_pack_expansion_empty)
17679 << UPD->isCXXClassMember() << UPD;
17688 for (
auto *E : UPD->expansions()) {
17695 else if (T.isNull())
17698 assert(
getSema().Context.hasSameType(ThisT, T) &&
17699 "mismatched resolved types in using pack expansion");
17701 return T.
isNull() ? FallbackT : T;
17703 if (
auto *Using = dyn_cast<UsingDecl>(D)) {
17704 assert(Using->hasTypename() &&
17705 "UnresolvedUsingTypenameDecl transformed to non-typename using");
17708 assert(++Using->shadow_begin() == Using->shadow_end());
17713 return SemaRef.Context.getUsingType(
Keyword, Qualifier, Shadow);
17716 "UnresolvedUsingTypenameDecl transformed to non-using decl");
17717 return SemaRef.Context.getUnresolvedUsingType(
17721template <
typename Derived>
17724 return SemaRef.BuildTypeofExprType(E, Kind);
17727template<
typename Derived>
17730 return SemaRef.Context.getTypeOfType(Underlying, Kind);
17733template <
typename Derived>
17735 return SemaRef.BuildDecltypeType(E);
17738template <
typename Derived>
17743 return SemaRef.BuildPackIndexingType(Pattern, IndexExpr, Loc, EllipsisLoc,
17744 FullySubstituted, Expansions);
17747template<
typename Derived>
17749 UnaryTransformType::UTTKind UKind,
17751 return SemaRef.BuildUnaryTransformType(BaseType, UKind, Loc);
17754template <
typename Derived>
17758 return SemaRef.CheckTemplateIdType(
17763template<
typename Derived>
17766 return SemaRef.BuildAtomicType(ValueType, KWLoc);
17769template<
typename Derived>
17773 return isReadPipe ?
SemaRef.BuildReadPipeType(ValueType, KWLoc)
17774 :
SemaRef.BuildWritePipeType(ValueType, KWLoc);
17777template <
typename Derived>
17781 llvm::APInt NumBitsAP(
SemaRef.Context.getIntWidth(
SemaRef.Context.IntTy),
17785 return SemaRef.BuildBitIntType(IsUnsigned, Bits, Loc);
17788template <
typename Derived>
17791 return SemaRef.BuildBitIntType(IsUnsigned, NumBitsExpr, Loc);
17794template <
typename Derived>
17802template <
typename Derived>
17809 getSema().ActOnTemplateName(
nullptr, SS, TemplateKWLoc,
17812 AllowInjectedClassName);
17816template<
typename Derived>
17823 bool AllowInjectedClassName) {
17826 SourceLocation SymbolLocations[3] = { NameLoc, NameLoc, NameLoc };
17831 false,
Template, AllowInjectedClassName);
17835template <
typename Derived>
17840 bool isPostIncDec = Second && (Op == OO_PlusPlus || Op == OO_MinusMinus);
17845 return SemaRef.PseudoObject().checkAssignment(
nullptr, OpLoc,
17846 Opc,
First, Second);
17861 if (Op == OO_Subscript) {
17862 if (!
First->getType()->isOverloadableType() &&
17864 return getSema().CreateBuiltinArraySubscriptExpr(
First, CalleeLoc, Second,
17866 }
else if (Op == OO_Arrow) {
17869 if (
First->getType()->isDependentType())
17872 return SemaRef.BuildOverloadedArrowExpr(
nullptr,
First, OpLoc);
17873 }
else if (Second ==
nullptr || isPostIncDec) {
17874 if (!
First->getType()->isOverloadableType() ||
17875 (Op == OO_Amp &&
getSema().isQualifiedMemberAccess(
First))) {
17882 return getSema().CreateBuiltinUnaryOp(OpLoc, Opc,
First);
17886 !
First->getType()->isOverloadableType() &&
17892 =
SemaRef.CreateBuiltinBinOp(OpLoc, Opc,
First, Second);
17901 if (!Second || isPostIncDec) {
17904 return SemaRef.CreateOverloadedUnaryOp(OpLoc, Opc, Functions,
First,
17911 First, Second, RequiresADL);
17918template<
typename Derived>
17928 QualType CanonicalBaseType =
Base->getType().getCanonicalType();
17934 ->getAsCanonical<RecordType>())) {
17936 return SemaRef.BuildPseudoDestructorExpr(
17937 Base, OperatorLoc, isArrow ? tok::arrow : tok::period, SS, ScopeType,
17938 CCLoc, TildeLoc, Destroyed);
17950 if (!
isa<TagType>(ScopeType->getType().getCanonicalType())) {
17951 getSema().Diag(ScopeType->getTypeLoc().getBeginLoc(),
17952 diag::err_expected_class_or_namespace)
17953 << ScopeType->getType() <<
getSema().getLangOpts().CPlusPlus;
17957 SS.
Make(
SemaRef.Context, ScopeType->getTypeLoc(), CCLoc);
17961 return getSema().BuildMemberReferenceExpr(
17962 Base,
Base->getType(), OperatorLoc, isArrow, SS, TemplateKWLoc,
17968template<
typename Derived>
17976 for (
unsigned I = 0; I < NumParams; ++I) {
17977 if (I != ContextParamPos) {
17983 Params.push_back(std::make_pair(StringRef(), QualType()));
17986 getSema().ActOnCapturedRegionStart(Loc,
nullptr,
17994 if (Body.isInvalid()) {
17995 getSema().ActOnCapturedRegionError();
17999 return getSema().ActOnCapturedRegionEnd(Body.get());
18002template <
typename Derived>
18008 llvm_unreachable(
"SYCL kernel call statement cannot appear in dependent "
18012template <
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)
This represents clause 'map' in the 'pragma omp ...' directives.
This represents clauses with a list of expressions that are mappable. Examples of these clauses are '...
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>.
QualType getOverflowBehaviorType(const OverflowBehaviorAttr *Attr, QualType Wrapped) const
TemplateName getSubstTemplateTemplateParmPack(const TemplateArgument &ArgPack, Decl *AssociatedDecl, unsigned Index, bool Final) const
QualType getHLSLAttributedResourceType(QualType Wrapped, QualType Contained, const HLSLAttributedResourceType::Attributes &Attrs)
AddrLabelExpr - The GNU address of label extension, representing &&label.
Represents the index of the current element of an array being initialized by an ArrayInitLoopExpr.
Represents a loop initializing the elements of an array.
Wrapper for source info for array parameter types.
This class represents BOTH the OpenMP Array Section and OpenACC 'subarray', with a boolean differenti...
ArraySubscriptExpr - [C99 6.5.2.1] Array Subscripting.
Wrapper for source info for arrays.
void setLBracketLoc(SourceLocation Loc)
An Embarcadero array type trait, as used in the implementation of __array_rank and __array_extent.
SourceLocation getEndLoc() const LLVM_READONLY
ArrayTypeTrait getTrait() const
Expr * getDimensionExpression() const
TypeSourceInfo * getQueriedTypeSourceInfo() const
SourceLocation getBeginLoc() const LLVM_READONLY
Represents an array type, per C99 6.7.5.2 - Array Declarators.
AsTypeExpr - Clang builtin function __builtin_astype [OpenCL 6.2.4.2] This AST node provides support ...
AtomicExpr - Variadic atomic builtins: __atomic_exchange, __atomic_fetch_*, __atomic_load,...
void setKWLoc(SourceLocation Loc)
Attr - This represents one attribute.
Represents an attribute applied to a statement.
SourceLocation getAttrLoc() const
ArrayRef< const Attr * > getAttrs() const
Type source information for an attributed type.
void setAttr(const Attr *A)
Type source information for an btf_tag attributed type.
BinaryConditionalOperator - The GNU extension to the conditional operator which allows the middle ope...
A builtin binary operation expression such as "x + y" or "x <= y".
static OverloadedOperatorKind getOverloadedOperator(Opcode Opc)
Retrieve the overloaded operator kind that corresponds to the given binary opcode.
static bool isAssignmentOp(Opcode Opc)
static Opcode getOverloadedOpcode(OverloadedOperatorKind OO)
Retrieve the binary opcode that corresponds to the given overloaded operator.
A fixed int type of a specified bitwidth.
Represents a block literal declaration, which is like an unnamed FunctionDecl.
void setIsVariadic(bool value)
BlockExpr - Adaptor class for mixing a BlockDecl with expressions.
Wrapper for source info for block pointers.
BreakStmt - This represents a break.
Represents a C++2a __builtin_bit_cast(T, v) expression.
SourceLocation getEndLoc() const LLVM_READONLY
SourceLocation getBeginLoc() const LLVM_READONLY
CStyleCastExpr - An explicit cast in C (C99 6.5.4) or a C-style cast in C++ (C++ [expr....
Represents a call to a CUDA kernel function.
A C++ addrspace_cast expression (currently only enabled for OpenCL).
Represents binding an expression to a temporary.
A boolean literal, per ([C++ lex.bool] Boolean literals).
CXXCatchStmt - This represents a C++ catch block.
A C++ const_cast expression (C++ [expr.const.cast]).
Represents a call to a C++ constructor.
SourceRange getParenOrBraceRange() const
Expr * getArg(unsigned Arg)
Return the specified argument.
bool isStdInitListInitialization() const
Whether this constructor call was written as list-initialization, but was interpreted as forming a st...
SourceLocation getEndLoc() const LLVM_READONLY
SourceLocation getBeginLoc() const LLVM_READONLY
bool isListInitialization() const
Whether this constructor call was written as list-initialization.
unsigned getNumArgs() const
Return the number of arguments to the constructor call.
Represents a C++ constructor within a class.
A default argument (C++ [dcl.fct.default]).
static CXXDefaultArgExpr * Create(const ASTContext &C, SourceLocation Loc, ParmVarDecl *Param, Expr *RewrittenExpr, DeclContext *UsedContext)
A use of a default initializer in a constructor or in aggregate initialization.
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
Represents a C++26 reflect expression [expr.reflect].
A C++ reinterpret_cast expression (C++ [expr.reinterpret.cast]).
A rewritten comparison expression that was originally written using operator syntax.
An expression "T()" which creates an rvalue of a non-class type T.
Represents a C++ nested-name-specifier or a global scope specifier.
void Make(ASTContext &Context, TypeLoc TL, SourceLocation ColonColonLoc)
Make a nested-name-specifier of the form 'type::'.
char * location_data() const
Retrieve the data associated with the source-location information.
SourceRange getRange() const
void MakeGlobal(ASTContext &Context, SourceLocation ColonColonLoc)
Turn this (empty) nested-name-specifier into the global nested-name-specifier '::'.
NestedNameSpecifier getScopeRep() const
Retrieve the representation of the nested-name-specifier.
NestedNameSpecifierLoc getWithLocInContext(ASTContext &Context) const
Retrieve a nested-name-specifier with location information, copied into the given AST context.
unsigned location_size() const
Retrieve the size of the data associated with source-location information.
void Extend(ASTContext &Context, NamespaceBaseDecl *Namespace, SourceLocation NamespaceLoc, SourceLocation ColonColonLoc)
Extend the current nested-name-specifier by another nested-name-specifier component of the form 'name...
void MakeMicrosoftSuper(ASTContext &Context, CXXRecordDecl *RD, SourceLocation SuperLoc, SourceLocation ColonColonLoc)
Turns this (empty) nested-name-specifier into '__super' nested-name-specifier.
bool isEmpty() const
No scope specifier.
void Adopt(NestedNameSpecifierLoc Other)
Adopt an existing nested-name-specifier (with source-range information).
Implicit construction of a std::initializer_list<T> object from an array temporary within list-initia...
Represents a C++ functional cast expression that builds a temporary object.
Represents the this expression in C++.
A C++ throw-expression (C++ [except.throw]).
CXXTryStmt - A C++ try block, including all handlers.
A C++ typeid expression (C++ [expr.typeid]), which gets the type_info that corresponds to the supplie...
Describes an explicit type conversion that uses functional notion but could not be resolved because o...
SourceLocation getLParenLoc() const
Retrieve the location of the left parentheses ('(') that precedes the argument list.
bool isListInitialization() const
Determine whether this expression models list-initialization.
TypeSourceInfo * getTypeSourceInfo() const
Retrieve the type source information for the type being constructed.
SourceLocation getRParenLoc() const
Retrieve the location of the right parentheses (')') that follows the argument list.
unsigned getNumArgs() const
Retrieve the number of arguments.
A Microsoft C++ __uuidof expression, which gets the _GUID that corresponds to the supplied type or ex...
CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).
static CallExpr * Create(const ASTContext &Ctx, Expr *Fn, ArrayRef< Expr * > Args, QualType Ty, ExprValueKind VK, SourceLocation RParenLoc, FPOptionsOverride FPFeatures, unsigned MinNumArgs=0, ADLCallKind UsesADL=NotADL)
Create a call expression.
Represents the body of a CapturedStmt, and serves as its DeclContext.
unsigned getNumParams() const
unsigned getContextParamPosition() const
ImplicitParamDecl * getParam(unsigned i) const
This captures a statement into a function.
CapturedDecl * getCapturedDecl()
Retrieve the outlined function declaration.
Stmt * getCapturedStmt()
Retrieve the statement being captured.
SourceLocation getBeginLoc() const LLVM_READONLY
CapturedRegionKind getCapturedRegionKind() const
Retrieve the captured region kind.
CaseStmt - Represent a case statement.
Expr * getSubExprAsWritten()
Retrieve the cast subexpression as it was written in the source code, looking through any implicit ca...
ChooseExpr - GNU builtin-in function __builtin_choose_expr.
Represents a 'co_await' expression.
CompoundAssignOperator - For compound assignments (e.g.
CompoundLiteralExpr - [C99 6.5.2.5].
CompoundStmt - This represents a group of statements like { stmt stmt }.
FPOptionsOverride getStoredFPFeatures() const
Get FPOptionsOverride from trailing storage.
SourceLocation getLBracLoc() const
bool hasStoredFPFeatures() const
SourceLocation getRBracLoc() const
Declaration of a C++20 concept.
static ConceptReference * Create(const ASTContext &C, NestedNameSpecifierLoc NNS, SourceLocation TemplateKWLoc, DeclarationNameInfo ConceptNameInfo, NamedDecl *FoundDecl, TemplateDecl *NamedConcept, const ASTTemplateArgumentListInfo *ArgsAsWritten)
Represents the specialization of a concept - evaluates to a prvalue of type bool.
const TypeClass * getTypePtr() const
ConditionalOperator - The ?
Represents the canonical version of C arrays with a specified constant size.
ConstantExpr - An expression that occurs in a constant context and optionally the result of evaluatin...
Represents a concrete matrix type with constant number of rows and columns.
ContinueStmt - This represents a continue.
ConvertVectorExpr - Clang builtin function __builtin_convertvector This AST node provides support for...
Represents a 'co_return' statement in the C++ Coroutines TS.
Represents the body of a coroutine.
Represents a sugar type with __counted_by or __sized_by annotations, including their _or_null variant...
Represents a 'co_yield' expression.
Wrapper for source info for pointers decayed from arrays and functions.
static DeclAccessPair make(NamedDecl *D, AccessSpecifier AS)
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
DeclContext * getParent()
getParent - Returns the containing DeclContext.
DeclContextLookupResult lookup_result
lookup_result lookup(DeclarationName Name) const
lookup - Find the declarations (if any) with the given Name in this context.
void addDecl(Decl *D)
Add the declaration D into this context.
A reference to a declared variable, function, enum, etc.
DeclStmt - Adaptor class for mixing declarations with statements and expressions.
Decl - This represents one declaration (or definition), e.g.
bool isInvalidDecl() const
SourceLocation getLocation() const
DeclContext * getDeclContext()
AccessSpecifier getAccess() const
The name of a declaration.
TemplateDecl * getCXXDeductionGuideTemplate() const
If this name is the name of a C++ deduction guide, return the template associated with that name.
@ CXXConversionFunctionName
QualType getCXXNameType() const
If this name is one of the C++ names (of a constructor, destructor, or conversion function),...
NameKind getNameKind() const
Determine what kind of name this is.
SourceLocation getInnerLocStart() const
Return start of source range ignoring outer template declarations.
TypeSourceInfo * getTypeSourceInfo() const
Information about one declarator, including the parsed type information and the identifier.
void setDecltypeLoc(SourceLocation Loc)
void setElaboratedKeywordLoc(SourceLocation Loc)
DeferStmt - This represents a deferred statement.
static DeferStmt * Create(ASTContext &Context, SourceLocation DeferLoc, Stmt *Body)
void setAttrOperandParensRange(SourceRange range)
Represents an extended address space qualifier where the input address space value is dependent.
Represents a 'co_await' expression while the type of the promise is dependent.
void setElaboratedKeywordLoc(SourceLocation Loc)
A qualified reference to a name whose declaration cannot yet be resolved.
SourceLocation getRAngleLoc() const
Retrieve the location of the right angle bracket ending the explicit template argument list following...
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies the name, with source location information.
SourceLocation getLAngleLoc() const
Retrieve the location of the left angle bracket starting the explicit template argument list followin...
bool hasExplicitTemplateArgs() const
Determines whether this lookup had explicit template arguments.
SourceLocation getTemplateKeywordLoc() const
Retrieve the location of the template keyword preceding this name, if any.
unsigned getNumTemplateArgs() const
DeclarationName getDeclName() const
Retrieve the name that this expression refers to.
TemplateArgumentLoc const * getTemplateArgs() const
const DeclarationNameInfo & getNameInfo() const
Retrieve the name that this expression refers to.
Represents an array type in C++ whose size is a value-dependent expression.
void setNameLoc(SourceLocation Loc)
Represents an extended vector type where either the type or size is dependent.
Represents a matrix type where the type and the number of rows and columns is dependent on a template...
void setNameLoc(SourceLocation Loc)
Represents a vector type where either the type or size is dependent.
Represents a single C99 designator.
Represents a C99 designated initializer expression.
Designation - Represent a full designation, which is a sequence of designators.
static Designator CreateArrayRangeDesignator(Expr *Start, Expr *End, SourceLocation LBracketLoc, SourceLocation EllipsisLoc)
Creates a GNU array-range designator.
static Designator CreateArrayDesignator(Expr *Index, SourceLocation LBracketLoc)
Creates an array designator.
static Designator CreateFieldDesignator(const IdentifierInfo *FieldName, SourceLocation DotLoc, SourceLocation FieldLoc)
Creates a field designator.
bool hasErrorOccurred() const
DoStmt - This represents a 'do/while' stmt.
Wrap a function effect's condition expression in another struct so that FunctionProtoType's TrailingO...
Expr * getCondition() const
void set(SourceLocation ElaboratedKeywordLoc, NestedNameSpecifierLoc QualifierLoc, SourceLocation NameLoc)
Represents a reference to emded data.
RAII object that enters a new expression evaluation context.
Wrapper for source info for enum types.
TypeSourceInfo * getTypeInfoAsWritten() const
getTypeInfoAsWritten - Returns the type source info for the type that this expression is casting to.
Represents an expression – generally a full-expression – that introduces cleanups to be run at the en...
This represents one expression.
bool isValueDependent() const
Determines whether the value of this expression depends on.
bool isTypeDependent() const
Determines whether the type of this expression depends on.
ExprObjectKind getObjectKind() const
getObjectKind - The object kind that this expression produces.
Expr * IgnoreImplicitAsWritten() LLVM_READONLY
Skip past any implicit AST nodes which might surround this expression until reaching a fixed point.
bool isDefaultArgument() const
Determine whether this expression is a default function argument.
bool hasPlaceholderType() const
Returns whether this expression has a placeholder type.
static ExprValueKind getValueKindForType(QualType T)
getValueKindForType - Given a formal return or parameter type, give its value kind.
An expression trait intrinsic.
ExtVectorElementExpr - This represents access to specific elements of a vector, and may occur on the ...
Represents difference between two FPOptions values.
FPOptions applyOverrides(FPOptions Base)
Represents a member of a struct/union/class.
ForStmt - This represents a 'for (init;cond;inc)' stmt.
Represents a function declaration or definition.
ArrayRef< ParmVarDecl * > parameters() const
SmallVector< Conflict > Conflicts
Represents an abstract function effect, using just an enumeration describing its kind.
StringRef name() const
The description printed in diagnostics, e.g. 'nonblocking'.
Kind oppositeKind() const
Return the opposite kind, for effects which have opposites.
ArrayRef< EffectConditionExpr > conditions() const
Represents a K&R-style 'int foo()' function, which has no information available about its arguments.
Represents a reference to a function parameter pack, init-capture pack, or binding pack that has been...
Represents a prototype with parameter type info, e.g.
param_type_iterator param_type_begin() const
unsigned getNumParams() const
SourceLocation getLocalRangeEnd() const
void setLocalRangeBegin(SourceLocation L)
void setLParenLoc(SourceLocation Loc)
SourceRange getExceptionSpecRange() const
void setParam(unsigned i, ParmVarDecl *VD)
ArrayRef< ParmVarDecl * > getParams() const
void setRParenLoc(SourceLocation Loc)
void setLocalRangeEnd(SourceLocation L)
void setExceptionSpecRange(SourceRange R)
TypeLoc getReturnLoc() const
SourceLocation getLocalRangeBegin() const
SourceLocation getLParenLoc() const
SourceLocation getRParenLoc() const
Interesting information about a specific parameter that can't simply be reflected in parameter's type...
This represents a GCC inline-assembly statement extension.
GNUNullExpr - Implements the GNU __null extension, which is a name for a null pointer constant that h...
Represents a C11 generic selection.
AssociationTy< false > Association
GotoStmt - This represents a direct goto.
Type source information for HLSL attributed resource type.
void setSourceRange(const SourceRange &R)
This class represents temporary values used to represent inout and out arguments in HLSL.
One of these records is kept for each identifier that is lexed.
IfStmt - This represents an if/then/else.
ImaginaryLiteral - We support imaginary integer and floating point literals, like "1....
ImplicitCastExpr - Allows us to explicitly represent implicit type conversions, which have no direct ...
Represents an implicitly-generated value initialization of an object of a given type.
Represents a C array with an unspecified size.
IndirectGotoStmt - This represents an indirect goto.
const TypeClass * getTypePtr() const
Describes an C or C++ initializer list.
InitListExpr * getSyntacticForm() const
Wrapper for source info for injected class names of class templates.
static IntegerLiteral * Create(const ASTContext &C, const llvm::APInt &V, QualType type, SourceLocation l)
Returns a new integer literal with value 'V' and type 'type'.
Represents the declaration of a label.
LabelStmt - Represents a label, which has a substatement.
A C++ lambda expression, which produces a function object (of unspecified type) that can be invoked l...
capture_iterator capture_begin() const
Retrieve an iterator pointing to the first lambda capture.
bool isInitCapture(const LambdaCapture *Capture) const
Determine whether one of this lambda's captures is an init-capture.
capture_iterator capture_end() const
Retrieve an iterator pointing past the end of the sequence of lambda captures.
const LambdaCapture * capture_iterator
An iterator that walks over the captures of the lambda, both implicit and explicit.
Represents the results of name lookup.
This represents a Microsoft inline-assembly statement extension.
Representation of a Microsoft __if_exists or __if_not_exists statement with a dependent name.
An instance of this class represents the declaration of a property member.
A member reference to an MSPropertyDecl.
MS property subscript expression.
void setExpansionLoc(SourceLocation Loc)
Represents a prvalue temporary that is written into memory so that a reference can bind to it.
MatrixSingleSubscriptExpr - Matrix single subscript expression for the MatrixType extension when you ...
MatrixSubscriptExpr - Matrix subscript expression for the MatrixType extension.
void setAttrNameLoc(SourceLocation loc)
MemberExpr - [C99 6.5.2.3] Structure and Union Members.
Wrapper for source info for member pointers.
A pointer to member type per C++ 8.3.3 - Pointers to members.
Data structure that captures multiple levels of template argument lists for use in template instantia...
This represents a decl that may have a name.
IdentifierInfo * getIdentifier() const
Get the identifier that names this declaration, if there is one.
StringRef getName() const
Get the name of identifier for this declaration as a StringRef.
DeclarationName getDeclName() const
Get the actual, stored name of the declaration, which may be a special name.
Represents C++ namespaces and their aliases.
Class that aids in the construction of nested-name-specifiers along with source-location information ...
void MakeTrivial(ASTContext &Context, NestedNameSpecifier Qualifier, SourceRange R)
Make a new nested-name-specifier from incomplete source-location information.
A C++ nested-name-specifier augmented with source location information.
NestedNameSpecifier getNestedNameSpecifier() const
Retrieve the nested-name-specifier to which this instance refers.
SourceLocation getLocalEndLoc() const
Retrieve the location of the end of this component of the nested-name-specifier.
SourceRange getSourceRange() const LLVM_READONLY
Retrieve the source range covering the entirety of this nested-name-specifier.
SourceLocation getEndLoc() const
Retrieve the location of the end of this nested-name-specifier.
SourceLocation getBeginLoc() const
Retrieve the location of the beginning of this nested-name-specifier.
TypeLoc castAsTypeLoc() const
For a nested-name-specifier that refers to a type, retrieve the type with source-location information...
void * getOpaqueData() const
Retrieve the opaque pointer that refers to source-location data.
SourceLocation getLocalBeginLoc() const
Retrieve the location of the beginning of this component of the nested-name-specifier.
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
NamespaceAndPrefix getAsNamespaceAndPrefix() const
CXXRecordDecl * getAsRecordDecl() const
Retrieve the record declaration stored in this nested name specifier, or null.
bool isDependent() const
Whether this nested name specifier refers to a dependent type or not.
@ MicrosoftSuper
Microsoft's '__super' specifier, stored as a CXXRecordDecl* of the class it appeared in.
@ Global
The global specifier '::'. There is no stored value.
@ Type
A type, stored as a Type*.
@ Namespace
A namespace-like entity, stored as a NamespaceBaseDecl*.
Represents a place-holder for an object not to be initialized by anything.
NonTypeTemplateParmDecl - Declares a non-type template parameter, e.g., "Size" in.
NullStmt - This is the null statement ";": C99 6.8.3p3.
This represents the 'align' clause in the 'pragma omp allocate' directive.
This represents clause 'allocate' in the 'pragma omp ...' directives.
This represents 'allocator' clause in the 'pragma omp ...' directive.
An explicit cast in C or a C-style cast in C++, which uses the syntax ([s1][s2]......
This is a basic class for representing single OpenMP clause.
OpenMPClauseKind getClauseKind() const
Returns kind of OpenMP clause (private, shared, reduction, etc.).
This represents 'collapse' clause in the 'pragma omp ...' directive.
This represents 'default' clause in the 'pragma omp ...' directive.
This represents 'final' clause in the 'pragma omp ...' directive.
Representation of the 'full' clause of the 'pragma omp unroll' directive.
This represents 'if' clause in the 'pragma omp ...' directive.
OpenMP 5.0 [2.1.6 Iterators] Iterators are identifiers that expand to multiple values in the clause o...
This class represents the 'looprange' clause in the 'pragma omp fuse' directive.
This represents 'num_threads' clause in the 'pragma omp ...' directive.
Representation of the 'partial' clause of the 'pragma omp unroll' directive.
This class represents the 'permutation' clause in the 'pragma omp interchange' directive.
This represents 'safelen' clause in the 'pragma omp ...' directive.
This represents 'simdlen' clause in the 'pragma omp ...' directive.
This represents the 'sizes' clause in the 'pragma omp tile' directive.
This represents 'threadset' clause in the 'pragma omp task ...' directive.
ObjCArrayLiteral - used for objective-c array containers; as in: @["Hello", NSApp,...
Represents Objective-C's @catch statement.
Represents Objective-C's @finally statement.
Represents Objective-C's @synchronized statement.
Represents Objective-C's @throw statement.
Represents Objective-C's @try ... @catch ... @finally statement.
Represents Objective-C's @autoreleasepool Statement.
A runtime availability query.
ObjCBoolLiteralExpr - Objective-C Boolean Literal.
ObjCBoxedExpr - used for generalized expression boxing.
An Objective-C "bridged" cast expression, which casts between Objective-C pointers and C pointers,...
ObjCDictionaryLiteral - AST node to represent objective-c dictionary literals; as in:"name" : NSUserN...
ObjCEncodeExpr, used for @encode in Objective-C.
Represents Objective-C's collection statement.
ObjCIndirectCopyRestoreExpr - Represents the passing of a function argument by indirect copy-restore ...
Wrapper for source info for ObjC interfaces.
ObjCIsaExpr - Represent X->isa and X.isa when X is an ObjC 'id' type.
ObjCIvarDecl - Represents an ObjC instance variable.
ObjCIvarRefExpr - A reference to an ObjC instance variable.
An expression that sends a message to the given Objective-C object or class.
@ SuperInstance
The receiver is the instance of the superclass object.
@ Instance
The receiver is an object instance.
@ SuperClass
The receiver is a superclass.
@ Class
The receiver is a class.
ObjCMethodDecl - Represents an instance or class method declaration.
Wraps an ObjCPointerType with source location information.
void setStarLoc(SourceLocation Loc)
void setHasBaseTypeAsWritten(bool HasBaseType)
Represents one property declaration in an Objective-C interface.
ObjCPropertyRefExpr - A dot-syntax expression to access an ObjC property.
ObjCProtocolExpr used for protocol expression in Objective-C.
ObjCSelectorExpr used for @selector in Objective-C.
ObjCStringLiteral, used for Objective-C string literals i.e.
ObjCSubscriptRefExpr - used for array and dictionary subscripting.
Represents the declaration of an Objective-C type parameter.
ProtocolLAngleLoc, ProtocolRAngleLoc, and the source locations for protocol qualifiers are stored aft...
@ Array
An index into an array.
@ Identifier
A field in a dependent type, known only by its name.
@ Base
An implicit indirection through a C++ base class, when the field found is in a base class.
static OpaquePtr make(QualType P)
OpaqueValueExpr - An expression referring to an opaque object of a fixed type and value class.
Expr * getSourceExpr() const
The source expression of an opaque value expression is the expression which originally generated the ...
This expression type represents an asterisk in an OpenACC Size-Expr, used in the 'tile' and 'gang' cl...
static OpenACCAsyncClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *IntExpr, SourceLocation EndLoc)
static OpenACCAttachClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCAutoClause * Create(const ASTContext &Ctx, SourceLocation BeginLoc, SourceLocation EndLoc)
This is the base type for all OpenACC Clauses.
Represents a 'collapse' clause on a 'loop' construct.
static OpenACCCollapseClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, bool HasForce, Expr *LoopCount, SourceLocation EndLoc)
static OpenACCCopyClause * Create(const ASTContext &C, OpenACCClauseKind Spelling, SourceLocation BeginLoc, SourceLocation LParenLoc, OpenACCModifierKind Mods, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCCopyInClause * Create(const ASTContext &C, OpenACCClauseKind Spelling, SourceLocation BeginLoc, SourceLocation LParenLoc, OpenACCModifierKind Mods, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCCopyOutClause * Create(const ASTContext &C, OpenACCClauseKind Spelling, SourceLocation BeginLoc, SourceLocation LParenLoc, OpenACCModifierKind Mods, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCCreateClause * Create(const ASTContext &C, OpenACCClauseKind Spelling, SourceLocation BeginLoc, SourceLocation LParenLoc, OpenACCModifierKind Mods, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCDefaultAsyncClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *IntExpr, SourceLocation EndLoc)
A 'default' clause, has the optional 'none' or 'present' argument.
static OpenACCDefaultClause * Create(const ASTContext &C, OpenACCDefaultClauseKind K, SourceLocation BeginLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
static OpenACCDeleteClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCDetachClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCDeviceClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCDeviceNumClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *IntExpr, SourceLocation EndLoc)
static OpenACCDevicePtrClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
A 'device_type' or 'dtype' clause, takes a list of either an 'asterisk' or an identifier.
static OpenACCDeviceTypeClause * Create(const ASTContext &C, OpenACCClauseKind K, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< DeviceTypeArgument > Archs, SourceLocation EndLoc)
static OpenACCFinalizeClause * Create(const ASTContext &Ctx, SourceLocation BeginLoc, SourceLocation EndLoc)
static OpenACCFirstPrivateClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, ArrayRef< OpenACCFirstPrivateRecipe > InitRecipes, SourceLocation EndLoc)
static OpenACCHostClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
An 'if' clause, which has a required condition expression.
static OpenACCIfClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *ConditionExpr, SourceLocation EndLoc)
static OpenACCIfPresentClause * Create(const ASTContext &Ctx, SourceLocation BeginLoc, SourceLocation EndLoc)
static OpenACCIndependentClause * Create(const ASTContext &Ctx, SourceLocation BeginLoc, SourceLocation EndLoc)
static OpenACCNoCreateClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCNumGangsClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > IntExprs, SourceLocation EndLoc)
static OpenACCNumWorkersClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *IntExpr, SourceLocation EndLoc)
static OpenACCPresentClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCPrivateClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, ArrayRef< OpenACCPrivateRecipe > InitRecipes, SourceLocation EndLoc)
A 'self' clause, which has an optional condition expression, or, in the event of an 'update' directiv...
static OpenACCSelfClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *ConditionExpr, SourceLocation EndLoc)
static OpenACCSeqClause * Create(const ASTContext &Ctx, SourceLocation BeginLoc, SourceLocation EndLoc)
static OpenACCTileClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > SizeExprs, SourceLocation EndLoc)
static OpenACCUseDeviceClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCVectorClause * Create(const ASTContext &Ctx, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *IntExpr, SourceLocation EndLoc)
static OpenACCVectorLengthClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *IntExpr, SourceLocation EndLoc)
static OpenACCWaitClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *DevNumExpr, SourceLocation QueuesLoc, ArrayRef< Expr * > QueueIdExprs, SourceLocation EndLoc)
static OpenACCWorkerClause * Create(const ASTContext &Ctx, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *IntExpr, SourceLocation EndLoc)
void initializeLocal(ASTContext &Context, SourceLocation loc)
A reference to an overloaded function set, either an UnresolvedLookupExpr or an UnresolvedMemberExpr.
bool hasExplicitTemplateArgs() const
Determines whether this expression had explicit template arguments.
SourceLocation getLAngleLoc() const
Retrieve the location of the left angle bracket starting the explicit template argument list followin...
SourceLocation getNameLoc() const
Gets the location of the name.
SourceLocation getTemplateKeywordLoc() const
Retrieve the location of the template keyword preceding this name, if any.
NestedNameSpecifierLoc getQualifierLoc() const
Fetches the nested-name qualifier with source-location information, if one was given.
TemplateArgumentLoc const * getTemplateArgs() const
llvm::iterator_range< decls_iterator > decls() const
unsigned getNumTemplateArgs() const
DeclarationName getName() const
Gets the name looked up.
SourceLocation getRAngleLoc() const
Retrieve the location of the right angle bracket ending the explicit template argument list following...
bool hasTemplateKeyword() const
Determines whether the name was preceded by the template keyword.
Represents a C++11 pack expansion that produces a sequence of expressions.
void setEllipsisLoc(SourceLocation Loc)
SourceLocation getEllipsisLoc() const
TypeLoc getPatternLoc() const
void setEllipsisLoc(SourceLocation Loc)
ParenExpr - This represents a parenthesized expression, e.g.
SourceLocation getLParen() const
Get the location of the left parentheses '('.
SourceLocation getRParen() const
Get the location of the right parentheses ')'.
void setLParenLoc(SourceLocation Loc)
Represents a parameter to a function.
unsigned getFunctionScopeIndex() const
Returns the index of this parameter in its prototype or method scope.
void setScopeInfo(unsigned scopeDepth, unsigned parameterIndex)
static ParmVarDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, const IdentifierInfo *Id, QualType T, TypeSourceInfo *TInfo, StorageClass S, Expr *DefArg)
unsigned getFunctionScopeDepth() const
void setKWLoc(SourceLocation Loc)
Pointer-authentication qualifiers.
void setSigilLoc(SourceLocation Loc)
TypeLoc getPointeeLoc() const
SourceLocation getSigilLoc() const
Wrapper for source info for pointers.
PointerType - C99 6.7.5.1 - Pointer Declarators.
[C99 6.4.2.2] - A predefined identifier such as func.
Stores the type being destroyed by a pseudo-destructor expression.
const IdentifierInfo * getIdentifier() const
SourceLocation getLocation() const
TypeSourceInfo * getTypeSourceInfo() const
PseudoObjectExpr - An expression which accesses a pseudo-object l-value.
A (possibly-)qualified type.
bool isNull() const
Return true if this QualType doesn't point to a type yet.
const Type * getTypePtr() const
Retrieves a pointer to the underlying (unqualified) type.
Qualifiers getQualifiers() const
Retrieve the set of qualifiers applied to this type.
QualType getUnqualifiedType() const
Retrieve the unqualified variant of the given type, removing as little sugar as possible.
Qualifiers getLocalQualifiers() const
Retrieve the set of qualifiers local to this particular QualType instance, not including any qualifie...
Represents a template name as written in source code.
Wrapper of type source information for a type with non-trivial direct qualifiers.
The collection of all-type qualifiers we support.
void removeObjCLifetime()
static Qualifiers fromCVRMask(unsigned CVR)
PointerAuthQualifier getPointerAuth() const
bool hasObjCLifetime() const
LangAS getAddressSpace() const
Frontend produces RecoveryExprs on semantic errors that prevent creating other well-formed expression...
Base for LValueReferenceType and RValueReferenceType.
QualType getPointeeTypeAsWritten() const
Represents the body of a requires-expression.
static RequiresExprBodyDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc)
C++2a [expr.prim.req]: A requires-expression provides a concise way to express requirements on templa...
static RequiresExpr * Create(ASTContext &C, SourceLocation RequiresKWLoc, RequiresExprBodyDecl *Body, SourceLocation LParenLoc, ArrayRef< ParmVarDecl * > LocalParameters, SourceLocation RParenLoc, ArrayRef< concepts::Requirement * > Requirements, SourceLocation RBraceLoc)
ReturnStmt - This represents a return, optionally of an expression: return; return 4;.
static SEHFinallyStmt * Create(const ASTContext &C, SourceLocation FinallyLoc, Stmt *Block)
Represents a __leave statement.
SYCLKernelCallStmt represents the transformation that is applied to the body of a function declared w...
Smart pointer class that efficiently represents Objective-C method names.
SemaDiagnosticBuilder Diag(SourceLocation Loc, unsigned DiagID)
Emit a diagnostic.
VarDecl * BuildObjCExceptionDecl(TypeSourceInfo *TInfo, QualType ExceptionType, SourceLocation StartLoc, SourceLocation IdLoc, const IdentifierInfo *Id, bool Invalid=false)
Build a type-check a new Objective-C exception variable declaration.
StmtResult ActOnObjCForCollectionStmt(SourceLocation ForColLoc, Stmt *First, Expr *collection, SourceLocation RParenLoc)
StmtResult FinishObjCForCollectionStmt(Stmt *ForCollection, Stmt *Body)
FinishObjCForCollectionStmt - Attach the body to a objective-C foreach statement.
ExprResult BuildObjCDictionaryLiteral(SourceRange SR, MutableArrayRef< ObjCDictionaryElement > Elements)
StmtResult ActOnObjCAtSynchronizedStmt(SourceLocation AtLoc, Expr *SynchExpr, Stmt *SynchBody)
ExprResult BuildObjCArrayLiteral(SourceRange SR, MultiExprArg Elements)
ExprResult BuildObjCBoxedExpr(SourceRange SR, Expr *ValueExpr)
BuildObjCBoxedExpr - builds an ObjCBoxedExpr AST node for the '@' prefixed parenthesized expression.
StmtResult ActOnObjCAtTryStmt(SourceLocation AtLoc, Stmt *Try, MultiStmtArg Catch, Stmt *Finally)
StmtResult ActOnObjCAtFinallyStmt(SourceLocation AtLoc, Stmt *Body)
StmtResult BuildObjCAtThrowStmt(SourceLocation AtLoc, Expr *Throw)
ExprResult ActOnObjCAtSynchronizedOperand(SourceLocation atLoc, Expr *operand)
ExprResult BuildObjCBridgedCast(SourceLocation LParenLoc, ObjCBridgeCastKind Kind, SourceLocation BridgeKeywordLoc, TypeSourceInfo *TSInfo, Expr *SubExpr)
StmtResult ActOnObjCAtCatchStmt(SourceLocation AtLoc, SourceLocation RParen, Decl *Parm, Stmt *Body)
StmtResult ActOnObjCAutoreleasePoolStmt(SourceLocation AtLoc, Stmt *Body)
ExprResult BuildObjCSubscriptExpression(SourceLocation RB, Expr *BaseExpr, Expr *IndexExpr, ObjCMethodDecl *getterMethod, ObjCMethodDecl *setterMethod)
Build an ObjC subscript pseudo-object expression, given that that's supported by the runtime.
Helper type for the registration/assignment of constructs that need to 'know' about their parent cons...
Helper type to restore the state of various 'loop' constructs when we run into a loop (for,...
A type to represent all the data for an OpenACC Clause that has been parsed, but not yet created/sema...
void ActOnWhileStmt(SourceLocation WhileLoc)
ExprResult ActOnOpenACCAsteriskSizeExpr(SourceLocation AsteriskLoc)
void ActOnDoStmt(SourceLocation DoLoc)
void ActOnRangeForStmtBegin(SourceLocation ForLoc, const Stmt *OldRangeFor, const Stmt *RangeFor)
StmtResult ActOnEndStmtDirective(OpenACCDirectiveKind K, SourceLocation StartLoc, SourceLocation DirLoc, SourceLocation LParenLoc, SourceLocation MiscLoc, ArrayRef< Expr * > Exprs, OpenACCAtomicKind AK, SourceLocation RParenLoc, SourceLocation EndLoc, ArrayRef< OpenACCClause * > Clauses, StmtResult AssocStmt)
Called after the directive has been completely parsed, including the declaration group or associated ...
void ActOnForStmtEnd(SourceLocation ForLoc, StmtResult Body)
void ActOnForStmtBegin(SourceLocation ForLoc, const Stmt *First, const Stmt *Second, const Stmt *Third)
ExprResult ActOnArraySectionExpr(Expr *Base, SourceLocation LBLoc, Expr *LowerBound, SourceLocation ColonLocFirst, Expr *Length, SourceLocation RBLoc)
Checks and creates an Array Section used in an OpenACC construct/clause.
OMPClause * ActOnOpenMPNocontextClause(Expr *Condition, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'nocontext' clause.
OMPClause * ActOnOpenMPXDynCGroupMemClause(Expr *Size, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on a well-formed 'ompx_dyn_cgroup_mem' clause.
OMPClause * ActOnOpenMPSafelenClause(Expr *Length, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'safelen' clause.
OMPClause * ActOnOpenMPHoldsClause(Expr *E, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'holds' clause.
OMPClause * ActOnOpenMPFilterClause(Expr *ThreadID, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'filter' clause.
OMPClause * ActOnOpenMPFullClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-form 'full' clauses.
OMPClause * ActOnOpenMPDetachClause(Expr *Evt, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'detach' clause.
OMPClause * ActOnOpenMPUseClause(Expr *InteropVar, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation VarLoc, SourceLocation EndLoc)
Called on well-formed 'use' clause.
OMPClause * ActOnOpenMPPrivateClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'private' clause.
OMPClause * ActOnOpenMPOrderedClause(SourceLocation StartLoc, SourceLocation EndLoc, SourceLocation LParenLoc=SourceLocation(), Expr *NumForLoops=nullptr)
Called on well-formed 'ordered' clause.
OMPClause * ActOnOpenMPIsDevicePtrClause(ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs)
Called on well-formed 'is_device_ptr' clause.
OMPClause * ActOnOpenMPHasDeviceAddrClause(ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs)
Called on well-formed 'has_device_addr' clause.
OMPClause * ActOnOpenMPPartialClause(Expr *FactorExpr, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-form 'partial' clauses.
OMPClause * ActOnOpenMPLastprivateClause(ArrayRef< Expr * > VarList, OpenMPLastprivateModifier LPKind, SourceLocation LPKindLoc, SourceLocation ColonLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'lastprivate' clause.
OMPClause * ActOnOpenMPFirstprivateClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'firstprivate' clause.
OMPClause * ActOnOpenMPPriorityClause(Expr *Priority, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'priority' clause.
OMPClause * ActOnOpenMPDistScheduleClause(OpenMPDistScheduleClauseKind Kind, Expr *ChunkSize, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation KindLoc, SourceLocation CommaLoc, SourceLocation EndLoc)
Called on well-formed 'dist_schedule' clause.
OMPClause * ActOnOpenMPLoopRangeClause(Expr *First, Expr *Count, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation FirstLoc, SourceLocation CountLoc, SourceLocation EndLoc)
Called on well-form 'looprange' clause after parsing its arguments.
OMPClause * ActOnOpenMPPermutationClause(ArrayRef< Expr * > PermExprs, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-form 'permutation' clause after parsing its arguments.
OMPClause * ActOnOpenMPNontemporalClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'nontemporal' clause.
OMPClause * ActOnOpenMPBindClause(OpenMPBindClauseKind Kind, SourceLocation KindLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on a well-formed 'bind' clause.
OMPClause * ActOnOpenMPThreadLimitClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'thread_limit' clause.
OMPClause * ActOnOpenMPSharedClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'shared' clause.
OMPClause * ActOnOpenMPCopyinClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'copyin' clause.
OMPClause * ActOnOpenMPDestroyClause(Expr *InteropVar, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation VarLoc, SourceLocation EndLoc)
Called on well-formed 'destroy' clause.
OMPClause * ActOnOpenMPAffinityClause(SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc, Expr *Modifier, ArrayRef< Expr * > Locators)
Called on well-formed 'affinity' clause.
OMPClause * ActOnOpenMPNumTeamsClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'num_teams' clause.
OMPClause * ActOnOpenMPDependClause(const OMPDependClause::DependDataTy &Data, Expr *DepModifier, ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'depend' clause.
OMPClause * ActOnOpenMPDoacrossClause(OpenMPDoacrossClauseModifier DepType, SourceLocation DepLoc, SourceLocation ColonLoc, ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'doacross' clause.
OMPClause * ActOnOpenMPUseDevicePtrClause(ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs, OpenMPUseDevicePtrFallbackModifier FallbackModifier, SourceLocation FallbackModifierLoc)
Called on well-formed 'use_device_ptr' clause.
OMPClause * ActOnOpenMPGrainsizeClause(OpenMPGrainsizeClauseModifier Modifier, Expr *Size, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ModifierLoc, SourceLocation EndLoc)
Called on well-formed 'grainsize' clause.
ExprResult ActOnOMPArraySectionExpr(Expr *Base, SourceLocation LBLoc, Expr *LowerBound, SourceLocation ColonLocFirst, SourceLocation ColonLocSecond, Expr *Length, Expr *Stride, SourceLocation RBLoc)
ExprResult ActOnOMPIteratorExpr(Scope *S, SourceLocation IteratorKwLoc, SourceLocation LLoc, SourceLocation RLoc, ArrayRef< OMPIteratorData > Data)
OMPClause * ActOnOpenMPUsesAllocatorClause(SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc, ArrayRef< UsesAllocatorsData > Data)
Called on well-formed 'uses_allocators' clause.
OMPClause * ActOnOpenMPAllocatorClause(Expr *Allocator, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'allocator' clause.
OMPClause * ActOnOpenMPInclusiveClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'inclusive' clause.
OMPClause * ActOnOpenMPTaskReductionClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc, CXXScopeSpec &ReductionIdScopeSpec, const DeclarationNameInfo &ReductionId, ArrayRef< Expr * > UnresolvedReductions={})
Called on well-formed 'task_reduction' clause.
OMPClause * ActOnOpenMPNowaitClause(SourceLocation StartLoc, SourceLocation EndLoc, SourceLocation LParenLoc, Expr *Condition)
Called on well-formed 'nowait' clause.
OMPClause * ActOnOpenMPOrderClause(OpenMPOrderClauseModifier Modifier, OpenMPOrderClauseKind Kind, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation MLoc, SourceLocation KindLoc, SourceLocation EndLoc)
Called on well-formed 'order' clause.
OMPClause * ActOnOpenMPSizesClause(ArrayRef< Expr * > SizeExprs, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-form 'sizes' clause.
OMPClause * ActOnOpenMPDeviceClause(OpenMPDeviceClauseModifier Modifier, Expr *Device, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ModifierLoc, SourceLocation EndLoc)
Called on well-formed 'device' clause.
OMPClause * 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 * ActOnOpenMPProcBindClause(llvm::omp::ProcBindKind Kind, SourceLocation KindLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'proc_bind' clause.
OMPClause * ActOnOpenMPXBareClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on a well-formed 'ompx_bare' clause.
StmtResult ActOnOpenMPInformationalDirective(OpenMPDirectiveKind Kind, const DeclarationNameInfo &DirName, ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Process an OpenMP informational directive.
StmtResult ActOnOpenMPCanonicalLoop(Stmt *AStmt)
Called for syntactical loops (ForStmt or CXXForRangeStmt) associated to an OpenMP loop directive.
OMPClause * ActOnOpenMPTransparentClause(Expr *Transparent, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'transparent' clause.
OMPClause * ActOnOpenMPHintClause(Expr *Hint, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'hint' clause.
ExprResult ActOnOMPArrayShapingExpr(Expr *Base, SourceLocation LParenLoc, SourceLocation RParenLoc, ArrayRef< Expr * > Dims, ArrayRef< SourceRange > Brackets)
OMPClause * ActOnOpenMPNumThreadsClause(OpenMPNumThreadsClauseModifier Modifier, Expr *NumThreads, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ModifierLoc, SourceLocation EndLoc)
Called on well-formed 'num_threads' clause.
OMPClause * ActOnOpenMPAtClause(OpenMPAtClauseKind Kind, SourceLocation KindLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'at' clause.
OMPClause * ActOnOpenMPInitClause(Expr *InteropVar, OMPInteropInfo &InteropInfo, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation VarLoc, SourceLocation EndLoc)
Called on well-formed 'init' clause.
OMPClause * ActOnOpenMPUseDeviceAddrClause(ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs)
Called on well-formed 'use_device_addr' clause.
OMPClause * ActOnOpenMPAllocateClause(Expr *Allocator, Expr *Alignment, OpenMPAllocateClauseModifier FirstModifier, SourceLocation FirstModifierLoc, OpenMPAllocateClauseModifier SecondModifier, SourceLocation SecondModifierLoc, ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation ColonLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'allocate' clause.
OMPClause * ActOnOpenMPFinalClause(Expr *Condition, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'final' clause.
OMPClause * ActOnOpenMPMapClause(Expr *IteratorModifier, ArrayRef< OpenMPMapModifierKind > MapTypeModifiers, ArrayRef< SourceLocation > MapTypeModifiersLoc, CXXScopeSpec &MapperIdScopeSpec, DeclarationNameInfo &MapperId, OpenMPMapClauseKind MapType, bool IsMapTypeImplicit, SourceLocation MapLoc, SourceLocation ColonLoc, ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs, bool NoDiagnose=false, ArrayRef< Expr * > UnresolvedMappers={})
Called on well-formed 'map' clause.
OMPClause * ActOnOpenMPNumTasksClause(OpenMPNumTasksClauseModifier Modifier, Expr *NumTasks, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ModifierLoc, SourceLocation EndLoc)
Called on well-formed 'num_tasks' clause.
OMPClause * ActOnOpenMPFromClause(ArrayRef< OpenMPMotionModifierKind > MotionModifiers, ArrayRef< SourceLocation > MotionModifiersLoc, Expr *IteratorModifier, CXXScopeSpec &MapperIdScopeSpec, DeclarationNameInfo &MapperId, SourceLocation ColonLoc, ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs, ArrayRef< Expr * > UnresolvedMappers={})
Called on well-formed 'from' clause.
OMPClause * ActOnOpenMPDynGroupprivateClause(OpenMPDynGroupprivateClauseModifier M1, OpenMPDynGroupprivateClauseFallbackModifier M2, Expr *Size, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation M1Loc, SourceLocation M2Loc, SourceLocation EndLoc)
Called on a well-formed 'dyn_groupprivate' clause.
void StartOpenMPDSABlock(OpenMPDirectiveKind K, const DeclarationNameInfo &DirName, Scope *CurScope, SourceLocation Loc)
Called on start of new data sharing attribute block.
OMPClause * ActOnOpenMPSeverityClause(OpenMPSeverityClauseKind Kind, SourceLocation KindLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'severity' clause.
OMPClause * ActOnOpenMPToClause(ArrayRef< OpenMPMotionModifierKind > MotionModifiers, ArrayRef< SourceLocation > MotionModifiersLoc, Expr *IteratorModifier, CXXScopeSpec &MapperIdScopeSpec, DeclarationNameInfo &MapperId, SourceLocation ColonLoc, ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs, ArrayRef< Expr * > UnresolvedMappers={})
Called on well-formed 'to' clause.
OMPClause * ActOnOpenMPLinearClause(ArrayRef< Expr * > VarList, Expr *Step, SourceLocation StartLoc, SourceLocation LParenLoc, OpenMPLinearClauseKind LinKind, SourceLocation LinLoc, SourceLocation ColonLoc, SourceLocation StepModifierLoc, SourceLocation EndLoc)
Called on well-formed 'linear' clause.
OMPClause * ActOnOpenMPDefaultmapClause(OpenMPDefaultmapClauseModifier M, OpenMPDefaultmapClauseKind Kind, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation MLoc, SourceLocation KindLoc, SourceLocation EndLoc)
Called on well-formed 'defaultmap' clause.
OMPClause * ActOnOpenMPReductionClause(ArrayRef< Expr * > VarList, OpenMPVarListDataTy::OpenMPReductionClauseModifiers Modifiers, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ModifierLoc, SourceLocation ColonLoc, SourceLocation EndLoc, CXXScopeSpec &ReductionIdScopeSpec, const DeclarationNameInfo &ReductionId, ArrayRef< Expr * > UnresolvedReductions={})
Called on well-formed 'reduction' clause.
OMPClause * ActOnOpenMPAlignedClause(ArrayRef< Expr * > VarList, Expr *Alignment, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc)
Called on well-formed 'aligned' clause.
OMPClause * ActOnOpenMPDepobjClause(Expr *Depobj, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'depobj' pseudo clause.
OMPClause * ActOnOpenMPNovariantsClause(Expr *Condition, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'novariants' clause.
OMPClause * ActOnOpenMPCopyprivateClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'copyprivate' clause.
OMPClause * ActOnOpenMPCollapseClause(Expr *NumForLoops, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'collapse' clause.
OMPClause * ActOnOpenMPDefaultClause(llvm::omp::DefaultKind M, SourceLocation MLoc, OpenMPDefaultClauseVariableCategory VCKind, SourceLocation VCKindLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'default' clause.
OMPClause * ActOnOpenMPAlignClause(Expr *Alignment, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'align' clause.
OMPClause * ActOnOpenMPXAttributeClause(ArrayRef< const Attr * > Attrs, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on a well-formed 'ompx_attribute' clause.
OMPClause * ActOnOpenMPExclusiveClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'exclusive' clause.
OMPClause * ActOnOpenMPIfClause(OpenMPDirectiveKind NameModifier, Expr *Condition, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation NameModifierLoc, SourceLocation ColonLoc, SourceLocation EndLoc)
Called on well-formed 'if' clause.
Expr * recreateSyntacticForm(PseudoObjectExpr *E)
Given a pseudo-object expression, recreate what it looks like syntactically without the attendant Opa...
ExprResult checkRValue(Expr *E)
StmtResult BuildSYCLKernelCallStmt(FunctionDecl *FD, CompoundStmt *Body, Expr *LaunchIdExpr)
Builds a SYCLKernelCallStmt to wrap 'Body' and to be used as the body of 'FD'.
ExprResult BuildUniqueStableNameExpr(SourceLocation OpLoc, SourceLocation LParen, SourceLocation RParen, TypeSourceInfo *TSI)
RAII object used to change the argument pack substitution index within a Sema object.
RAII object used to temporarily allow the C++ 'this' expression to be used, with the given qualifiers...
A RAII object to enter scope of a compound statement.
A helper class for building up ExtParameterInfos.
const FunctionProtoType::ExtParameterInfo * getPointerOrNull(unsigned numParams)
Return a pointer (suitable for setting in an ExtProtoInfo) to the ExtParameterInfo array we've built ...
void set(unsigned index, FunctionProtoType::ExtParameterInfo info)
Set the ExtParameterInfo for the parameter at the given index,.
Records and restores the CurFPFeatures state on entry/exit of compound statements.
Sema - This implements semantic analysis and AST building for C.
ParsedType CreateParsedType(QualType T, TypeSourceInfo *TInfo)
Package the given type and TSI into a ParsedType.
ExprResult ActOnCXXParenListInitExpr(ArrayRef< Expr * > Args, QualType T, unsigned NumUserSpecifiedExprs, SourceLocation InitLoc, SourceLocation LParenLoc, SourceLocation RParenLoc)
ExprResult BuildOperatorCoawaitCall(SourceLocation Loc, Expr *E, UnresolvedLookupExpr *Lookup)
Build a call to 'operator co_await' if there is a suitable operator for the given expression.
ExprResult BuildMemberReferenceExpr(Expr *Base, QualType BaseType, SourceLocation OpLoc, bool IsArrow, CXXScopeSpec &SS, SourceLocation TemplateKWLoc, NamedDecl *FirstQualifierInScope, const DeclarationNameInfo &NameInfo, const TemplateArgumentListInfo *TemplateArgs, const Scope *S, ActOnMemberAccessExtraArgs *ExtraArgs=nullptr)
StmtResult BuildMSDependentExistsStmt(SourceLocation KeywordLoc, bool IsIfExists, NestedNameSpecifierLoc QualifierLoc, DeclarationNameInfo NameInfo, Stmt *Nested)
@ LookupOrdinaryName
Ordinary name lookup, which finds ordinary names (functions, variables, typedefs, etc....
@ LookupMemberName
Member name lookup, which finds the names of class/struct/union members.
@ LookupTagName
Tag name lookup, which finds the names of enums, classes, structs, and unions.
bool checkFinalSuspendNoThrow(const Stmt *FinalSuspend)
Check that the expression co_await promise.final_suspend() shall not be potentially-throwing.
ExprResult CreateBuiltinMatrixSingleSubscriptExpr(Expr *Base, Expr *RowIdx, SourceLocation RBLoc)
ExprResult ActOnConstantExpression(ExprResult Res)
StmtResult ActOnMSAsmStmt(SourceLocation AsmLoc, SourceLocation LBraceLoc, ArrayRef< Token > AsmToks, StringRef AsmString, unsigned NumOutputs, unsigned NumInputs, ArrayRef< StringRef > Constraints, ArrayRef< StringRef > Clobbers, ArrayRef< Expr * > Exprs, SourceLocation EndLoc)
StmtResult BuildCoroutineBodyStmt(CoroutineBodyStmt::CtorArgs)
ExprResult BuildCoyieldExpr(SourceLocation KwLoc, Expr *E)
void ActOnStartStmtExpr()
void ActOnStmtExprError()
void MarkDeclarationsReferencedInExpr(Expr *E, bool SkipLocalVariables=false, ArrayRef< const Expr * > StopAt={})
Mark any declarations that appear within this expression or any potentially-evaluated subexpressions ...
VarDecl * buildCoroutinePromise(SourceLocation Loc)
ExprResult CheckBooleanCondition(SourceLocation Loc, Expr *E, bool IsConstexpr=false)
CheckBooleanCondition - Diagnose problems involving the use of the given expression as a boolean cond...
@ Boolean
A boolean condition, from 'if', 'while', 'for', or 'do'.
@ Switch
An integral condition for a 'switch' statement.
@ ConstexprIf
A constant boolean condition from 'if constexpr'.
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)
bool RequireCompleteType(SourceLocation Loc, QualType T, CompleteTypeKind Kind, TypeDiagnoser &Diagnoser)
Ensure that the type T is a complete type.
ExprResult PerformObjectMemberConversion(Expr *From, NestedNameSpecifier Qualifier, NamedDecl *FoundDecl, NamedDecl *Member)
Cast a base object to a member's actual type.
Expr * MaybeCreateExprWithCleanups(Expr *SubExpr)
MaybeCreateExprWithCleanups - If the current full-expression requires any cleanups,...
SmallVector< ExpressionEvaluationContextRecord, 8 > ExprEvalContexts
A stack of expression evaluation contexts.
ExprResult BuildEmptyCXXFoldExpr(SourceLocation EllipsisLoc, BinaryOperatorKind Operator)
ExprResult BuildCXXThrow(SourceLocation OpLoc, Expr *Ex, bool IsThrownVarInScope)
ExprResult 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 ...
llvm::json::Object Object
The JSON file list parser is used to communicate input to InstallAPI.
CanQual< Type > CanQualType
Represents a canonical, potentially-qualified type.
OpenMPOriginalSharingModifier
OpenMP 6.0 original sharing modifiers.
OverloadedOperatorKind
Enumeration specifying the different kinds of C++ overloaded operators.
@ OO_None
Not an overloaded operator.
@ NUM_OVERLOADED_OPERATORS
bool isa(CodeGen::Address addr)
ArrayTypeTrait
Names for the array type traits.
OpenMPDefaultClauseVariableCategory
OpenMP variable-category for 'default' clause.
AutoTypeKeyword
Which keyword(s) were used to create an AutoType.
OpenMPDefaultmapClauseModifier
OpenMP modifiers for 'defaultmap' clause.
OpenMPOrderClauseModifier
OpenMP modifiers for 'order' clause.
@ Ambiguous
Name lookup results in an ambiguity; use getAmbiguityKind to figure out what kind of ambiguity we hav...
@ NotFound
No entity found met the criteria.
@ FoundOverloaded
Name lookup found a set of overloaded functions that met the criteria.
@ Found
Name lookup found a single declaration that met the criteria.
@ FoundUnresolvedValue
Name lookup found an unresolvable value declaration and cannot yet complete.
@ NotFoundInCurrentInstantiation
No entity found met the criteria within the current instantiation,, but there were dependent base cla...
IfStatementKind
In an if statement, this denotes whether the statement is a constexpr or consteval if statement.
@ TemplateName
The identifier is a template name. FIXME: Add an annotation for that.
@ OK_ObjCProperty
An Objective-C property is a logical field of an Objective-C object which is read and written via Obj...
OpenMPAtClauseKind
OpenMP attributes for 'at' clause.
@ LCK_ByCopy
Capturing by copy (a.k.a., by value)
@ LCK_ByRef
Capturing by reference.
@ LCK_StarThis
Capturing the *this object by copy.
NonTagKind
Common ways to introduce type names without a tag for use in diagnostics.
OpenMPReductionClauseModifier
OpenMP modifiers for 'reduction' clause.
std::pair< llvm::PointerUnion< const TemplateTypeParmType *, NamedDecl *, const TemplateSpecializationType *, const SubstBuiltinTemplatePackType * >, SourceLocation > UnexpandedParameterPack
@ DevicePtr
'deviceptr' clause, allowed on Compute and Combined Constructs, plus 'data' and 'declare'.
@ Invalid
Represents an invalid clause, for the purposes of parsing.
@ Attach
'attach' clause, allowed on Compute and Combined constructs, plus 'data' and 'enter data'.
@ Self
'self' clause, allowed on Compute and Combined Constructs, plus 'update'.
@ Detach
'detach' clause, allowed on the 'exit data' construct.
TypeOfKind
The kind of 'typeof' expression we're after.
OpenMPScheduleClauseModifier
OpenMP modifiers for 'schedule' clause.
OpenACCComputeConstruct(OpenACCDirectiveKind K, SourceLocation Start, SourceLocation DirectiveLoc, SourceLocation End, ArrayRef< const OpenACCClause * > Clauses, Stmt *StructuredBlock)
OpenMPDistScheduleClauseKind
OpenMP attributes for 'dist_schedule' clause.
OpenMPDoacrossClauseModifier
OpenMP dependence types for 'doacross' clause.
@ Dependent
Parse the block as a dependent block, which may be used in some template instantiations but not other...
UnaryExprOrTypeTrait
Names for the "expression or type" traits.
std::pair< NullabilityKind, bool > DiagNullabilityKind
A nullability kind paired with a bit indicating whether it used a context-sensitive keyword.
OpenMPDynGroupprivateClauseFallbackModifier
MutableArrayRef< Expr * > MultiExprArg
@ Property
The type of a property.
@ Result
The result type of a method or function.
OpenMPBindClauseKind
OpenMP bindings for the 'bind' clause.
ArraySizeModifier
Capture whether this is a normal array (e.g.
bool isComputedNoexcept(ExceptionSpecificationType ESpecType)
OpenMPLastprivateModifier
OpenMP 'lastprivate' clause modifier.
@ Template
We are parsing a template declaration.
ActionResult< CXXBaseSpecifier * > BaseResult
OpenMPGrainsizeClauseModifier
OpenMPNumTasksClauseModifier
TagTypeKind
The kind of a tag type.
bool transformOMPMappableExprListClause(TreeTransform< Derived > &TT, OMPMappableExprListClause< T > *C, llvm::SmallVectorImpl< Expr * > &Vars, CXXScopeSpec &MapperIdScopeSpec, DeclarationNameInfo &MapperIdInfo, llvm::SmallVectorImpl< Expr * > &UnresolvedMappers)
OpenMPUseDevicePtrFallbackModifier
OpenMP 6.1 use_device_ptr fallback modifier.
@ Keyword
The name has been typo-corrected to a keyword.
bool isOpenMPLoopDirective(OpenMPDirectiveKind DKind)
Checks if the specified directive is a directive with an associated loop construct.
OpenMPSeverityClauseKind
OpenMP attributes for 'severity' clause.
std::tuple< NamedDecl *, TemplateArgument > getReplacedTemplateParameter(Decl *D, unsigned Index)
Internal helper used by Subst* nodes to retrieve a parameter from the AssociatedDecl,...
OpenMPDefaultmapClauseKind
OpenMP attributes for 'defaultmap' clause.
OpenMPAllocateClauseModifier
OpenMP modifiers for 'allocate' clause.
OpenMPLinearClauseKind
OpenMP attributes for 'linear' clause.
llvm::omp::Directive OpenMPDirectiveKind
OpenMP directives.
OpenMPDynGroupprivateClauseModifier
@ VK_PRValue
A pr-value expression (in the C++11 taxonomy) produces a temporary value.
@ VK_LValue
An l-value expression is a reference to an object with independent storage.
@ Dependent
The name is a dependent name, so the results will differ from one instantiation to the next.
@ Exists
The symbol exists.
@ Error
An error occurred.
@ DoesNotExist
The symbol does not exist.
MutableArrayRef< Stmt * > MultiStmtArg
OpenMPNumThreadsClauseModifier
U cast(CodeGen::Address addr)
OpenMPDeviceClauseModifier
OpenMP modifiers for 'device' clause.
OpaquePtr< QualType > ParsedType
An opaque type for threading parsed type information through the parser.
ElaboratedTypeKeyword
The elaboration keyword that precedes a qualified type name or introduces an elaborated-type-specifie...
@ None
No keyword precedes the qualified type name.
@ Class
The "class" keyword introduces the elaborated-type-specifier.
@ Typename
The "typename" keyword precedes the qualified type name, e.g., typename T::type.
ActionResult< Expr * > ExprResult
OpenMPOrderClauseKind
OpenMP attributes for 'order' clause.
TypeTrait
Names for traits that operate specifically on types.
@ Parens
New-expression has a C++98 paren-delimited initializer.
ExceptionSpecificationType
The various types of exception specifications that exist in C++11.
@ EST_Uninstantiated
not instantiated yet
@ EST_Unevaluated
not evaluated yet, for special member function
@ EST_Dynamic
throw(T1, T2)
OpenMPScheduleClauseKind
OpenMP attributes for 'schedule' clause.
static QualType TransformTypeSpecType(TypeLocBuilder &TLB, TyLoc T)
ActionResult< Stmt * > StmtResult
OpenMPMapClauseKind
OpenMP mapping kind for 'map' clause.
Expr * AllocatorTraits
Allocator traits.
Expr * Allocator
Allocator.
SourceLocation LParenLoc
Locations of '(' and ')' symbols.
The result of a constraint satisfaction check, containing the necessary information to diagnose an un...
Represents an explicit template argument list in C++, e.g., the "<int>" in "sort<int>".
static const ASTTemplateArgumentListInfo * Create(const ASTContext &C, const TemplateArgumentListInfo &List)
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].
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