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,
1145 return SemaRef.Context.getAutoType(
1146 DK, DeducedAsType,
Keyword, TypeConstraintConcept, TypeConstraintArgs);
1154 return SemaRef.Context.getDeducedTemplateSpecializationType(
1173 return SemaRef.BuildParenType(InnerType);
1186 bool DeducedTSTContext) {
1188 SS.
Adopt(QualifierLoc);
1192 if (!
SemaRef.computeDeclContext(SS))
1200 return SemaRef.CheckTypenameType(
Keyword, KeywordLoc, QualifierLoc,
1201 *Id, IdLoc, DeducedTSTContext);
1214 if (
SemaRef.RequireCompleteDeclContext(SS, DC))
1219 switch (
Result.getResultKind()) {
1230 llvm_unreachable(
"Tag lookup cannot find non-tags");
1242 switch (
Result.getResultKind()) {
1248 SemaRef.Diag(IdLoc, diag::err_tag_reference_non_tag)
1249 << SomeDecl << NTK << Kind;
1254 SemaRef.Diag(IdLoc, diag::err_not_tag_in_scope)
1260 if (!
SemaRef.isAcceptableTagRedeclaration(Tag, Kind,
false,
1262 SemaRef.Diag(KeywordLoc, diag::err_use_with_wrong_tag) << Id;
1263 SemaRef.Diag(Tag->getLocation(), diag::note_previous_use);
1319 bool AllowInjectedClassName);
1332 bool AllowInjectedClassName);
1338 bool AllowInjectedClassName);
1348 Decl *AssociatedDecl,
unsigned Index,
1351 ArgPack, AssociatedDecl, Index, Final);
1405 return SemaRef.ActOnLabelStmt(IdentLoc, L, ColonLoc, SubStmt);
1415 if (
SemaRef.CheckRebuiltStmtAttributes(Attrs))
1417 return SemaRef.BuildAttributedStmt(AttrLoc, Attrs, SubStmt);
1429 Then, ElseLoc, Else);
1483 Inc, RParenLoc, Body);
1528 bool IsVolatile,
unsigned NumOutputs,
1535 NumInputs, Names, Constraints, Exprs,
1536 AsmString, Clobbers, NumLabels, RParenLoc);
1545 StringRef AsmString,
1546 unsigned NumOutputs,
unsigned NumInputs,
1552 NumOutputs, NumInputs,
1553 Constraints, Clobbers, Exprs, EndLoc);
1582 CoawaitLoc, Operand, OpCoawaitLookup);
1586 Suspend.
get(),
true);
1687 Kind, DirName, CancelRegion, Clauses, AStmt, StartLoc, EndLoc);
1699 Kind, DirName, Clauses, AStmt, StartLoc, EndLoc);
1713 NameModifier,
Condition, StartLoc, LParenLoc, NameModifierLoc, ColonLoc,
1739 Modifier, NumThreads, StartLoc, LParenLoc, ModifierLoc, EndLoc);
1800 First, Count, StartLoc, LParenLoc, FirstLoc, CountLoc, EndLoc);
1836 Kind, KindKwLoc, VCKind, VCLoc, StartLoc, LParenLoc, EndLoc);
1849 Kind, KindKwLoc, StartLoc, LParenLoc, EndLoc);
1856 ImpexTypeArg, StartLoc, LParenLoc, EndLoc);
1869 M1, M2, Kind, ChunkSize, StartLoc, LParenLoc, M1Loc, M2Loc, KindLoc,
1931 VarList, LPKind, LPKindLoc, ColonLoc, StartLoc, LParenLoc, EndLoc);
1959 VarList, {Modifier, OriginalSharingModifier}, StartLoc, LParenLoc,
1960 ModifierLoc, ColonLoc, EndLoc, ReductionIdScopeSpec, ReductionId,
1961 UnresolvedReductions);
1975 VarList, StartLoc, LParenLoc, ColonLoc, EndLoc, ReductionIdScopeSpec,
1976 ReductionId, UnresolvedReductions);
1991 VarList, StartLoc, LParenLoc, ColonLoc, EndLoc, ReductionIdScopeSpec,
1992 ReductionId, UnresolvedReductions);
2005 VarList, Step, StartLoc, LParenLoc, Modifier, ModifierLoc, ColonLoc,
2006 StepModifierLoc, EndLoc);
2019 VarList, Alignment, StartLoc, LParenLoc, ColonLoc, EndLoc);
2079 Data, DepModifier, VarList, StartLoc, LParenLoc, EndLoc);
2092 Modifier,
Device, StartLoc, LParenLoc, ModifierLoc, EndLoc);
2107 IteratorModifier, MapTypeModifiers, MapTypeModifiersLoc,
2108 MapperIdScopeSpec, MapperId, MapType, IsMapTypeImplicit, MapLoc,
2109 ColonLoc, VarList, Locs,
2110 false, UnresolvedMappers);
2127 Allocate, Alignment, FirstModifier, FirstModifierLoc, SecondModifier,
2128 SecondModifierLoc, VarList, StartLoc, LParenLoc, ColonLoc, EndLoc);
2176 Modifier,
Device, StartLoc, LParenLoc, ModifierLoc, EndLoc);
2189 Modifier, NumTasks, StartLoc, LParenLoc, ModifierLoc, EndLoc);
2224 Kind, ChunkSize, StartLoc, LParenLoc, KindLoc, CommaLoc, EndLoc);
2239 MotionModifiers, MotionModifiersLoc, IteratorModifier,
2240 MapperIdScopeSpec, MapperId, ColonLoc, VarList, Locs,
2256 MotionModifiers, MotionModifiersLoc, IteratorModifier,
2257 MapperIdScopeSpec, MapperId, ColonLoc, VarList, Locs,
2270 VarList, Locs, FallbackModifier, FallbackModifierLoc);
2312 M, Kind, StartLoc, LParenLoc, MLoc, KindLoc, EndLoc);
2359 StartLoc, LParenLoc, EndLoc,
Data);
2372 StartLoc, LParenLoc, ColonLoc, EndLoc, Modifier, Locators);
2384 Modifier, Kind, StartLoc, LParenLoc, ModifierKwLoc, KindKwLoc, EndLoc);
2397 InteropVar, InteropInfo, StartLoc, LParenLoc, VarLoc, EndLoc);
2408 LParenLoc, VarLoc, EndLoc);
2420 InteropVar, StartLoc, LParenLoc, VarLoc, EndLoc);
2491 M1, M2, Size, StartLoc, LParenLoc, M1Loc, M2Loc, EndLoc);
2572 DepType, DepLoc, ColonLoc, VarList, StartLoc, LParenLoc, EndLoc);
2620 ForLoc, Element, Collection, RParenLoc);
2638 StartLoc, IdLoc, Id);
2675 if (
DeclStmt *RangeStmt = dyn_cast<DeclStmt>(Range)) {
2676 if (RangeStmt->isSingleDecl()) {
2677 if (
VarDecl *RangeVar = dyn_cast<VarDecl>(RangeStmt->getSingleDecl())) {
2678 if (RangeVar->isInvalidDecl())
2681 Expr *RangeExpr = RangeVar->getInit();
2688 diag::err_objc_for_range_init_stmt)
2689 <<
Init->getSourceRange();
2692 ForLoc, LoopVar, RangeExpr, RParenLoc);
2699 ForLoc, CoawaitLoc,
Init, ColonLoc, Range, Begin, End,
Cond, Inc,
2713 QualifierLoc, NameInfo, Nested);
2775 SS.
Adopt(QualifierLoc);
2897 if (IsOMPArraySection)
2899 Base, LBracketLoc, LowerBound, ColonLocFirst, ColonLocSecond, Length,
2900 Stride, RBracketLoc);
2902 assert(Stride ==
nullptr && !ColonLocSecond.
isValid() &&
2903 "Stride/second colon not allowed for OpenACC");
2906 Base, LBracketLoc, LowerBound, ColonLocFirst, Length, RBracketLoc);
2918 Base, LParenLoc, RParenLoc, Dims, BracketsRanges);
2930 nullptr, IteratorKwLoc, LLoc, RLoc,
Data);
2940 Expr *ExecConfig =
nullptr) {
2942 nullptr, Callee, LParenLoc, Args, RParenLoc, ExecConfig);
2949 nullptr, Callee, LParenLoc, Args, RParenLoc);
2967 if (!
Member->getDeclName()) {
2971 assert(
Member->getType()->isRecordType() &&
2972 "unnamed member not of record type?");
2985 if (!isArrow &&
Base->isPRValue()) {
3000 SS.
Adopt(QualifierLoc);
3003 if (
Base->containsErrors())
3008 if (isArrow && !BaseType->isPointerType())
3014 R.addDecl(FoundDecl);
3017 if (
getSema().isUnevaluatedContext() &&
Base->isImplicitCXXThis() &&
3022 ->getAsCXXRecordDecl()) {
3026 if (!ThisClass->Equals(
Class) && !ThisClass->isDerivedFrom(
Class))
3034 FirstQualifierInScope,
3035 R, ExplicitTemplateArgs,
3045 bool ForFoldExpression =
false) {
3124 return SemaRef.BuildInitList(LBraceLoc,
Inits, RBraceLoc);
3137 =
SemaRef.ActOnDesignatedInitializer(Desig, EqualOrColonLoc, GNUSyntax,
3177 unsigned NumUserSpecifiedExprs,
3182 InitLoc, LParenLoc, RParenLoc);
3212 return SemaRef.ActOnChooseExpr(BuiltinLoc,
3224 Expr *ControllingExpr,
3229 ControllingExpr, Types, Exprs);
3244 ControllingType, Types, Exprs);
3277 case Stmt::CXXStaticCastExprClass:
3278 return getDerived().RebuildCXXStaticCastExpr(OpLoc, LAngleLoc, TInfo,
3279 RAngleLoc, LParenLoc,
3280 SubExpr, RParenLoc);
3282 case Stmt::CXXDynamicCastExprClass:
3283 return getDerived().RebuildCXXDynamicCastExpr(OpLoc, LAngleLoc, TInfo,
3284 RAngleLoc, LParenLoc,
3285 SubExpr, RParenLoc);
3287 case Stmt::CXXReinterpretCastExprClass:
3288 return getDerived().RebuildCXXReinterpretCastExpr(OpLoc, LAngleLoc, TInfo,
3289 RAngleLoc, LParenLoc,
3293 case Stmt::CXXConstCastExprClass:
3294 return getDerived().RebuildCXXConstCastExpr(OpLoc, LAngleLoc, TInfo,
3295 RAngleLoc, LParenLoc,
3296 SubExpr, RParenLoc);
3298 case Stmt::CXXAddrspaceCastExprClass:
3299 return getDerived().RebuildCXXAddrspaceCastExpr(
3300 OpLoc, LAngleLoc, TInfo, RAngleLoc, LParenLoc, SubExpr, RParenLoc);
3303 llvm_unreachable(
"Invalid C++ named cast");
3381 OpLoc, tok::kw_addrspace_cast, TInfo, SubExpr,
3393 bool ListInitialization) {
3397 if (
auto *PLE = dyn_cast<ParenListExpr>(Sub))
3399 TInfo, LParenLoc,
MultiExprArg(PLE->getExprs(), PLE->getNumExprs()),
3400 RParenLoc, ListInitialization);
3402 if (
auto *PLE = dyn_cast<CXXParenListInitExpr>(Sub))
3404 TInfo, LParenLoc, PLE->getInitExprs(), RParenLoc, ListInitialization);
3408 ListInitialization);
3472 if (
getSema().CheckCXXThisType(ThisLoc, ThisType))
3482 bool IsThrownVariableInScope) {
3492 Expr *RewrittenExpr) {
3494 RewrittenExpr,
getSema().CurContext);
3528 std::optional<Expr *> ArraySize,
3547 bool IsGlobalDelete,
3598 bool IsAddressOfOperand,
3601 SS.
Adopt(QualifierLoc);
3603 if (TemplateArgs || TemplateKWLoc.
isValid())
3605 SS, TemplateKWLoc, NameInfo, TemplateArgs, IsAddressOfOperand);
3608 SS, NameInfo, IsAddressOfOperand, RecoveryTSI);
3630 bool IsElidable,
MultiExprArg Args,
bool HadMultipleCandidates,
3631 bool ListInitialization,
bool StdInitListInitialization,
3638 FoundCtor =
Constructor->getInheritedConstructor().getConstructor();
3641 if (
getSema().CompleteConstructorCall(FoundCtor, T, Args, Loc,
3648 HadMultipleCandidates,
3650 StdInitListInitialization,
3651 RequiresZeroInit, ConstructKind,
3659 bool ConstructsVBase,
3660 bool InheritedFromVBase) {
3662 Loc, T,
Constructor, ConstructsVBase, InheritedFromVBase);
3673 bool ListInitialization) {
3675 TSInfo, LParenOrBraceLoc, Args, RParenOrBraceLoc, ListInitialization);
3686 bool ListInitialization) {
3688 RParenLoc, ListInitialization);
3705 SS.
Adopt(QualifierLoc);
3707 return SemaRef.BuildMemberReferenceExpr(BaseE, BaseType,
3708 OperatorLoc, IsArrow,
3710 FirstQualifierInScope,
3712 TemplateArgs,
nullptr);
3728 SS.
Adopt(QualifierLoc);
3730 return SemaRef.BuildMemberReferenceExpr(BaseE, BaseType,
3731 OperatorLoc, IsArrow,
3733 FirstQualifierInScope,
3734 R, TemplateArgs,
nullptr);
3742 return SemaRef.BuildCXXNoexceptExpr(Range.getBegin(), Arg, Range.getEnd());
3755 RParenLoc, Length, PartialArgs);
3760 Expr *PackIdExpression,
Expr *IndexExpr,
3762 bool FullySubstituted =
false) {
3764 IndexExpr, RSquareLoc, ExpandedExprs,
3790 NamedConcept, TALI);
3808 LocalParameters, RParenLoc, Requirements,
3815 return SemaRef.BuildTypeRequirement(SubstDiag);
3819 return SemaRef.BuildTypeRequirement(T);
3827 return SemaRef.BuildExprRequirement(SubstDiag, IsSimple, NoexceptLoc,
3834 return SemaRef.BuildExprRequirement(E, IsSimple, NoexceptLoc,
3841 return SemaRef.BuildNestedRequirement(InvalidConstraintEntity,
3846 return SemaRef.BuildNestedRequirement(Constraint);
3862 Expr **Elements,
unsigned NumElements) {
3872 RB,
Base, Key, getterMethod, setterMethod);
3891 return SemaRef.ObjC().BuildObjCEncodeExpression(AtLoc, EncodeTypeInfo,
3903 return SemaRef.ObjC().BuildClassMessage(
3904 ReceiverTypeInfo, ReceiverTypeInfo->
getType(),
3917 return SemaRef.ObjC().BuildInstanceMessage(Receiver, Receiver->
getType(),
3920 SelectorLocs, RBracLoc, Args);
3932 return Method->isInstanceMethod()
3933 ?
SemaRef.ObjC().BuildInstanceMessage(
3934 nullptr, SuperType, SuperLoc, Sel,
Method, LBracLoc,
3935 SelectorLocs, RBracLoc, Args)
3936 :
SemaRef.ObjC().BuildClassMessage(
nullptr, SuperType, SuperLoc,
3938 SelectorLocs, RBracLoc, Args);
3947 bool IsArrow,
bool IsFreeIvar) {
3956 if (IsFreeIvar &&
Result.isUsable())
3993 PropertyLoc,
Base));
4022 =
SemaRef.Context.Idents.get(
"__builtin_shufflevector");
4025 assert(!Lookup.
empty() &&
"No __builtin_shufflevector?");
4033 Callee =
SemaRef.ImpCastExprToType(Callee, CalleePtrTy,
4034 CK_BuiltinFnToFnPtr).get();
4050 return SemaRef.ConvertVectorExpr(SrcExpr, DstTInfo, BuiltinLoc, RParenLoc);
4065 EllipsisLoc, NumExpansions);
4089 llvm_unreachable(
"Pack expansion pattern has no parameter packs");
4125 EllipsisLoc, RHS, RParenLoc,
4134 Init->containsUnexpandedParameterPack();
4135 else if (PVD->hasUninstantiatedDefaultArg())
4137 PVD->getUninstantiatedDefaultArg()
4138 ->containsUnexpandedParameterPack();
4292 Exprs.push_back(DevNumExpr);
4293 llvm::append_range(Exprs, QueueIdExprs);
4330 AssociatedDecl, NTTP, Loc, Arg, PackIndex, Final);
4354 ObjectType, FirstQualifierInScope);
4360 QualType TransformDependentNameType(TypeLocBuilder &TLB,
4361 DependentNameTypeLoc TL,
4362 bool DeducibleTSTContext,
4363 QualType ObjectType = QualType(),
4364 NamedDecl *UnqualLookup =
nullptr);
4367 TransformOpenACCClauseList(OpenACCDirectiveKind DirKind,
4372 OpenACCDirectiveKind DirKind,
4373 const OpenACCClause *OldClause);
4376template <
typename Derived>
4386#define STMT(Node, Parent) \
4387 case Stmt::Node##Class: return getDerived().Transform##Node(cast<Node>(S));
4388#define VALUESTMT(Node, Parent) \
4389 case Stmt::Node##Class: \
4390 return getDerived().Transform##Node(cast<Node>(S), SDK);
4391#define ABSTRACT_STMT(Node)
4392#define EXPR(Node, Parent)
4393#include "clang/AST/StmtNodes.inc"
4396#define STMT(Node, Parent)
4397#define ABSTRACT_STMT(Stmt)
4398#define EXPR(Node, Parent) case Stmt::Node##Class:
4399#include "clang/AST/StmtNodes.inc"
4404 E =
getSema().ActOnStmtExprResult(E);
4412template<
typename Derived>
4420#define GEN_CLANG_CLAUSE_CLASS
4421#define CLAUSE_CLASS(Enum, Str, Class) \
4423 return getDerived().Transform##Class(cast<Class>(S));
4424#include "llvm/Frontend/OpenMP/OMP.inc"
4431template<
typename Derived>
4438#define STMT(Node, Parent) case Stmt::Node##Class: break;
4439#define ABSTRACT_STMT(Stmt)
4440#define EXPR(Node, Parent) \
4441 case Stmt::Node##Class: return getDerived().Transform##Node(cast<Node>(E));
4442#include "clang/AST/StmtNodes.inc"
4448template<
typename Derived>
4456 if (
auto *FE = dyn_cast<FullExpr>(
Init))
4457 Init = FE->getSubExpr();
4459 if (
auto *AIL = dyn_cast<ArrayInitLoopExpr>(
Init)) {
4465 Init = MTE->getSubExpr();
4468 Init = Binder->getSubExpr();
4471 Init = ICE->getSubExprAsWritten();
4474 dyn_cast<CXXStdInitializerListExpr>(
Init))
4511 getSema().currentEvaluationContext().InLifetimeExtendingContext =
4512 getSema().parentEvaluationContext().InLifetimeExtendingContext;
4513 getSema().currentEvaluationContext().RebuildDefaultArgOrDefaultInit =
4514 getSema().parentEvaluationContext().RebuildDefaultArgOrDefaultInit;
4516 bool ArgChanged =
false;
4518 true, NewArgs, &ArgChanged))
4528 if (
Parens.isInvalid()) {
4531 assert(NewArgs.empty() &&
4532 "no parens or braces but have direct init with arguments?");
4539template<
typename Derived>
4545 for (
unsigned I = 0; I != NumInputs; ++I) {
4555 Expr *Pattern = Expansion->getPattern();
4558 getSema().collectUnexpandedParameterPacks(Pattern, Unexpanded);
4559 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
4564 bool RetainExpansion =
false;
4565 UnsignedOrNone OrigNumExpansions = Expansion->getNumExpansions();
4569 Unexpanded,
true, Expand,
4570 RetainExpansion, NumExpansions))
4583 Expansion->getEllipsisLoc(),
4585 if (Out.isInvalid())
4590 Outputs.push_back(Out.get());
4596 if (ArgChanged) *ArgChanged =
true;
4600 for (
unsigned I = 0; I != *NumExpansions; ++I) {
4603 if (Out.isInvalid())
4606 if (Out.get()->containsUnexpandedParameterPack()) {
4608 Out.get(), Expansion->getEllipsisLoc(), OrigNumExpansions);
4609 if (Out.isInvalid())
4613 Outputs.push_back(Out.get());
4618 if (RetainExpansion) {
4619 ForgetPartiallySubstitutedPackRAII Forget(
getDerived());
4622 if (Out.isInvalid())
4626 Out.get(), Expansion->getEllipsisLoc(), OrigNumExpansions);
4627 if (Out.isInvalid())
4630 Outputs.push_back(Out.get());
4637 IsCall ?
getDerived().TransformInitializer(Inputs[I],
false)
4642 if (
Result.get() != Inputs[I] && ArgChanged)
4645 Outputs.push_back(
Result.get());
4651template <
typename Derived>
4662 VarDecl *ConditionVar = cast_or_null<VarDecl>(
4668 return getSema().ActOnConditionVariable(ConditionVar, Loc, Kind);
4677 return getSema().ActOnCondition(
nullptr, Loc, CondExpr.
get(), Kind,
4684template <
typename Derived>
4692 Qualifier = Qualifier.getAsNamespaceAndPrefix().Prefix)
4704 llvm_unreachable(
"unexpected null nested name specifier");
4735 QualifierLoc =
getDerived().TransformNestedNameSpecifierLoc(
4736 QualifierLoc, ObjectType, FirstQualifierInScope);
4740 FirstQualifierInScope =
nullptr;
4742 SS.
Adopt(QualifierLoc);
4746 if (
SemaRef.BuildCXXNestedNameSpecifier(
nullptr, IdInfo,
4748 FirstQualifierInScope,
false))
4756 T = TransformTypeInObjectScope(TLB, TL, ObjectType,
4757 FirstQualifierInScope);
4763 if (T->isDependentType() || T->isRecordType() ||
4764 (
SemaRef.getLangOpts().CPlusPlus11 && T->isEnumeralType())) {
4765 if (T->isEnumeralType())
4767 diag::warn_cxx98_compat_enum_nested_name_spec);
4774 if (!TTL || !TTL.
getDecl()->isInvalidDecl()) {
4798template<
typename Derived>
4818 TemplateDecl *NewTemplate = cast_or_null<TemplateDecl>(
4825 SemaRef.Context.DeclarationNames.getCXXDeductionGuideName(NewTemplate));
4835 NewTInfo =
getDerived().TransformType(OldTInfo);
4838 NewCanTy =
SemaRef.Context.getCanonicalType(NewTInfo->
getType());
4846 NewCanTy =
SemaRef.Context.getCanonicalType(NewT);
4859 llvm_unreachable(
"Unknown name kind.");
4862template <
typename Derived>
4866 QualType ObjectType,
bool AllowInjectedClassName) {
4868 return getDerived().RebuildTemplateName(SS, TemplateKWLoc, *II, NameLoc,
4869 ObjectType, AllowInjectedClassName);
4871 NameLoc, ObjectType,
4872 AllowInjectedClassName);
4875template <
typename Derived>
4879 NamedDecl *FirstQualifierInScope,
bool AllowInjectedClassName) {
4881 TemplateName UnderlyingName = QTN->getUnderlyingTemplate();
4884 QualifierLoc =
getDerived().TransformNestedNameSpecifierLoc(
4885 QualifierLoc, ObjectType, FirstQualifierInScope);
4892 UnderlyingQualifier, TemplateKWLoc, UnderlyingName, NameLoc, ObjectType,
4893 FirstQualifierInScope, AllowInjectedClassName);
4894 if (NewUnderlyingName.
isNull())
4896 assert(!UnderlyingQualifier &&
"unexpected qualifier");
4900 NewUnderlyingName == UnderlyingName)
4903 SS.
Adopt(QualifierLoc);
4904 return getDerived().RebuildTemplateName(SS, QTN->hasTemplateKeyword(),
4910 QualifierLoc =
getDerived().TransformNestedNameSpecifierLoc(
4911 QualifierLoc, ObjectType, FirstQualifierInScope);
4925 SS.
Adopt(QualifierLoc);
4926 return getDerived().RebuildTemplateName(SS, TemplateKWLoc, DTN->getName(),
4927 NameLoc, ObjectType,
4928 AllowInjectedClassName);
4933 assert(!QualifierLoc &&
"Unexpected qualified SubstTemplateTemplateParm");
4940 ReplacementQualifierLoc = Builder.getWithLocInContext(
SemaRef.Context);
4944 ReplacementQualifierLoc, TemplateKWLoc, ReplacementName, NameLoc,
4945 ObjectType, FirstQualifierInScope, AllowInjectedClassName);
4948 Decl *AssociatedDecl =
4949 getDerived().TransformDecl(NameLoc, S->getAssociatedDecl());
4951 AssociatedDecl == S->getAssociatedDecl())
4953 return SemaRef.Context.getSubstTemplateTemplateParm(
4954 NewName, AssociatedDecl, S->getIndex(), S->getPackIndex(),
4959 "DeducedTemplateName should not escape partial ordering");
4963 assert(!QualifierLoc &&
"Unexpected qualifier");
4970 assert(!QualifierLoc &&
4971 "Unexpected qualified SubstTemplateTemplateParmPack");
4973 SubstPack->getArgumentPack(), SubstPack->getAssociatedDecl(),
4974 SubstPack->getIndex(), SubstPack->getFinal());
4978 llvm_unreachable(
"overloaded function decl survived to here");
4981template <
typename Derived>
4986 QualifierLoc, TemplateKeywordLoc, Name, NameLoc);
4992template<
typename Derived>
4996 Output =
getSema().getTrivialTemplateArgumentLoc(
5000template <
typename Derived>
5008 llvm_unreachable(
"Unexpected TemplateArgument");
5031 if (NewT == T && D == NewD)
5048 llvm_unreachable(
"unexpected template argument kind");
5080 llvm_unreachable(
"Caller should expand pack expansions");
5096 E =
SemaRef.ActOnConstantExpression(E);
5111template<
typename Derived,
typename InputIterator>
5119 typedef typename std::iterator_traits<InputIterator>::difference_type
5134 : Self(Self), Iter(Iter) { }
5149 Self.InventTemplateArgumentLoc(*Iter,
Result);
5157 return X.Iter == Y.Iter;
5162 return X.Iter != Y.Iter;
5166template<
typename Derived>
5167template<
typename InputIterator>
5187 PackLocIterator(*
this, In.getArgument().pack_begin()),
5188 PackLocIterator(*
this, In.getArgument().pack_end()), *PackOutput,
5195 if (In.getArgument().isPackExpansion()) {
5207 std::optional<ForgetSubstitutionRAII> ForgetSubst;
5217 if (Out.getArgument().containsUnexpandedParameterPack()) {
5220 if (Out.getArgument().isNull())
5230 ForgetPartiallySubstitutedPackRAII Forget(
getDerived());
5238 if (Out.getArgument().isNull())
5257template <
typename Derived>
5258template <
typename InputIterator>
5267 return !Arg.isDependent() && Arg.isConceptOrConceptTemplateParameter();
5279 PackLocIterator(*
this, In.getArgument().pack_begin()),
5280 PackLocIterator(*
this, In.getArgument().pack_end()), Outputs,
5286 if (!isNonDependentConceptArgument(In.getArgument())) {
5301template <
typename Derived>
5312 Pattern =
getSema().getTemplateArgumentPackExpansionPattern(
5315 getSema().collectUnexpandedParameterPacks(Pattern, Unexpanded);
5316 if (IsLateExpansionAttempt) {
5321 return P.first.dyn_cast<
const SubstBuiltinTemplatePackType *>();
5323 if (!SawPackTypes) {
5328 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
5336 Info.
Ellipsis, Pattern.getSourceRange(), Unexpanded,
5342 if (ComputeInfo(In,
false, Info, Pattern))
5354 std::optional<Sema::ArgPackSubstIndexRAII> SubstIndex(
5355 std::in_place,
getSema(), std::nullopt);
5361 if (Out.getArgument().isNull())
5398 ForgetSubstitutionRAII ForgetSubst(
getDerived());
5399 if (ComputeInfo(Out,
true, Info, OutPattern))
5412template<
typename Derived>
5430template <
typename Derived>
5450template<
typename Derived>
5453 switch (T.getTypeLocClass()) {
5454#define ABSTRACT_TYPELOC(CLASS, PARENT)
5455#define TYPELOC(CLASS, PARENT) \
5456 case TypeLoc::CLASS: \
5457 return getDerived().Transform##CLASS##Type(TLB, \
5458 T.castAs<CLASS##TypeLoc>());
5459#include "clang/AST/TypeLocNodes.def"
5462 llvm_unreachable(
"unhandled type loc!");
5465template<
typename Derived>
5478template <
typename Derived>
5516template<
typename Derived>
5522 auto SuppressObjCLifetime =
5525 Result = getDerived().TransformTemplateTypeParmType(TLB, TTP,
5526 SuppressObjCLifetime);
5527 }
else if (
auto STTP = UnqualTL.
getAs<SubstTemplateTypeParmPackTypeLoc>()) {
5528 Result = getDerived().TransformSubstTemplateTypeParmPackType(
5529 TLB, STTP, SuppressObjCLifetime);
5531 Result = getDerived().TransformType(TLB, UnqualTL);
5550template <
typename Derived>
5560 SemaRef.Diag(Loc, diag::err_address_space_mismatch_templ_inst)
5567 if (T.getPointerAuth().isPresent()) {
5568 SemaRef.Diag(Loc, diag::err_ptrauth_qualifier_redundant) << TL.
getType();
5571 if (!T->isDependentType()) {
5572 if (!T->isSignableType(
SemaRef.getASTContext())) {
5573 SemaRef.Diag(Loc, diag::err_ptrauth_qualifier_invalid_target) << T;
5581 if (T->isFunctionType()) {
5582 T =
SemaRef.getASTContext().getAddrSpaceQualType(T,
5592 if (T->isReferenceType()) {
5602 if (!T->isObjCLifetimeType() && !T->isDependentType())
5604 else if (T.getObjCLifetime()) {
5608 const AutoType *AutoTy;
5609 if ((AutoTy = dyn_cast<AutoType>(T)) && AutoTy->isDeduced()) {
5615 SemaRef.Context.getQualifiedType(
Deduced.getUnqualifiedType(), Qs);
5616 T =
SemaRef.Context.getAutoType(AutoTy->getDeducedKind(),
Deduced,
5617 AutoTy->getKeyword(),
5618 AutoTy->getTypeConstraintConcept(),
5619 AutoTy->getTypeConstraintArguments());
5624 SemaRef.Diag(Loc, diag::err_attr_objc_ownership_redundant) << T;
5630 return SemaRef.BuildQualifiedType(T, Loc, Quals);
5633template <
typename Derived>
5634QualType TreeTransform<Derived>::TransformTypeInObjectScope(
5637 assert(!getDerived().AlreadyTransformed(TL.
getType()));
5640 case TypeLoc::TemplateSpecialization:
5641 return getDerived().TransformTemplateSpecializationType(
5643 FirstQualifierInScope,
true);
5644 case TypeLoc::DependentName:
5645 return getDerived().TransformDependentNameType(
5647 ObjectType, FirstQualifierInScope);
5651 return getDerived().TransformType(TLB, TL);
5655template <
class TyLoc>
static inline
5657 TyLoc NewT = TLB.
push<TyLoc>(T.getType());
5658 NewT.setNameLoc(T.getNameLoc());
5662template<
typename Derived>
5663QualType TreeTransform<Derived>::TransformBuiltinType(TypeLocBuilder &TLB,
5665 BuiltinTypeLoc NewT = TLB.push<BuiltinTypeLoc>(T.getType());
5666 NewT.setBuiltinLoc(T.getBuiltinLoc());
5667 if (T.needsExtraLocalData())
5668 NewT.getWrittenBuiltinSpecs() = T.getWrittenBuiltinSpecs();
5672template<
typename Derived>
5679template <
typename Derived>
5683 return getDerived().
TransformType(TLB, TL.getOriginalLoc());
5686template<
typename Derived>
5689 QualType OriginalType = getDerived().TransformType(TLB, TL.getOriginalLoc());
5690 if (OriginalType.isNull())
5694 if (getDerived().AlwaysRebuild() ||
5695 OriginalType != TL.getOriginalLoc().getType())
5702template <
typename Derived>
5706 QualType OriginalType = getDerived().TransformType(TLB, TL.getElementLoc());
5707 if (OriginalType.isNull())
5711 if (getDerived().AlwaysRebuild() ||
5712 OriginalType != TL.getElementLoc().getType())
5719template<
typename Derived>
5723 = getDerived().TransformType(TLB, TL.getPointeeLoc());
5724 if (PointeeType.isNull())
5728 if (PointeeType->getAs<ObjCObjectType>()) {
5740 if (getDerived().AlwaysRebuild() ||
5741 PointeeType != TL.getPointeeLoc().getType()) {
5742 Result = getDerived().RebuildPointerType(PointeeType, TL.getSigilLoc());
5749 TLB.TypeWasModifiedSafely(
Result->getPointeeType());
5756template<
typename Derived>
5761 = getDerived().TransformType(TLB, TL.getPointeeLoc());
5762 if (PointeeType.isNull())
5766 if (getDerived().AlwaysRebuild() ||
5767 PointeeType != TL.getPointeeLoc().getType()) {
5768 Result = getDerived().RebuildBlockPointerType(PointeeType,
5783template<
typename Derived>
5791 if (PointeeType.
isNull())
5796 PointeeType != T->getPointeeTypeAsWritten()) {
5798 T->isSpelledAsLValue(),
5820template<
typename Derived>
5824 return TransformReferenceType(TLB, TL);
5827template<
typename Derived>
5829TreeTransform<Derived>::TransformRValueReferenceType(TypeLocBuilder &TLB,
5830 RValueReferenceTypeLoc TL) {
5831 return TransformReferenceType(TLB, TL);
5834template<
typename Derived>
5838 QualType PointeeType = getDerived().TransformType(TLB, TL.getPointeeLoc());
5839 if (PointeeType.isNull())
5846 getDerived().TransformNestedNameSpecifierLoc(OldQualifierLoc);
5847 if (!NewQualifierLoc)
5850 CXXRecordDecl *OldCls = T->getMostRecentCXXRecordDecl(), *NewCls =
nullptr;
5852 NewCls = cast_or_null<CXXRecordDecl>(
5853 getDerived().TransformDecl(TL.getStarLoc(), OldCls));
5859 if (getDerived().AlwaysRebuild() || PointeeType != T->getPointeeType() ||
5860 NewQualifierLoc.getNestedNameSpecifier() !=
5861 OldQualifierLoc.getNestedNameSpecifier() ||
5864 SS.
Adopt(NewQualifierLoc);
5865 Result = getDerived().RebuildMemberPointerType(PointeeType, SS, NewCls,
5874 if (MPT && PointeeType != MPT->getPointeeType()) {
5881 NewTL.setQualifierLoc(NewQualifierLoc);
5886template<
typename Derived>
5891 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
5892 if (ElementType.isNull())
5896 Expr *OldSize = TL.getSizeExpr();
5898 OldSize =
const_cast<Expr*
>(T->getSizeExpr());
5899 Expr *NewSize =
nullptr;
5903 NewSize = getDerived().TransformExpr(OldSize).template getAs<Expr>();
5908 if (getDerived().AlwaysRebuild() ||
5909 ElementType != T->getElementType() ||
5910 (T->getSizeExpr() && NewSize != OldSize)) {
5911 Result = getDerived().RebuildConstantArrayType(ElementType,
5912 T->getSizeModifier(),
5913 T->getSize(), NewSize,
5914 T->getIndexTypeCVRQualifiers(),
5915 TL.getBracketsRange());
5926 NewTL.setRBracketLoc(TL.getRBracketLoc());
5927 NewTL.setSizeExpr(NewSize);
5932template<
typename Derived>
5937 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
5938 if (ElementType.isNull())
5942 if (getDerived().AlwaysRebuild() ||
5943 ElementType != T->getElementType()) {
5944 Result = getDerived().RebuildIncompleteArrayType(ElementType,
5945 T->getSizeModifier(),
5946 T->getIndexTypeCVRQualifiers(),
5947 TL.getBracketsRange());
5954 NewTL.setRBracketLoc(TL.getRBracketLoc());
5955 NewTL.setSizeExpr(
nullptr);
5960template<
typename Derived>
5965 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
5966 if (ElementType.isNull())
5973 SizeResult = getDerived().TransformExpr(T->getSizeExpr());
5975 if (SizeResult.isInvalid())
5979 if (SizeResult.isInvalid())
5985 if (getDerived().AlwaysRebuild() ||
5986 ElementType != T->getElementType() ||
5987 Size != T->getSizeExpr()) {
5988 Result = getDerived().RebuildVariableArrayType(ElementType,
5989 T->getSizeModifier(),
5991 T->getIndexTypeCVRQualifiers(),
5992 TL.getBracketsRange());
6001 NewTL.setRBracketLoc(TL.getRBracketLoc());
6002 NewTL.setSizeExpr(Size);
6007template<
typename Derived>
6012 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
6013 if (ElementType.isNull())
6021 SemaRef.
ExprEvalContexts.back().InConditionallyConstantEvaluateContext =
true;
6024 Expr *origSize = TL.getSizeExpr();
6025 if (!origSize) origSize = T->getSizeExpr();
6028 = getDerived().TransformExpr(origSize);
6030 if (sizeResult.isInvalid())
6033 Expr *size = sizeResult.get();
6036 if (getDerived().AlwaysRebuild() ||
6037 ElementType != T->getElementType() ||
6039 Result = getDerived().RebuildDependentSizedArrayType(ElementType,
6040 T->getSizeModifier(),
6042 T->getIndexTypeCVRQualifiers(),
6043 TL.getBracketsRange());
6052 NewTL.setRBracketLoc(TL.getRBracketLoc());
6053 NewTL.setSizeExpr(size);
6058template <
typename Derived>
6062 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
6063 if (ElementType.isNull())
6071 if (
Size.isInvalid())
6075 if (getDerived().AlwaysRebuild() || ElementType != T->getElementType() ||
6076 Size.get() != T->getSizeExpr()) {
6077 Result = getDerived().RebuildDependentVectorType(
6078 ElementType,
Size.get(), T->getAttributeLoc(), T->getVectorKind());
6096template<
typename Derived>
6103 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
6104 if (ElementType.isNull())
6113 if (
Size.isInvalid())
6117 if (getDerived().AlwaysRebuild() ||
6118 ElementType != T->getElementType() ||
6119 Size.get() != T->getSizeExpr()) {
6120 Result = getDerived().RebuildDependentSizedExtVectorType(ElementType,
6122 T->getAttributeLoc());
6140template <
typename Derived>
6145 QualType ElementType = getDerived().TransformType(T->getElementType());
6146 if (ElementType.isNull())
6150 if (getDerived().AlwaysRebuild() || ElementType != T->getElementType()) {
6151 Result = getDerived().RebuildConstantMatrixType(
6152 ElementType, T->getNumRows(), T->getNumColumns());
6159 NewTL.setAttrOperandParensRange(TL.getAttrOperandParensRange());
6160 NewTL.setAttrRowOperand(TL.getAttrRowOperand());
6161 NewTL.setAttrColumnOperand(TL.getAttrColumnOperand());
6166template <
typename Derived>
6171 QualType ElementType = getDerived().TransformType(T->getElementType());
6172 if (ElementType.isNull()) {
6180 Expr *origRows = TL.getAttrRowOperand();
6182 origRows = T->getRowExpr();
6183 Expr *origColumns = TL.getAttrColumnOperand();
6185 origColumns = T->getColumnExpr();
6187 ExprResult rowResult = getDerived().TransformExpr(origRows);
6189 if (rowResult.isInvalid())
6192 ExprResult columnResult = getDerived().TransformExpr(origColumns);
6194 if (columnResult.isInvalid())
6197 Expr *rows = rowResult.get();
6198 Expr *columns = columnResult.get();
6201 if (getDerived().AlwaysRebuild() || ElementType != T->getElementType() ||
6202 rows != origRows || columns != origColumns) {
6203 Result = getDerived().RebuildDependentSizedMatrixType(
6204 ElementType, rows, columns, T->getAttributeLoc());
6214 NewTL.setAttrOperandParensRange(TL.getAttrOperandParensRange());
6215 NewTL.setAttrRowOperand(rows);
6216 NewTL.setAttrColumnOperand(columns);
6220template <
typename Derived>
6226 getDerived().TransformType(TLB, TL.getPointeeTypeLoc());
6228 if (pointeeType.isNull())
6235 ExprResult AddrSpace = getDerived().TransformExpr(T->getAddrSpaceExpr());
6237 if (AddrSpace.isInvalid())
6241 if (getDerived().AlwaysRebuild() || pointeeType != T->getPointeeType() ||
6242 AddrSpace.get() != T->getAddrSpaceExpr()) {
6243 Result = getDerived().RebuildDependentAddressSpaceType(
6244 pointeeType, AddrSpace.get(), T->getAttributeLoc());
6255 NewTL.setAttrExprOperand(TL.getAttrExprOperand());
6256 NewTL.setAttrNameLoc(TL.getAttrNameLoc());
6259 TLB.TypeWasModifiedSafely(
Result);
6265template <
typename Derived>
6269 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
6270 if (ElementType.isNull())
6274 if (getDerived().AlwaysRebuild() ||
6275 ElementType != T->getElementType()) {
6276 Result = getDerived().RebuildVectorType(ElementType, T->getNumElements(),
6277 T->getVectorKind());
6288template<
typename Derived>
6292 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
6293 if (ElementType.isNull())
6297 if (getDerived().AlwaysRebuild() ||
6298 ElementType != T->getElementType()) {
6299 Result = getDerived().RebuildExtVectorType(ElementType,
6300 T->getNumElements(),
6312template <
typename Derived>
6315 bool ExpectParameterPack) {
6350 if (NewTSI == OldTSI && indexAdjustment == 0)
6360 getDerived().transformedLocalDecl(OldParm, {newParm});
6364template <
typename Derived>
6372 unsigned *LastParamTransformed) {
6373 int indexAdjustment = 0;
6375 unsigned NumParams = Params.size();
6376 for (
unsigned i = 0; i != NumParams; ++i) {
6377 if (LastParamTransformed)
6378 *LastParamTransformed = i;
6380 assert(OldParm->getFunctionScopeIndex() == i);
6384 if (OldParm->isParameterPack()) {
6389 TypeLoc TL = OldParm->getTypeSourceInfo()->getTypeLoc();
6392 SemaRef.collectUnexpandedParameterPacks(Pattern, Unexpanded);
6395 bool ShouldExpand =
false;
6396 bool RetainExpansion =
false;
6398 if (Unexpanded.size() > 0) {
6399 OrigNumExpansions = ExpansionTL.
getTypePtr()->getNumExpansions();
6400 NumExpansions = OrigNumExpansions;
6404 ShouldExpand, RetainExpansion, NumExpansions)) {
6409 const AutoType *AT =
6410 Pattern.getType().getTypePtr()->getContainedAutoType();
6411 assert((AT && (!AT->isDeduced() || AT->getDeducedType().isNull())) &&
6412 "Could not find parameter packs or undeduced auto type!");
6419 getDerived().ExpandingFunctionParameterPack(OldParm);
6420 for (
unsigned I = 0; I != *NumExpansions; ++I) {
6423 =
getDerived().TransformFunctionTypeParam(OldParm,
6431 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6432 OutParamTypes.push_back(NewParm->
getType());
6434 PVars->push_back(NewParm);
6439 if (RetainExpansion) {
6440 ForgetPartiallySubstitutedPackRAII Forget(
getDerived());
6442 =
getDerived().TransformFunctionTypeParam(OldParm,
6450 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6451 OutParamTypes.push_back(NewParm->
getType());
6453 PVars->push_back(NewParm);
6469 NewParm =
getDerived().TransformFunctionTypeParam(OldParm,
6474 "Parameter pack no longer a parameter pack after "
6477 NewParm =
getDerived().TransformFunctionTypeParam(
6478 OldParm, indexAdjustment, std::nullopt,
6486 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6487 OutParamTypes.push_back(NewParm->
getType());
6489 PVars->push_back(NewParm);
6497 bool IsPackExpansion =
false;
6500 if (
const PackExpansionType *Expansion
6501 = dyn_cast<PackExpansionType>(OldType)) {
6503 QualType Pattern = Expansion->getPattern();
6505 getSema().collectUnexpandedParameterPacks(Pattern, Unexpanded);
6508 bool ShouldExpand =
false;
6509 bool RetainExpansion =
false;
6513 RetainExpansion, NumExpansions)) {
6520 for (
unsigned I = 0; I != *NumExpansions; ++I) {
6527 NewType =
getSema().getASTContext().getPackExpansionType(
6528 NewType, std::nullopt);
6535 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6536 OutParamTypes.push_back(NewType);
6538 PVars->push_back(
nullptr);
6547 if (RetainExpansion) {
6548 ForgetPartiallySubstitutedPackRAII Forget(
getDerived());
6554 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6555 OutParamTypes.push_back(NewType);
6557 PVars->push_back(
nullptr);
6562 OldType = Expansion->getPattern();
6563 IsPackExpansion =
true;
6565 NewType =
getDerived().TransformType(OldType);
6567 NewType =
getDerived().TransformType(OldType);
6573 if (IsPackExpansion)
6574 NewType =
getSema().Context.getPackExpansionType(NewType,
6578 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6579 OutParamTypes.push_back(NewType);
6581 PVars->push_back(
nullptr);
6586 for (
unsigned i = 0, e = PVars->size(); i != e; ++i)
6588 assert(parm->getFunctionScopeIndex() == i);
6595template<
typename Derived>
6600 return getDerived().TransformFunctionProtoType(
6604 ExceptionStorage, Changed);
6608template<
typename Derived>
template<
typename Fn>
6627 if (T->hasTrailingReturn()) {
6631 T->getExtParameterInfosOrNull(),
6632 ParamTypes, &ParamDecls, ExtParamInfos))
6642 auto *RD = dyn_cast<CXXRecordDecl>(
SemaRef.getCurLexicalContext());
6644 SemaRef, !ThisContext && RD ? RD : ThisContext, ThisTypeQuals);
6659 T->getExtParameterInfosOrNull(),
6660 ParamTypes, &ParamDecls, ExtParamInfos))
6666 bool EPIChanged =
false;
6671 if (
auto NewExtParamInfos =
6687 std::optional<FunctionEffectSet> NewFX;
6699 std::optional<FunctionEffectMode> Mode =
6719 "FunctionEffectMode::None shouldn't be possible here");
6722 if (!
SemaRef.diagnoseConflictingFunctionEffect(*NewFX, NewEC,
6725 NewFX->insert(NewEC, Errs);
6726 assert(Errs.empty());
6735 T->getParamTypes() !=
llvm::ArrayRef(ParamTypes) || EPIChanged) {
6736 Result =
getDerived().RebuildFunctionProtoType(ResultType, ParamTypes, EPI);
6747 for (
unsigned i = 0, e = NewTL.
getNumParams(); i != e; ++i)
6753template<
typename Derived>
6776 getSema().ActOnNoexceptSpec(NoexceptExpr.
get(), EST);
6791 if (
const PackExpansionType *PackExpansion =
6792 T->getAs<PackExpansionType>()) {
6797 SemaRef.collectUnexpandedParameterPacks(PackExpansion->getPattern(),
6799 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
6804 bool Expand =
false;
6805 bool RetainExpansion =
false;
6806 UnsignedOrNone NumExpansions = PackExpansion->getNumExpansions();
6811 true, Expand, RetainExpansion,
6824 U =
SemaRef.Context.getPackExpansionType(
U, NumExpansions);
6825 Exceptions.push_back(
U);
6831 for (
unsigned ArgIdx = 0; ArgIdx != *NumExpansions; ++ArgIdx) {
6835 if (
U.isNull() ||
SemaRef.CheckSpecifiedExceptionType(
U, Loc))
6838 Exceptions.push_back(
U);
6842 if (
U.isNull() ||
SemaRef.CheckSpecifiedExceptionType(
U, Loc))
6847 Exceptions.push_back(
U);
6857template<
typename Derived>
6867 if (getDerived().AlwaysRebuild() || ResultType != T->getReturnType())
6868 Result = getDerived().RebuildFunctionNoProtoType(ResultType);
6879template <
typename Derived>
6880QualType TreeTransform<Derived>::TransformUnresolvedUsingType(
6881 TypeLocBuilder &TLB, UnresolvedUsingTypeLoc TL) {
6883 const UnresolvedUsingType *T = TL.getTypePtr();
6884 bool Changed =
false;
6886 NestedNameSpecifierLoc QualifierLoc = TL.getQualifierLoc();
6887 if (NestedNameSpecifierLoc OldQualifierLoc = QualifierLoc) {
6888 QualifierLoc = getDerived().TransformNestedNameSpecifierLoc(QualifierLoc);
6891 Changed |= QualifierLoc != OldQualifierLoc;
6894 auto *D = getDerived().TransformDecl(TL.getNameLoc(), T->getDecl());
6900 if (getDerived().AlwaysRebuild() || Changed) {
6901 Result = getDerived().RebuildUnresolvedUsingType(
6902 T->getKeyword(), QualifierLoc.getNestedNameSpecifier(), TL.getNameLoc(),
6910 QualifierLoc, TL.getNameLoc());
6913 QualifierLoc, TL.getNameLoc());
6917template <
typename Derived>
6925 QualifierLoc = getDerived().TransformNestedNameSpecifierLoc(QualifierLoc);
6928 Changed |= QualifierLoc != OldQualifierLoc;
6931 auto *D = cast_or_null<UsingShadowDecl>(
6932 getDerived().TransformDecl(TL.getNameLoc(), T->getDecl()));
6937 QualType UnderlyingType = getDerived().TransformType(T->desugar());
6938 if (UnderlyingType.isNull())
6940 Changed |= UnderlyingType != T->desugar();
6943 if (getDerived().AlwaysRebuild() || Changed) {
6944 Result = getDerived().RebuildUsingType(
6945 T->getKeyword(), QualifierLoc.getNestedNameSpecifier(), D,
6955template<
typename Derived>
6963 QualifierLoc = getDerived().TransformNestedNameSpecifierLoc(QualifierLoc);
6966 Changed |= QualifierLoc != OldQualifierLoc;
6969 auto *
Typedef = cast_or_null<TypedefNameDecl>(
6970 getDerived().TransformDecl(TL.getNameLoc(), T->getDecl()));
6978 if (getDerived().AlwaysRebuild() || Changed) {
6979 Result = getDerived().RebuildTypedefType(
6980 T->getKeyword(), QualifierLoc.getNestedNameSpecifier(),
Typedef);
6986 QualifierLoc, TL.getNameLoc());
6990template<
typename Derived>
6998 ExprResult E = getDerived().TransformExpr(TL.getUnderlyingExpr());
7008 if (getDerived().AlwaysRebuild() || E.get() != TL.getUnderlyingExpr()) {
7010 getDerived().RebuildTypeOfExprType(E.get(), TL.getTypeofLoc(), Kind);
7017 NewTL.setLParenLoc(TL.getLParenLoc());
7018 NewTL.setRParenLoc(TL.getRParenLoc());
7023template<
typename Derived>
7027 TypeSourceInfo* New_Under_TI = getDerived().TransformType(Old_Under_TI);
7033 if (getDerived().AlwaysRebuild() || New_Under_TI != Old_Under_TI) {
7034 Result = getDerived().RebuildTypeOfType(New_Under_TI->getType(), Kind);
7041 NewTL.setLParenLoc(TL.getLParenLoc());
7042 NewTL.setRParenLoc(TL.getRParenLoc());
7043 NewTL.setUnmodifiedTInfo(New_Under_TI);
7048template<
typename Derived>
7051 const DecltypeType *T = TL.getTypePtr();
7058 ExprResult E = getDerived().TransformExpr(T->getUnderlyingExpr());
7062 E = getSema().ActOnDecltypeExpression(E.get());
7067 if (getDerived().AlwaysRebuild() ||
7068 E.get() != T->getUnderlyingExpr()) {
7069 Result = getDerived().RebuildDecltypeType(E.get(), TL.getDecltypeLoc());
7077 NewTL.setRParenLoc(TL.getRParenLoc());
7081template <
typename Derived>
7091 IndexExpr = getDerived().TransformExpr(TL.getIndexExpr());
7092 if (IndexExpr.isInvalid())
7095 QualType Pattern = TL.getPattern();
7097 const PackIndexingType *PIT = TL.
getTypePtr();
7101 bool NotYetExpanded = Types.empty();
7102 bool FullySubstituted =
true;
7104 if (Types.empty() && !PIT->expandsToEmptyPack())
7108 if (!T->containsUnexpandedParameterPack()) {
7109 QualType Transformed = getDerived().TransformType(T);
7110 if (Transformed.isNull())
7112 SubtitutedTypes.push_back(Transformed);
7117 getSema().collectUnexpandedParameterPacks(T, Unexpanded);
7118 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
7121 bool ShouldExpand =
true;
7122 bool RetainExpansion =
false;
7124 if (getDerived().TryExpandParameterPacks(
7127 RetainExpansion, NumExpansions))
7129 if (!ShouldExpand) {
7135 QualType Pack = getDerived().TransformType(TLB, TI->getTypeLoc());
7138 if (NotYetExpanded) {
7139 FullySubstituted =
false;
7140 QualType Out = getDerived().RebuildPackIndexingType(
7150 SubtitutedTypes.push_back(Pack);
7153 for (
unsigned I = 0; I != *NumExpansions; ++I) {
7158 SubtitutedTypes.push_back(Out);
7159 FullySubstituted &= !
Out->containsUnexpandedParameterPack();
7163 if (RetainExpansion) {
7164 FullySubstituted =
false;
7165 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
7169 SubtitutedTypes.push_back(Out);
7177 QualType Result = getDerived().TransformType(TLB, TL.getPatternLoc());
7179 QualType Out = getDerived().RebuildPackIndexingType(
7181 FullySubstituted, SubtitutedTypes);
7190template<
typename Derived>
7196 if (
Result->isDependentType()) {
7197 const UnaryTransformType *T = TL.getTypePtr();
7199 NewBaseTSI = getDerived().TransformType(TL.getUnderlyingTInfo());
7202 QualType NewBase = NewBaseTSI->getType();
7204 Result = getDerived().RebuildUnaryTransformType(NewBase,
7213 NewTL.setParensRange(TL.getParensRange());
7214 NewTL.setUnderlyingTInfo(NewBaseTSI);
7218template<
typename Derived>
7221 const DeducedTemplateSpecializationType *T = TL.getTypePtr();
7226 TL.getTemplateNameLoc());
7230 QualType OldDeduced = T->getDeducedType();
7232 if (!OldDeduced.isNull()) {
7233 NewDeduced = getDerived().TransformType(OldDeduced);
7234 if (NewDeduced.isNull())
7238 QualType Result = getDerived().RebuildDeducedTemplateSpecializationType(
7246 NewTL.setTemplateNameLoc(TL.getTemplateNameLoc());
7247 NewTL.setQualifierLoc(QualifierLoc);
7251template <
typename Derived>
7258 QualifierLoc =
getDerived().TransformNestedNameSpecifierLoc(QualifierLoc);
7263 auto *TD = cast_or_null<TagDecl>(
7270 TD != T->getDecl()) {
7271 if (T->isCanonicalUnqualified())
7288template <
typename Derived>
7294template <
typename Derived>
7295QualType TreeTransform<Derived>::TransformRecordType(TypeLocBuilder &TLB,
7297 return getDerived().TransformTagType(TLB, TL);
7300template<
typename Derived>
7307template<
typename Derived>
7311 return getDerived().TransformTemplateTypeParmType(
7316template <
typename Derived>
7322template<
typename Derived>
7323QualType TreeTransform<Derived>::TransformSubstTemplateTypeParmType(
7324 TypeLocBuilder &TLB,
7325 SubstTemplateTypeParmTypeLoc TL) {
7326 const SubstTemplateTypeParmType *T = TL.getTypePtr();
7329 getDerived().TransformDecl(TL.getNameLoc(), T->getAssociatedDecl());
7334 TemporaryBase Rebase(*
this, TL.getNameLoc(), DeclarationName());
7335 QualType Replacement = getDerived().TransformType(T->getReplacementType());
7336 if (Replacement.isNull())
7340 Replacement, NewReplaced, T->getIndex(), T->getPackIndex(),
7344 SubstTemplateTypeParmTypeLoc NewTL
7345 = TLB.push<SubstTemplateTypeParmTypeLoc>(Result);
7346 NewTL.setNameLoc(TL.getNameLoc());
7350template <
typename Derived>
7356template<
typename Derived>
7360 return getDerived().TransformSubstTemplateTypeParmPackType(
7364template <
typename Derived>
7370template<
typename Derived>
7371QualType TreeTransform<Derived>::TransformAtomicType(TypeLocBuilder &TLB,
7373 QualType ValueType = getDerived().TransformType(TLB, TL.getValueLoc());
7374 if (ValueType.isNull())
7377 QualType Result = TL.getType();
7378 if (getDerived().AlwaysRebuild() ||
7379 ValueType != TL.getValueLoc().getType()) {
7380 Result = getDerived().RebuildAtomicType(ValueType, TL.getKWLoc());
7381 if (Result.isNull())
7387 NewTL.setLParenLoc(TL.getLParenLoc());
7388 NewTL.setRParenLoc(TL.getRParenLoc());
7393template <
typename Derived>
7396 QualType ValueType = getDerived().TransformType(TLB, TL.getValueLoc());
7397 if (ValueType.isNull())
7401 if (getDerived().AlwaysRebuild() || ValueType != TL.getValueLoc().getType()) {
7404 Result = getDerived().RebuildPipeType(ValueType, TL.getKWLoc(), isReadPipe);
7415template <
typename Derived>
7421 if (getDerived().AlwaysRebuild()) {
7422 Result = getDerived().RebuildBitIntType(EIT->isUnsigned(),
7423 EIT->getNumBits(), TL.getNameLoc());
7433template <
typename Derived>
7440 ExprResult BitsExpr = getDerived().TransformExpr(EIT->getNumBitsExpr());
7443 if (BitsExpr.isInvalid())
7448 if (getDerived().AlwaysRebuild() || BitsExpr.get() != EIT->getNumBitsExpr()) {
7449 Result = getDerived().RebuildDependentBitIntType(
7450 EIT->isUnsigned(), BitsExpr.get(), TL.getNameLoc());
7466template <
typename Derived>
7469 llvm_unreachable(
"This type does not need to be transformed.");
7477 template<
typename ArgLocContainer>
7479 ArgLocContainer *Container;
7504 : Container(&Container), Index(Index) { }
7518 return Container->getArgLoc(Index);
7522 return pointer(Container->getArgLoc(Index));
7527 return X.Container == Y.Container &&
X.Index == Y.Index;
7536template<
typename Derived>
7537QualType TreeTransform<Derived>::TransformAutoType(TypeLocBuilder &TLB,
7539 const AutoType *T = TL.getTypePtr();
7540 QualType OldDeduced = T->getDeducedType();
7541 QualType NewDeduced;
7542 if (!OldDeduced.isNull()) {
7543 NewDeduced = getDerived().TransformType(OldDeduced);
7544 if (NewDeduced.isNull())
7551 if (T->isConstrained()) {
7552 assert(TL.getConceptReference());
7553 NewCD = cast_or_null<ConceptDecl>(getDerived().TransformDecl(
7554 TL.getConceptNameLoc(), T->getTypeConstraintConcept()));
7556 NewTemplateArgs.setLAngleLoc(TL.getLAngleLoc());
7557 NewTemplateArgs.setRAngleLoc(TL.getRAngleLoc());
7559 if (getDerived().TransformTemplateArguments(
7560 ArgIterator(TL, 0), ArgIterator(TL, TL.getNumArgs()),
7564 if (TL.getNestedNameSpecifierLoc()) {
7566 = getDerived().TransformNestedNameSpecifierLoc(
7567 TL.getNestedNameSpecifierLoc());
7568 if (!NewNestedNameSpec)
7574 if (getDerived().AlwaysRebuild() || NewDeduced != OldDeduced ||
7575 T->isDependentType() || T->isConstrained()) {
7578 NewArgList.reserve(NewTemplateArgs.size());
7579 for (
const auto &ArgLoc : NewTemplateArgs.arguments())
7580 NewArgList.push_back(ArgLoc.getArgument());
7581 Result = getDerived().RebuildAutoType(
7583 NewDeduced, T->getKeyword(), NewCD, NewArgList);
7590 NewTL.setRParenLoc(TL.getRParenLoc());
7591 NewTL.setConceptReference(
nullptr);
7593 if (T->isConstrained()) {
7595 TL.getTypePtr()->getTypeConstraintConcept()->getDeclName(),
7596 TL.getConceptNameLoc(),
7597 TL.getTypePtr()->getTypeConstraintConcept()->getDeclName());
7599 SemaRef.
Context, NewNestedNameSpec, TL.getTemplateKWLoc(), DNI,
7600 TL.getFoundDecl(), TL.getTypePtr()->getTypeConstraintConcept(),
7602 NewTL.setConceptReference(CR);
7608template <
typename Derived>
7611 return getDerived().TransformTemplateSpecializationType(
7616template <
typename Derived>
7619 NamedDecl *FirstQualifierInScope,
bool AllowInjectedClassName) {
7620 const TemplateSpecializationType *T = TL.
getTypePtr();
7626 AllowInjectedClassName);
7635 if (getDerived().TransformTemplateArguments(ArgIterator(TL, 0),
7644 QualType Result = getDerived().RebuildTemplateSpecializationType(
7657template <
typename Derived>
7661 QualType modifiedType = getDerived().TransformType(TLB, TL.getModifiedLoc());
7662 if (modifiedType.isNull())
7666 const Attr *oldAttr = TL.getAttr();
7667 const Attr *newAttr = oldAttr ? getDerived().TransformAttr(oldAttr) :
nullptr;
7668 if (oldAttr && !newAttr)
7674 if (getDerived().AlwaysRebuild() ||
7675 modifiedType != oldType->getModifiedType()) {
7688 QualType equivalentType = modifiedType;
7689 if (TL.getModifiedLoc().getType() != TL.getEquivalentTypeLoc().getType()) {
7691 AuxiliaryTLB.
reserve(TL.getFullDataSize());
7693 getDerived().TransformType(AuxiliaryTLB, TL.getEquivalentTypeLoc());
7694 if (equivalentType.isNull())
7700 if (
auto nullability = oldType->getImmediateNullability()) {
7701 if (!modifiedType->canHaveNullability()) {
7702 SemaRef.
Diag((TL.getAttr() ? TL.getAttr()->getLocation()
7703 : TL.getModifiedLoc().getBeginLoc()),
7704 diag::err_nullability_nonpointer)
7721template <
typename Derived>
7725 QualType InnerTy = getDerived().TransformType(TLB, TL.getInnerLoc());
7726 if (InnerTy.isNull())
7729 Expr *OldCount = TL.getCountExpr();
7730 Expr *NewCount =
nullptr;
7732 ExprResult CountResult = getDerived().TransformExpr(OldCount);
7733 if (CountResult.isInvalid())
7735 NewCount = CountResult.get();
7739 if (getDerived().AlwaysRebuild() || InnerTy != OldTy->desugar() ||
7740 OldCount != NewCount) {
7743 InnerTy, NewCount, OldTy->isCountInBytes(), OldTy->isOrNull());
7750template <
typename Derived>
7754 llvm_unreachable(
"Unexpected TreeTransform for BTFTagAttributedType");
7757template <
typename Derived>
7760 const OverflowBehaviorType *OldTy = TL.getTypePtr();
7761 QualType InnerTy = getDerived().TransformType(TLB, TL.getWrappedLoc());
7762 if (InnerTy.isNull())
7766 if (getDerived().AlwaysRebuild() || InnerTy != OldTy->getUnderlyingType()) {
7778template <
typename Derived>
7782 const HLSLAttributedResourceType *oldType = TL.getTypePtr();
7784 QualType WrappedTy = getDerived().TransformType(TLB, TL.getWrappedLoc());
7785 if (WrappedTy.isNull())
7789 QualType OldContainedTy = oldType->getContainedType();
7791 if (!OldContainedTy.isNull()) {
7792 TypeSourceInfo *oldContainedTSI = TL.getContainedTypeSourceInfo();
7793 if (!oldContainedTSI)
7794 oldContainedTSI = getSema().getASTContext().getTrivialTypeSourceInfo(
7796 ContainedTSI = getDerived().TransformType(oldContainedTSI);
7799 ContainedTy = ContainedTSI->getType();
7803 if (getDerived().AlwaysRebuild() || WrappedTy != oldType->getWrappedType() ||
7804 ContainedTy != oldType->getContainedType()) {
7806 WrappedTy, ContainedTy, oldType->getAttrs());
7812 NewTL.setContainedTypeSourceInfo(ContainedTSI);
7816template <
typename Derived>
7820 return TL.getType();
7823template<
typename Derived>
7827 QualType Inner = getDerived().TransformType(TLB, TL.getInnerLoc());
7832 if (getDerived().AlwaysRebuild() ||
7833 Inner != TL.getInnerLoc().getType()) {
7834 Result = getDerived().RebuildParenType(Inner);
7841 NewTL.setRParenLoc(TL.getRParenLoc());
7845template <
typename Derived>
7849 QualType Inner = getDerived().TransformType(TLB, TL.getInnerLoc());
7854 if (getDerived().AlwaysRebuild() || Inner != TL.getInnerLoc().getType()) {
7856 getDerived().RebuildMacroQualifiedType(Inner, TL.getMacroIdentifier());
7866template<
typename Derived>
7867QualType TreeTransform<Derived>::TransformDependentNameType(
7869 return TransformDependentNameType(TLB, TL,
false);
7872template <
typename Derived>
7873QualType TreeTransform<Derived>::TransformDependentNameType(
7876 const DependentNameType *T = TL.
getTypePtr();
7880 QualifierLoc = getDerived().TransformNestedNameSpecifierLoc(
7881 QualifierLoc, ObjectType, UnqualLookup);
7885 assert((ObjectType.isNull() && !UnqualLookup) &&
7886 "must be transformed by TransformNestedNameSpecifierLoc");
7890 = getDerived().RebuildDependentNameType(T->getKeyword(),
7891 TL.getElaboratedKeywordLoc(),
7902 NewTL.setQualifierLoc(QualifierLoc);
7903 NewTL.setNameLoc(TL.getNameLoc());
7907 NewTL.setTemplateNameLoc(TL.getNameLoc());
7908 NewTL.setQualifierLoc(QualifierLoc);
7911 QualifierLoc, TL.getNameLoc());
7914 NewTL.
set(TL.getElaboratedKeywordLoc(), QualifierLoc, TL.getNameLoc());
7918 NewTL.setQualifierLoc(QualifierLoc);
7919 NewTL.setNameLoc(TL.getNameLoc());
7924template<
typename Derived>
7928 = getDerived().TransformType(TLB, TL.getPatternLoc());
7929 if (Pattern.isNull())
7933 if (getDerived().AlwaysRebuild() ||
7934 Pattern != TL.getPatternLoc().getType()) {
7935 Result = getDerived().RebuildPackExpansionType(Pattern,
7936 TL.getPatternLoc().getSourceRange(),
7937 TL.getEllipsisLoc(),
7938 TL.getTypePtr()->getNumExpansions());
7948template<
typename Derived>
7953 TLB.pushFullCopy(TL);
7954 return TL.getType();
7957template<
typename Derived>
7961 const ObjCTypeParamType *T = TL.getTypePtr();
7963 getDerived().TransformDecl(T->getDecl()->getLocation(), T->getDecl()));
7968 if (getDerived().AlwaysRebuild() ||
7969 OTP != T->getDecl()) {
7970 Result = getDerived().RebuildObjCTypeParamType(
7971 OTP, TL.getProtocolLAngleLoc(),
7972 llvm::ArrayRef(TL.getTypePtr()->qual_begin(), TL.getNumProtocols()),
7973 TL.getProtocolLocs(), TL.getProtocolRAngleLoc());
7979 if (TL.getNumProtocols()) {
7980 NewTL.setProtocolLAngleLoc(TL.getProtocolLAngleLoc());
7981 for (
unsigned i = 0, n = TL.getNumProtocols(); i != n; ++i)
7982 NewTL.setProtocolLoc(i, TL.getProtocolLoc(i));
7983 NewTL.setProtocolRAngleLoc(TL.getProtocolRAngleLoc());
7988template<
typename Derived>
7993 QualType BaseType = getDerived().TransformType(TLB, TL.getBaseLoc());
7994 if (BaseType.isNull())
7997 bool AnyChanged = BaseType != TL.getBaseLoc().getType();
8001 for (
unsigned i = 0, n = TL.getNumTypeArgs(); i != n; ++i) {
8003 TypeLoc TypeArgLoc = TypeArgInfo->getTypeLoc();
8004 QualType TypeArg = TypeArgInfo->getType();
8009 const auto *PackExpansion = PackExpansionLoc.getType()
8010 ->castAs<PackExpansionType>();
8014 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
8018 TypeLoc PatternLoc = PackExpansionLoc.getPatternLoc();
8019 bool Expand =
false;
8020 bool RetainExpansion =
false;
8021 UnsignedOrNone NumExpansions = PackExpansion->getNumExpansions();
8022 if (getDerived().TryExpandParameterPacks(
8023 PackExpansionLoc.getEllipsisLoc(), PatternLoc.getSourceRange(),
8024 Unexpanded,
true, Expand,
8025 RetainExpansion, NumExpansions))
8035 TypeArgBuilder.
reserve(PatternLoc.getFullDataSize());
8036 QualType NewPatternType = getDerived().TransformType(TypeArgBuilder,
8038 if (NewPatternType.isNull())
8042 NewPatternType, NumExpansions);
8044 NewExpansionLoc.
setEllipsisLoc(PackExpansionLoc.getEllipsisLoc());
8045 NewTypeArgInfos.push_back(
8046 TypeArgBuilder.getTypeSourceInfo(SemaRef.
Context, NewExpansionType));
8052 for (
unsigned ArgIdx = 0; ArgIdx != *NumExpansions; ++ArgIdx) {
8056 TypeArgBuilder.
reserve(PatternLoc.getFullDataSize());
8058 QualType NewTypeArg = getDerived().TransformType(TypeArgBuilder,
8060 if (NewTypeArg.isNull())
8063 NewTypeArgInfos.push_back(
8064 TypeArgBuilder.getTypeSourceInfo(SemaRef.
Context, NewTypeArg));
8071 TypeArgBuilder.
reserve(TypeArgLoc.getFullDataSize());
8073 getDerived().TransformType(TypeArgBuilder, TypeArgLoc);
8074 if (NewTypeArg.isNull())
8078 if (NewTypeArg == TypeArg) {
8079 NewTypeArgInfos.push_back(TypeArgInfo);
8083 NewTypeArgInfos.push_back(
8084 TypeArgBuilder.getTypeSourceInfo(SemaRef.
Context, NewTypeArg));
8089 if (getDerived().AlwaysRebuild() || AnyChanged) {
8091 Result = getDerived().RebuildObjCObjectType(
8092 BaseType, TL.getBeginLoc(), TL.getTypeArgsLAngleLoc(), NewTypeArgInfos,
8093 TL.getTypeArgsRAngleLoc(), TL.getProtocolLAngleLoc(),
8094 llvm::ArrayRef(TL.getTypePtr()->qual_begin(), TL.getNumProtocols()),
8095 TL.getProtocolLocs(), TL.getProtocolRAngleLoc());
8103 NewT.setTypeArgsLAngleLoc(TL.getTypeArgsLAngleLoc());
8104 for (
unsigned i = 0, n = TL.getNumTypeArgs(); i != n; ++i)
8105 NewT.setTypeArgTInfo(i, NewTypeArgInfos[i]);
8106 NewT.setTypeArgsRAngleLoc(TL.getTypeArgsRAngleLoc());
8107 NewT.setProtocolLAngleLoc(TL.getProtocolLAngleLoc());
8108 for (
unsigned i = 0, n = TL.getNumProtocols(); i != n; ++i)
8109 NewT.setProtocolLoc(i, TL.getProtocolLoc(i));
8110 NewT.setProtocolRAngleLoc(TL.getProtocolRAngleLoc());
8114template<
typename Derived>
8118 QualType PointeeType = getDerived().TransformType(TLB, TL.getPointeeLoc());
8119 if (PointeeType.isNull())
8123 if (getDerived().AlwaysRebuild() ||
8124 PointeeType != TL.getPointeeLoc().getType()) {
8125 Result = getDerived().RebuildObjCObjectPointerType(PointeeType,
8139template<
typename Derived>
8145template<
typename Derived>
8148 return getDerived().TransformCompoundStmt(S,
false);
8151template<
typename Derived>
8158 getSema().resetFPOptions(
8161 bool SubStmtInvalid =
false;
8162 bool SubStmtChanged =
false;
8164 for (
auto *B : S->
body()) {
8166 B, IsStmtExpr && B == S->
body_back() ? StmtDiscardKind::StmtExprResult
8167 : StmtDiscardKind::Discarded);
8169 if (
Result.isInvalid()) {
8176 SubStmtInvalid =
true;
8180 SubStmtChanged = SubStmtChanged || Result.get() != B;
8181 Statements.push_back(Result.getAs<Stmt>());
8187 if (!getDerived().AlwaysRebuild() &&
8191 return getDerived().RebuildCompoundStmt(S->
getLBracLoc(),
8197template<
typename Derived>
8206 LHS = getDerived().TransformExpr(S->getLHS());
8208 if (LHS.isInvalid())
8212 RHS = getDerived().TransformExpr(S->getRHS());
8214 if (RHS.isInvalid())
8221 StmtResult Case = getDerived().RebuildCaseStmt(S->getCaseLoc(),
8223 S->getEllipsisLoc(),
8226 if (Case.isInvalid())
8231 getDerived().TransformStmt(S->getSubStmt());
8232 if (SubStmt.isInvalid())
8236 return getDerived().RebuildCaseStmtBody(Case.get(), SubStmt.get());
8239template <
typename Derived>
8243 getDerived().TransformStmt(S->getSubStmt());
8244 if (SubStmt.isInvalid())
8248 return getDerived().RebuildDefaultStmt(S->getDefaultLoc(), S->getColonLoc(),
8252template<
typename Derived>
8255 StmtResult SubStmt = getDerived().TransformStmt(S->getSubStmt(), SDK);
8256 if (SubStmt.isInvalid())
8259 Decl *LD = getDerived().TransformDecl(S->getDecl()->getLocation(),
8267 if (LD == S->getDecl())
8268 S->getDecl()->setStmt(
nullptr);
8271 return getDerived().RebuildLabelStmt(S->getIdentLoc(),
8276template <
typename Derived>
8281 switch (R->getKind()) {
8285 return getDerived().Transform##X##Attr(cast<X##Attr>(R));
8286#include "clang/Basic/AttrList.inc"
8291template <
typename Derived>
8298 switch (R->getKind()) {
8302 return getDerived().TransformStmt##X##Attr(OrigS, InstS, cast<X##Attr>(R));
8303#include "clang/Basic/AttrList.inc"
8308template <
typename Derived>
8311 StmtDiscardKind SDK) {
8316 bool AttrsChanged =
false;
8320 for (
const auto *I : S->
getAttrs()) {
8322 getDerived().TransformStmtAttr(S->
getSubStmt(), SubStmt.
get(), I);
8323 AttrsChanged |= (I != R);
8336 return getDerived().RebuildAttributedStmt(S->
getAttrLoc(), Attrs,
8340template<
typename Derived>
8345 if (
Init.isInvalid())
8349 if (!S->isConsteval()) {
8351 Cond = getDerived().TransformCondition(
8352 S->getIfLoc(), S->getConditionVariable(), S->getCond(),
8355 if (
Cond.isInvalid())
8360 std::optional<bool> ConstexprConditionValue;
8361 if (S->isConstexpr())
8362 ConstexprConditionValue =
Cond.getKnownValue();
8366 if (!ConstexprConditionValue || *ConstexprConditionValue) {
8370 S->isNonNegatedConsteval());
8372 Then = getDerived().TransformStmt(S->getThen());
8373 if (Then.isInvalid())
8379 Then =
new (getSema().Context)
8380 CompoundStmt(S->getThen()->getBeginLoc(), S->getThen()->getEndLoc());
8385 if (!ConstexprConditionValue || !*ConstexprConditionValue) {
8389 S->isNegatedConsteval());
8391 Else = getDerived().TransformStmt(S->getElse());
8392 if (Else.isInvalid())
8394 }
else if (S->getElse() && ConstexprConditionValue &&
8395 *ConstexprConditionValue) {
8399 Else =
new (getSema().Context)
8400 CompoundStmt(S->getElse()->getBeginLoc(), S->getElse()->getEndLoc());
8403 if (!getDerived().AlwaysRebuild() &&
8404 Init.get() == S->getInit() &&
8405 Cond.get() == std::make_pair(S->getConditionVariable(), S->getCond()) &&
8406 Then.get() == S->getThen() &&
8407 Else.get() == S->getElse())
8410 return getDerived().RebuildIfStmt(
8411 S->getIfLoc(), S->getStatementKind(), S->getLParenLoc(),
Cond,
8412 S->getRParenLoc(),
Init.get(), Then.get(), S->getElseLoc(), Else.get());
8415template<
typename Derived>
8420 if (
Init.isInvalid())
8425 S->getSwitchLoc(), S->getConditionVariable(), S->getCond(),
8427 if (
Cond.isInvalid())
8432 getDerived().RebuildSwitchStmtStart(S->getSwitchLoc(), S->getLParenLoc(),
8433 Init.get(),
Cond, S->getRParenLoc());
8438 StmtResult Body = getDerived().TransformStmt(S->getBody());
8439 if (Body.isInvalid())
8443 return getDerived().RebuildSwitchStmtBody(S->getSwitchLoc(),
Switch.get(),
8447template<
typename Derived>
8452 S->getWhileLoc(), S->getConditionVariable(), S->getCond(),
8454 if (
Cond.isInvalid())
8463 StmtResult Body = getDerived().TransformStmt(S->getBody());
8464 if (Body.isInvalid())
8467 if (!getDerived().AlwaysRebuild() &&
8468 Cond.get() == std::make_pair(S->getConditionVariable(), S->getCond()) &&
8469 Body.get() == S->getBody())
8472 return getDerived().RebuildWhileStmt(S->getWhileLoc(), S->getLParenLoc(),
8473 Cond, S->getRParenLoc(), Body.get());
8476template<
typename Derived>
8485 StmtResult Body = getDerived().TransformStmt(S->getBody());
8486 if (Body.isInvalid())
8491 if (
Cond.isInvalid())
8494 if (!getDerived().AlwaysRebuild() &&
8495 Cond.get() == S->getCond() &&
8496 Body.get() == S->getBody())
8499 return getDerived().RebuildDoStmt(S->getDoLoc(), Body.get(), S->getWhileLoc(),
8500 S->getWhileLoc(),
Cond.get(),
8504template<
typename Derived>
8507 if (getSema().getLangOpts().OpenMP)
8508 getSema().OpenMP().startOpenMPLoop();
8512 if (
Init.isInvalid())
8517 if (getSema().getLangOpts().OpenMP &&
Init.isUsable())
8518 getSema().OpenMP().ActOnOpenMPLoopInitialization(S->getForLoc(),
8523 S->getForLoc(), S->getConditionVariable(), S->getCond(),
8525 if (
Cond.isInvalid())
8530 if (
Inc.isInvalid())
8534 if (S->getInc() && !FullInc.get())
8541 S->getBeginLoc(), S->getInit(),
Init.get(), S->getCond(),
8542 Cond.get().second, S->getInc(),
Inc.get());
8545 StmtResult Body = getDerived().TransformStmt(S->getBody());
8546 if (Body.isInvalid())
8551 if (!getDerived().AlwaysRebuild() &&
8552 Init.get() == S->getInit() &&
8553 Cond.get() == std::make_pair(S->getConditionVariable(), S->getCond()) &&
8554 Inc.get() == S->getInc() &&
8555 Body.get() == S->getBody())
8558 return getDerived().RebuildForStmt(S->getForLoc(), S->getLParenLoc(),
8560 S->getRParenLoc(), Body.get());
8563template<
typename Derived>
8566 Decl *LD = getDerived().TransformDecl(S->getLabel()->getLocation(),
8572 return getDerived().RebuildGotoStmt(S->getGotoLoc(), S->getLabelLoc(),
8576template<
typename Derived>
8584 if (!getDerived().AlwaysRebuild() &&
8585 Target.get() == S->getTarget())
8588 return getDerived().RebuildIndirectGotoStmt(S->getGotoLoc(), S->getStarLoc(),
8592template<
typename Derived>
8595 if (!S->hasLabelTarget())
8598 Decl *LD = getDerived().TransformDecl(S->getLabelDecl()->getLocation(),
8607template<
typename Derived>
8610 if (!S->hasLabelTarget())
8613 Decl *LD = getDerived().TransformDecl(S->getLabelDecl()->getLocation(),
8622template <
typename Derived>
8630template<
typename Derived>
8640 return getDerived().RebuildReturnStmt(S->getReturnLoc(),
Result.get());
8643template<
typename Derived>
8646 bool DeclChanged =
false;
8649 for (
auto *D : S->decls()) {
8650 Decl *Transformed = getDerived().TransformDefinition(D->getLocation(), D);
8654 if (Transformed != D)
8658 if (
auto *TD = dyn_cast<TypeDecl>(Transformed)) {
8659 if (
auto *TN = dyn_cast<TypedefNameDecl>(TD)) {
8660 LSI->ContainsUnexpandedParameterPack |=
8661 TN->getUnderlyingType()->containsUnexpandedParameterPack();
8663 LSI->ContainsUnexpandedParameterPack |=
8666 .getTypeDeclType(TD)
8667 ->containsUnexpandedParameterPack();
8670 if (
auto *VD = dyn_cast<VarDecl>(Transformed))
8671 LSI->ContainsUnexpandedParameterPack |=
8672 VD->getType()->containsUnexpandedParameterPack();
8675 Decls.push_back(Transformed);
8678 if (!getDerived().AlwaysRebuild() && !DeclChanged)
8681 return getDerived().RebuildDeclStmt(Decls, S->getBeginLoc(), S->getEndLoc());
8684template<
typename Derived>
8694 bool ExprsChanged =
false;
8696 auto RebuildString = [&](
Expr *E) {
8701 ExprsChanged =
true;
8708 for (
unsigned I = 0, E = S->getNumOutputs(); I != E; ++I) {
8709 Names.push_back(S->getOutputIdentifier(I));
8715 Constraints.push_back(
Result.get());
8718 Expr *OutputExpr = S->getOutputExpr(I);
8719 Result = getDerived().TransformExpr(OutputExpr);
8723 ExprsChanged |=
Result.get() != OutputExpr;
8725 Exprs.push_back(
Result.get());
8729 for (
unsigned I = 0, E = S->getNumInputs(); I != E; ++I) {
8730 Names.push_back(S->getInputIdentifier(I));
8736 Constraints.push_back(
Result.get());
8739 Expr *InputExpr = S->getInputExpr(I);
8740 Result = getDerived().TransformExpr(InputExpr);
8744 ExprsChanged |=
Result.get() != InputExpr;
8746 Exprs.push_back(
Result.get());
8750 for (
unsigned I = 0, E = S->getNumLabels(); I != E; ++I) {
8751 Names.push_back(S->getLabelIdentifier(I));
8756 ExprsChanged |=
Result.get() != S->getLabelExpr(I);
8757 Exprs.push_back(
Result.get());
8761 for (
unsigned I = 0, E = S->getNumClobbers(); I != E; ++I) {
8765 Clobbers.push_back(
Result.get());
8768 ExprResult AsmString = RebuildString(S->getAsmStringExpr());
8769 if (AsmString.isInvalid())
8772 if (!getDerived().AlwaysRebuild() && !ExprsChanged)
8775 return getDerived().RebuildGCCAsmStmt(S->getAsmLoc(), S->isSimple(),
8776 S->isVolatile(), S->getNumOutputs(),
8777 S->getNumInputs(), Names.data(),
8778 Constraints, Exprs, AsmString.get(),
8779 Clobbers, S->getNumLabels(),
8783template<
typename Derived>
8788 bool HadError =
false, HadChange =
false;
8792 TransformedExprs.reserve(SrcExprs.size());
8793 for (
unsigned i = 0, e = SrcExprs.size(); i != e; ++i) {
8795 if (!
Result.isUsable()) {
8798 HadChange |= (
Result.get() != SrcExprs[i]);
8799 TransformedExprs.push_back(
Result.get());
8804 if (!HadChange && !getDerived().AlwaysRebuild())
8807 return getDerived().RebuildMSAsmStmt(S->getAsmLoc(), S->getLBraceLoc(),
8808 AsmToks, S->getAsmString(),
8809 S->getNumOutputs(), S->getNumInputs(),
8810 S->getAllConstraints(), S->getClobbers(),
8811 TransformedExprs, S->getEndLoc());
8815template<
typename Derived>
8820 assert(FD && ScopeInfo && !ScopeInfo->CoroutinePromise &&
8821 ScopeInfo->NeedsCoroutineSuspends &&
8822 ScopeInfo->CoroutineSuspends.first ==
nullptr &&
8823 ScopeInfo->CoroutineSuspends.second ==
nullptr &&
8824 "expected clean scope info");
8828 ScopeInfo->setNeedsCoroutineSuspends(
false);
8841 getDerived().transformedLocalDecl(S->getPromiseDecl(), {Promise});
8842 ScopeInfo->CoroutinePromise = Promise;
8847 StmtResult InitSuspend = getDerived().TransformStmt(S->getInitSuspendStmt());
8848 if (InitSuspend.isInvalid())
8851 getDerived().TransformStmt(S->getFinalSuspendStmt());
8852 if (FinalSuspend.isInvalid() ||
8855 ScopeInfo->setCoroutineSuspends(InitSuspend.get(), FinalSuspend.get());
8858 StmtResult BodyRes = getDerived().TransformStmt(S->getBody());
8859 if (BodyRes.isInvalid())
8863 if (Builder.isInvalid())
8866 Expr *ReturnObject = S->getReturnValueInit();
8867 assert(ReturnObject &&
"the return object is expected to be valid");
8868 ExprResult Res = getDerived().TransformInitializer(ReturnObject,
8870 if (Res.isInvalid())
8872 Builder.ReturnValue = Res.get();
8877 if (S->hasDependentPromiseType()) {
8880 if (!Promise->getType()->isDependentType()) {
8881 assert(!S->getFallthroughHandler() && !S->getExceptionHandler() &&
8882 !S->getReturnStmtOnAllocFailure() && !S->getDeallocate() &&
8883 "these nodes should not have been built yet");
8884 if (!Builder.buildDependentStatements())
8888 if (
auto *OnFallthrough = S->getFallthroughHandler()) {
8889 StmtResult Res = getDerived().TransformStmt(OnFallthrough);
8890 if (Res.isInvalid())
8892 Builder.OnFallthrough = Res.get();
8895 if (
auto *OnException = S->getExceptionHandler()) {
8896 StmtResult Res = getDerived().TransformStmt(OnException);
8897 if (Res.isInvalid())
8899 Builder.OnException = Res.get();
8902 if (
auto *OnAllocFailure = S->getReturnStmtOnAllocFailure()) {
8903 StmtResult Res = getDerived().TransformStmt(OnAllocFailure);
8904 if (Res.isInvalid())
8906 Builder.ReturnStmtOnAllocFailure = Res.get();
8910 assert(S->getAllocate() && S->getDeallocate() &&
8911 "allocation and deallocation calls must already be built");
8912 ExprResult AllocRes = getDerived().TransformExpr(S->getAllocate());
8913 if (AllocRes.isInvalid())
8915 Builder.Allocate = AllocRes.get();
8917 ExprResult DeallocRes = getDerived().TransformExpr(S->getDeallocate());
8918 if (DeallocRes.isInvalid())
8920 Builder.Deallocate = DeallocRes.get();
8922 if (
auto *ResultDecl = S->getResultDecl()) {
8923 StmtResult Res = getDerived().TransformStmt(ResultDecl);
8924 if (Res.isInvalid())
8926 Builder.ResultDecl = Res.get();
8931 if (Res.isInvalid())
8933 Builder.ReturnStmt = Res.get();
8937 return getDerived().RebuildCoroutineBodyStmt(Builder);
8940template<
typename Derived>
8950 return getDerived().RebuildCoreturnStmt(S->getKeywordLoc(),
Result.get(),
8954template <
typename Derived>
8967 ExprResult Lookup = getSema().BuildOperatorCoawaitLookupExpr(
8968 getSema().getCurScope(), E->getKeywordLoc());
8972 return getDerived().RebuildCoawaitExpr(
8973 E->getKeywordLoc(),
Operand.get(),
8977template <
typename Derived>
8980 ExprResult OperandResult = getDerived().TransformInitializer(E->getOperand(),
8982 if (OperandResult.isInvalid())
8986 E->getOperatorCoawaitLookup());
8993 return getDerived().RebuildDependentCoawaitExpr(
8994 E->getKeywordLoc(), OperandResult.get(),
8998template<
typename Derived>
9008 return getDerived().RebuildCoyieldExpr(E->getKeywordLoc(),
Result.get());
9013template<
typename Derived>
9017 StmtResult TryBody = getDerived().TransformStmt(S->getTryBody());
9018 if (TryBody.isInvalid())
9022 bool AnyCatchChanged =
false;
9024 for (
unsigned I = 0, N = S->getNumCatchStmts(); I != N; ++I) {
9025 StmtResult Catch = getDerived().TransformStmt(S->getCatchStmt(I));
9026 if (Catch.isInvalid())
9028 if (Catch.get() != S->getCatchStmt(I))
9029 AnyCatchChanged =
true;
9030 CatchStmts.push_back(Catch.get());
9035 if (S->getFinallyStmt()) {
9036 Finally = getDerived().TransformStmt(S->getFinallyStmt());
9037 if (Finally.isInvalid())
9042 if (!getDerived().AlwaysRebuild() &&
9043 TryBody.get() == S->getTryBody() &&
9045 Finally.get() == S->getFinallyStmt())
9049 return getDerived().RebuildObjCAtTryStmt(S->getAtTryLoc(), TryBody.get(),
9050 CatchStmts, Finally.get());
9053template<
typename Derived>
9058 if (
VarDecl *FromVar = S->getCatchParamDecl()) {
9060 if (FromVar->getTypeSourceInfo()) {
9061 TSInfo = getDerived().TransformType(FromVar->getTypeSourceInfo());
9068 T = TSInfo->getType();
9070 T = getDerived().TransformType(FromVar->getType());
9075 Var = getDerived().RebuildObjCExceptionDecl(FromVar, TSInfo, T);
9080 StmtResult Body = getDerived().TransformStmt(S->getCatchBody());
9081 if (Body.isInvalid())
9084 return getDerived().RebuildObjCAtCatchStmt(S->getAtCatchLoc(),
9089template<
typename Derived>
9093 StmtResult Body = getDerived().TransformStmt(S->getFinallyBody());
9094 if (Body.isInvalid())
9098 if (!getDerived().AlwaysRebuild() &&
9099 Body.get() == S->getFinallyBody())
9103 return getDerived().RebuildObjCAtFinallyStmt(S->getAtFinallyLoc(),
9107template<
typename Derived>
9111 if (S->getThrowExpr()) {
9112 Operand = getDerived().TransformExpr(S->getThrowExpr());
9117 if (!getDerived().AlwaysRebuild() &&
9118 Operand.get() == S->getThrowExpr())
9121 return getDerived().RebuildObjCAtThrowStmt(S->getThrowLoc(),
Operand.get());
9124template<
typename Derived>
9133 getDerived().RebuildObjCAtSynchronizedOperand(S->getAtSynchronizedLoc(),
9139 StmtResult Body = getDerived().TransformStmt(S->getSynchBody());
9140 if (Body.isInvalid())
9144 if (!getDerived().AlwaysRebuild() &&
9145 Object.get() == S->getSynchExpr() &&
9146 Body.get() == S->getSynchBody())
9150 return getDerived().RebuildObjCAtSynchronizedStmt(S->getAtSynchronizedLoc(),
9151 Object.get(), Body.get());
9154template<
typename Derived>
9159 StmtResult Body = getDerived().TransformStmt(S->getSubStmt());
9160 if (Body.isInvalid())
9164 if (!getDerived().AlwaysRebuild() &&
9165 Body.get() == S->getSubStmt())
9169 return getDerived().RebuildObjCAutoreleasePoolStmt(
9170 S->getAtLoc(), Body.get());
9173template<
typename Derived>
9178 StmtResult Element = getDerived().TransformStmt(
9179 S->getElement(), StmtDiscardKind::NotDiscarded);
9180 if (Element.isInvalid())
9184 ExprResult Collection = getDerived().TransformExpr(S->getCollection());
9185 if (Collection.isInvalid())
9189 StmtResult Body = getDerived().TransformStmt(S->getBody());
9190 if (Body.isInvalid())
9194 if (!getDerived().AlwaysRebuild() &&
9195 Element.get() == S->getElement() &&
9196 Collection.get() == S->getCollection() &&
9197 Body.get() == S->getBody())
9201 return getDerived().RebuildObjCForCollectionStmt(S->getForLoc(),
9208template <
typename Derived>
9212 if (
VarDecl *ExceptionDecl = S->getExceptionDecl()) {
9214 getDerived().TransformType(ExceptionDecl->getTypeSourceInfo());
9218 Var = getDerived().RebuildExceptionDecl(
9219 ExceptionDecl, T, ExceptionDecl->getInnerLocStart(),
9220 ExceptionDecl->getLocation(), ExceptionDecl->getIdentifier());
9221 if (!Var || Var->isInvalidDecl())
9226 StmtResult Handler = getDerived().TransformStmt(S->getHandlerBlock());
9227 if (Handler.isInvalid())
9230 if (!getDerived().AlwaysRebuild() && !Var &&
9231 Handler.get() == S->getHandlerBlock())
9234 return getDerived().RebuildCXXCatchStmt(S->getCatchLoc(), Var, Handler.get());
9237template <
typename Derived>
9240 StmtResult TryBlock = getDerived().TransformCompoundStmt(S->getTryBlock());
9241 if (TryBlock.isInvalid())
9245 bool HandlerChanged =
false;
9247 for (
unsigned I = 0, N = S->getNumHandlers(); I != N; ++I) {
9248 StmtResult Handler = getDerived().TransformCXXCatchStmt(S->getHandler(I));
9249 if (Handler.isInvalid())
9252 HandlerChanged = HandlerChanged || Handler.get() != S->getHandler(I);
9253 Handlers.push_back(Handler.getAs<
Stmt>());
9256 getSema().DiagnoseExceptionUse(S->getTryLoc(),
true);
9258 if (!getDerived().AlwaysRebuild() && TryBlock.get() == S->getTryBlock() &&
9262 return getDerived().RebuildCXXTryStmt(S->getTryLoc(), TryBlock.get(),
9266template<
typename Derived>
9277 auto &LastRecord = getSema().currentEvaluationContext();
9278 LastRecord.InLifetimeExtendingContext =
true;
9279 LastRecord.RebuildDefaultArgOrDefaultInit =
true;
9282 S->getInit() ? getDerived().TransformStmt(S->getInit()) :
StmtResult();
9283 if (
Init.isInvalid())
9287 if (
Range.isInvalid())
9292 getSema().ExprEvalContexts.back().ForRangeLifetimeExtendTemps.empty());
9293 auto ForRangeLifetimeExtendTemps =
9294 getSema().ExprEvalContexts.back().ForRangeLifetimeExtendTemps;
9296 StmtResult Begin = getDerived().TransformStmt(S->getBeginStmt());
9297 if (Begin.isInvalid())
9299 StmtResult End = getDerived().TransformStmt(S->getEndStmt());
9300 if (End.isInvalid())
9304 if (
Cond.isInvalid())
9308 if (
Cond.isInvalid())
9314 if (
Inc.isInvalid())
9319 StmtResult LoopVar = getDerived().TransformStmt(S->getLoopVarStmt());
9320 if (LoopVar.isInvalid())
9324 if (getDerived().AlwaysRebuild() ||
9325 Init.get() != S->getInit() ||
9326 Range.get() != S->getRangeStmt() ||
9327 Begin.get() != S->getBeginStmt() ||
9328 End.get() != S->getEndStmt() ||
9329 Cond.get() != S->getCond() ||
9330 Inc.get() != S->getInc() ||
9331 LoopVar.get() != S->getLoopVarStmt()) {
9332 NewStmt = getDerived().RebuildCXXForRangeStmt(
9333 S->getForLoc(), S->getCoawaitLoc(),
Init.get(), S->getColonLoc(),
9334 Range.get(), Begin.get(), End.get(),
Cond.get(),
Inc.get(),
9335 LoopVar.get(), S->getRParenLoc(), ForRangeLifetimeExtendTemps);
9336 if (NewStmt.isInvalid() && LoopVar.get() != S->getLoopVarStmt()) {
9338 getSema().ActOnInitializerError(
9349 StmtResult Body = getDerived().TransformStmt(S->getBody());
9350 if (Body.isInvalid())
9357 if (Body.get() != S->getBody() && NewStmt.get() == S) {
9358 NewStmt = getDerived().RebuildCXXForRangeStmt(
9359 S->getForLoc(), S->getCoawaitLoc(),
Init.get(), S->getColonLoc(),
9360 Range.get(), Begin.get(), End.get(),
Cond.get(),
Inc.get(),
9361 LoopVar.get(), S->getRParenLoc(), ForRangeLifetimeExtendTemps);
9362 if (NewStmt.isInvalid())
9366 if (NewStmt.get() == S)
9369 return FinishCXXForRangeStmt(NewStmt.get(), Body.get());
9372template<
typename Derived>
9378 if (S->getQualifierLoc()) {
9380 = getDerived().TransformNestedNameSpecifierLoc(S->getQualifierLoc());
9387 if (NameInfo.getName()) {
9388 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
9389 if (!NameInfo.getName())
9394 if (!getDerived().AlwaysRebuild() &&
9395 QualifierLoc == S->getQualifierLoc() &&
9396 NameInfo.getName() == S->getNameInfo().getName())
9401 SS.
Adopt(QualifierLoc);
9403 switch (getSema().CheckMicrosoftIfExistsSymbol(
nullptr, SS, NameInfo)) {
9405 if (S->isIfExists())
9408 return new (getSema().Context)
NullStmt(S->getKeywordLoc());
9411 if (S->isIfNotExists())
9414 return new (getSema().Context)
NullStmt(S->getKeywordLoc());
9425 StmtResult SubStmt = getDerived().TransformCompoundStmt(S->getSubStmt());
9426 if (SubStmt.isInvalid())
9434 return getDerived().RebuildMSDependentExistsStmt(S->getKeywordLoc(),
9441template<
typename Derived>
9445 if (E->getQualifierLoc()) {
9447 = getDerived().TransformNestedNameSpecifierLoc(E->getQualifierLoc());
9453 getDerived().TransformDecl(E->getMemberLoc(), E->getPropertyDecl()));
9458 if (
Base.isInvalid())
9464 QualifierLoc, E->getMemberLoc());
9467template <
typename Derived>
9471 if (BaseRes.isInvalid())
9473 auto IdxRes = getDerived().TransformExpr(E->getIdx());
9474 if (IdxRes.isInvalid())
9477 if (!getDerived().AlwaysRebuild() &&
9478 BaseRes.get() == E->getBase() &&
9479 IdxRes.get() == E->getIdx())
9482 return getDerived().RebuildArraySubscriptExpr(
9483 BaseRes.get(),
SourceLocation(), IdxRes.get(), E->getRBracketLoc());
9486template <
typename Derived>
9488 StmtResult TryBlock = getDerived().TransformCompoundStmt(S->getTryBlock());
9489 if (TryBlock.isInvalid())
9492 StmtResult Handler = getDerived().TransformSEHHandler(S->getHandler());
9493 if (Handler.isInvalid())
9496 if (!getDerived().AlwaysRebuild() && TryBlock.get() == S->getTryBlock() &&
9497 Handler.get() == S->getHandler())
9500 return getDerived().RebuildSEHTryStmt(S->getIsCXXTry(), S->getTryLoc(),
9501 TryBlock.get(), Handler.get());
9504template <
typename Derived>
9507 if (
Block.isInvalid())
9510 return getDerived().RebuildSEHFinallyStmt(S->getFinallyLoc(),
Block.get());
9513template <
typename Derived>
9515 ExprResult FilterExpr = getDerived().TransformExpr(S->getFilterExpr());
9516 if (FilterExpr.isInvalid())
9520 if (
Block.isInvalid())
9523 return getDerived().RebuildSEHExceptStmt(S->getExceptLoc(), FilterExpr.get(),
9527template <
typename Derived>
9535template<
typename Derived>
9545template <
typename Derived>
9547TreeTransform<Derived>::TransformOMPCanonicalLoop(OMPCanonicalLoop *L) {
9551 return getDerived().TransformStmt(L->getLoopStmt());
9554template <
typename Derived>
9561 TClauses.reserve(Clauses.size());
9565 getDerived().getSema().OpenMP().StartOpenMPClause((*I)->getClauseKind());
9567 getDerived().getSema().OpenMP().EndOpenMPClause();
9569 TClauses.push_back(Clause);
9571 TClauses.push_back(
nullptr);
9575 if (D->hasAssociatedStmt() && D->getAssociatedStmt()) {
9576 getDerived().getSema().OpenMP().ActOnOpenMPRegionStart(
9577 D->getDirectiveKind(),
9583 if (D->getDirectiveKind() == OMPD_atomic ||
9584 D->getDirectiveKind() == OMPD_critical ||
9585 D->getDirectiveKind() == OMPD_section ||
9586 D->getDirectiveKind() == OMPD_master)
9587 CS = D->getAssociatedStmt();
9589 CS = D->getRawStmt();
9592 getSema().getLangOpts().OpenMPIRBuilder)
9596 getDerived().getSema().OpenMP().ActOnOpenMPRegionEnd(Body, TClauses);
9601 if (TClauses.size() != Clauses.size()) {
9607 if (D->getDirectiveKind() == OMPD_critical) {
9609 DirName =
getDerived().TransformDeclarationNameInfo(DirName);
9612 if (D->getDirectiveKind() == OMPD_cancellation_point) {
9614 }
else if (D->getDirectiveKind() == OMPD_cancel) {
9618 return getDerived().RebuildOMPExecutableDirective(
9619 D->getDirectiveKind(), DirName, CancelRegion, TClauses,
9620 AssociatedStmt.
get(), D->getBeginLoc(), D->getEndLoc());
9628template <
typename Derived>
9635 TClauses.reserve(Clauses.size());
9638 getDerived().getSema().OpenMP().StartOpenMPClause(
C->getClauseKind());
9640 getDerived().getSema().OpenMP().EndOpenMPClause();
9642 TClauses.push_back(Clause);
9644 TClauses.push_back(
nullptr);
9648 if (D->hasAssociatedStmt() && D->getAssociatedStmt()) {
9649 getDerived().getSema().OpenMP().ActOnOpenMPRegionStart(
9650 D->getDirectiveKind(),
9655 assert(D->getDirectiveKind() == OMPD_assume &&
9656 "Unexpected informational directive");
9657 Stmt *CS = D->getAssociatedStmt();
9661 getDerived().getSema().OpenMP().ActOnOpenMPRegionEnd(Body, TClauses);
9665 if (TClauses.size() != Clauses.size())
9670 return getDerived().RebuildOMPInformationalDirective(
9671 D->getDirectiveKind(), DirName, TClauses, AssociatedStmt.
get(),
9672 D->getBeginLoc(), D->getEndLoc());
9675template <
typename Derived>
9680 SemaRef.
Diag(D->getBeginLoc(), diag::err_omp_instantiation_not_supported)
9681 << getOpenMPDirectiveName(D->getDirectiveKind(), OMPVersion);
9685template <
typename Derived>
9687TreeTransform<Derived>::TransformOMPParallelDirective(OMPParallelDirective *D) {
9688 DeclarationNameInfo DirName;
9689 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9690 OMPD_parallel, DirName,
nullptr, D->getBeginLoc());
9691 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9692 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9696template <
typename Derived>
9700 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9701 OMPD_simd, DirName,
nullptr, D->getBeginLoc());
9702 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9703 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9707template <
typename Derived>
9711 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9712 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
9713 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9714 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9718template <
typename Derived>
9722 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9723 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
9724 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9725 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9729template <
typename Derived>
9733 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9734 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
9735 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9736 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9740template <
typename Derived>
9744 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9745 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
9746 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9747 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9751template <
typename Derived>
9753 OMPInterchangeDirective *D) {
9755 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9756 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
9757 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9758 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9762template <
typename Derived>
9766 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9767 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
9768 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9769 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9773template <
typename Derived>
9777 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9778 OMPD_for, DirName,
nullptr, D->getBeginLoc());
9779 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9780 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9784template <
typename Derived>
9788 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9789 OMPD_for_simd, DirName,
nullptr, D->getBeginLoc());
9790 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9791 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9795template <
typename Derived>
9799 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9800 OMPD_sections, DirName,
nullptr, D->getBeginLoc());
9801 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9802 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9806template <
typename Derived>
9810 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9811 OMPD_section, DirName,
nullptr, D->getBeginLoc());
9812 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9813 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9817template <
typename Derived>
9821 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9822 OMPD_scope, DirName,
nullptr, D->getBeginLoc());
9823 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9824 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9828template <
typename Derived>
9832 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9833 OMPD_single, DirName,
nullptr, D->getBeginLoc());
9834 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9835 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9839template <
typename Derived>
9843 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9844 OMPD_master, DirName,
nullptr, D->getBeginLoc());
9845 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9846 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9850template <
typename Derived>
9854 OMPD_critical, D->getDirectiveName(),
nullptr, D->getBeginLoc());
9855 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9856 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9860template <
typename Derived>
9862 OMPParallelForDirective *D) {
9864 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9865 OMPD_parallel_for, DirName,
nullptr, D->getBeginLoc());
9866 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9867 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9871template <
typename Derived>
9873 OMPParallelForSimdDirective *D) {
9875 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9876 OMPD_parallel_for_simd, DirName,
nullptr, D->getBeginLoc());
9877 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9878 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9882template <
typename Derived>
9884 OMPParallelMasterDirective *D) {
9886 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9887 OMPD_parallel_master, DirName,
nullptr, D->getBeginLoc());
9888 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9889 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9893template <
typename Derived>
9895 OMPParallelMaskedDirective *D) {
9897 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9898 OMPD_parallel_masked, DirName,
nullptr, D->getBeginLoc());
9899 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9900 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9904template <
typename Derived>
9906 OMPParallelSectionsDirective *D) {
9908 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9909 OMPD_parallel_sections, DirName,
nullptr, D->getBeginLoc());
9910 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9911 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9915template <
typename Derived>
9919 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9920 OMPD_task, DirName,
nullptr, D->getBeginLoc());
9921 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9922 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9926template <
typename Derived>
9928 OMPTaskyieldDirective *D) {
9930 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9931 OMPD_taskyield, DirName,
nullptr, D->getBeginLoc());
9932 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9933 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9937template <
typename Derived>
9941 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9942 OMPD_barrier, DirName,
nullptr, D->getBeginLoc());
9943 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9944 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9948template <
typename Derived>
9952 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9953 OMPD_taskwait, DirName,
nullptr, D->getBeginLoc());
9954 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9955 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9959template <
typename Derived>
9963 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9964 OMPD_assume, DirName,
nullptr, D->getBeginLoc());
9965 StmtResult Res = getDerived().TransformOMPInformationalDirective(D);
9966 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9970template <
typename Derived>
9974 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9975 OMPD_error, DirName,
nullptr, D->getBeginLoc());
9976 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9977 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9981template <
typename Derived>
9983 OMPTaskgroupDirective *D) {
9985 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9986 OMPD_taskgroup, DirName,
nullptr, D->getBeginLoc());
9987 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9988 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9992template <
typename Derived>
9996 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9997 OMPD_flush, DirName,
nullptr, D->getBeginLoc());
9998 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9999 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10003template <
typename Derived>
10007 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10008 OMPD_depobj, DirName,
nullptr, D->getBeginLoc());
10009 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10010 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10014template <
typename Derived>
10018 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10019 OMPD_scan, DirName,
nullptr, D->getBeginLoc());
10020 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10021 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10025template <
typename Derived>
10029 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10030 OMPD_ordered, DirName,
nullptr, D->getBeginLoc());
10031 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10032 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10036template <
typename Derived>
10040 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10041 OMPD_atomic, DirName,
nullptr, D->getBeginLoc());
10042 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10043 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10047template <
typename Derived>
10051 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10052 OMPD_target, DirName,
nullptr, D->getBeginLoc());
10053 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10054 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10058template <
typename Derived>
10060 OMPTargetDataDirective *D) {
10062 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10063 OMPD_target_data, DirName,
nullptr, D->getBeginLoc());
10064 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10065 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10069template <
typename Derived>
10071 OMPTargetEnterDataDirective *D) {
10073 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10074 OMPD_target_enter_data, DirName,
nullptr, D->getBeginLoc());
10075 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10076 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10080template <
typename Derived>
10082 OMPTargetExitDataDirective *D) {
10084 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10085 OMPD_target_exit_data, DirName,
nullptr, D->getBeginLoc());
10086 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10087 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10091template <
typename Derived>
10093 OMPTargetParallelDirective *D) {
10095 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10096 OMPD_target_parallel, DirName,
nullptr, D->getBeginLoc());
10097 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10098 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10102template <
typename Derived>
10104 OMPTargetParallelForDirective *D) {
10106 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10107 OMPD_target_parallel_for, DirName,
nullptr, D->getBeginLoc());
10108 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10109 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10113template <
typename Derived>
10115 OMPTargetUpdateDirective *D) {
10117 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10118 OMPD_target_update, DirName,
nullptr, D->getBeginLoc());
10119 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10120 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10124template <
typename Derived>
10128 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10129 OMPD_teams, DirName,
nullptr, D->getBeginLoc());
10130 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10131 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10135template <
typename Derived>
10137 OMPCancellationPointDirective *D) {
10139 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10140 OMPD_cancellation_point, DirName,
nullptr, D->getBeginLoc());
10141 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10142 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10146template <
typename Derived>
10150 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10151 OMPD_cancel, DirName,
nullptr, D->getBeginLoc());
10152 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10153 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10157template <
typename Derived>
10161 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10162 OMPD_taskloop, DirName,
nullptr, D->getBeginLoc());
10163 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10164 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10168template <
typename Derived>
10170 OMPTaskLoopSimdDirective *D) {
10172 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10173 OMPD_taskloop_simd, DirName,
nullptr, D->getBeginLoc());
10174 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10175 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10179template <
typename Derived>
10181 OMPMasterTaskLoopDirective *D) {
10183 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10184 OMPD_master_taskloop, DirName,
nullptr, D->getBeginLoc());
10185 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10186 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10190template <
typename Derived>
10192 OMPMaskedTaskLoopDirective *D) {
10194 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10195 OMPD_masked_taskloop, DirName,
nullptr, D->getBeginLoc());
10196 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10197 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10201template <
typename Derived>
10203 OMPMasterTaskLoopSimdDirective *D) {
10205 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10206 OMPD_master_taskloop_simd, DirName,
nullptr, D->getBeginLoc());
10207 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10208 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10212template <
typename Derived>
10214 OMPMaskedTaskLoopSimdDirective *D) {
10216 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10217 OMPD_masked_taskloop_simd, DirName,
nullptr, D->getBeginLoc());
10218 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10219 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10223template <
typename Derived>
10225 OMPParallelMasterTaskLoopDirective *D) {
10227 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10228 OMPD_parallel_master_taskloop, DirName,
nullptr, D->getBeginLoc());
10229 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10230 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10234template <
typename Derived>
10236 OMPParallelMaskedTaskLoopDirective *D) {
10238 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10239 OMPD_parallel_masked_taskloop, DirName,
nullptr, D->getBeginLoc());
10240 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10241 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10245template <
typename Derived>
10248 OMPParallelMasterTaskLoopSimdDirective *D) {
10250 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10251 OMPD_parallel_master_taskloop_simd, DirName,
nullptr, D->getBeginLoc());
10252 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10253 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10257template <
typename Derived>
10260 OMPParallelMaskedTaskLoopSimdDirective *D) {
10262 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10263 OMPD_parallel_masked_taskloop_simd, DirName,
nullptr, D->getBeginLoc());
10264 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10265 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10269template <
typename Derived>
10271 OMPDistributeDirective *D) {
10273 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10274 OMPD_distribute, DirName,
nullptr, D->getBeginLoc());
10275 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10276 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10280template <
typename Derived>
10282 OMPDistributeParallelForDirective *D) {
10284 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10285 OMPD_distribute_parallel_for, DirName,
nullptr, D->getBeginLoc());
10286 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10287 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10291template <
typename Derived>
10294 OMPDistributeParallelForSimdDirective *D) {
10296 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10297 OMPD_distribute_parallel_for_simd, DirName,
nullptr, D->getBeginLoc());
10298 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10299 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10303template <
typename Derived>
10305 OMPDistributeSimdDirective *D) {
10307 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10308 OMPD_distribute_simd, DirName,
nullptr, D->getBeginLoc());
10309 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10310 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10314template <
typename Derived>
10316 OMPTargetParallelForSimdDirective *D) {
10318 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10319 OMPD_target_parallel_for_simd, DirName,
nullptr, D->getBeginLoc());
10320 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10321 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10325template <
typename Derived>
10327 OMPTargetSimdDirective *D) {
10329 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10330 OMPD_target_simd, DirName,
nullptr, D->getBeginLoc());
10331 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10332 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10336template <
typename Derived>
10338 OMPTeamsDistributeDirective *D) {
10340 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10341 OMPD_teams_distribute, DirName,
nullptr, D->getBeginLoc());
10342 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10343 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10347template <
typename Derived>
10349 OMPTeamsDistributeSimdDirective *D) {
10351 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10352 OMPD_teams_distribute_simd, DirName,
nullptr, D->getBeginLoc());
10353 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10354 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10358template <
typename Derived>
10360 OMPTeamsDistributeParallelForSimdDirective *D) {
10362 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10363 OMPD_teams_distribute_parallel_for_simd, DirName,
nullptr,
10365 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10366 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10370template <
typename Derived>
10372 OMPTeamsDistributeParallelForDirective *D) {
10374 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10375 OMPD_teams_distribute_parallel_for, DirName,
nullptr, D->getBeginLoc());
10376 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10377 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10381template <
typename Derived>
10383 OMPTargetTeamsDirective *D) {
10385 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10386 OMPD_target_teams, DirName,
nullptr, D->getBeginLoc());
10387 auto Res = getDerived().TransformOMPExecutableDirective(D);
10388 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10392template <
typename Derived>
10394 OMPTargetTeamsDistributeDirective *D) {
10396 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10397 OMPD_target_teams_distribute, DirName,
nullptr, D->getBeginLoc());
10398 auto Res = getDerived().TransformOMPExecutableDirective(D);
10399 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10403template <
typename Derived>
10406 OMPTargetTeamsDistributeParallelForDirective *D) {
10408 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10409 OMPD_target_teams_distribute_parallel_for, DirName,
nullptr,
10411 auto Res = getDerived().TransformOMPExecutableDirective(D);
10412 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10416template <
typename Derived>
10419 OMPTargetTeamsDistributeParallelForSimdDirective *D) {
10421 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10422 OMPD_target_teams_distribute_parallel_for_simd, DirName,
nullptr,
10424 auto Res = getDerived().TransformOMPExecutableDirective(D);
10425 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10429template <
typename Derived>
10432 OMPTargetTeamsDistributeSimdDirective *D) {
10434 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10435 OMPD_target_teams_distribute_simd, DirName,
nullptr, D->getBeginLoc());
10436 auto Res = getDerived().TransformOMPExecutableDirective(D);
10437 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10441template <
typename Derived>
10445 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10446 OMPD_interop, DirName,
nullptr, D->getBeginLoc());
10447 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10448 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10452template <
typename Derived>
10456 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10457 OMPD_dispatch, DirName,
nullptr, D->getBeginLoc());
10458 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10459 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10463template <
typename Derived>
10467 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10468 OMPD_masked, DirName,
nullptr, D->getBeginLoc());
10469 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10470 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10474template <
typename Derived>
10476 OMPGenericLoopDirective *D) {
10478 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10479 OMPD_loop, DirName,
nullptr, D->getBeginLoc());
10480 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10481 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10485template <
typename Derived>
10487 OMPTeamsGenericLoopDirective *D) {
10489 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10490 OMPD_teams_loop, DirName,
nullptr, D->getBeginLoc());
10491 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10492 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10496template <
typename Derived>
10498 OMPTargetTeamsGenericLoopDirective *D) {
10500 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10501 OMPD_target_teams_loop, DirName,
nullptr, D->getBeginLoc());
10502 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10503 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10507template <
typename Derived>
10509 OMPParallelGenericLoopDirective *D) {
10511 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10512 OMPD_parallel_loop, DirName,
nullptr, D->getBeginLoc());
10513 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10514 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10518template <
typename Derived>
10521 OMPTargetParallelGenericLoopDirective *D) {
10523 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10524 OMPD_target_parallel_loop, DirName,
nullptr, D->getBeginLoc());
10525 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10526 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10533template <
typename Derived>
10536 if (
Cond.isInvalid())
10538 return getDerived().RebuildOMPIfClause(
10539 C->getNameModifier(),
Cond.get(),
C->getBeginLoc(),
C->getLParenLoc(),
10540 C->getNameModifierLoc(),
C->getColonLoc(),
C->getEndLoc());
10543template <
typename Derived>
10546 if (
Cond.isInvalid())
10548 return getDerived().RebuildOMPFinalClause(
Cond.get(),
C->getBeginLoc(),
10549 C->getLParenLoc(),
C->getEndLoc());
10552template <
typename Derived>
10555 ExprResult NumThreads = getDerived().TransformExpr(
C->getNumThreads());
10556 if (NumThreads.isInvalid())
10558 return getDerived().RebuildOMPNumThreadsClause(
10559 C->getModifier(), NumThreads.get(),
C->getBeginLoc(),
C->getLParenLoc(),
10560 C->getModifierLoc(),
C->getEndLoc());
10563template <
typename Derived>
10566 ExprResult E = getDerived().TransformExpr(
C->getSafelen());
10569 return getDerived().RebuildOMPSafelenClause(
10570 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10573template <
typename Derived>
10576 ExprResult E = getDerived().TransformExpr(
C->getAllocator());
10579 return getDerived().RebuildOMPAllocatorClause(
10580 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10583template <
typename Derived>
10586 ExprResult E = getDerived().TransformExpr(
C->getSimdlen());
10589 return getDerived().RebuildOMPSimdlenClause(
10590 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10593template <
typename Derived>
10596 TransformedSizes.reserve(
C->getNumSizes());
10598 for (
Expr *E :
C->getSizesRefs()) {
10600 TransformedSizes.push_back(
nullptr);
10604 ExprResult T = getDerived().TransformExpr(E);
10609 TransformedSizes.push_back(T.get());
10612 if (!Changed && !getDerived().AlwaysRebuild())
10614 return RebuildOMPSizesClause(TransformedSizes,
C->getBeginLoc(),
10615 C->getLParenLoc(),
C->getEndLoc());
10618template <
typename Derived>
10622 TransformedArgs.reserve(
C->getNumLoops());
10624 for (
Expr *E :
C->getArgsRefs()) {
10626 TransformedArgs.push_back(
nullptr);
10630 ExprResult T = getDerived().TransformExpr(E);
10635 TransformedArgs.push_back(T.get());
10638 if (!Changed && !getDerived().AlwaysRebuild())
10640 return RebuildOMPPermutationClause(TransformedArgs,
C->getBeginLoc(),
10641 C->getLParenLoc(),
C->getEndLoc());
10644template <
typename Derived>
10646 if (!getDerived().AlwaysRebuild())
10648 return RebuildOMPFullClause(
C->getBeginLoc(),
C->getEndLoc());
10651template <
typename Derived>
10654 ExprResult T = getDerived().TransformExpr(
C->getFactor());
10657 Expr *Factor = T.get();
10658 bool Changed = Factor !=
C->getFactor();
10660 if (!Changed && !getDerived().AlwaysRebuild())
10662 return RebuildOMPPartialClause(Factor,
C->getBeginLoc(),
C->getLParenLoc(),
10666template <
typename Derived>
10669 ExprResult F = getDerived().TransformExpr(
C->getFirst());
10673 ExprResult Cn = getDerived().TransformExpr(
C->getCount());
10674 if (Cn.isInvalid())
10678 Expr *Count = Cn.get();
10680 bool Changed = (
First !=
C->getFirst()) || (Count !=
C->getCount());
10683 if (!Changed && !getDerived().AlwaysRebuild())
10686 return RebuildOMPLoopRangeClause(
First, Count,
C->getBeginLoc(),
10687 C->getLParenLoc(),
C->getFirstLoc(),
10688 C->getCountLoc(),
C->getEndLoc());
10691template <
typename Derived>
10694 ExprResult E = getDerived().TransformExpr(
C->getNumForLoops());
10697 return getDerived().RebuildOMPCollapseClause(
10698 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10701template <
typename Derived>
10705 C->getDefaultKind(),
C->getDefaultKindKwLoc(),
C->getDefaultVC(),
10706 C->getDefaultVCLoc(),
C->getBeginLoc(),
C->getLParenLoc(),
10710template <
typename Derived>
10717template <
typename Derived>
10720 Expr *Impex =
C->getImpexType();
10721 ExprResult TransformedImpex = getDerived().TransformExpr(Impex);
10723 if (TransformedImpex.isInvalid())
10726 return getDerived().RebuildOMPTransparentClause(
10727 TransformedImpex.get(),
C->getBeginLoc(),
C->getLParenLoc(),
10731template <
typename Derived>
10735 C->getProcBindKind(),
C->getProcBindKindKwLoc(),
C->getBeginLoc(),
10736 C->getLParenLoc(),
C->getEndLoc());
10739template <
typename Derived>
10742 ExprResult E = getDerived().TransformExpr(
C->getChunkSize());
10745 return getDerived().RebuildOMPScheduleClause(
10746 C->getFirstScheduleModifier(),
C->getSecondScheduleModifier(),
10747 C->getScheduleKind(), E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
10748 C->getFirstScheduleModifierLoc(),
C->getSecondScheduleModifierLoc(),
10749 C->getScheduleKindLoc(),
C->getCommaLoc(),
C->getEndLoc());
10752template <
typename Derived>
10756 if (
auto *
Num =
C->getNumForLoops()) {
10757 E = getDerived().TransformExpr(
Num);
10761 return getDerived().RebuildOMPOrderedClause(
C->getBeginLoc(),
C->getEndLoc(),
10762 C->getLParenLoc(), E.get());
10765template <
typename Derived>
10769 if (
Expr *Evt =
C->getEventHandler()) {
10770 E = getDerived().TransformExpr(Evt);
10774 return getDerived().RebuildOMPDetachClause(E.get(),
C->getBeginLoc(),
10775 C->getLParenLoc(),
C->getEndLoc());
10778template <
typename Derived>
10784 if (
Cond.isInvalid())
10787 return getDerived().RebuildOMPNowaitClause(
Cond.get(),
C->getBeginLoc(),
10788 C->getLParenLoc(),
C->getEndLoc());
10791template <
typename Derived>
10798template <
typename Derived>
10805template <
typename Derived>
10811template <
typename Derived>
10817template <
typename Derived>
10824template <
typename Derived>
10831template <
typename Derived>
10838template <
typename Derived>
10844template <
typename Derived>
10850template <
typename Derived>
10852 ExprResult E = getDerived().TransformExpr(
C->getExpr());
10855 return getDerived().RebuildOMPHoldsClause(E.get(),
C->getBeginLoc(),
10856 C->getLParenLoc(),
C->getEndLoc());
10859template <
typename Derived>
10865template <
typename Derived>
10870template <
typename Derived>
10872 OMPNoOpenMPRoutinesClause *
C) {
10875template <
typename Derived>
10877 OMPNoOpenMPConstructsClause *
C) {
10880template <
typename Derived>
10882 OMPNoParallelismClause *
C) {
10886template <
typename Derived>
10893template <
typename Derived>
10900template <
typename Derived>
10907template <
typename Derived>
10914template <
typename Derived>
10921template <
typename Derived>
10927template <
typename Derived>
10934template <
typename Derived>
10940template <
typename Derived>
10947template <
typename Derived>
10949 ExprResult IVR = getDerived().TransformExpr(
C->getInteropVar());
10950 if (IVR.isInvalid())
10954 InteropInfo.PreferTypes.reserve(
C->varlist_size() - 1);
10955 for (
Expr *E : llvm::drop_begin(
C->varlist())) {
10957 if (ER.isInvalid())
10959 InteropInfo.PreferTypes.push_back(ER.get());
10961 return getDerived().RebuildOMPInitClause(IVR.get(), InteropInfo,
10962 C->getBeginLoc(),
C->getLParenLoc(),
10963 C->getVarLoc(),
C->getEndLoc());
10966template <
typename Derived>
10968 ExprResult ER = getDerived().TransformExpr(
C->getInteropVar());
10969 if (ER.isInvalid())
10971 return getDerived().RebuildOMPUseClause(ER.get(),
C->getBeginLoc(),
10972 C->getLParenLoc(),
C->getVarLoc(),
10976template <
typename Derived>
10980 if (
Expr *IV =
C->getInteropVar()) {
10981 ER = getDerived().TransformExpr(IV);
10982 if (ER.isInvalid())
10985 return getDerived().RebuildOMPDestroyClause(ER.get(),
C->getBeginLoc(),
10986 C->getLParenLoc(),
C->getVarLoc(),
10990template <
typename Derived>
10994 if (
Cond.isInvalid())
10996 return getDerived().RebuildOMPNovariantsClause(
10997 Cond.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11000template <
typename Derived>
11004 if (
Cond.isInvalid())
11006 return getDerived().RebuildOMPNocontextClause(
11007 Cond.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11010template <
typename Derived>
11013 ExprResult ThreadID = getDerived().TransformExpr(
C->getThreadID());
11014 if (ThreadID.isInvalid())
11016 return getDerived().RebuildOMPFilterClause(ThreadID.get(),
C->getBeginLoc(),
11017 C->getLParenLoc(),
C->getEndLoc());
11020template <
typename Derived>
11022 ExprResult E = getDerived().TransformExpr(
C->getAlignment());
11025 return getDerived().RebuildOMPAlignClause(E.get(),
C->getBeginLoc(),
11026 C->getLParenLoc(),
C->getEndLoc());
11029template <
typename Derived>
11031 OMPUnifiedAddressClause *
C) {
11032 llvm_unreachable(
"unified_address clause cannot appear in dependent context");
11035template <
typename Derived>
11037 OMPUnifiedSharedMemoryClause *
C) {
11039 "unified_shared_memory clause cannot appear in dependent context");
11042template <
typename Derived>
11044 OMPReverseOffloadClause *
C) {
11045 llvm_unreachable(
"reverse_offload clause cannot appear in dependent context");
11048template <
typename Derived>
11050 OMPDynamicAllocatorsClause *
C) {
11052 "dynamic_allocators clause cannot appear in dependent context");
11055template <
typename Derived>
11057 OMPAtomicDefaultMemOrderClause *
C) {
11059 "atomic_default_mem_order clause cannot appear in dependent context");
11062template <
typename Derived>
11065 llvm_unreachable(
"self_maps clause cannot appear in dependent context");
11068template <
typename Derived>
11071 C->getBeginLoc(),
C->getLParenLoc(),
11075template <
typename Derived>
11079 C->getSeverityKind(),
C->getSeverityKindKwLoc(),
C->getBeginLoc(),
11080 C->getLParenLoc(),
C->getEndLoc());
11083template <
typename Derived>
11086 ExprResult E = getDerived().TransformExpr(
C->getMessageString());
11089 return getDerived().RebuildOMPMessageClause(
11090 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11093template <
typename Derived>
11097 Vars.reserve(
C->varlist_size());
11098 for (
auto *
VE :
C->varlist()) {
11100 if (EVar.isInvalid())
11102 Vars.push_back(EVar.get());
11104 return getDerived().RebuildOMPPrivateClause(
11105 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11108template <
typename Derived>
11110 OMPFirstprivateClause *
C) {
11112 Vars.reserve(
C->varlist_size());
11113 for (
auto *
VE :
C->varlist()) {
11115 if (EVar.isInvalid())
11117 Vars.push_back(EVar.get());
11119 return getDerived().RebuildOMPFirstprivateClause(
11120 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11123template <
typename Derived>
11127 Vars.reserve(
C->varlist_size());
11128 for (
auto *
VE :
C->varlist()) {
11130 if (EVar.isInvalid())
11132 Vars.push_back(EVar.get());
11134 return getDerived().RebuildOMPLastprivateClause(
11135 Vars,
C->getKind(),
C->getKindLoc(),
C->getColonLoc(),
C->getBeginLoc(),
11136 C->getLParenLoc(),
C->getEndLoc());
11139template <
typename Derived>
11143 Vars.reserve(
C->varlist_size());
11144 for (
auto *
VE :
C->varlist()) {
11146 if (EVar.isInvalid())
11148 Vars.push_back(EVar.get());
11150 return getDerived().RebuildOMPSharedClause(Vars,
C->getBeginLoc(),
11151 C->getLParenLoc(),
C->getEndLoc());
11154template <
typename Derived>
11158 Vars.reserve(
C->varlist_size());
11159 for (
auto *
VE :
C->varlist()) {
11161 if (EVar.isInvalid())
11163 Vars.push_back(EVar.get());
11166 ReductionIdScopeSpec.
Adopt(
C->getQualifierLoc());
11169 if (NameInfo.getName()) {
11170 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
11171 if (!NameInfo.getName())
11177 for (
auto *E :
C->reduction_ops()) {
11182 for (
auto *D : ULE->decls()) {
11185 Decls.addDecl(InstD, InstD->getAccess());
11189 ReductionIdScopeSpec.getWithLocInContext(SemaRef.
Context), NameInfo,
11190 true, Decls.begin(), Decls.end(),
11193 UnresolvedReductions.push_back(
nullptr);
11195 return getDerived().RebuildOMPReductionClause(
11196 Vars,
C->getModifier(),
C->getOriginalSharingModifier(),
C->getBeginLoc(),
11197 C->getLParenLoc(),
C->getModifierLoc(),
C->getColonLoc(),
C->getEndLoc(),
11198 ReductionIdScopeSpec, NameInfo, UnresolvedReductions);
11201template <
typename Derived>
11203 OMPTaskReductionClause *
C) {
11205 Vars.reserve(
C->varlist_size());
11206 for (
auto *
VE :
C->varlist()) {
11208 if (EVar.isInvalid())
11210 Vars.push_back(EVar.get());
11213 ReductionIdScopeSpec.
Adopt(
C->getQualifierLoc());
11216 if (NameInfo.getName()) {
11217 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
11218 if (!NameInfo.getName())
11224 for (
auto *E :
C->reduction_ops()) {
11229 for (
auto *D : ULE->decls()) {
11232 Decls.addDecl(InstD, InstD->getAccess());
11236 ReductionIdScopeSpec.getWithLocInContext(SemaRef.
Context), NameInfo,
11237 true, Decls.begin(), Decls.end(),
11240 UnresolvedReductions.push_back(
nullptr);
11242 return getDerived().RebuildOMPTaskReductionClause(
11243 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getColonLoc(),
11244 C->getEndLoc(), ReductionIdScopeSpec, NameInfo, UnresolvedReductions);
11247template <
typename Derived>
11251 Vars.reserve(
C->varlist_size());
11252 for (
auto *
VE :
C->varlist()) {
11254 if (EVar.isInvalid())
11256 Vars.push_back(EVar.get());
11259 ReductionIdScopeSpec.
Adopt(
C->getQualifierLoc());
11262 if (NameInfo.getName()) {
11263 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
11264 if (!NameInfo.getName())
11270 for (
auto *E :
C->reduction_ops()) {
11275 for (
auto *D : ULE->decls()) {
11278 Decls.addDecl(InstD, InstD->getAccess());
11282 ReductionIdScopeSpec.getWithLocInContext(SemaRef.
Context), NameInfo,
11283 true, Decls.begin(), Decls.end(),
11286 UnresolvedReductions.push_back(
nullptr);
11288 return getDerived().RebuildOMPInReductionClause(
11289 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getColonLoc(),
11290 C->getEndLoc(), ReductionIdScopeSpec, NameInfo, UnresolvedReductions);
11293template <
typename Derived>
11297 Vars.reserve(
C->varlist_size());
11298 for (
auto *
VE :
C->varlist()) {
11300 if (EVar.isInvalid())
11302 Vars.push_back(EVar.get());
11304 ExprResult Step = getDerived().TransformExpr(
C->getStep());
11305 if (Step.isInvalid())
11307 return getDerived().RebuildOMPLinearClause(
11308 Vars, Step.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getModifier(),
11309 C->getModifierLoc(),
C->getColonLoc(),
C->getStepModifierLoc(),
11313template <
typename Derived>
11317 Vars.reserve(
C->varlist_size());
11318 for (
auto *
VE :
C->varlist()) {
11320 if (EVar.isInvalid())
11322 Vars.push_back(EVar.get());
11324 ExprResult Alignment = getDerived().TransformExpr(
C->getAlignment());
11325 if (Alignment.isInvalid())
11327 return getDerived().RebuildOMPAlignedClause(
11328 Vars, Alignment.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11329 C->getColonLoc(),
C->getEndLoc());
11332template <
typename Derived>
11336 Vars.reserve(
C->varlist_size());
11337 for (
auto *
VE :
C->varlist()) {
11339 if (EVar.isInvalid())
11341 Vars.push_back(EVar.get());
11343 return getDerived().RebuildOMPCopyinClause(Vars,
C->getBeginLoc(),
11344 C->getLParenLoc(),
C->getEndLoc());
11347template <
typename Derived>
11351 Vars.reserve(
C->varlist_size());
11352 for (
auto *
VE :
C->varlist()) {
11354 if (EVar.isInvalid())
11356 Vars.push_back(EVar.get());
11358 return getDerived().RebuildOMPCopyprivateClause(
11359 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11362template <
typename Derived>
11365 Vars.reserve(
C->varlist_size());
11366 for (
auto *
VE :
C->varlist()) {
11368 if (EVar.isInvalid())
11370 Vars.push_back(EVar.get());
11372 return getDerived().RebuildOMPFlushClause(Vars,
C->getBeginLoc(),
11373 C->getLParenLoc(),
C->getEndLoc());
11376template <
typename Derived>
11379 ExprResult E = getDerived().TransformExpr(
C->getDepobj());
11382 return getDerived().RebuildOMPDepobjClause(E.get(),
C->getBeginLoc(),
11383 C->getLParenLoc(),
C->getEndLoc());
11386template <
typename Derived>
11390 Expr *DepModifier =
C->getModifier();
11392 ExprResult DepModRes = getDerived().TransformExpr(DepModifier);
11393 if (DepModRes.isInvalid())
11395 DepModifier = DepModRes.get();
11397 Vars.reserve(
C->varlist_size());
11398 for (
auto *
VE :
C->varlist()) {
11400 if (EVar.isInvalid())
11402 Vars.push_back(EVar.get());
11404 return getDerived().RebuildOMPDependClause(
11405 {
C->getDependencyKind(),
C->getDependencyLoc(),
C->getColonLoc(),
11406 C->getOmpAllMemoryLoc()},
11407 DepModifier, Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11410template <
typename Derived>
11413 ExprResult E = getDerived().TransformExpr(
C->getDevice());
11416 return getDerived().RebuildOMPDeviceClause(
11417 C->getModifier(), E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11418 C->getModifierLoc(),
C->getEndLoc());
11421template <
typename Derived,
class T>
11428 Vars.reserve(
C->varlist_size());
11429 for (
auto *
VE :
C->varlist()) {
11433 Vars.push_back(EVar.
get());
11437 if (
C->getMapperQualifierLoc()) {
11438 QualifierLoc = TT.
getDerived().TransformNestedNameSpecifierLoc(
11439 C->getMapperQualifierLoc());
11443 MapperIdScopeSpec.
Adopt(QualifierLoc);
11444 MapperIdInfo =
C->getMapperIdInfo();
11445 if (MapperIdInfo.
getName()) {
11446 MapperIdInfo = TT.
getDerived().TransformDeclarationNameInfo(MapperIdInfo);
11452 for (
auto *E :
C->mapperlists()) {
11457 for (
auto *D : ULE->decls()) {
11460 Decls.addDecl(InstD, InstD->
getAccess());
11465 MapperIdInfo,
true, Decls.begin(), Decls.end(),
11468 UnresolvedMappers.push_back(
nullptr);
11474template <
typename Derived>
11476 OMPVarListLocTy Locs(
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11478 Expr *IteratorModifier =
C->getIteratorModifier();
11479 if (IteratorModifier) {
11480 ExprResult MapModRes = getDerived().TransformExpr(IteratorModifier);
11481 if (MapModRes.isInvalid())
11483 IteratorModifier = MapModRes.
get();
11489 *
this,
C, Vars, MapperIdScopeSpec, MapperIdInfo, UnresolvedMappers))
11491 return getDerived().RebuildOMPMapClause(
11492 IteratorModifier,
C->getMapTypeModifiers(),
C->getMapTypeModifiersLoc(),
11493 MapperIdScopeSpec, MapperIdInfo,
C->getMapType(),
C->isImplicitMapType(),
11494 C->getMapLoc(),
C->getColonLoc(), Vars, Locs, UnresolvedMappers);
11497template <
typename Derived>
11500 Expr *Allocator =
C->getAllocator();
11502 ExprResult AllocatorRes = getDerived().TransformExpr(Allocator);
11503 if (AllocatorRes.isInvalid())
11505 Allocator = AllocatorRes.get();
11507 Expr *Alignment =
C->getAlignment();
11509 ExprResult AlignmentRes = getDerived().TransformExpr(Alignment);
11510 if (AlignmentRes.isInvalid())
11512 Alignment = AlignmentRes.get();
11515 Vars.reserve(
C->varlist_size());
11516 for (
auto *
VE :
C->varlist()) {
11518 if (EVar.isInvalid())
11520 Vars.push_back(EVar.get());
11522 return getDerived().RebuildOMPAllocateClause(
11523 Allocator, Alignment,
C->getFirstAllocateModifier(),
11524 C->getFirstAllocateModifierLoc(),
C->getSecondAllocateModifier(),
11525 C->getSecondAllocateModifierLoc(), Vars,
C->getBeginLoc(),
11526 C->getLParenLoc(),
C->getColonLoc(),
C->getEndLoc());
11529template <
typename Derived>
11533 Vars.reserve(
C->varlist_size());
11534 for (
auto *
VE :
C->varlist()) {
11536 if (EVar.isInvalid())
11538 Vars.push_back(EVar.get());
11540 return getDerived().RebuildOMPNumTeamsClause(
11541 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11544template <
typename Derived>
11548 Vars.reserve(
C->varlist_size());
11549 for (
auto *
VE :
C->varlist()) {
11551 if (EVar.isInvalid())
11553 Vars.push_back(EVar.get());
11555 return getDerived().RebuildOMPThreadLimitClause(
11556 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11559template <
typename Derived>
11562 ExprResult E = getDerived().TransformExpr(
C->getPriority());
11565 return getDerived().RebuildOMPPriorityClause(
11566 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11569template <
typename Derived>
11572 ExprResult E = getDerived().TransformExpr(
C->getGrainsize());
11575 return getDerived().RebuildOMPGrainsizeClause(
11576 C->getModifier(), E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11577 C->getModifierLoc(),
C->getEndLoc());
11580template <
typename Derived>
11583 ExprResult E = getDerived().TransformExpr(
C->getNumTasks());
11586 return getDerived().RebuildOMPNumTasksClause(
11587 C->getModifier(), E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11588 C->getModifierLoc(),
C->getEndLoc());
11591template <
typename Derived>
11593 ExprResult E = getDerived().TransformExpr(
C->getHint());
11596 return getDerived().RebuildOMPHintClause(E.get(),
C->getBeginLoc(),
11597 C->getLParenLoc(),
C->getEndLoc());
11600template <
typename Derived>
11602 OMPDistScheduleClause *
C) {
11603 ExprResult E = getDerived().TransformExpr(
C->getChunkSize());
11606 return getDerived().RebuildOMPDistScheduleClause(
11607 C->getDistScheduleKind(), E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11608 C->getDistScheduleKindLoc(),
C->getCommaLoc(),
C->getEndLoc());
11611template <
typename Derived>
11617 C->getDefaultmapKind(),
11620 C->getDefaultmapModifierLoc(),
11621 C->getDefaultmapKindLoc(),
11625template <
typename Derived>
11629 Expr *IteratorModifier =
C->getIteratorModifier();
11630 if (IteratorModifier) {
11631 ExprResult MapModRes = getDerived().TransformExpr(IteratorModifier);
11632 if (MapModRes.isInvalid())
11634 IteratorModifier = MapModRes.get();
11640 *
this,
C, Vars, MapperIdScopeSpec, MapperIdInfo, UnresolvedMappers))
11642 return getDerived().RebuildOMPToClause(
11643 C->getMotionModifiers(),
C->getMotionModifiersLoc(), IteratorModifier,
11644 MapperIdScopeSpec, MapperIdInfo,
C->getColonLoc(), Vars, Locs,
11645 UnresolvedMappers);
11648template <
typename Derived>
11652 Expr *IteratorModifier =
C->getIteratorModifier();
11653 if (IteratorModifier) {
11654 ExprResult MapModRes = getDerived().TransformExpr(IteratorModifier);
11655 if (MapModRes.isInvalid())
11657 IteratorModifier = MapModRes.get();
11663 *
this,
C, Vars, MapperIdScopeSpec, MapperIdInfo, UnresolvedMappers))
11665 return getDerived().RebuildOMPFromClause(
11666 C->getMotionModifiers(),
C->getMotionModifiersLoc(), IteratorModifier,
11667 MapperIdScopeSpec, MapperIdInfo,
C->getColonLoc(), Vars, Locs,
11668 UnresolvedMappers);
11671template <
typename Derived>
11673 OMPUseDevicePtrClause *
C) {
11675 Vars.reserve(
C->varlist_size());
11676 for (
auto *
VE :
C->varlist()) {
11678 if (EVar.isInvalid())
11680 Vars.push_back(EVar.get());
11683 return getDerived().RebuildOMPUseDevicePtrClause(
11684 Vars, Locs,
C->getFallbackModifier(),
C->getFallbackModifierLoc());
11687template <
typename Derived>
11689 OMPUseDeviceAddrClause *
C) {
11691 Vars.reserve(
C->varlist_size());
11692 for (
auto *
VE :
C->varlist()) {
11694 if (EVar.isInvalid())
11696 Vars.push_back(EVar.get());
11699 return getDerived().RebuildOMPUseDeviceAddrClause(Vars, Locs);
11702template <
typename Derived>
11706 Vars.reserve(
C->varlist_size());
11707 for (
auto *
VE :
C->varlist()) {
11709 if (EVar.isInvalid())
11711 Vars.push_back(EVar.get());
11714 return getDerived().RebuildOMPIsDevicePtrClause(Vars, Locs);
11717template <
typename Derived>
11719 OMPHasDeviceAddrClause *
C) {
11721 Vars.reserve(
C->varlist_size());
11722 for (
auto *
VE :
C->varlist()) {
11724 if (EVar.isInvalid())
11726 Vars.push_back(EVar.get());
11729 return getDerived().RebuildOMPHasDeviceAddrClause(Vars, Locs);
11732template <
typename Derived>
11736 Vars.reserve(
C->varlist_size());
11737 for (
auto *
VE :
C->varlist()) {
11739 if (EVar.isInvalid())
11741 Vars.push_back(EVar.get());
11743 return getDerived().RebuildOMPNontemporalClause(
11744 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11747template <
typename Derived>
11751 Vars.reserve(
C->varlist_size());
11752 for (
auto *
VE :
C->varlist()) {
11754 if (EVar.isInvalid())
11756 Vars.push_back(EVar.get());
11758 return getDerived().RebuildOMPInclusiveClause(
11759 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11762template <
typename Derived>
11766 Vars.reserve(
C->varlist_size());
11767 for (
auto *
VE :
C->varlist()) {
11769 if (EVar.isInvalid())
11771 Vars.push_back(EVar.get());
11773 return getDerived().RebuildOMPExclusiveClause(
11774 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11777template <
typename Derived>
11779 OMPUsesAllocatorsClause *
C) {
11781 Data.reserve(
C->getNumberOfAllocators());
11782 for (
unsigned I = 0, E =
C->getNumberOfAllocators(); I < E; ++I) {
11783 OMPUsesAllocatorsClause::Data D =
C->getAllocatorData(I);
11785 if (Allocator.isInvalid())
11789 AllocatorTraits = getDerived().TransformExpr(AT);
11790 if (AllocatorTraits.isInvalid())
11794 NewD.Allocator = Allocator.get();
11795 NewD.AllocatorTraits = AllocatorTraits.get();
11799 return getDerived().RebuildOMPUsesAllocatorsClause(
11800 Data,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11803template <
typename Derived>
11807 Locators.reserve(
C->varlist_size());
11809 if (
Expr *Modifier =
C->getModifier()) {
11810 ModifierRes = getDerived().TransformExpr(Modifier);
11811 if (ModifierRes.isInvalid())
11814 for (
Expr *E :
C->varlist()) {
11815 ExprResult Locator = getDerived().TransformExpr(E);
11816 if (Locator.isInvalid())
11818 Locators.push_back(Locator.get());
11820 return getDerived().RebuildOMPAffinityClause(
11821 C->getBeginLoc(),
C->getLParenLoc(),
C->getColonLoc(),
C->getEndLoc(),
11822 ModifierRes.get(), Locators);
11825template <
typename Derived>
11828 C->getKind(),
C->getKindKwLoc(),
C->getBeginLoc(),
C->getLParenLoc(),
11829 C->getEndLoc(),
C->getModifier(),
C->getModifierKwLoc());
11832template <
typename Derived>
11835 C->getBindKind(),
C->getBindKindLoc(),
C->getBeginLoc(),
11836 C->getLParenLoc(),
C->getEndLoc());
11839template <
typename Derived>
11841 OMPXDynCGroupMemClause *
C) {
11843 if (
Size.isInvalid())
11845 return getDerived().RebuildOMPXDynCGroupMemClause(
11846 Size.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11849template <
typename Derived>
11851 OMPDynGroupprivateClause *
C) {
11853 if (
Size.isInvalid())
11855 return getDerived().RebuildOMPDynGroupprivateClause(
11856 C->getDynGroupprivateModifier(),
C->getDynGroupprivateFallbackModifier(),
11857 Size.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11858 C->getDynGroupprivateModifierLoc(),
11859 C->getDynGroupprivateFallbackModifierLoc(),
C->getEndLoc());
11862template <
typename Derived>
11866 Vars.reserve(
C->varlist_size());
11867 for (
auto *
VE :
C->varlist()) {
11869 if (EVar.isInvalid())
11871 Vars.push_back(EVar.get());
11873 return getDerived().RebuildOMPDoacrossClause(
11874 C->getDependenceType(),
C->getDependenceLoc(),
C->getColonLoc(), Vars,
11875 C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11878template <
typename Derived>
11882 for (
auto *A :
C->getAttrs())
11883 NewAttrs.push_back(getDerived().TransformAttr(A));
11884 return getDerived().RebuildOMPXAttributeClause(
11885 NewAttrs,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11888template <
typename Derived>
11897template <
typename Derived>
11898class OpenACCClauseTransform final
11900 TreeTransform<Derived> &Self;
11901 ArrayRef<const OpenACCClause *> ExistingClauses;
11902 SemaOpenACC::OpenACCParsedClause &ParsedClause;
11903 OpenACCClause *NewClause =
nullptr;
11906 ExprResult Res = Self.TransformExpr(VarRef);
11908 if (!Res.isUsable())
11911 Res = Self.getSema().OpenACC().ActOnVar(ParsedClause.getDirectiveKind(),
11912 ParsedClause.getClauseKind(),
11918 llvm::SmallVector<Expr *> VisitVarList(ArrayRef<Expr *> VarList) {
11919 llvm::SmallVector<Expr *> InstantiatedVarList;
11920 for (Expr *CurVar : VarList) {
11923 if (VarRef.isUsable())
11924 InstantiatedVarList.push_back(VarRef.get());
11927 return InstantiatedVarList;
11931 OpenACCClauseTransform(TreeTransform<Derived> &Self,
11932 ArrayRef<const OpenACCClause *> ExistingClauses,
11933 SemaOpenACC::OpenACCParsedClause &PC)
11934 : Self(Self), ExistingClauses(ExistingClauses), ParsedClause(PC) {}
11936 OpenACCClause *CreatedClause()
const {
return NewClause; }
11938#define VISIT_CLAUSE(CLAUSE_NAME) \
11939 void Visit##CLAUSE_NAME##Clause(const OpenACC##CLAUSE_NAME##Clause &Clause);
11940#include "clang/Basic/OpenACCClauses.def"
11943template <
typename Derived>
11944void OpenACCClauseTransform<Derived>::VisitDefaultClause(
11946 ParsedClause.setDefaultDetails(
C.getDefaultClauseKind());
11949 Self.getSema().getASTContext(), ParsedClause.getDefaultClauseKind(),
11950 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
11951 ParsedClause.getEndLoc());
11954template <
typename Derived>
11955void OpenACCClauseTransform<Derived>::VisitIfClause(
const OpenACCIfClause &
C) {
11957 assert(
Cond &&
"If constructed with invalid Condition");
11961 if (Res.isInvalid() || !Res.get().second)
11964 ParsedClause.setConditionDetails(Res.get().second);
11967 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
11968 ParsedClause.getLParenLoc(), ParsedClause.getConditionExpr(),
11969 ParsedClause.getEndLoc());
11972template <
typename Derived>
11973void OpenACCClauseTransform<Derived>::VisitSelfClause(
11979 for (
Expr *CurVar :
C.getVarList()) {
11982 if (!Res.isUsable())
11985 Res =
Self.getSema().OpenACC().ActOnVar(ParsedClause.getDirectiveKind(),
11986 ParsedClause.getClauseKind(),
11989 if (Res.isUsable())
11990 InstantiatedVarList.push_back(Res.get());
11993 ParsedClause.setVarListDetails(InstantiatedVarList,
11997 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
11998 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
11999 ParsedClause.getEndLoc());
12002 if (
C.hasConditionExpr()) {
12005 Self.TransformCondition(
Cond->getExprLoc(),
nullptr,
Cond,
12008 if (Res.isInvalid() || !Res.get().second)
12011 ParsedClause.setConditionDetails(Res.get().second);
12015 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12016 ParsedClause.getLParenLoc(), ParsedClause.getConditionExpr(),
12017 ParsedClause.getEndLoc());
12021template <
typename Derived>
12022void OpenACCClauseTransform<Derived>::VisitNumGangsClause(
12026 for (
Expr *CurIntExpr :
C.getIntExprs()) {
12029 if (!Res.isUsable())
12034 C.getBeginLoc(), Res.get());
12035 if (!Res.isUsable())
12038 InstantiatedIntExprs.push_back(Res.get());
12041 ParsedClause.setIntExprDetails(InstantiatedIntExprs);
12043 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12044 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs(),
12045 ParsedClause.getEndLoc());
12048template <
typename Derived>
12049void OpenACCClauseTransform<Derived>::VisitPrivateClause(
12054 for (
const auto [RefExpr, InitRecipe] :
12055 llvm::zip(
C.getVarList(),
C.getInitRecipes())) {
12058 if (VarRef.isUsable()) {
12059 InstantiatedVarList.push_back(VarRef.get());
12063 if (InitRecipe.isSet())
12064 InitRecipes.push_back(InitRecipe);
12066 InitRecipes.push_back(
12067 Self.getSema().OpenACC().CreatePrivateInitRecipe(VarRef.get()));
12070 ParsedClause.setVarListDetails(InstantiatedVarList,
12074 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12075 ParsedClause.getLParenLoc(), ParsedClause.getVarList(), InitRecipes,
12076 ParsedClause.getEndLoc());
12079template <
typename Derived>
12080void OpenACCClauseTransform<Derived>::VisitHostClause(
12082 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12086 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12087 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12088 ParsedClause.getEndLoc());
12091template <
typename Derived>
12092void OpenACCClauseTransform<Derived>::VisitDeviceClause(
12094 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12098 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12099 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12100 ParsedClause.getEndLoc());
12103template <
typename Derived>
12104void OpenACCClauseTransform<Derived>::VisitFirstPrivateClause(
12109 for (
const auto [RefExpr, InitRecipe] :
12110 llvm::zip(
C.getVarList(),
C.getInitRecipes())) {
12113 if (VarRef.isUsable()) {
12114 InstantiatedVarList.push_back(VarRef.get());
12118 if (InitRecipe.isSet())
12119 InitRecipes.push_back(InitRecipe);
12121 InitRecipes.push_back(
12122 Self.getSema().OpenACC().CreateFirstPrivateInitRecipe(
12126 ParsedClause.setVarListDetails(InstantiatedVarList,
12130 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12131 ParsedClause.getLParenLoc(), ParsedClause.getVarList(), InitRecipes,
12132 ParsedClause.getEndLoc());
12135template <
typename Derived>
12136void OpenACCClauseTransform<Derived>::VisitNoCreateClause(
12138 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12142 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12143 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12144 ParsedClause.getEndLoc());
12147template <
typename Derived>
12148void OpenACCClauseTransform<Derived>::VisitPresentClause(
12150 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12154 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12155 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12156 ParsedClause.getEndLoc());
12159template <
typename Derived>
12160void OpenACCClauseTransform<Derived>::VisitCopyClause(
12162 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12163 C.getModifierList());
12166 Self.getSema().getASTContext(), ParsedClause.getClauseKind(),
12167 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12168 ParsedClause.getModifierList(), ParsedClause.getVarList(),
12169 ParsedClause.getEndLoc());
12172template <
typename Derived>
12173void OpenACCClauseTransform<Derived>::VisitLinkClause(
12175 llvm_unreachable(
"link clause not valid unless a decl transform");
12178template <
typename Derived>
12179void OpenACCClauseTransform<Derived>::VisitDeviceResidentClause(
12181 llvm_unreachable(
"device_resident clause not valid unless a decl transform");
12183template <
typename Derived>
12184void OpenACCClauseTransform<Derived>::VisitNoHostClause(
12186 llvm_unreachable(
"nohost clause not valid unless a decl transform");
12188template <
typename Derived>
12189void OpenACCClauseTransform<Derived>::VisitBindClause(
12191 llvm_unreachable(
"bind clause not valid unless a decl transform");
12194template <
typename Derived>
12195void OpenACCClauseTransform<Derived>::VisitCopyInClause(
12197 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12198 C.getModifierList());
12201 Self.getSema().getASTContext(), ParsedClause.getClauseKind(),
12202 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12203 ParsedClause.getModifierList(), ParsedClause.getVarList(),
12204 ParsedClause.getEndLoc());
12207template <
typename Derived>
12208void OpenACCClauseTransform<Derived>::VisitCopyOutClause(
12210 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12211 C.getModifierList());
12214 Self.getSema().getASTContext(), ParsedClause.getClauseKind(),
12215 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12216 ParsedClause.getModifierList(), ParsedClause.getVarList(),
12217 ParsedClause.getEndLoc());
12220template <
typename Derived>
12221void OpenACCClauseTransform<Derived>::VisitCreateClause(
12223 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12224 C.getModifierList());
12227 Self.getSema().getASTContext(), ParsedClause.getClauseKind(),
12228 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12229 ParsedClause.getModifierList(), ParsedClause.getVarList(),
12230 ParsedClause.getEndLoc());
12232template <
typename Derived>
12233void OpenACCClauseTransform<Derived>::VisitAttachClause(
12238 llvm::erase_if(VarList, [&](
Expr *E) {
12239 return Self.getSema().OpenACC().CheckVarIsPointerType(
12245 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12246 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12247 ParsedClause.getEndLoc());
12250template <
typename Derived>
12251void OpenACCClauseTransform<Derived>::VisitDetachClause(
12256 llvm::erase_if(VarList, [&](
Expr *E) {
12257 return Self.getSema().OpenACC().CheckVarIsPointerType(
12263 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12264 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12265 ParsedClause.getEndLoc());
12268template <
typename Derived>
12269void OpenACCClauseTransform<Derived>::VisitDeleteClause(
12271 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12274 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12275 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12276 ParsedClause.getEndLoc());
12279template <
typename Derived>
12280void OpenACCClauseTransform<Derived>::VisitUseDeviceClause(
12282 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12285 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12286 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12287 ParsedClause.getEndLoc());
12290template <
typename Derived>
12291void OpenACCClauseTransform<Derived>::VisitDevicePtrClause(
12296 llvm::erase_if(VarList, [&](
Expr *E) {
12297 return Self.getSema().OpenACC().CheckVarIsPointerType(
12303 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12304 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12305 ParsedClause.getEndLoc());
12308template <
typename Derived>
12309void OpenACCClauseTransform<Derived>::VisitNumWorkersClause(
12311 Expr *IntExpr =
const_cast<Expr *
>(
C.getIntExpr());
12312 assert(IntExpr &&
"num_workers clause constructed with invalid int expr");
12315 if (!Res.isUsable())
12320 C.getBeginLoc(), Res.get());
12321 if (!Res.isUsable())
12324 ParsedClause.setIntExprDetails(Res.get());
12326 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12327 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs()[0],
12328 ParsedClause.getEndLoc());
12331template <
typename Derived>
12332void OpenACCClauseTransform<Derived>::VisitDeviceNumClause (
12334 Expr *IntExpr =
const_cast<Expr *
>(
C.getIntExpr());
12335 assert(IntExpr &&
"device_num clause constructed with invalid int expr");
12338 if (!Res.isUsable())
12343 C.getBeginLoc(), Res.get());
12344 if (!Res.isUsable())
12347 ParsedClause.setIntExprDetails(Res.get());
12349 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12350 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs()[0],
12351 ParsedClause.getEndLoc());
12354template <
typename Derived>
12355void OpenACCClauseTransform<Derived>::VisitDefaultAsyncClause(
12357 Expr *IntExpr =
const_cast<Expr *
>(
C.getIntExpr());
12358 assert(IntExpr &&
"default_async clause constructed with invalid int expr");
12361 if (!Res.isUsable())
12366 C.getBeginLoc(), Res.get());
12367 if (!Res.isUsable())
12370 ParsedClause.setIntExprDetails(Res.get());
12372 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12373 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs()[0],
12374 ParsedClause.getEndLoc());
12377template <
typename Derived>
12378void OpenACCClauseTransform<Derived>::VisitVectorLengthClause(
12380 Expr *IntExpr =
const_cast<Expr *
>(
C.getIntExpr());
12381 assert(IntExpr &&
"vector_length clause constructed with invalid int expr");
12384 if (!Res.isUsable())
12389 C.getBeginLoc(), Res.get());
12390 if (!Res.isUsable())
12393 ParsedClause.setIntExprDetails(Res.get());
12395 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12396 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs()[0],
12397 ParsedClause.getEndLoc());
12400template <
typename Derived>
12401void OpenACCClauseTransform<Derived>::VisitAsyncClause(
12403 if (
C.hasIntExpr()) {
12405 if (!Res.isUsable())
12410 C.getBeginLoc(), Res.get());
12411 if (!Res.isUsable())
12413 ParsedClause.setIntExprDetails(Res.get());
12417 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12418 ParsedClause.getLParenLoc(),
12419 ParsedClause.getNumIntExprs() != 0 ? ParsedClause.getIntExprs()[0]
12421 ParsedClause.getEndLoc());
12424template <
typename Derived>
12425void OpenACCClauseTransform<Derived>::VisitWorkerClause(
12427 if (
C.hasIntExpr()) {
12432 if (!Res.isUsable())
12437 C.getBeginLoc(), Res.get());
12438 if (!Res.isUsable())
12440 ParsedClause.setIntExprDetails(Res.get());
12444 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12445 ParsedClause.getLParenLoc(),
12446 ParsedClause.getNumIntExprs() != 0 ? ParsedClause.getIntExprs()[0]
12448 ParsedClause.getEndLoc());
12451template <
typename Derived>
12452void OpenACCClauseTransform<Derived>::VisitVectorClause(
12454 if (
C.hasIntExpr()) {
12459 if (!Res.isUsable())
12464 C.getBeginLoc(), Res.get());
12465 if (!Res.isUsable())
12467 ParsedClause.setIntExprDetails(Res.get());
12471 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12472 ParsedClause.getLParenLoc(),
12473 ParsedClause.getNumIntExprs() != 0 ? ParsedClause.getIntExprs()[0]
12475 ParsedClause.getEndLoc());
12478template <
typename Derived>
12479void OpenACCClauseTransform<Derived>::VisitWaitClause(
12481 if (
C.hasExprs()) {
12482 Expr *DevNumExpr =
nullptr;
12486 if (
C.getDevNumExpr()) {
12488 if (!Res.isUsable())
12492 C.getBeginLoc(), Res.get());
12493 if (!Res.isUsable())
12496 DevNumExpr = Res.get();
12500 for (
Expr *CurQueueIdExpr :
C.getQueueIdExprs()) {
12502 if (!Res.isUsable())
12506 C.getBeginLoc(), Res.get());
12507 if (!Res.isUsable())
12510 InstantiatedQueueIdExprs.push_back(Res.get());
12513 ParsedClause.setWaitDetails(DevNumExpr,
C.getQueuesLoc(),
12514 std::move(InstantiatedQueueIdExprs));
12518 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12519 ParsedClause.getLParenLoc(), ParsedClause.getDevNumExpr(),
12520 ParsedClause.getQueuesLoc(), ParsedClause.getQueueIdExprs(),
12521 ParsedClause.getEndLoc());
12524template <
typename Derived>
12525void OpenACCClauseTransform<Derived>::VisitDeviceTypeClause(
12529 Self.getSema().getASTContext(),
C.getClauseKind(),
12530 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12531 C.getArchitectures(), ParsedClause.getEndLoc());
12534template <
typename Derived>
12535void OpenACCClauseTransform<Derived>::VisitAutoClause(
12539 ParsedClause.getBeginLoc(),
12540 ParsedClause.getEndLoc());
12543template <
typename Derived>
12544void OpenACCClauseTransform<Derived>::VisitIndependentClause(
12547 ParsedClause.getBeginLoc(),
12548 ParsedClause.getEndLoc());
12551template <
typename Derived>
12552void OpenACCClauseTransform<Derived>::VisitSeqClause(
12555 ParsedClause.getBeginLoc(),
12556 ParsedClause.getEndLoc());
12558template <
typename Derived>
12559void OpenACCClauseTransform<Derived>::VisitFinalizeClause(
12562 ParsedClause.getBeginLoc(),
12563 ParsedClause.getEndLoc());
12566template <
typename Derived>
12567void OpenACCClauseTransform<Derived>::VisitIfPresentClause(
12570 ParsedClause.getBeginLoc(),
12571 ParsedClause.getEndLoc());
12574template <
typename Derived>
12575void OpenACCClauseTransform<Derived>::VisitReductionClause(
12581 for (
const auto [Var, OrigRecipe] :
12582 llvm::zip(TransformedVars,
C.getRecipes())) {
12584 ParsedClause.getDirectiveKind(),
C.getReductionOp(), Var);
12585 if (Res.isUsable()) {
12586 ValidVars.push_back(Res.get());
12588 if (OrigRecipe.isSet())
12589 Recipes.emplace_back(OrigRecipe.AllocaDecl, OrigRecipe.CombinerRecipes);
12591 Recipes.push_back(
Self.getSema().OpenACC().CreateReductionInitRecipe(
12592 C.getReductionOp(), Res.get()));
12596 NewClause =
Self.getSema().OpenACC().CheckReductionClause(
12597 ExistingClauses, ParsedClause.getDirectiveKind(),
12598 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12599 C.getReductionOp(), ValidVars, Recipes, ParsedClause.getEndLoc());
12602template <
typename Derived>
12603void OpenACCClauseTransform<Derived>::VisitCollapseClause(
12605 Expr *LoopCount =
const_cast<Expr *
>(
C.getLoopCount());
12606 assert(LoopCount &&
"collapse clause constructed with invalid loop count");
12610 NewLoopCount =
Self.getSema().OpenACC().ActOnIntExpr(
12612 NewLoopCount.get()->getBeginLoc(), NewLoopCount.get());
12615 Self.getSema().OpenACC().CheckCollapseLoopCount(NewLoopCount.get());
12617 ParsedClause.setCollapseDetails(
C.hasForce(), NewLoopCount.get());
12619 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12620 ParsedClause.getLParenLoc(), ParsedClause.isForce(),
12621 ParsedClause.getLoopCount(), ParsedClause.getEndLoc());
12624template <
typename Derived>
12625void OpenACCClauseTransform<Derived>::VisitTileClause(
12630 for (
Expr *E :
C.getSizeExprs()) {
12633 if (!NewSizeExpr.isUsable())
12636 NewSizeExpr =
Self.getSema().OpenACC().ActOnIntExpr(
12638 NewSizeExpr.get()->getBeginLoc(), NewSizeExpr.get());
12640 NewSizeExpr =
Self.getSema().OpenACC().CheckTileSizeExpr(NewSizeExpr.get());
12642 if (!NewSizeExpr.isUsable())
12644 TransformedExprs.push_back(NewSizeExpr.get());
12647 ParsedClause.setIntExprDetails(TransformedExprs);
12649 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12650 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs(),
12651 ParsedClause.getEndLoc());
12653template <
typename Derived>
12654void OpenACCClauseTransform<Derived>::VisitGangClause(
12659 for (
unsigned I = 0; I <
C.getNumExprs(); ++I) {
12661 if (!ER.isUsable())
12664 ER =
Self.getSema().OpenACC().CheckGangExpr(ExistingClauses,
12665 ParsedClause.getDirectiveKind(),
12666 C.getExpr(I).first, ER.get());
12667 if (!ER.isUsable())
12669 TransformedGangKinds.push_back(
C.getExpr(I).first);
12670 TransformedIntExprs.push_back(ER.get());
12673 NewClause =
Self.getSema().OpenACC().CheckGangClause(
12674 ParsedClause.getDirectiveKind(), ExistingClauses,
12675 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12676 TransformedGangKinds, TransformedIntExprs, ParsedClause.getEndLoc());
12679template <
typename Derived>
12680OpenACCClause *TreeTransform<Derived>::TransformOpenACCClause(
12685 DirKind, OldClause->getClauseKind(), OldClause->getBeginLoc());
12686 ParsedClause.setEndLoc(OldClause->getEndLoc());
12688 if (
const auto *WithParms = dyn_cast<OpenACCClauseWithParams>(OldClause))
12689 ParsedClause.setLParenLoc(WithParms->getLParenLoc());
12691 OpenACCClauseTransform<Derived> Transform{*
this, ExistingClauses,
12693 Transform.Visit(OldClause);
12695 return Transform.CreatedClause();
12698template <
typename Derived>
12700TreeTransform<Derived>::TransformOpenACCClauseList(
12703 for (
const auto *Clause : OldClauses) {
12704 if (
OpenACCClause *TransformedClause = getDerived().TransformOpenACCClause(
12705 TransformedClauses, DirKind, Clause))
12706 TransformedClauses.push_back(TransformedClause);
12708 return TransformedClauses;
12711template <
typename Derived>
12714 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12717 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12720 if (getSema().OpenACC().ActOnStartStmtDirective(
12721 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12726 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
12727 C->clauses(), TransformedClauses);
12728 StmtResult StrBlock = getDerived().TransformStmt(
C->getStructuredBlock());
12729 StrBlock = getSema().OpenACC().ActOnAssociatedStmt(
12730 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses, StrBlock);
12732 return getDerived().RebuildOpenACCComputeConstruct(
12733 C->getDirectiveKind(),
C->getBeginLoc(),
C->getDirectiveLoc(),
12734 C->getEndLoc(), TransformedClauses, StrBlock);
12737template <
typename Derived>
12741 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12744 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12747 if (getSema().OpenACC().ActOnStartStmtDirective(
12748 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12753 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
12754 C->clauses(), TransformedClauses);
12756 Loop = getSema().OpenACC().ActOnAssociatedStmt(
12757 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses,
Loop);
12759 return getDerived().RebuildOpenACCLoopConstruct(
12760 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12761 TransformedClauses,
Loop);
12764template <
typename Derived>
12766 OpenACCCombinedConstruct *
C) {
12767 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12770 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12773 if (getSema().OpenACC().ActOnStartStmtDirective(
12774 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12779 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
12780 C->clauses(), TransformedClauses);
12782 Loop = getSema().OpenACC().ActOnAssociatedStmt(
12783 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses,
Loop);
12785 return getDerived().RebuildOpenACCCombinedConstruct(
12786 C->getDirectiveKind(),
C->getBeginLoc(),
C->getDirectiveLoc(),
12787 C->getEndLoc(), TransformedClauses,
Loop);
12790template <
typename Derived>
12793 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12796 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12798 if (getSema().OpenACC().ActOnStartStmtDirective(
12799 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12803 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
12804 C->clauses(), TransformedClauses);
12805 StmtResult StrBlock = getDerived().TransformStmt(
C->getStructuredBlock());
12806 StrBlock = getSema().OpenACC().ActOnAssociatedStmt(
12807 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses, StrBlock);
12809 return getDerived().RebuildOpenACCDataConstruct(
12810 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12811 TransformedClauses, StrBlock);
12814template <
typename Derived>
12816 OpenACCEnterDataConstruct *
C) {
12817 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12820 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12822 if (getSema().OpenACC().ActOnStartStmtDirective(
12823 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12826 return getDerived().RebuildOpenACCEnterDataConstruct(
12827 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12828 TransformedClauses);
12831template <
typename Derived>
12833 OpenACCExitDataConstruct *
C) {
12834 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12837 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12839 if (getSema().OpenACC().ActOnStartStmtDirective(
12840 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12843 return getDerived().RebuildOpenACCExitDataConstruct(
12844 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12845 TransformedClauses);
12848template <
typename Derived>
12850 OpenACCHostDataConstruct *
C) {
12851 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12854 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12856 if (getSema().OpenACC().ActOnStartStmtDirective(
12857 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12861 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
12862 C->clauses(), TransformedClauses);
12863 StmtResult StrBlock = getDerived().TransformStmt(
C->getStructuredBlock());
12864 StrBlock = getSema().OpenACC().ActOnAssociatedStmt(
12865 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses, StrBlock);
12867 return getDerived().RebuildOpenACCHostDataConstruct(
12868 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12869 TransformedClauses, StrBlock);
12872template <
typename Derived>
12875 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12878 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12880 if (getSema().OpenACC().ActOnStartStmtDirective(
12881 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12884 return getDerived().RebuildOpenACCInitConstruct(
12885 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12886 TransformedClauses);
12889template <
typename Derived>
12891 OpenACCShutdownConstruct *
C) {
12892 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12895 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12897 if (getSema().OpenACC().ActOnStartStmtDirective(
12898 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12901 return getDerived().RebuildOpenACCShutdownConstruct(
12902 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12903 TransformedClauses);
12905template <
typename Derived>
12908 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12911 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12913 if (getSema().OpenACC().ActOnStartStmtDirective(
12914 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12917 return getDerived().RebuildOpenACCSetConstruct(
12918 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12919 TransformedClauses);
12922template <
typename Derived>
12924 OpenACCUpdateConstruct *
C) {
12925 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12928 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12930 if (getSema().OpenACC().ActOnStartStmtDirective(
12931 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12934 return getDerived().RebuildOpenACCUpdateConstruct(
12935 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12936 TransformedClauses);
12939template <
typename Derived>
12942 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12945 if (
C->hasDevNumExpr()) {
12946 DevNumExpr = getDerived().TransformExpr(
C->getDevNumExpr());
12948 if (DevNumExpr.isUsable())
12949 DevNumExpr = getSema().OpenACC().ActOnIntExpr(
12951 C->getBeginLoc(), DevNumExpr.get());
12956 for (
Expr *QE :
C->getQueueIdExprs()) {
12957 assert(QE &&
"Null queue id expr?");
12958 ExprResult NewEQ = getDerived().TransformExpr(QE);
12960 if (!NewEQ.isUsable())
12964 C->getBeginLoc(), NewEQ.get());
12965 if (NewEQ.isUsable())
12966 QueueIdExprs.push_back(NewEQ.get());
12970 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12973 if (getSema().OpenACC().ActOnStartStmtDirective(
12974 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12977 return getDerived().RebuildOpenACCWaitConstruct(
12978 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getLParenLoc(),
12979 DevNumExpr.isUsable() ? DevNumExpr.get() :
nullptr,
C->getQueuesLoc(),
12980 QueueIdExprs,
C->getRParenLoc(),
C->getEndLoc(), TransformedClauses);
12982template <
typename Derived>
12984 OpenACCCacheConstruct *
C) {
12985 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12988 for (
Expr *Var :
C->getVarList()) {
12989 assert(Var &&
"Null var listexpr?");
12991 ExprResult NewVar = getDerived().TransformExpr(Var);
12993 if (!NewVar.isUsable())
12996 NewVar = getSema().OpenACC().ActOnVar(
12998 if (!NewVar.isUsable())
13001 TransformedVarList.push_back(NewVar.get());
13004 if (getSema().OpenACC().ActOnStartStmtDirective(
C->getDirectiveKind(),
13005 C->getBeginLoc(), {}))
13008 return getDerived().RebuildOpenACCCacheConstruct(
13009 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getLParenLoc(),
13010 C->getReadOnlyLoc(), TransformedVarList,
C->getRParenLoc(),
13014template <
typename Derived>
13016 OpenACCAtomicConstruct *
C) {
13017 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13020 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
13023 if (getSema().OpenACC().ActOnStartStmtDirective(
C->getDirectiveKind(),
13024 C->getBeginLoc(), {}))
13029 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(), {}, {});
13031 StmtResult AssocStmt = getDerived().TransformStmt(
C->getAssociatedStmt());
13032 AssocStmt = getSema().OpenACC().ActOnAssociatedStmt(
13033 C->getBeginLoc(),
C->getDirectiveKind(),
C->getAtomicKind(), {},
13036 return getDerived().RebuildOpenACCAtomicConstruct(
13037 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getAtomicKind(),
13038 C->getEndLoc(), TransformedClauses, AssocStmt);
13041template <
typename Derived>
13044 if (getDerived().AlwaysRebuild())
13053template<
typename Derived>
13056 return TransformExpr(E->getSubExpr());
13059template <
typename Derived>
13062 if (!E->isTypeDependent())
13065 TypeSourceInfo *NewT = getDerived().TransformType(E->getTypeSourceInfo());
13070 if (!getDerived().AlwaysRebuild() && E->getTypeSourceInfo() == NewT)
13073 return getDerived().RebuildSYCLUniqueStableNameExpr(
13074 E->getLocation(), E->getLParenLocation(), E->getRParenLocation(), NewT);
13077template <
typename Derived>
13081 const auto *SKEPAttr = FD->template getAttr<SYCLKernelEntryPointAttr>();
13082 if (!SKEPAttr || SKEPAttr->isInvalidAttr())
13085 ExprResult IdExpr = getDerived().TransformExpr(S->getKernelLaunchIdExpr());
13086 if (IdExpr.isInvalid())
13089 StmtResult Body = getDerived().TransformStmt(S->getOriginalStmt());
13090 if (Body.isInvalid())
13096 if (SR.isInvalid())
13102template <
typename Derived>
13105 assert(
false &&
"not implemented yet");
13109template<
typename Derived>
13112 if (!E->isTypeDependent())
13116 E->getIdentKind());
13119template<
typename Derived>
13123 if (E->getQualifierLoc()) {
13125 = getDerived().TransformNestedNameSpecifierLoc(E->getQualifierLoc());
13131 = cast_or_null<ValueDecl>(getDerived().TransformDecl(E->getLocation(),
13133 if (!ND || ND->isInvalidDecl())
13137 if (E->getFoundDecl() != E->getDecl()) {
13138 Found = cast_or_null<NamedDecl>(
13139 getDerived().TransformDecl(E->getLocation(), E->getFoundDecl()));
13145 if (NameInfo.getName()) {
13146 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
13147 if (!NameInfo.getName())
13151 if (!getDerived().AlwaysRebuild() &&
13152 !E->isCapturedByCopyInLambdaWithExplicitObjectParameter() &&
13153 QualifierLoc == E->getQualifierLoc() && ND == E->getDecl() &&
13154 Found == E->getFoundDecl() &&
13155 NameInfo.getName() == E->getDecl()->getDeclName() &&
13156 !E->hasExplicitTemplateArgs()) {
13166 if (E->hasExplicitTemplateArgs()) {
13167 TemplateArgs = &TransArgs;
13168 TransArgs.setLAngleLoc(E->getLAngleLoc());
13169 TransArgs.setRAngleLoc(E->getRAngleLoc());
13170 if (getDerived().TransformTemplateArguments(E->getTemplateArgs(),
13171 E->getNumTemplateArgs(),
13176 return getDerived().RebuildDeclRefExpr(QualifierLoc, ND, NameInfo,
13177 Found, TemplateArgs);
13180template<
typename Derived>
13186template <
typename Derived>
13192template<
typename Derived>
13198template<
typename Derived>
13204template<
typename Derived>
13210template<
typename Derived>
13216template<
typename Derived>
13219 return getDerived().TransformCallExpr(E);
13222template<
typename Derived>
13227 if (E->isExprPredicate())
13228 ControllingExpr = getDerived().TransformExpr(E->getControllingExpr());
13230 ControllingType = getDerived().TransformType(E->getControllingType());
13232 if (ControllingExpr.isInvalid() && !ControllingType)
13243 AssocTypes.push_back(AssocType);
13245 AssocTypes.push_back(
nullptr);
13249 getDerived().TransformExpr(Assoc.getAssociationExpr());
13250 if (AssocExpr.isInvalid())
13252 AssocExprs.push_back(AssocExpr.get());
13255 if (!ControllingType)
13256 return getDerived().RebuildGenericSelectionExpr(E->getGenericLoc(),
13257 E->getDefaultLoc(),
13259 ControllingExpr.get(),
13262 return getDerived().RebuildGenericSelectionExpr(
13263 E->getGenericLoc(), E->getDefaultLoc(), E->getRParenLoc(),
13264 ControllingType, AssocTypes, AssocExprs);
13267template<
typename Derived>
13270 ExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
13271 if (SubExpr.isInvalid())
13274 if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getSubExpr())
13277 return getDerived().RebuildParenExpr(SubExpr.get(), E->getLParen(),
13284template<
typename Derived>
13288 return getDerived().TransformDependentScopeDeclRefExpr(
13289 DRE,
true,
nullptr);
13291 return getDerived().TransformUnresolvedLookupExpr(
13297template<
typename Derived>
13302 SubExpr = TransformAddressOfOperand(E->
getSubExpr());
13308 if (!getDerived().AlwaysRebuild() && SubExpr.
get() == E->
getSubExpr())
13316template<
typename Derived>
13318TreeTransform<Derived>::TransformOffsetOfExpr(OffsetOfExpr *E) {
13320 TypeSourceInfo *Type = getDerived().TransformType(E->getTypeSourceInfo());
13330 bool ExprChanged =
false;
13331 typedef Sema::OffsetOfComponent Component;
13333 for (
unsigned I = 0, N = E->getNumComponents(); I != N; ++I) {
13334 const OffsetOfNode &ON = E->getComponent(I);
13336 Comp.isBrackets =
true;
13337 Comp.LocStart = ON.getSourceRange().getBegin();
13338 Comp.LocEnd = ON.getSourceRange().getEnd();
13339 switch (ON.getKind()) {
13341 Expr *FromIndex = E->getIndexExpr(ON.getArrayExprIndex());
13342 ExprResult Index = getDerived().TransformExpr(FromIndex);
13343 if (Index.isInvalid())
13346 ExprChanged = ExprChanged || Index.get() != FromIndex;
13347 Comp.isBrackets =
true;
13348 Comp.U.E = Index.get();
13354 Comp.isBrackets =
false;
13355 Comp.U.IdentInfo = ON.getFieldName();
13356 if (!
Comp.U.IdentInfo)
13366 Components.push_back(Comp);
13370 if (!getDerived().AlwaysRebuild() &&
13371 Type == E->getTypeSourceInfo() &&
13376 return getDerived().RebuildOffsetOfExpr(E->getOperatorLoc(),
Type,
13377 Components, E->getRParenLoc());
13380template<
typename Derived>
13383 assert((!E->getSourceExpr() || getDerived().AlreadyTransformed(E->getType())) &&
13384 "opaque value expression requires transformation");
13388template <
typename Derived>
13392 for (
Expr *
C : E->subExpressions()) {
13394 if (NewC.isInvalid())
13400 if (!getDerived().AlwaysRebuild() && !Changed)
13402 return getDerived().RebuildRecoveryExpr(E->getBeginLoc(), E->getEndLoc(),
13406template<
typename Derived>
13416 ExprResult result = getDerived().TransformExpr(newSyntacticForm);
13417 if (result.isInvalid())
return ExprError();
13422 if (result.get()->hasPlaceholderType(BuiltinType::PseudoObject))
13428template<
typename Derived>
13432 if (E->isArgumentType()) {
13439 if (!getDerived().AlwaysRebuild() && OldT == NewT)
13442 return getDerived().RebuildUnaryExprOrTypeTrait(NewT, E->getOperatorLoc(),
13444 E->getSourceRange());
13458 auto *PE = dyn_cast<ParenExpr>(E->getArgumentExpr());
13460 PE ? dyn_cast<DependentScopeDeclRefExpr>(PE->getSubExpr()) :
nullptr)
13461 SubExpr = getDerived().TransformParenDependentScopeDeclRefExpr(
13462 PE, DRE,
false, &RecoveryTSI);
13464 SubExpr = getDerived().TransformExpr(E->getArgumentExpr());
13467 return getDerived().RebuildUnaryExprOrTypeTrait(
13468 RecoveryTSI, E->getOperatorLoc(), E->getKind(), E->getSourceRange());
13469 }
else if (SubExpr.isInvalid())
13472 if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getArgumentExpr())
13475 return getDerived().RebuildUnaryExprOrTypeTrait(SubExpr.get(),
13476 E->getOperatorLoc(),
13478 E->getSourceRange());
13481template<
typename Derived>
13484 ExprResult LHS = getDerived().TransformExpr(E->getLHS());
13485 if (LHS.isInvalid())
13488 ExprResult RHS = getDerived().TransformExpr(E->getRHS());
13489 if (RHS.isInvalid())
13493 if (!getDerived().AlwaysRebuild() &&
13494 LHS.get() == E->getLHS() &&
13495 RHS.get() == E->getRHS())
13498 return getDerived().RebuildArraySubscriptExpr(
13500 E->getLHS()->getBeginLoc(), RHS.get(), E->getRBracketLoc());
13503template <
typename Derived>
13507 if (
Base.isInvalid())
13510 ExprResult RowIdx = getDerived().TransformExpr(E->getRowIdx());
13511 if (RowIdx.isInvalid())
13514 if (!getDerived().AlwaysRebuild() &&
Base.get() == E->getBase() &&
13515 RowIdx.get() == E->getRowIdx())
13518 return getDerived().RebuildMatrixSingleSubscriptExpr(
Base.get(), RowIdx.get(),
13519 E->getRBracketLoc());
13522template <
typename Derived>
13526 if (
Base.isInvalid())
13529 ExprResult RowIdx = getDerived().TransformExpr(E->getRowIdx());
13530 if (RowIdx.isInvalid())
13533 ExprResult ColumnIdx = getDerived().TransformExpr(E->getColumnIdx());
13534 if (ColumnIdx.isInvalid())
13537 if (!getDerived().AlwaysRebuild() &&
Base.get() == E->getBase() &&
13538 RowIdx.get() == E->getRowIdx() && ColumnIdx.get() == E->getColumnIdx())
13541 return getDerived().RebuildMatrixSubscriptExpr(
13542 Base.get(), RowIdx.get(), ColumnIdx.get(), E->getRBracketLoc());
13545template <
typename Derived>
13549 if (
Base.isInvalid())
13553 if (E->getLowerBound()) {
13554 LowerBound = getDerived().TransformExpr(E->getLowerBound());
13555 if (LowerBound.isInvalid())
13560 if (E->getLength()) {
13561 Length = getDerived().TransformExpr(E->getLength());
13562 if (Length.isInvalid())
13567 if (E->isOMPArraySection()) {
13568 if (
Expr *Str = E->getStride()) {
13569 Stride = getDerived().TransformExpr(Str);
13570 if (Stride.isInvalid())
13575 if (!getDerived().AlwaysRebuild() &&
Base.get() == E->getBase() &&
13576 LowerBound.get() == E->getLowerBound() &&
13577 Length.get() == E->getLength() &&
13578 (E->isOpenACCArraySection() || Stride.get() == E->getStride()))
13581 return getDerived().RebuildArraySectionExpr(
13582 E->isOMPArraySection(),
Base.get(), E->getBase()->getEndLoc(),
13583 LowerBound.get(), E->getColonLocFirst(),
13584 E->isOMPArraySection() ? E->getColonLocSecond() :
SourceLocation{},
13585 Length.get(), Stride.get(), E->getRBracketLoc());
13588template <
typename Derived>
13592 if (
Base.isInvalid())
13596 bool ErrorFound =
false;
13597 for (
Expr *
Dim : E->getDimensions()) {
13599 if (DimRes.isInvalid()) {
13603 Dims.push_back(DimRes.get());
13608 return getDerived().RebuildOMPArrayShapingExpr(
Base.get(), E->getLParenLoc(),
13609 E->getRParenLoc(), Dims,
13610 E->getBracketsRanges());
13613template <
typename Derived>
13616 unsigned NumIterators = E->numOfIterators();
13619 bool ErrorFound =
false;
13620 bool NeedToRebuild = getDerived().AlwaysRebuild();
13621 for (
unsigned I = 0; I < NumIterators; ++I) {
13623 Data[I].DeclIdent = D->getIdentifier();
13624 Data[I].DeclIdentLoc = D->getLocation();
13625 if (D->getLocation() == D->getBeginLoc()) {
13627 "Implicit type must be int.");
13629 TypeSourceInfo *TSI = getDerived().TransformType(D->getTypeSourceInfo());
13637 ErrorFound = ErrorFound ||
13638 !(!D->getTypeSourceInfo() || (
Data[I].
Type.getAsOpaquePtr() &&
13639 !
Data[I].Type.get().isNull())) ||
13640 Begin.isInvalid() || End.isInvalid() || Step.isInvalid();
13643 Data[I].Range.Begin = Begin.get();
13644 Data[I].Range.End = End.get();
13645 Data[I].Range.Step = Step.get();
13646 Data[I].AssignLoc = E->getAssignLoc(I);
13647 Data[I].ColonLoc = E->getColonLoc(I);
13648 Data[I].SecColonLoc = E->getSecondColonLoc(I);
13651 (D->getTypeSourceInfo() &&
Data[I].
Type.get().getTypePtrOrNull() !=
13652 D->getType().getTypePtrOrNull()) ||
13658 if (!NeedToRebuild)
13661 ExprResult Res = getDerived().RebuildOMPIteratorExpr(
13662 E->getIteratorKwLoc(), E->getLParenLoc(), E->getRParenLoc(),
Data);
13663 if (!Res.isUsable())
13666 for (
unsigned I = 0; I < NumIterators; ++I)
13667 getDerived().transformedLocalDecl(E->getIteratorDecl(I),
13668 IE->getIteratorDecl(I));
13672template<
typename Derived>
13681 bool ArgChanged =
false;
13683 if (getDerived().TransformExprs(E->getArgs(), E->getNumArgs(),
true, Args,
13687 if (!getDerived().AlwaysRebuild() &&
13688 Callee.get() == E->getCallee() &&
13694 = ((
Expr *)
Callee.get())->getSourceRange().getBegin();
13697 if (E->hasStoredFPFeatures()) {
13699 getSema().CurFPFeatures =
13701 getSema().FpPragmaStack.CurrentValue = NewOverrides;
13704 return getDerived().RebuildCallExpr(
Callee.get(), FakeLParenLoc,
13706 E->getRParenLoc());
13709template<
typename Derived>
13713 if (
Base.isInvalid())
13717 if (E->hasQualifier()) {
13719 = getDerived().TransformNestedNameSpecifierLoc(E->getQualifierLoc());
13727 = cast_or_null<ValueDecl>(getDerived().TransformDecl(E->getMemberLoc(),
13728 E->getMemberDecl()));
13732 NamedDecl *FoundDecl = E->getFoundDecl();
13733 if (FoundDecl == E->getMemberDecl()) {
13736 FoundDecl = cast_or_null<NamedDecl>(
13737 getDerived().TransformDecl(E->getMemberLoc(), FoundDecl));
13742 if (!getDerived().AlwaysRebuild() &&
13743 Base.get() == E->getBase() &&
13744 QualifierLoc == E->getQualifierLoc() &&
13745 Member == E->getMemberDecl() &&
13746 FoundDecl == E->getFoundDecl() &&
13747 !E->hasExplicitTemplateArgs()) {
13752 getSema().OpenMP().isOpenMPRebuildMemberExpr(
13762 if (E->hasExplicitTemplateArgs()) {
13763 TransArgs.setLAngleLoc(E->getLAngleLoc());
13764 TransArgs.setRAngleLoc(E->getRAngleLoc());
13765 if (getDerived().TransformTemplateArguments(E->getTemplateArgs(),
13766 E->getNumTemplateArgs(),
13779 NamedDecl *FirstQualifierInScope =
nullptr;
13781 if (MemberNameInfo.getName()) {
13782 MemberNameInfo = getDerived().TransformDeclarationNameInfo(MemberNameInfo);
13783 if (!MemberNameInfo.getName())
13787 return getDerived().RebuildMemberExpr(
Base.get(), FakeOperatorLoc,
13794 (E->hasExplicitTemplateArgs()
13795 ? &TransArgs :
nullptr),
13796 FirstQualifierInScope);
13799template<
typename Derived>
13802 ExprResult LHS = getDerived().TransformExpr(E->getLHS());
13803 if (LHS.isInvalid())
13807 getDerived().TransformInitializer(E->getRHS(),
false);
13808 if (RHS.isInvalid())
13811 if (!getDerived().AlwaysRebuild() &&
13812 LHS.get() == E->getLHS() &&
13813 RHS.get() == E->getRHS())
13816 if (E->isCompoundAssignmentOp())
13818 return getDerived().RebuildBinaryOperator(
13819 E->getOperatorLoc(), E->getOpcode(), LHS.get(), RHS.get());
13822 getSema().CurFPFeatures =
13823 NewOverrides.applyOverrides(getSema().getLangOpts());
13824 getSema().FpPragmaStack.CurrentValue = NewOverrides;
13825 return getDerived().RebuildBinaryOperator(E->getOperatorLoc(), E->getOpcode(),
13826 LHS.get(), RHS.get());
13829template <
typename Derived>
13834 ExprResult LHS = getDerived().TransformExpr(
const_cast<Expr*
>(Decomp.LHS));
13835 if (LHS.isInvalid())
13838 ExprResult RHS = getDerived().TransformExpr(
const_cast<Expr*
>(Decomp.RHS));
13839 if (RHS.isInvalid())
13845 bool ChangedAnyLookups =
false;
13846 Expr *PossibleBinOps[] = {E->getSemanticForm(),
13847 const_cast<Expr *
>(Decomp.InnerBinOp)};
13848 for (
Expr *PossibleBinOp : PossibleBinOps) {
13849 auto *Op = dyn_cast<CXXOperatorCallExpr>(PossibleBinOp->IgnoreImplicit());
13852 auto *
Callee = dyn_cast<DeclRefExpr>(Op->getCallee()->IgnoreImplicit());
13858 NamedDecl *
Found = cast_or_null<NamedDecl>(getDerived().TransformDecl(
13859 E->getOperatorLoc(),
Callee->getFoundDecl()));
13863 ChangedAnyLookups =
true;
13864 UnqualLookups.addDecl(
Found);
13867 if (!getDerived().AlwaysRebuild() && !ChangedAnyLookups &&
13868 LHS.get() == Decomp.LHS && RHS.get() == Decomp.RHS) {
13874 const Expr *StopAt[] = {Decomp.LHS, Decomp.RHS};
13879 return getDerived().RebuildCXXRewrittenBinaryOperator(
13880 E->getOperatorLoc(), Decomp.Opcode, UnqualLookups, LHS.get(), RHS.get());
13883template<
typename Derived>
13889 getSema().CurFPFeatures =
13890 NewOverrides.applyOverrides(getSema().getLangOpts());
13891 getSema().FpPragmaStack.CurrentValue = NewOverrides;
13892 return getDerived().TransformBinaryOperator(E);
13895template<
typename Derived>
13901 ExprResult commonExpr = getDerived().TransformExpr(e->getCommon());
13902 if (commonExpr.isInvalid())
13905 ExprResult rhs = getDerived().TransformExpr(e->getFalseExpr());
13906 if (rhs.isInvalid())
13909 if (!getDerived().AlwaysRebuild() &&
13910 commonExpr.get() == e->getCommon() &&
13911 rhs.get() == e->getFalseExpr())
13914 return getDerived().RebuildConditionalOperator(commonExpr.get(),
13915 e->getQuestionLoc(),
13921template<
typename Derived>
13925 if (
Cond.isInvalid())
13928 ExprResult LHS = getDerived().TransformExpr(E->getLHS());
13929 if (LHS.isInvalid())
13932 ExprResult RHS = getDerived().TransformExpr(E->getRHS());
13933 if (RHS.isInvalid())
13936 if (!getDerived().AlwaysRebuild() &&
13937 Cond.get() == E->getCond() &&
13938 LHS.get() == E->getLHS() &&
13939 RHS.get() == E->getRHS())
13942 return getDerived().RebuildConditionalOperator(
Cond.get(),
13943 E->getQuestionLoc(),
13949template<
typename Derived>
13954 return getDerived().
TransformExpr(E->getSubExprAsWritten());
13957template<
typename Derived>
13965 = getDerived().TransformExpr(E->getSubExprAsWritten());
13966 if (SubExpr.isInvalid())
13969 if (!getDerived().AlwaysRebuild() &&
13970 Type == E->getTypeInfoAsWritten() &&
13971 SubExpr.get() == E->getSubExpr())
13974 return getDerived().RebuildCStyleCastExpr(E->getLParenLoc(),
13980template<
typename Derived>
13988 ExprResult Init = getDerived().TransformExpr(E->getInitializer());
13989 if (
Init.isInvalid())
13992 if (!getDerived().AlwaysRebuild() &&
13994 Init.get() == E->getInitializer())
14001 return getDerived().RebuildCompoundLiteralExpr(
14002 E->getLParenLoc(), NewT,
14003 E->getInitializer()->getEndLoc(),
Init.get());
14006template<
typename Derived>
14010 if (
Base.isInvalid())
14013 if (!getDerived().AlwaysRebuild() &&
14014 Base.get() == E->getBase())
14020 return getDerived().RebuildExtVectorOrMatrixElementExpr(
14021 Base.get(), FakeOperatorLoc, E->isArrow(), E->getAccessorLoc(),
14025template <
typename Derived>
14029 if (
Base.isInvalid())
14032 if (!getDerived().AlwaysRebuild() &&
Base.get() == E->getBase())
14038 return getDerived().RebuildExtVectorOrMatrixElementExpr(
14039 Base.get(), FakeOperatorLoc,
false, E->getAccessorLoc(),
14043template<
typename Derived>
14049 bool InitChanged =
false;
14055 if (getDerived().TransformExprs(E->getInits(), E->getNumInits(),
false,
14056 Inits, &InitChanged))
14059 if (!getDerived().AlwaysRebuild() && !InitChanged) {
14066 return getDerived().RebuildInitList(E->getLBraceLoc(),
Inits,
14067 E->getRBraceLoc());
14070template<
typename Derived>
14077 if (
Init.isInvalid())
14082 bool ExprChanged =
false;
14084 if (D.isFieldDesignator()) {
14085 if (D.getFieldDecl()) {
14087 getDerived().TransformDecl(D.getFieldLoc(), D.getFieldDecl()));
14088 if (Field != D.getFieldDecl())
14091 ExprChanged =
true;
14092 if (
Field->isAnonymousStructOrUnion())
14098 ExprChanged =
true;
14101 D.getFieldName(), D.getDotLoc(), D.getFieldLoc()));
14105 if (D.isArrayDesignator()) {
14106 ExprResult Index = getDerived().TransformExpr(E->getArrayIndex(D));
14107 if (Index.isInvalid())
14110 Desig.AddDesignator(
14113 ExprChanged = ExprChanged || Index.get() != E->getArrayIndex(D);
14114 ArrayExprs.push_back(Index.get());
14118 assert(D.isArrayRangeDesignator() &&
"New kind of designator?");
14120 = getDerived().TransformExpr(E->getArrayRangeStart(D));
14121 if (Start.isInvalid())
14124 ExprResult End = getDerived().TransformExpr(E->getArrayRangeEnd(D));
14125 if (End.isInvalid())
14129 Start.get(), End.get(), D.getLBracketLoc(), D.getEllipsisLoc()));
14131 ExprChanged = ExprChanged || Start.get() != E->getArrayRangeStart(D) ||
14132 End.get() != E->getArrayRangeEnd(D);
14134 ArrayExprs.push_back(Start.get());
14135 ArrayExprs.push_back(End.get());
14138 if (!getDerived().AlwaysRebuild() &&
14139 Init.get() == E->getInit() &&
14143 return getDerived().RebuildDesignatedInitExpr(Desig, ArrayExprs,
14144 E->getEqualOrColonLoc(),
14145 E->usesGNUSyntax(),
Init.get());
14150template<
typename Derived>
14154 llvm_unreachable(
"Unexpected DesignatedInitUpdateExpr in syntactic form of "
14159template<
typename Derived>
14163 llvm_unreachable(
"Unexpected NoInitExpr in syntactic form of initializer");
14167template<
typename Derived>
14170 llvm_unreachable(
"Unexpected ArrayInitLoopExpr outside of initializer");
14174template<
typename Derived>
14177 llvm_unreachable(
"Unexpected ArrayInitIndexExpr outside of initializer");
14181template<
typename Derived>
14189 QualType T = getDerived().TransformType(E->getType());
14193 if (!getDerived().AlwaysRebuild() &&
14197 return getDerived().RebuildImplicitValueInitExpr(T);
14200template<
typename Derived>
14203 TypeSourceInfo *TInfo = getDerived().TransformType(E->getWrittenTypeInfo());
14207 ExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
14208 if (SubExpr.isInvalid())
14211 if (!getDerived().AlwaysRebuild() &&
14212 TInfo == E->getWrittenTypeInfo() &&
14213 SubExpr.get() == E->getSubExpr())
14216 return getDerived().RebuildVAArgExpr(E->getBuiltinLoc(), SubExpr.get(),
14217 TInfo, E->getRParenLoc());
14220template<
typename Derived>
14223 bool ArgumentChanged =
false;
14225 if (TransformExprs(E->getExprs(), E->getNumExprs(),
true,
Inits,
14229 return getDerived().RebuildParenListExpr(E->getLParenLoc(),
14231 E->getRParenLoc());
14239template<
typename Derived>
14242 Decl *LD = getDerived().TransformDecl(E->getLabel()->getLocation(),
14247 return getDerived().RebuildAddrLabelExpr(E->getAmpAmpLoc(), E->getLabelLoc(),
14251template<
typename Derived>
14256 = getDerived().TransformCompoundStmt(E->getSubStmt(),
true);
14257 if (SubStmt.isInvalid()) {
14262 unsigned OldDepth = E->getTemplateDepth();
14263 unsigned NewDepth = getDerived().TransformTemplateDepth(OldDepth);
14265 if (!getDerived().AlwaysRebuild() && OldDepth == NewDepth &&
14266 SubStmt.get() == E->getSubStmt()) {
14272 return getDerived().RebuildStmtExpr(E->getLParenLoc(), SubStmt.get(),
14273 E->getRParenLoc(), NewDepth);
14276template<
typename Derived>
14280 if (
Cond.isInvalid())
14283 ExprResult LHS = getDerived().TransformExpr(E->getLHS());
14284 if (LHS.isInvalid())
14287 ExprResult RHS = getDerived().TransformExpr(E->getRHS());
14288 if (RHS.isInvalid())
14291 if (!getDerived().AlwaysRebuild() &&
14292 Cond.get() == E->getCond() &&
14293 LHS.get() == E->getLHS() &&
14294 RHS.get() == E->getRHS())
14297 return getDerived().RebuildChooseExpr(E->getBuiltinLoc(),
14298 Cond.get(), LHS.get(), RHS.get(),
14299 E->getRParenLoc());
14302template<
typename Derived>
14308template<
typename Derived>
14311 switch (E->getOperator()) {
14315 case OO_Array_Delete:
14316 llvm_unreachable(
"new and delete operators cannot use CXXOperatorCallExpr");
14321 assert(E->getNumArgs() >= 1 &&
"Object call is missing arguments");
14334 if (FakeLParenLoc.isInvalid() && EndLoc.isValid())
14335 FakeLParenLoc = EndLoc;
14339 if (getDerived().TransformExprs(E->getArgs() + 1, E->getNumArgs() - 1,
true,
14343 if (E->getOperator() == OO_Subscript)
14344 return getDerived().RebuildCxxSubscriptExpr(
Object.get(), FakeLParenLoc,
14345 Args, E->getEndLoc());
14347 return getDerived().RebuildCallExpr(
Object.get(), FakeLParenLoc, Args,
14351#define OVERLOADED_OPERATOR(Name, Spelling, Token, Unary, Binary, MemberOnly) \
14355#define OVERLOADED_OPERATOR_MULTI(Name,Spelling,Unary,Binary,MemberOnly)
14356#include "clang/Basic/OperatorKinds.def"
14358 case OO_Conditional:
14359 llvm_unreachable(
"conditional operator is not actually overloadable");
14363 llvm_unreachable(
"not an overloaded operator?");
14367 if (E->getNumArgs() == 1 && E->getOperator() == OO_Amp)
14368 First = getDerived().TransformAddressOfOperand(E->getArg(0));
14370 First = getDerived().TransformExpr(E->getArg(0));
14371 if (
First.isInvalid())
14375 if (E->getNumArgs() == 2) {
14377 getDerived().TransformInitializer(E->getArg(1),
false);
14378 if (Second.isInvalid())
14384 getSema().CurFPFeatures =
14385 NewOverrides.applyOverrides(getSema().getLangOpts());
14386 getSema().FpPragmaStack.CurrentValue = NewOverrides;
14392 if (getDerived().TransformOverloadExprDecls(ULE, ULE->requiresADL(), R))
14395 return getDerived().RebuildCXXOperatorCallExpr(
14396 E->getOperator(), E->getOperatorLoc(),
Callee->getBeginLoc(),
14397 ULE->requiresADL(),
R.asUnresolvedSet(),
First.get(), Second.get());
14402 Callee = ICE->getSubExprAsWritten();
14404 ValueDecl *VD = cast_or_null<ValueDecl>(
14405 getDerived().TransformDecl(DR->getLocation(), DR));
14410 Functions.addDecl(VD);
14412 return getDerived().RebuildCXXOperatorCallExpr(
14413 E->getOperator(), E->getOperatorLoc(),
Callee->getBeginLoc(),
14414 false, Functions,
First.get(), Second.get());
14417template<
typename Derived>
14420 return getDerived().TransformCallExpr(E);
14423template <
typename Derived>
14426 getSema().CurContext != E->getParentContext();
14428 if (!getDerived().AlwaysRebuild() && !NeedRebuildFunc)
14431 return getDerived().RebuildSourceLocExpr(E->getIdentKind(), E->getType(),
14432 E->getBeginLoc(), E->getEndLoc(),
14433 getSema().CurContext);
14436template <
typename Derived>
14441template<
typename Derived>
14450 ExprResult EC = getDerived().TransformCallExpr(E->getConfig());
14451 if (EC.isInvalid())
14455 bool ArgChanged =
false;
14457 if (getDerived().TransformExprs(E->getArgs(), E->getNumArgs(),
true, Args,
14461 if (!getDerived().AlwaysRebuild() &&
14462 Callee.get() == E->getCallee() &&
14468 = ((
Expr *)
Callee.get())->getSourceRange().getBegin();
14469 return getDerived().RebuildCallExpr(
Callee.get(), FakeLParenLoc,
14471 E->getRParenLoc(), EC.get());
14474template<
typename Derived>
14490 return getDerived().RebuildCXXNamedCastExpr(
14497template<
typename Derived>
14506 if (Sub.isInvalid())
14509 return getDerived().RebuildBuiltinBitCastExpr(BCE->
getBeginLoc(), TSI,
14513template<
typename Derived>
14515TreeTransform<Derived>::TransformCXXStaticCastExpr(CXXStaticCastExpr *E) {
14516 return getDerived().TransformCXXNamedCastExpr(E);
14519template<
typename Derived>
14525template<
typename Derived>
14532template<
typename Derived>
14538template<
typename Derived>
14544template<
typename Derived>
14549 getDerived().TransformTypeWithDeducedTST(E->getTypeInfoAsWritten());
14554 = getDerived().TransformExpr(E->getSubExprAsWritten());
14555 if (SubExpr.isInvalid())
14558 if (!getDerived().AlwaysRebuild() &&
14559 Type == E->getTypeInfoAsWritten() &&
14560 SubExpr.get() == E->getSubExpr())
14563 return getDerived().RebuildCXXFunctionalCastExpr(
Type,
14567 E->isListInitialization());
14570template<
typename Derived>
14573 if (E->isTypeOperand()) {
14575 = getDerived().TransformType(E->getTypeOperandSourceInfo());
14579 if (!getDerived().AlwaysRebuild() &&
14580 TInfo == E->getTypeOperandSourceInfo())
14583 return getDerived().RebuildCXXTypeidExpr(E->getType(), E->getBeginLoc(),
14584 TInfo, E->getEndLoc());
14590 Expr *Op = E->getExprOperand();
14592 if (E->isGLValue()) {
14594 if (
auto *RD = OpType->getAsCXXRecordDecl()) {
14596 diag::err_incomplete_typeid))
14599 if (RD->isPolymorphic())
14607 ExprResult SubExpr = getDerived().TransformExpr(Op);
14608 if (SubExpr.isInvalid())
14611 if (!getDerived().AlwaysRebuild() &&
14612 SubExpr.get() == E->getExprOperand())
14615 return getDerived().RebuildCXXTypeidExpr(E->getType(), E->getBeginLoc(),
14616 SubExpr.get(), E->getEndLoc());
14619template<
typename Derived>
14622 if (E->isTypeOperand()) {
14624 = getDerived().TransformType(E->getTypeOperandSourceInfo());
14628 if (!getDerived().AlwaysRebuild() &&
14629 TInfo == E->getTypeOperandSourceInfo())
14632 return getDerived().RebuildCXXUuidofExpr(E->getType(), E->getBeginLoc(),
14633 TInfo, E->getEndLoc());
14639 ExprResult SubExpr = getDerived().TransformExpr(E->getExprOperand());
14640 if (SubExpr.isInvalid())
14643 if (!getDerived().AlwaysRebuild() &&
14644 SubExpr.get() == E->getExprOperand())
14647 return getDerived().RebuildCXXUuidofExpr(E->getType(), E->getBeginLoc(),
14648 SubExpr.get(), E->getEndLoc());
14651template<
typename Derived>
14657template<
typename Derived>
14664template<
typename Derived>
14680 auto &S = getSema();
14681 if (E->isCapturedByCopyInLambdaWithExplicitObjectParameter())
14682 return S.getCurrentThisType();
14683 if (S.getCurLambda())
14684 return getDerived().TransformType(E->getType());
14685 return S.getCurrentThisType();
14688 if (!getDerived().AlwaysRebuild() && T == E->getType() &&
14689 !E->isCapturedByCopyInLambdaWithExplicitObjectParameter()) {
14692 getSema().MarkThisReferenced(E);
14696 return getDerived().RebuildCXXThisExpr(E->getBeginLoc(), T, E->isImplicit());
14699template<
typename Derived>
14702 ExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
14703 if (SubExpr.isInvalid())
14706 getSema().DiagnoseExceptionUse(E->getThrowLoc(),
false);
14708 if (!getDerived().AlwaysRebuild() &&
14709 SubExpr.get() == E->getSubExpr())
14712 return getDerived().RebuildCXXThrowExpr(E->getThrowLoc(), SubExpr.get(),
14713 E->isThrownVariableInScope());
14716template<
typename Derived>
14720 getDerived().TransformDecl(E->getBeginLoc(), E->getParam()));
14725 if (E->hasRewrittenInit()) {
14726 InitRes = getDerived().TransformExpr(E->getRewrittenExpr());
14727 if (InitRes.isInvalid())
14731 if (!getDerived().AlwaysRebuild() && Param == E->getParam() &&
14732 E->getUsedContext() == SemaRef.
CurContext &&
14733 InitRes.get() == E->getRewrittenExpr())
14736 return getDerived().RebuildCXXDefaultArgExpr(E->getUsedLocation(), Param,
14740template<
typename Derived>
14744 getDerived().TransformDecl(E->getBeginLoc(), E->getField()));
14748 if (!getDerived().AlwaysRebuild() && Field == E->getField() &&
14752 return getDerived().RebuildCXXDefaultInitExpr(E->getExprLoc(), Field);
14755template<
typename Derived>
14759 TypeSourceInfo *T = getDerived().TransformType(E->getTypeSourceInfo());
14763 if (!getDerived().AlwaysRebuild() &&
14764 T == E->getTypeSourceInfo())
14767 return getDerived().RebuildCXXScalarValueInitExpr(T,
14768 T->getTypeLoc().getEndLoc(),
14769 E->getRParenLoc());
14772template<
typename Derived>
14777 getDerived().TransformTypeWithDeducedTST(E->getAllocatedTypeSourceInfo());
14778 if (!AllocTypeInfo)
14782 std::optional<Expr *> ArraySize;
14783 if (E->isArray()) {
14785 if (std::optional<Expr *> OldArraySize = E->getArraySize()) {
14786 NewArraySize = getDerived().TransformExpr(*OldArraySize);
14787 if (NewArraySize.isInvalid())
14790 ArraySize = NewArraySize.get();
14794 bool ArgumentChanged =
false;
14796 if (getDerived().TransformExprs(E->getPlacementArgs(),
14797 E->getNumPlacementArgs(),
true,
14798 PlacementArgs, &ArgumentChanged))
14802 Expr *OldInit = E->getInitializer();
14805 NewInit = getDerived().TransformInitializer(OldInit,
true);
14806 if (NewInit.isInvalid())
14811 if (E->getOperatorNew()) {
14812 OperatorNew = cast_or_null<FunctionDecl>(
14813 getDerived().TransformDecl(E->getBeginLoc(), E->getOperatorNew()));
14819 if (E->getOperatorDelete()) {
14820 OperatorDelete = cast_or_null<FunctionDecl>(
14821 getDerived().TransformDecl(E->getBeginLoc(), E->getOperatorDelete()));
14822 if (!OperatorDelete)
14826 if (!getDerived().AlwaysRebuild() &&
14827 AllocTypeInfo == E->getAllocatedTypeSourceInfo() &&
14828 ArraySize == E->getArraySize() &&
14829 NewInit.get() == OldInit &&
14830 OperatorNew == E->getOperatorNew() &&
14831 OperatorDelete == E->getOperatorDelete() &&
14832 !ArgumentChanged) {
14837 if (OperatorDelete)
14840 if (E->isArray() && !E->getAllocatedType()->isDependentType()) {
14852 QualType AllocType = AllocTypeInfo->getType();
14863 = dyn_cast<ConstantArrayType>(ArrayT)) {
14867 AllocType = ConsArrayT->getElementType();
14869 = dyn_cast<DependentSizedArrayType>(ArrayT)) {
14870 if (DepArrayT->getSizeExpr()) {
14871 ArraySize = DepArrayT->getSizeExpr();
14872 AllocType = DepArrayT->getElementType();
14877 return getDerived().RebuildCXXNewExpr(
14878 E->getBeginLoc(), E->isGlobalNew(),
14879 E->getBeginLoc(), PlacementArgs,
14880 E->getBeginLoc(), E->getTypeIdParens(), AllocType,
14881 AllocTypeInfo, ArraySize, E->getDirectInitRange(), NewInit.get());
14884template<
typename Derived>
14893 if (E->getOperatorDelete()) {
14894 OperatorDelete = cast_or_null<FunctionDecl>(
14895 getDerived().TransformDecl(E->getBeginLoc(), E->getOperatorDelete()));
14896 if (!OperatorDelete)
14900 if (!getDerived().AlwaysRebuild() &&
14901 Operand.get() == E->getArgument() &&
14902 OperatorDelete == E->getOperatorDelete()) {
14905 if (OperatorDelete)
14908 if (!E->getArgument()->isTypeDependent()) {
14910 E->getDestroyedType());
14911 if (
auto *
Record = Destroyed->getAsCXXRecordDecl())
14919 return getDerived().RebuildCXXDeleteExpr(
14920 E->getBeginLoc(), E->isGlobalDelete(), E->isArrayForm(),
Operand.get());
14923template<
typename Derived>
14928 if (
Base.isInvalid())
14932 bool MayBePseudoDestructor =
false;
14934 E->getOperatorLoc(),
14935 E->isArrow()? tok::arrow : tok::period,
14937 MayBePseudoDestructor);
14938 if (
Base.isInvalid())
14941 QualType ObjectType = ObjectTypePtr.get();
14943 if (QualifierLoc) {
14945 = getDerived().TransformNestedNameSpecifierLoc(QualifierLoc, ObjectType);
14950 SS.
Adopt(QualifierLoc);
14953 if (E->getDestroyedTypeInfo()) {
14954 TypeSourceInfo *DestroyedTypeInfo = getDerived().TransformTypeInObjectScope(
14955 E->getDestroyedTypeInfo(), ObjectType,
14957 if (!DestroyedTypeInfo)
14959 Destroyed = DestroyedTypeInfo;
14960 }
else if (!ObjectType.isNull() && ObjectType->isDependentType()) {
14964 E->getDestroyedTypeLoc());
14968 *E->getDestroyedTypeIdentifier(), E->getDestroyedTypeLoc(),
14969 nullptr, SS, ObjectTypePtr,
false);
14975 E->getDestroyedTypeLoc());
14979 if (E->getScopeTypeInfo()) {
14980 ScopeTypeInfo = getDerived().TransformTypeInObjectScope(
14981 E->getScopeTypeInfo(), ObjectType,
nullptr);
14982 if (!ScopeTypeInfo)
14986 return getDerived().RebuildCXXPseudoDestructorExpr(
Base.get(),
14987 E->getOperatorLoc(),
14991 E->getColonColonLoc(),
14996template <
typename Derived>
15001 bool AllEmptyPacks =
true;
15002 for (
auto *OldD : Old->
decls()) {
15018 if (
auto *UPD = dyn_cast<UsingPackDecl>(InstD))
15019 Decls = UPD->expansions();
15022 for (
auto *D : Decls) {
15023 if (
auto *UD = dyn_cast<UsingDecl>(D)) {
15024 for (
auto *SD : UD->shadows())
15031 AllEmptyPacks &= Decls.empty();
15040 if (AllEmptyPacks && !RequiresADL) {
15051 NamedDecl *FoundDecl = R.getRepresentativeDecl()->getUnderlyingDecl();
15052 getSema().FilterAcceptableTemplateNames(R,
15058 getSema().Diag(R.getNameLoc(),
15059 diag::err_template_kw_refers_to_non_template)
15063 diag::note_template_kw_refers_to_non_template)
15064 << R.getLookupName();
15072template <
typename Derived>
15078template <
typename Derived>
15081 bool IsAddressOfOperand) {
15086 if (TransformOverloadExprDecls(Old, Old->
requiresADL(), R))
15093 = getDerived().TransformNestedNameSpecifierLoc(Old->
getQualifierLoc());
15097 SS.
Adopt(QualifierLoc);
15101 CXXRecordDecl *NamingClass
15102 = cast_or_null<CXXRecordDecl>(getDerived().TransformDecl(
15105 if (!NamingClass) {
15110 R.setNamingClass(NamingClass);
15131 SS, TemplateKWLoc, R,
15138 return getDerived().RebuildDeclarationNameExpr(SS, R, Old->
requiresADL());
15141 return getDerived().RebuildTemplateIdExpr(SS, TemplateKWLoc, R,
15145template<
typename Derived>
15148 bool ArgChanged =
false;
15150 for (
unsigned I = 0, N = E->getNumArgs(); I != N; ++I) {
15152 TypeLoc FromTL = From->getTypeLoc();
15155 TLB.
reserve(FromTL.getFullDataSize());
15156 QualType To = getDerived().TransformType(TLB, FromTL);
15160 if (To == From->getType())
15161 Args.push_back(From);
15163 Args.push_back(TLB.getTypeSourceInfo(SemaRef.
Context, To));
15173 TypeLoc PatternTL = ExpansionTL.getPatternLoc();
15179 bool Expand =
true;
15180 bool RetainExpansion =
false;
15182 ExpansionTL.getTypePtr()->getNumExpansions();
15184 if (getDerived().TryExpandParameterPacks(
15185 ExpansionTL.getEllipsisLoc(), PatternTL.getSourceRange(),
15186 Unexpanded,
true, Expand,
15187 RetainExpansion, NumExpansions))
15197 TLB.
reserve(From->getTypeLoc().getFullDataSize());
15199 QualType To = getDerived().TransformType(TLB, PatternTL);
15203 To = getDerived().RebuildPackExpansionType(To,
15204 PatternTL.getSourceRange(),
15205 ExpansionTL.getEllipsisLoc(),
15213 Args.push_back(TLB.getTypeSourceInfo(SemaRef.
Context, To));
15219 for (
unsigned I = 0; I != *NumExpansions; ++I) {
15222 TLB.
reserve(PatternTL.getFullDataSize());
15223 QualType To = getDerived().TransformType(TLB, PatternTL);
15227 if (To->containsUnexpandedParameterPack()) {
15228 To = getDerived().RebuildPackExpansionType(To,
15229 PatternTL.getSourceRange(),
15230 ExpansionTL.getEllipsisLoc(),
15240 Args.push_back(TLB.getTypeSourceInfo(SemaRef.
Context, To));
15243 if (!RetainExpansion)
15248 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
15251 TLB.
reserve(From->getTypeLoc().getFullDataSize());
15253 QualType To = getDerived().TransformType(TLB, PatternTL);
15257 To = getDerived().RebuildPackExpansionType(To,
15258 PatternTL.getSourceRange(),
15259 ExpansionTL.getEllipsisLoc(),
15267 Args.push_back(TLB.getTypeSourceInfo(SemaRef.
Context, To));
15270 if (!getDerived().AlwaysRebuild() && !ArgChanged)
15273 return getDerived().RebuildTypeTrait(E->getTrait(), E->getBeginLoc(), Args,
15277template<
typename Derived>
15283 if (getDerived().TransformTemplateArguments(Old->getTemplateArgs(),
15284 Old->NumTemplateArgs, TransArgs))
15287 return getDerived().RebuildConceptSpecializationExpr(
15288 E->getNestedNameSpecifierLoc(), E->getTemplateKWLoc(),
15289 E->getConceptNameInfo(), E->getFoundDecl(), E->getNamedConcept(),
15293template<
typename Derived>
15307 getSema().Context, getSema().CurContext,
15308 E->getBody()->getBeginLoc());
15312 ExprResult TypeParamResult = getDerived().TransformRequiresTypeParams(
15313 E->getRequiresKWLoc(), E->getRBraceLoc(), E, Body,
15314 E->getLocalParameters(), TransParamTypes, TransParams, ExtParamInfos);
15318 Param->setDeclContext(Body);
15324 if (!TypeParamResult.isUnset())
15325 return TypeParamResult;
15328 if (getDerived().TransformRequiresExprRequirements(E->getRequirements(),
15333 if (
auto *ER = dyn_cast<concepts::ExprRequirement>(Req)) {
15334 if (ER->getReturnTypeRequirement().isTypeConstraint()) {
15335 ER->getReturnTypeRequirement()
15336 .getTypeConstraintTemplateParameterList()->getParam(0)
15337 ->setDeclContext(Body);
15342 return getDerived().RebuildRequiresExpr(
15343 E->getRequiresKWLoc(), Body, E->getLParenLoc(), TransParams,
15344 E->getRParenLoc(), TransReqs, E->getRBraceLoc());
15347template<
typename Derived>
15353 if (
auto *TypeReq = dyn_cast<concepts::TypeRequirement>(Req))
15354 TransReq =
getDerived().TransformTypeRequirement(TypeReq);
15355 else if (
auto *ExprReq = dyn_cast<concepts::ExprRequirement>(Req))
15356 TransReq =
getDerived().TransformExprRequirement(ExprReq);
15358 TransReq =
getDerived().TransformNestedRequirement(
15362 Transformed.push_back(TransReq);
15367template<
typename Derived>
15380 return getDerived().RebuildTypeRequirement(TransType);
15383template<
typename Derived>
15386 llvm::PointerUnion<Expr *, concepts::Requirement::SubstitutionDiagnostic *> TransExpr;
15392 TransExprRes =
SemaRef.CheckPlaceholderExpr(TransExprRes.
get());
15395 TransExpr = TransExprRes.
get();
15398 std::optional<concepts::ExprRequirement::ReturnTypeRequirement> TransRetReq;
15400 if (RetReq.isEmpty())
15401 TransRetReq.emplace();
15402 else if (RetReq.isSubstitutionFailure())
15403 TransRetReq.emplace(RetReq.getSubstitutionDiagnostic());
15404 else if (RetReq.isTypeConstraint()) {
15406 RetReq.getTypeConstraintTemplateParameterList();
15408 getDerived().TransformTemplateParameterList(OrigTPL);
15411 TransRetReq.emplace(TPL);
15413 assert(TransRetReq &&
"All code paths leading here must set TransRetReq");
15414 if (
Expr *E = dyn_cast<Expr *>(TransExpr))
15417 std::move(*TransRetReq));
15423template<
typename Derived>
15429 return getDerived().RebuildNestedRequirement(
15437 return getDerived().RebuildNestedRequirement(TransConstraint.
get());
15440template<
typename Derived>
15447 if (!getDerived().AlwaysRebuild() &&
15464template<
typename Derived>
15471 SubExpr = getDerived().TransformExpr(E->getQueriedExpression());
15472 if (SubExpr.isInvalid())
15475 if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getQueriedExpression())
15479 return getDerived().RebuildExpressionTrait(E->getTrait(), E->getBeginLoc(),
15480 SubExpr.get(), E->getEndLoc());
15483template <
typename Derived>
15488 DRE, AddrTaken, RecoveryTSI);
15501template <
typename Derived>
15508template <
typename Derived>
15524 getDerived().TransformDeclarationNameInfo(E->
getNameInfo());
15529 if (!getDerived().AlwaysRebuild() && QualifierLoc == E->
getQualifierLoc() &&
15535 return getDerived().RebuildDependentScopeDeclRefExpr(
15536 QualifierLoc, TemplateKWLoc, NameInfo,
nullptr,
15537 IsAddressOfOperand, RecoveryTSI);
15541 if (getDerived().TransformTemplateArguments(
15545 return getDerived().RebuildDependentScopeDeclRefExpr(
15546 QualifierLoc, TemplateKWLoc, NameInfo, &TransArgs, IsAddressOfOperand,
15550template<
typename Derived>
15556 if (getDerived().AllowSkippingCXXConstructExpr() &&
15557 ((E->getNumArgs() == 1 ||
15558 (E->getNumArgs() > 1 && getDerived().DropCallArgument(E->getArg(1)))) &&
15559 (!getDerived().DropCallArgument(E->getArg(0))) &&
15560 !E->isListInitialization()))
15566 QualType T = getDerived().TransformType(E->getType());
15571 getDerived().TransformDecl(E->getBeginLoc(), E->getConstructor()));
15575 bool ArgumentChanged =
false;
15580 E->isListInitialization());
15581 if (getDerived().TransformExprs(E->getArgs(), E->getNumArgs(),
true, Args,
15586 if (!getDerived().AlwaysRebuild() &&
15587 T == E->getType() &&
15589 !ArgumentChanged) {
15596 return getDerived().RebuildCXXConstructExpr(
15597 T, E->getBeginLoc(),
Constructor, E->isElidable(), Args,
15598 E->hadMultipleCandidates(), E->isListInitialization(),
15599 E->isStdInitListInitialization(), E->requiresZeroInitialization(),
15600 E->getConstructionKind(), E->getParenOrBraceRange());
15603template<
typename Derived>
15606 QualType T = getDerived().TransformType(E->getType());
15611 getDerived().TransformDecl(E->getBeginLoc(), E->getConstructor()));
15615 if (!getDerived().AlwaysRebuild() &&
15616 T == E->getType() &&
15624 return getDerived().RebuildCXXInheritedCtorInitExpr(
15626 E->constructsVBase(), E->inheritedFromVBase());
15633template<
typename Derived>
15636 if (
auto *Dtor = E->getTemporary()->getDestructor())
15639 return getDerived().TransformExpr(E->getSubExpr());
15647template<
typename Derived>
15653template<
typename Derived>
15658 getDerived().TransformTypeWithDeducedTST(E->getTypeSourceInfo());
15663 getDerived().TransformDecl(E->getBeginLoc(), E->getConstructor()));
15667 bool ArgumentChanged =
false;
15669 Args.reserve(E->getNumArgs());
15673 E->isListInitialization());
15674 if (TransformExprs(E->getArgs(), E->getNumArgs(),
true, Args,
15678 if (E->isListInitialization() && !E->isStdInitListInitialization()) {
15679 ExprResult Res = RebuildInitList(E->getBeginLoc(), Args, E->getEndLoc());
15680 if (Res.isInvalid())
15682 Args = {Res.get()};
15686 if (!getDerived().AlwaysRebuild() &&
15687 T == E->getTypeSourceInfo() &&
15689 !ArgumentChanged) {
15696 return getDerived().RebuildCXXTemporaryObjectExpr(
15697 T, LParenLoc, Args, E->getEndLoc(), E->isListInitialization());
15700template<
typename Derived>
15705 typedef std::pair<ExprResult, QualType> InitCaptureInfoTy;
15706 struct TransformedInitCapture {
15708 SourceLocation EllipsisLoc;
15710 SmallVector<InitCaptureInfoTy, 4> Expansions;
15713 InitCaptures.resize(E->explicit_capture_end() - E->explicit_capture_begin());
15715 CEnd = E->capture_end();
15717 if (!E->isInitCapture(
C))
15720 TransformedInitCapture &
Result = InitCaptures[
C - E->capture_begin()];
15725 ExprResult NewExprInitResult = getDerived().TransformInitializer(
15728 if (NewExprInitResult.isInvalid()) {
15732 Expr *NewExprInit = NewExprInitResult.get();
15735 getSema().buildLambdaInitCaptureInitialization(
15736 C->getLocation(),
C->getCaptureKind() ==
LCK_ByRef,
15737 EllipsisLoc, NumExpansions, OldVD->getIdentifier(),
15741 Result.Expansions.push_back(
15742 InitCaptureInfoTy(NewExprInit, NewInitCaptureType));
15746 if (OldVD->isParameterPack()) {
15755 bool Expand =
true;
15756 bool RetainExpansion =
false;
15758 ExpansionTL.getTypePtr()->getNumExpansions();
15760 if (getDerived().TryExpandParameterPacks(
15761 ExpansionTL.getEllipsisLoc(), OldVD->getInit()->getSourceRange(),
15762 Unexpanded,
true, Expand,
15763 RetainExpansion, NumExpansions))
15765 assert(!RetainExpansion &&
"Should not need to retain expansion after a "
15766 "capture since it cannot be extended");
15768 for (
unsigned I = 0; I != *NumExpansions; ++I) {
15773 SubstInitCapture(ExpansionTL.getEllipsisLoc(), NumExpansions);
15774 Result.EllipsisLoc = ExpansionTL.getEllipsisLoc();
15811 while (DC->isRequiresExprBody())
15813 if ((getSema().isUnevaluatedContext() ||
15814 getSema().isConstantEvaluatedContext()) &&
15815 !(dyn_cast_or_null<CXXRecordDecl>(DC->getParent()) &&
15817 (DC->isFileContext() || !DC->getParent()->isDependentContext()))
15822 E->getIntroducerRange(),
nullptr, DependencyKind,
15823 E->getCaptureDefault());
15824 getDerived().transformedLocalDecl(OldClass, {
Class});
15827 getSema().CreateLambdaCallOperator(E->getIntroducerRange(),
Class);
15830 getSema().buildLambdaScope(LSI, NewCallOperator, E->getIntroducerRange(),
15831 E->getCaptureDefault(), E->getCaptureDefaultLoc(),
15832 E->hasExplicitParameters(), E->isMutable());
15842 CEnd = E->capture_end();
15846 if (
C->isImplicit())
15850 if (
C->capturesThis()) {
15858 dyn_cast_if_present<CXXRecordDecl>(
15859 getSema().getFunctionLevelDeclContext()),
15861 getSema().CheckCXXThisCapture(
C->getLocation(),
C->isExplicit(),
15868 if (
C->capturesVLAType())
15872 if (E->isInitCapture(
C)) {
15873 TransformedInitCapture &NewC = InitCaptures[
C - E->capture_begin()];
15878 for (InitCaptureInfoTy &Info : NewC.Expansions) {
15880 QualType InitQualType = Info.second;
15881 if (
Init.isInvalid() || InitQualType.isNull()) {
15885 VarDecl *NewVD = getSema().createLambdaInitCaptureVarDecl(
15886 OldVD->getLocation(), InitQualType, NewC.EllipsisLoc,
15887 OldVD->getIdentifier(), OldVD->getInitStyle(),
Init.get(),
15888 getSema().CurContext);
15893 NewVDs.push_back(NewVD);
15894 getSema().addInitCapture(LSI, NewVD,
C->getCaptureKind() ==
LCK_ByRef);
15899 if (NewC.EllipsisLoc.isInvalid())
15900 LSI->ContainsUnexpandedParameterPack |=
15901 Init.get()->containsUnexpandedParameterPack();
15907 getDerived().transformedLocalDecl(OldVD, NewVDs);
15911 assert(
C->capturesVariable() &&
"unexpected kind of lambda capture");
15919 if (
C->isPackExpansion()) {
15921 bool ShouldExpand =
false;
15922 bool RetainExpansion =
false;
15924 if (getDerived().TryExpandParameterPacks(
15925 C->getEllipsisLoc(),
C->getLocation(), Unexpanded,
15926 true, ShouldExpand,
15927 RetainExpansion, NumExpansions)) {
15932 if (ShouldExpand) {
15937 for (
unsigned I = 0; I != *NumExpansions; ++I) {
15939 ValueDecl *CapturedVar = cast_if_present<ValueDecl>(
15940 getDerived().TransformDecl(
C->getLocation(), Pack));
15941 if (!CapturedVar) {
15947 getSema().tryCaptureVariable(CapturedVar,
C->getLocation(), Kind);
15955 EllipsisLoc =
C->getEllipsisLoc();
15959 auto *CapturedVar = cast_or_null<ValueDecl>(
15960 getDerived().TransformDecl(
C->getLocation(),
C->getCapturedVar()));
15961 if (!CapturedVar || CapturedVar->isInvalidDecl()) {
15968 if (
auto *VD = dyn_cast<VarDecl>(CapturedVar); VD && !
C->isPackExpansion())
15969 LSI->ContainsUnexpandedParameterPack |= VD->isParameterPack();
15972 getSema().tryCaptureVariable(CapturedVar,
C->getLocation(), Kind,
15975 getSema().finishLambdaExplicitCaptures(LSI);
15979 auto TPL = getDerived().TransformTemplateParameterList(
15980 E->getTemplateParameterList());
15981 LSI->GLTemplateParameterList = TPL;
15983 getSema().AddTemplateParametersToLambdaCallOperator(NewCallOperator,
Class,
15985 LSI->ContainsUnexpandedParameterPack |=
15986 TPL->containsUnexpandedParameterPack();
15991 E->getCallOperator()->getTypeSourceInfo()->getTypeLoc();
15993 getDerived().TransformType(NewCallOpTLBuilder, OldCallOpTypeLoc);
15994 if (NewCallOpType.isNull())
15996 LSI->ContainsUnexpandedParameterPack |=
15997 NewCallOpType->containsUnexpandedParameterPack();
15999 NewCallOpTLBuilder.getTypeSourceInfo(getSema().Context, NewCallOpType);
16004 assert(FPTL &&
"Not a FunctionProtoType?");
16007 if (!TRC.ArgPackSubstIndex)
16010 getSema().CompleteLambdaCallOperator(
16011 NewCallOperator, E->getCallOperator()->getLocation(),
16012 E->getCallOperator()->getInnerLocStart(), TRC, NewCallOpTSI,
16013 E->getCallOperator()->getConstexprKind(),
16014 E->getCallOperator()->getStorageClass(), FPTL.getParams(),
16015 E->hasExplicitResultType());
16017 getDerived().transformAttrs(E->getCallOperator(), NewCallOperator);
16018 getDerived().transformedLocalDecl(E->getCallOperator(), {NewCallOperator});
16024 std::optional<CXXRecordDecl::LambdaNumbering> Numbering;
16025 if (getDerived().ReplacingOriginal()) {
16026 Numbering = OldClass->getLambdaNumbering();
16029 getSema().handleLambdaNumbering(
Class, NewCallOperator, Numbering);
16034 getSema().PushExpressionEvaluationContextForFunction(
16036 E->getCallOperator());
16043 C.PointOfInstantiation = E->getBody()->getBeginLoc();
16044 getSema().pushCodeSynthesisContext(
C);
16048 : getDerived().TransformLambdaBody(E, E->getBody());
16050 getSema().popCodeSynthesisContext();
16054 FuncScopeCleanup.disable();
16056 if (Body.isInvalid()) {
16057 SavedContext.pop();
16058 getSema().ActOnLambdaError(E->getBeginLoc(),
nullptr,
16063 getSema().ActOnFinishFunctionBody(NewCallOperator, Body.get(),
16066 SavedContext.pop();
16101 DependencyKind = getDerived().ComputeLambdaDependency(LSI);
16102 Class->setLambdaDependencyKind(DependencyKind);
16104 return getDerived().RebuildLambdaExpr(E->getBeginLoc(),
16105 Body.get()->getEndLoc(), LSI);
16108template<
typename Derived>
16114template<
typename Derived>
16123 if (!
C->isImplicit())
16127 if (
C->capturesThis()) {
16128 getSema().CheckCXXThisCapture(
C->getLocation(),
C->isExplicit(),
16135 if (
C->capturesVLAType())
16138 assert(
C->capturesVariable() &&
"unexpected kind of lambda capture");
16142 VarDecl *CapturedVar = cast_or_null<VarDecl>(
16148 getSema().tryCaptureVariable(CapturedVar,
C->getLocation());
16154template<
typename Derived>
16163 bool ArgumentChanged =
false;
16175 if (!getDerived().AlwaysRebuild() &&
16181 return getDerived().RebuildCXXUnresolvedConstructExpr(
16185template<
typename Derived>
16194 if (!E->isImplicitAccess()) {
16195 OldBase = E->getBase();
16196 Base = getDerived().TransformExpr(OldBase);
16197 if (
Base.isInvalid())
16202 bool MayBePseudoDestructor =
false;
16204 E->getOperatorLoc(),
16205 E->isArrow()? tok::arrow : tok::period,
16207 MayBePseudoDestructor);
16208 if (
Base.isInvalid())
16211 ObjectType = ObjectTy.get();
16212 BaseType = ((
Expr*)
Base.get())->getType();
16215 BaseType = getDerived().TransformType(E->getBaseType());
16222 = getDerived().TransformFirstQualifierInScope(
16223 E->getFirstQualifierFoundInScope(),
16224 E->getQualifierLoc().getBeginLoc());
16227 if (E->getQualifier()) {
16229 = getDerived().TransformNestedNameSpecifierLoc(E->getQualifierLoc(),
16231 FirstQualifierInScope);
16243 = getDerived().TransformDeclarationNameInfo(E->getMemberNameInfo());
16244 if (!NameInfo.getName())
16247 if (!E->hasExplicitTemplateArgs()) {
16250 if (!getDerived().AlwaysRebuild() &&
16251 Base.get() == OldBase &&
16252 BaseType == E->getBaseType() &&
16253 QualifierLoc == E->getQualifierLoc() &&
16254 NameInfo.getName() == E->getMember() &&
16255 FirstQualifierInScope == E->getFirstQualifierFoundInScope())
16258 return getDerived().RebuildCXXDependentScopeMemberExpr(
Base.get(),
16261 E->getOperatorLoc(),
16264 FirstQualifierInScope,
16270 if (getDerived().TransformTemplateArguments(E->getTemplateArgs(),
16271 E->getNumTemplateArgs(),
16275 return getDerived().RebuildCXXDependentScopeMemberExpr(
Base.get(),
16278 E->getOperatorLoc(),
16281 FirstQualifierInScope,
16286template <
typename Derived>
16292 if (!Old->isImplicitAccess()) {
16293 Base = getDerived().TransformExpr(Old->getBase());
16294 if (
Base.isInvalid())
16297 getSema().PerformMemberExprBaseConversion(
Base.get(), Old->isArrow());
16298 if (
Base.isInvalid())
16300 BaseType =
Base.get()->getType();
16302 BaseType = getDerived().TransformType(Old->getBaseType());
16306 if (Old->getQualifierLoc()) {
16308 getDerived().TransformNestedNameSpecifierLoc(Old->getQualifierLoc());
16318 if (TransformOverloadExprDecls(Old,
false, R))
16322 if (Old->getNamingClass()) {
16324 getDerived().TransformDecl(Old->getMemberLoc(), Old->getNamingClass()));
16328 R.setNamingClass(NamingClass);
16332 if (Old->hasExplicitTemplateArgs()) {
16333 TransArgs.setLAngleLoc(Old->getLAngleLoc());
16334 TransArgs.setRAngleLoc(Old->getRAngleLoc());
16335 if (getDerived().TransformTemplateArguments(
16336 Old->getTemplateArgs(), Old->getNumTemplateArgs(), TransArgs))
16344 NamedDecl *FirstQualifierInScope =
nullptr;
16346 return getDerived().RebuildUnresolvedMemberExpr(
16347 Base.get(), BaseType, Old->getOperatorLoc(), Old->isArrow(), QualifierLoc,
16348 TemplateKWLoc, FirstQualifierInScope, R,
16349 (Old->hasExplicitTemplateArgs() ? &TransArgs :
nullptr));
16352template<
typename Derived>
16357 ExprResult SubExpr = getDerived().TransformExpr(E->getOperand());
16358 if (SubExpr.isInvalid())
16361 if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getOperand())
16364 return getDerived().RebuildCXXNoexceptExpr(E->getSourceRange(),SubExpr.get());
16367template<
typename Derived>
16370 ExprResult Pattern = getDerived().TransformExpr(E->getPattern());
16371 if (Pattern.isInvalid())
16374 if (!getDerived().AlwaysRebuild() && Pattern.get() == E->getPattern())
16377 return getDerived().RebuildPackExpansion(Pattern.get(), E->getEllipsisLoc(),
16378 E->getNumExpansions());
16381template <
typename Derived>
16386 if (!Arg.isPackExpansion()) {
16398 getSema().getTemplateArgumentPackExpansionPattern(ArgLoc, Ellipsis,
16399 OrigNumExpansions);
16411 if (!NumExpansions) {
16423template<
typename Derived>
16442 bool ShouldExpand =
false;
16443 bool RetainExpansion =
false;
16444 UnsignedOrNone NumExpansions = std::nullopt;
16445 if (getDerived().TryExpandParameterPacks(
16447 true, ShouldExpand,
16448 RetainExpansion, NumExpansions))
16453 if (ShouldExpand) {
16455 if (
auto *TTPD = dyn_cast<TemplateTypeParmDecl>(Pack)) {
16456 ArgStorage = getSema().Context.getPackExpansionType(
16457 getSema().Context.getTypeDeclType(TTPD), std::nullopt);
16458 }
else if (
auto *TTPD = dyn_cast<TemplateTemplateParmDecl>(Pack)) {
16462 ExprResult DRE = getSema().BuildDeclRefExpr(
16463 VD, VD->getType().getNonLValueExprType(getSema().Context),
16466 if (DRE.isInvalid())
16469 new (getSema().Context)
16473 PackArgs = ArgStorage;
16478 if (!PackArgs.size()) {
16479 auto *Pack = cast_or_null<NamedDecl>(
16483 return getDerived().RebuildSizeOfPackExpr(
16490 getDerived().ComputeSizeOfPackExprWithoutSubstitution(PackArgs);
16502 TemporaryBase Rebase(*
this, E->
getPackLoc(), getBaseEntity());
16505 if (TransformTemplateArguments(PackLocIterator(*
this, PackArgs.begin()),
16506 PackLocIterator(*
this, PackArgs.end()),
16507 TransformedPackArgs,
true))
16514 bool PartialSubstitution =
false;
16515 for (
auto &Loc : TransformedPackArgs.arguments()) {
16516 Args.push_back(Loc.getArgument());
16517 if (Loc.getArgument().isPackExpansion())
16518 PartialSubstitution =
true;
16521 if (PartialSubstitution)
16522 return getDerived().RebuildSizeOfPackExpr(
16524 std::nullopt, Args);
16526 return getDerived().RebuildSizeOfPackExpr(
16528 static_cast<unsigned>(Args.size()),
16532template <
typename Derived>
16535 if (!E->isValueDependent())
16543 IndexExpr = getDerived().TransformExpr(E->getIndexExpr());
16544 if (IndexExpr.isInvalid())
16549 bool FullySubstituted =
true;
16550 if (!E->expandsToEmptyPack() && E->getExpressions().empty()) {
16551 Expr *Pattern = E->getPackIdExpression();
16553 getSema().collectUnexpandedParameterPacks(E->getPackIdExpression(),
16555 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
16559 bool ShouldExpand =
true;
16560 bool RetainExpansion =
false;
16562 NumExpansions = std::nullopt;
16563 if (getDerived().TryExpandParameterPacks(
16564 E->getEllipsisLoc(), Pattern->getSourceRange(), Unexpanded,
16565 true, ShouldExpand,
16566 RetainExpansion, NumExpansions))
16568 if (!ShouldExpand) {
16570 ExprResult Pack = getDerived().TransformExpr(Pattern);
16571 if (Pack.isInvalid())
16573 return getDerived().RebuildPackIndexingExpr(
16574 E->getEllipsisLoc(), E->getRSquareLoc(), Pack.get(), IndexExpr.get(),
16577 for (
unsigned I = 0; I != *NumExpansions; ++I) {
16580 if (
Out.isInvalid())
16582 if (
Out.get()->containsUnexpandedParameterPack()) {
16583 Out = getDerived().RebuildPackExpansion(
Out.get(), E->getEllipsisLoc(),
16584 OrigNumExpansions);
16585 if (
Out.isInvalid())
16587 FullySubstituted =
false;
16589 ExpandedExprs.push_back(
Out.get());
16593 if (RetainExpansion) {
16594 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
16597 if (
Out.isInvalid())
16600 Out = getDerived().RebuildPackExpansion(
Out.get(), E->getEllipsisLoc(),
16601 OrigNumExpansions);
16602 if (
Out.isInvalid())
16604 FullySubstituted =
false;
16605 ExpandedExprs.push_back(
Out.get());
16607 }
else if (!E->expandsToEmptyPack()) {
16608 if (getDerived().TransformExprs(E->getExpressions().data(),
16609 E->getExpressions().size(),
false,
16614 return getDerived().RebuildPackIndexingExpr(
16615 E->getEllipsisLoc(), E->getRSquareLoc(), E->getPackIdExpression(),
16616 IndexExpr.get(), ExpandedExprs, FullySubstituted);
16619template <
typename Derived>
16622 if (!getSema().ArgPackSubstIndex)
16628 return getDerived().RebuildSubstNonTypeTemplateParmExpr(
16629 E->getAssociatedDecl(), E->getParameterPack(),
16630 E->getParameterPackLocation(), Arg, SemaRef.
getPackIndex(Pack),
16634template <
typename Derived>
16638 ExprResult Replacement = getDerived().TransformExpr(OrigReplacement);
16639 if (Replacement.isInvalid())
16642 Decl *AssociatedDecl =
16643 getDerived().TransformDecl(E->getNameLoc(), E->getAssociatedDecl());
16644 if (!AssociatedDecl)
16647 if (Replacement.get() == OrigReplacement &&
16648 AssociatedDecl == E->getAssociatedDecl())
16651 auto getParamAndType = [E](
Decl *AssociatedDecl)
16652 -> std::tuple<NonTypeTemplateParmDecl *, QualType> {
16653 auto [PDecl, Arg] =
16657 return {Param, Param->getType()};
16659 Arg = Arg.getPackAsArray()[*PackIndex];
16660 return {Param, Arg.getNonTypeTemplateArgumentType()};
16666 if (
auto [Param, ParamType] = getParamAndType(AssociatedDecl);
16668 ParamType, std::get<1>(getParamAndType(E->getAssociatedDecl()))) ||
16669 Replacement.get() != OrigReplacement) {
16676 Param, ParamType, Replacement.get(), SugaredConverted,
16677 CanonicalConverted,
16679 if (Replacement.isInvalid())
16683 Replacement = E->getReplacement();
16686 return getDerived().RebuildSubstNonTypeTemplateParmExpr(
16687 AssociatedDecl, E->getParameter(), E->getNameLoc(),
16689 E->getPackIndex(), E->getFinal());
16692template<
typename Derived>
16699template<
typename Derived>
16706template<
typename Derived>
16710 if (
Expr *OldCallee = E->getCallee()) {
16711 ExprResult CalleeResult = getDerived().TransformExpr(OldCallee);
16712 if (CalleeResult.isInvalid())
16717 Expr *Pattern = E->getPattern();
16720 getSema().collectUnexpandedParameterPacks(Pattern, Unexpanded);
16721 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
16725 bool Expand =
true;
16726 bool RetainExpansion =
false;
16728 NumExpansions = OrigNumExpansions;
16729 if (getDerived().TryExpandParameterPacks(
16730 E->getEllipsisLoc(), Pattern->getSourceRange(), Unexpanded,
16731 true, Expand, RetainExpansion,
16741 E->getLHS() ? getDerived().TransformExpr(E->getLHS()) :
ExprResult();
16742 if (LHS.isInvalid())
16746 E->getRHS() ? getDerived().TransformExpr(E->getRHS()) :
ExprResult();
16747 if (RHS.isInvalid())
16750 if (!getDerived().AlwaysRebuild() &&
16751 LHS.get() == E->getLHS() && RHS.get() == E->getRHS())
16754 return getDerived().RebuildCXXFoldExpr(
16755 Callee, E->getBeginLoc(), LHS.get(), E->getOperator(),
16756 E->getEllipsisLoc(), RHS.get(), E->getEndLoc(), NumExpansions);
16762 if (NumExpansions && SemaRef.
getLangOpts().BracketDepth < *NumExpansions) {
16763 SemaRef.
Diag(E->getEllipsisLoc(),
16764 clang::diag::err_fold_expression_limit_exceeded)
16765 << *NumExpansions << SemaRef.
getLangOpts().BracketDepth
16766 << E->getSourceRange();
16767 SemaRef.
Diag(E->getEllipsisLoc(), diag::note_bracket_depth);
16776 bool LeftFold = E->isLeftFold();
16780 if (!LeftFold && RetainExpansion) {
16781 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
16784 if (
Out.isInvalid())
16787 Result = getDerived().RebuildCXXFoldExpr(
16788 Callee, E->getBeginLoc(),
Out.get(), E->getOperator(),
16789 E->getEllipsisLoc(),
Result.get(), E->getEndLoc(), OrigNumExpansions);
16794 bool WarnedOnComparison =
false;
16795 for (
unsigned I = 0; I != *NumExpansions; ++I) {
16797 getSema(), LeftFold ? I : *NumExpansions - I - 1);
16799 if (
Out.isInvalid())
16802 if (
Out.get()->containsUnexpandedParameterPack()) {
16804 Result = getDerived().RebuildCXXFoldExpr(
16805 Callee, E->getBeginLoc(), LeftFold ?
Result.get() :
Out.get(),
16806 E->getOperator(), E->getEllipsisLoc(),
16807 LeftFold ?
Out.get() :
Result.get(), E->getEndLoc(),
16808 OrigNumExpansions);
16809 }
else if (
Result.isUsable()) {
16816 Result = getDerived().RebuildCXXOperatorCallExpr(
16818 E->getEllipsisLoc(),
Callee->getBeginLoc(),
Callee->requiresADL(),
16819 Functions, LHS, RHS);
16821 Result = getDerived().RebuildBinaryOperator(E->getEllipsisLoc(),
16822 E->getOperator(), LHS, RHS,
16824 if (!WarnedOnComparison &&
Result.isUsable()) {
16825 if (
auto *BO = dyn_cast<BinaryOperator>(
Result.get());
16826 BO && BO->isComparisonOp()) {
16827 WarnedOnComparison =
true;
16828 SemaRef.
Diag(BO->getBeginLoc(),
16829 diag::warn_comparison_in_fold_expression)
16830 << BO->getOpcodeStr();
16843 if (LeftFold && RetainExpansion) {
16844 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
16847 if (
Out.isInvalid())
16850 Result = getDerived().RebuildCXXFoldExpr(
16851 Callee, E->getBeginLoc(),
Result.get(), E->getOperator(),
16852 E->getEllipsisLoc(),
Out.get(), E->getEndLoc(), OrigNumExpansions);
16858 PE->setIsProducedByFoldExpansion();
16863 return getDerived().RebuildEmptyCXXFoldExpr(E->getEllipsisLoc(),
16868template <
typename Derived>
16874 QualType T = getDerived().TransformType(E->getType());
16876 bool ArgChanged =
false;
16878 if (getDerived().TransformExprs(InitExprs.data(), InitExprs.size(),
true,
16879 TransformedInits, &ArgChanged))
16882 if (!getDerived().AlwaysRebuild() && !ArgChanged && T == E->getType())
16885 return getDerived().RebuildCXXParenListInitExpr(
16886 TransformedInits, T, E->getUserSpecifiedInitExprs().size(),
16887 E->getInitLoc(), E->getBeginLoc(), E->getEndLoc());
16890template<
typename Derived>
16897template<
typename Derived>
16903template<
typename Derived>
16909template<
typename Derived>
16912 ExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
16913 if (SubExpr.isInvalid())
16916 if (!getDerived().AlwaysRebuild() &&
16917 SubExpr.get() == E->getSubExpr())
16920 return getDerived().RebuildObjCBoxedExpr(E->getSourceRange(), SubExpr.get());
16923template<
typename Derived>
16928 bool ArgChanged =
false;
16929 if (getDerived().TransformExprs(E->getElements(), E->getNumElements(),
16930 false, Elements, &ArgChanged))
16933 if (!getDerived().AlwaysRebuild() && !ArgChanged)
16936 return getDerived().RebuildObjCArrayLiteral(E->getSourceRange(),
16941template<
typename Derived>
16947 bool ArgChanged =
false;
16948 for (
unsigned I = 0, N = E->getNumElements(); I != N; ++I) {
16951 if (OrigElement.isPackExpansion()) {
16954 getSema().collectUnexpandedParameterPacks(OrigElement.Key, Unexpanded);
16955 getSema().collectUnexpandedParameterPacks(OrigElement.Value, Unexpanded);
16956 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
16960 bool Expand =
true;
16961 bool RetainExpansion =
false;
16964 SourceRange PatternRange(OrigElement.Key->getBeginLoc(),
16965 OrigElement.Value->getEndLoc());
16966 if (getDerived().TryExpandParameterPacks(
16967 OrigElement.EllipsisLoc, PatternRange, Unexpanded,
16968 true, Expand, RetainExpansion,
16977 ExprResult Key = getDerived().TransformExpr(OrigElement.Key);
16978 if (Key.isInvalid())
16981 if (Key.get() != OrigElement.Key)
16985 if (
Value.isInvalid())
16992 Key.get(),
Value.get(), OrigElement.EllipsisLoc, NumExpansions
16994 Elements.push_back(Expansion);
17004 for (
unsigned I = 0; I != *NumExpansions; ++I) {
17006 ExprResult Key = getDerived().TransformExpr(OrigElement.Key);
17007 if (Key.isInvalid())
17011 if (
Value.isInvalid())
17021 if (Key.get()->containsUnexpandedParameterPack() ||
17022 Value.get()->containsUnexpandedParameterPack())
17023 Element.EllipsisLoc = OrigElement.EllipsisLoc;
17025 Elements.push_back(Element);
17035 ExprResult Key = getDerived().TransformExpr(OrigElement.Key);
17036 if (Key.isInvalid())
17039 if (Key.get() != OrigElement.Key)
17044 = getDerived().TransformExpr(OrigElement.Value);
17045 if (
Value.isInvalid())
17053 Elements.push_back(Element);
17056 if (!getDerived().AlwaysRebuild() && !ArgChanged)
17059 return getDerived().RebuildObjCDictionaryLiteral(E->getSourceRange(),
17063template<
typename Derived>
17067 = getDerived().TransformType(E->getEncodedTypeSourceInfo());
17068 if (!EncodedTypeInfo)
17071 if (!getDerived().AlwaysRebuild() &&
17072 EncodedTypeInfo == E->getEncodedTypeSourceInfo())
17075 return getDerived().RebuildObjCEncodeExpr(E->getAtLoc(),
17077 E->getRParenLoc());
17080template<
typename Derived>
17090template<
typename Derived>
17094 = getDerived().TransformType(E->getTypeInfoAsWritten());
17102 if (!getDerived().AlwaysRebuild() &&
17103 TSInfo == E->getTypeInfoAsWritten() &&
17104 Result.get() == E->getSubExpr())
17108 E->getLParenLoc(), E->getBridgeKind(), E->getBridgeKeywordLoc(), TSInfo,
17112template <
typename Derived>
17118template<
typename Derived>
17122 bool ArgChanged =
false;
17124 Args.reserve(E->getNumArgs());
17125 if (getDerived().TransformExprs(E->getArgs(), E->getNumArgs(),
false, Args,
17132 = getDerived().TransformType(E->getClassReceiverTypeInfo());
17133 if (!ReceiverTypeInfo)
17137 if (!getDerived().AlwaysRebuild() &&
17138 ReceiverTypeInfo == E->getClassReceiverTypeInfo() && !ArgChanged)
17143 E->getSelectorLocs(SelLocs);
17144 return getDerived().RebuildObjCMessageExpr(ReceiverTypeInfo,
17147 E->getMethodDecl(),
17154 if (!E->getMethodDecl())
17159 E->getSelectorLocs(SelLocs);
17160 return getDerived().RebuildObjCMessageExpr(E->getSuperLoc(),
17163 E->getReceiverType(),
17164 E->getMethodDecl(),
17172 "Only class and instance messages may be instantiated");
17174 = getDerived().TransformExpr(E->getInstanceReceiver());
17175 if (Receiver.isInvalid())
17179 if (!getDerived().AlwaysRebuild() &&
17180 Receiver.get() == E->getInstanceReceiver() && !ArgChanged)
17185 E->getSelectorLocs(SelLocs);
17186 return getDerived().RebuildObjCMessageExpr(Receiver.get(),
17189 E->getMethodDecl(),
17195template<
typename Derived>
17201template<
typename Derived>
17207template<
typename Derived>
17212 if (
Base.isInvalid())
17218 if (!getDerived().AlwaysRebuild() &&
17219 Base.get() == E->getBase())
17222 return getDerived().RebuildObjCIvarRefExpr(
Base.get(), E->getDecl(),
17224 E->isArrow(), E->isFreeIvar());
17227template<
typename Derived>
17232 if (!E->isObjectReceiver())
17237 if (
Base.isInvalid())
17243 if (!getDerived().AlwaysRebuild() &&
17244 Base.get() == E->getBase())
17247 if (E->isExplicitProperty())
17248 return getDerived().RebuildObjCPropertyRefExpr(
Base.get(),
17249 E->getExplicitProperty(),
17252 return getDerived().RebuildObjCPropertyRefExpr(
Base.get(),
17254 E->getImplicitPropertyGetter(),
17255 E->getImplicitPropertySetter(),
17259template<
typename Derived>
17264 if (
Base.isInvalid())
17268 ExprResult Key = getDerived().TransformExpr(E->getKeyExpr());
17269 if (Key.isInvalid())
17273 if (!getDerived().AlwaysRebuild() &&
17274 Key.get() == E->getKeyExpr() &&
Base.get() == E->getBaseExpr())
17277 return getDerived().RebuildObjCSubscriptRefExpr(E->getRBracket(),
17278 Base.get(), Key.get(),
17279 E->getAtIndexMethodDecl(),
17280 E->setAtIndexMethodDecl());
17283template<
typename Derived>
17288 if (
Base.isInvalid())
17292 if (!getDerived().AlwaysRebuild() &&
17293 Base.get() == E->getBase())
17296 return getDerived().RebuildObjCIsaExpr(
Base.get(), E->getIsaMemberLoc(),
17301template<
typename Derived>
17304 bool ArgumentChanged =
false;
17306 SubExprs.reserve(E->getNumSubExprs());
17307 if (getDerived().TransformExprs(E->getSubExprs(), E->getNumSubExprs(),
false,
17308 SubExprs, &ArgumentChanged))
17311 if (!getDerived().AlwaysRebuild() &&
17315 return getDerived().RebuildShuffleVectorExpr(E->getBuiltinLoc(),
17317 E->getRParenLoc());
17320template<
typename Derived>
17323 ExprResult SrcExpr = getDerived().TransformExpr(E->getSrcExpr());
17324 if (SrcExpr.isInvalid())
17331 if (!getDerived().AlwaysRebuild() &&
17332 Type == E->getTypeSourceInfo() &&
17333 SrcExpr.get() == E->getSrcExpr())
17336 return getDerived().RebuildConvertVectorExpr(E->getBuiltinLoc(),
17337 SrcExpr.get(),
Type,
17338 E->getRParenLoc());
17341template<
typename Derived>
17344 BlockDecl *oldBlock = E->getBlockDecl();
17350 blockScope->TheDecl->setBlockMissingReturnType(
17351 oldBlock->blockMissingReturnType());
17360 if (getDerived().TransformFunctionTypeParams(
17361 E->getCaretLocation(), oldBlock->parameters(),
nullptr,
17362 exprFunctionType->getExtParameterInfosOrNull(), paramTypes, ¶ms,
17364 getSema().ActOnBlockError(E->getCaretLocation(),
nullptr);
17369 getDerived().TransformType(exprFunctionType->getReturnType());
17371 auto epi = exprFunctionType->getExtProtoInfo();
17372 epi.ExtParameterInfos = extParamInfos.getPointerOrNull(paramTypes.size());
17375 getDerived().RebuildFunctionProtoType(exprResultType, paramTypes, epi);
17379 if (!params.empty())
17380 blockScope->TheDecl->setParams(params);
17382 if (!oldBlock->blockMissingReturnType()) {
17383 blockScope->HasImplicitReturnType =
false;
17384 blockScope->ReturnType = exprResultType;
17388 StmtResult body = getDerived().TransformStmt(E->getBody());
17389 if (body.isInvalid()) {
17390 getSema().ActOnBlockError(E->getCaretLocation(),
nullptr);
17398 for (
const auto &I : oldBlock->captures()) {
17399 VarDecl *oldCapture = I.getVariable();
17402 if (oldCapture->isParameterPack())
17406 cast<VarDecl>(getDerived().TransformDecl(E->getCaretLocation(),
17408 assert(blockScope->CaptureMap.count(newCapture));
17414 assert((!blockScope->isCXXThisCaptured() || oldBlock->capturesCXXThis()) &&
17415 "this pointer isn't captured in the old block");
17423template<
typename Derived>
17426 ExprResult SrcExpr = getDerived().TransformExpr(E->getSrcExpr());
17427 if (SrcExpr.isInvalid())
17430 QualType Type = getDerived().TransformType(E->getType());
17433 E->getRParenLoc());
17436template<
typename Derived>
17439 bool ArgumentChanged =
false;
17441 SubExprs.reserve(E->getNumSubExprs());
17442 if (getDerived().TransformExprs(E->getSubExprs(), E->getNumSubExprs(),
false,
17443 SubExprs, &ArgumentChanged))
17446 if (!getDerived().AlwaysRebuild() &&
17450 return getDerived().RebuildAtomicExpr(E->getBuiltinLoc(), SubExprs,
17451 E->getOp(), E->getRParenLoc());
17458template<
typename Derived>
17461 return SemaRef.BuildPointerType(PointeeType,
Star,
17465template<
typename Derived>
17468 return SemaRef.BuildBlockPointerType(PointeeType,
Star,
17472template<
typename Derived>
17475 bool WrittenAsLValue,
17477 return SemaRef.BuildReferenceType(ReferentType, WrittenAsLValue,
17481template <
typename Derived>
17485 return SemaRef.BuildMemberPointerType(PointeeType, SS, Cls, Sigil,
17489template<
typename Derived>
17496 return SemaRef.ObjC().BuildObjCTypeParamType(
17497 Decl, ProtocolLAngleLoc, Protocols, ProtocolLocs, ProtocolRAngleLoc,
17501template<
typename Derived>
17512 return SemaRef.ObjC().BuildObjCObjectType(
17513 BaseType, Loc, TypeArgsLAngleLoc, TypeArgs, TypeArgsRAngleLoc,
17514 ProtocolLAngleLoc, Protocols, ProtocolLocs, ProtocolRAngleLoc,
17519template<
typename Derived>
17523 return SemaRef.Context.getObjCObjectPointerType(PointeeType);
17526template <
typename Derived>
17529 Expr *SizeExpr,
unsigned IndexTypeQuals,
SourceRange BracketsRange) {
17530 if (SizeExpr || !Size)
17531 return SemaRef.BuildArrayType(ElementType, SizeMod, SizeExpr,
17532 IndexTypeQuals, BracketsRange,
17536 SemaRef.Context.UnsignedCharTy,
SemaRef.Context.UnsignedShortTy,
17538 SemaRef.Context.UnsignedLongLongTy,
SemaRef.Context.UnsignedInt128Ty
17541 for (
const auto &T : Types)
17542 if (Size->getBitWidth() ==
SemaRef.Context.getIntWidth(T)) {
17552 return SemaRef.BuildArrayType(ElementType, SizeMod, ArraySize,
17553 IndexTypeQuals, BracketsRange,
17557template <
typename Derived>
17560 Expr *SizeExpr,
unsigned IndexTypeQuals,
SourceRange BracketsRange) {
17561 return getDerived().RebuildArrayType(ElementType, SizeMod, &Size, SizeExpr,
17562 IndexTypeQuals, BracketsRange);
17565template <
typename Derived>
17569 return getDerived().RebuildArrayType(ElementType, SizeMod,
nullptr,
nullptr,
17570 IndexTypeQuals, BracketsRange);
17573template <
typename Derived>
17576 unsigned IndexTypeQuals,
SourceRange BracketsRange) {
17577 return getDerived().RebuildArrayType(ElementType, SizeMod,
nullptr,
17579 IndexTypeQuals, BracketsRange);
17582template <
typename Derived>
17585 unsigned IndexTypeQuals,
SourceRange BracketsRange) {
17586 return getDerived().RebuildArrayType(ElementType, SizeMod,
nullptr,
17588 IndexTypeQuals, BracketsRange);
17591template <
typename Derived>
17594 return SemaRef.BuildAddressSpaceAttr(PointeeType, AddrSpaceExpr,
17598template <
typename Derived>
17600 unsigned NumElements,
17603 return SemaRef.Context.getVectorType(ElementType, NumElements, VecKind);
17606template <
typename Derived>
17610 return SemaRef.BuildVectorType(ElementType, SizeExpr, AttributeLoc);
17613template<
typename Derived>
17615 unsigned NumElements,
17617 llvm::APInt numElements(
SemaRef.Context.getIntWidth(
SemaRef.Context.IntTy),
17618 NumElements,
true);
17622 return SemaRef.BuildExtVectorType(ElementType, VectorSize, AttributeLoc);
17625template<
typename Derived>
17630 return SemaRef.BuildExtVectorType(ElementType, SizeExpr, AttributeLoc);
17633template <
typename Derived>
17635 QualType ElementType,
unsigned NumRows,
unsigned NumColumns) {
17636 return SemaRef.Context.getConstantMatrixType(ElementType, NumRows,
17640template <
typename Derived>
17644 return SemaRef.BuildMatrixType(ElementType, RowExpr, ColumnExpr,
17648template <
typename Derived>
17652 return SemaRef.BuildFunctionType(T, ParamTypes,
17658template<
typename Derived>
17660 return SemaRef.Context.getFunctionNoProtoType(T);
17663template <
typename Derived>
17667 assert(D &&
"no decl found");
17671 if (
auto *UPD = dyn_cast<UsingPackDecl>(D)) {
17675 if (UPD->expansions().empty()) {
17676 getSema().Diag(NameLoc, diag::err_using_pack_expansion_empty)
17677 << UPD->isCXXClassMember() << UPD;
17686 for (
auto *E : UPD->expansions()) {
17693 else if (T.isNull())
17696 assert(
getSema().Context.hasSameType(ThisT, T) &&
17697 "mismatched resolved types in using pack expansion");
17699 return T.
isNull() ? FallbackT : T;
17701 if (
auto *Using = dyn_cast<UsingDecl>(D)) {
17702 assert(Using->hasTypename() &&
17703 "UnresolvedUsingTypenameDecl transformed to non-typename using");
17706 assert(++Using->shadow_begin() == Using->shadow_end());
17711 return SemaRef.Context.getUsingType(
Keyword, Qualifier, Shadow);
17714 "UnresolvedUsingTypenameDecl transformed to non-using decl");
17715 return SemaRef.Context.getUnresolvedUsingType(
17719template <
typename Derived>
17722 return SemaRef.BuildTypeofExprType(E, Kind);
17725template<
typename Derived>
17728 return SemaRef.Context.getTypeOfType(Underlying, Kind);
17731template <
typename Derived>
17733 return SemaRef.BuildDecltypeType(E);
17736template <
typename Derived>
17741 return SemaRef.BuildPackIndexingType(Pattern, IndexExpr, Loc, EllipsisLoc,
17742 FullySubstituted, Expansions);
17745template<
typename Derived>
17747 UnaryTransformType::UTTKind UKind,
17749 return SemaRef.BuildUnaryTransformType(BaseType, UKind, Loc);
17752template <
typename Derived>
17756 return SemaRef.CheckTemplateIdType(
17761template<
typename Derived>
17764 return SemaRef.BuildAtomicType(ValueType, KWLoc);
17767template<
typename Derived>
17771 return isReadPipe ?
SemaRef.BuildReadPipeType(ValueType, KWLoc)
17772 :
SemaRef.BuildWritePipeType(ValueType, KWLoc);
17775template <
typename Derived>
17779 llvm::APInt NumBitsAP(
SemaRef.Context.getIntWidth(
SemaRef.Context.IntTy),
17783 return SemaRef.BuildBitIntType(IsUnsigned, Bits, Loc);
17786template <
typename Derived>
17789 return SemaRef.BuildBitIntType(IsUnsigned, NumBitsExpr, Loc);
17792template <
typename Derived>
17800template <
typename Derived>
17807 getSema().ActOnTemplateName(
nullptr, SS, TemplateKWLoc,
17810 AllowInjectedClassName);
17814template<
typename Derived>
17821 bool AllowInjectedClassName) {
17824 SourceLocation SymbolLocations[3] = { NameLoc, NameLoc, NameLoc };
17829 false,
Template, AllowInjectedClassName);
17833template <
typename Derived>
17838 bool isPostIncDec = Second && (Op == OO_PlusPlus || Op == OO_MinusMinus);
17843 return SemaRef.PseudoObject().checkAssignment(
nullptr, OpLoc,
17844 Opc,
First, Second);
17859 if (Op == OO_Subscript) {
17860 if (!
First->getType()->isOverloadableType() &&
17862 return getSema().CreateBuiltinArraySubscriptExpr(
First, CalleeLoc, Second,
17864 }
else if (Op == OO_Arrow) {
17867 if (
First->getType()->isDependentType())
17870 return SemaRef.BuildOverloadedArrowExpr(
nullptr,
First, OpLoc);
17871 }
else if (Second ==
nullptr || isPostIncDec) {
17872 if (!
First->getType()->isOverloadableType() ||
17873 (Op == OO_Amp &&
getSema().isQualifiedMemberAccess(
First))) {
17880 return getSema().CreateBuiltinUnaryOp(OpLoc, Opc,
First);
17884 !
First->getType()->isOverloadableType() &&
17890 =
SemaRef.CreateBuiltinBinOp(OpLoc, Opc,
First, Second);
17899 if (!Second || isPostIncDec) {
17902 return SemaRef.CreateOverloadedUnaryOp(OpLoc, Opc, Functions,
First,
17909 First, Second, RequiresADL);
17916template<
typename Derived>
17926 QualType CanonicalBaseType =
Base->getType().getCanonicalType();
17932 ->getAsCanonical<RecordType>())) {
17934 return SemaRef.BuildPseudoDestructorExpr(
17935 Base, OperatorLoc, isArrow ? tok::arrow : tok::period, SS, ScopeType,
17936 CCLoc, TildeLoc, Destroyed);
17948 if (!
isa<TagType>(ScopeType->getType().getCanonicalType())) {
17949 getSema().Diag(ScopeType->getTypeLoc().getBeginLoc(),
17950 diag::err_expected_class_or_namespace)
17951 << ScopeType->getType() <<
getSema().getLangOpts().CPlusPlus;
17955 SS.
Make(
SemaRef.Context, ScopeType->getTypeLoc(), CCLoc);
17959 return getSema().BuildMemberReferenceExpr(
17960 Base,
Base->getType(), OperatorLoc, isArrow, SS, TemplateKWLoc,
17966template<
typename Derived>
17974 for (
unsigned I = 0; I < NumParams; ++I) {
17975 if (I != ContextParamPos) {
17981 Params.push_back(std::make_pair(StringRef(), QualType()));
17984 getSema().ActOnCapturedRegionStart(Loc,
nullptr,
17992 if (Body.isInvalid()) {
17993 getSema().ActOnCapturedRegionError();
17997 return getSema().ActOnCapturedRegionEnd(Body.get());
18000template <
typename Derived>
18006 llvm_unreachable(
"SYCL kernel call statement cannot appear in dependent "
18010template <
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 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 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.
@ Deduced
The normal deduced case.
@ Undeduced
Not deduced yet. This is for example an 'auto' which was just parsed.
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