13#ifndef LLVM_CLANG_LIB_SEMA_TREETRANSFORM_H
14#define LLVM_CLANG_LIB_SEMA_TREETRANSFORM_H
49#include "llvm/ADT/ArrayRef.h"
50#include "llvm/Support/ErrorHandling.h"
54using namespace llvm::omp;
121template<
typename Derived>
126 class ForgetPartiallySubstitutedPackRAII {
134 ForgetPartiallySubstitutedPackRAII(Derived &
Self)
135 :
Self(
Self), ResetPackSubstIndex(
Self.getSema(), std::nullopt) {
136 Old =
Self.ForgetPartiallySubstitutedPack();
139 ~ForgetPartiallySubstitutedPackRAII() {
140 Self.RememberPartiallySubstitutedPack(Old);
157 Derived &
getDerived() {
return static_cast<Derived&
>(*this); }
161 return static_cast<const Derived&
>(*this);
229 if (Location.isValid())
230 Self.getDerived().setBase(Location, Entity);
234 Self.getDerived().setBase(OldLocation, OldEntity);
307 bool FailOnPackProducingTemplates,
308 bool &ShouldExpand,
bool &RetainExpansion,
310 ShouldExpand =
false;
338 struct ForgetSubstitutionRAII {
344 Old =
Self.ForgetSubstitution();
347 ~ForgetSubstitutionRAII() {
Self.RememberSubstitution(std::move(Old)); }
447 const X##Attr *Transform##X##Attr(const X##Attr *R) { return R; }
448#include "clang/Basic/AttrList.inc"
458 const X##Attr *TransformStmt##X##Attr(const Stmt *, const Stmt *, \
459 const X##Attr *A) { \
460 return getDerived().Transform##X##Attr(A); \
462#include "clang/Basic/AttrList.inc"
508 bool *ArgChanged =
nullptr);
517 llvm::DenseMap<Decl *, Decl *>::iterator Known
520 return Known->second;
548 assert(
New.size() == 1 &&
549 "must override transformedLocalDecl if performing pack expansion");
587 NamedDecl *FirstQualifierInScope =
nullptr);
632 NamedDecl *FirstQualifierInScope =
nullptr,
633 bool AllowInjectedClassName =
false);
645 bool Uneval =
false);
672 bool Uneval =
false) {
691 template<
typename InputIterator>
695 bool Uneval =
false);
697 template <
typename InputIterator>
701 bool Uneval =
false);
722 return SemaRef.Context.getTrivialTypeSourceInfo(
T,
726#define ABSTRACT_TYPELOC(CLASS, PARENT)
727#define TYPELOC(CLASS, PARENT) \
728 QualType Transform##CLASS##Type(TypeLocBuilder &TLB, CLASS##TypeLoc T);
729#include "clang/AST/TypeLocNodes.def"
733 bool SuppressObjCLifetime);
737 bool SuppressObjCLifetime);
739 template<
typename Fn>
757 bool AllowInjectedClassName);
785 return getDerived().TransformFunctionTypeParams(
786 Loc, Params, ParamTypes, ParamInfos, PTypes, PVars, PInfos,
nullptr);
804 KWLoc, Params,
nullptr,
805 nullptr, PTypes, &TransParams, PInfos))
819 bool ExpectParameterPack);
846 bool IsAddressOfOperand,
854 bool IsAddressOfOperand);
862#define STMT(Node, Parent) \
863 LLVM_ATTRIBUTE_NOINLINE \
864 StmtResult Transform##Node(Node *S);
865#define VALUESTMT(Node, Parent) \
866 LLVM_ATTRIBUTE_NOINLINE \
867 StmtResult Transform##Node(Node *S, StmtDiscardKind SDK);
868#define EXPR(Node, Parent) \
869 LLVM_ATTRIBUTE_NOINLINE \
870 ExprResult Transform##Node(Node *E);
871#define ABSTRACT_STMT(Stmt)
872#include "clang/AST/StmtNodes.inc"
874#define GEN_CLANG_CLAUSE_CLASS
875#define CLAUSE_CLASS(Enum, Str, Class) \
876 LLVM_ATTRIBUTE_NOINLINE \
877 OMPClause *Transform##Class(Class *S);
878#include "llvm/Frontend/OpenMP/OMP.inc"
956 const llvm::APInt *Size,
Expr *SizeExpr,
957 unsigned IndexTypeQuals,
SourceRange BracketsRange);
966 const llvm::APInt &Size,
Expr *SizeExpr,
967 unsigned IndexTypeQuals,
977 unsigned IndexTypeQuals,
987 unsigned IndexTypeQuals,
998 unsigned IndexTypeQuals,
1036 unsigned NumColumns);
1053 Expr *AddrSpaceExpr,
1077 return SemaRef.Context.getUsingType(
Keyword, Qualifier, D, UnderlyingType);
1090 return SemaRef.Context.getMacroQualifiedType(
T, MacroII);
1100 return SemaRef.Context.getCanonicalTagType(Tag);
1117 UnaryTransformType::UTTKind UKind,
1129 bool FullySubstituted,
1143 TypeConstraintConcept,
1144 TypeConstraintArgs);
1151 return SemaRef.Context.getDeducedTemplateSpecializationType(
1170 return SemaRef.BuildParenType(InnerType);
1183 bool DeducedTSTContext) {
1185 SS.
Adopt(QualifierLoc);
1189 if (!
SemaRef.computeDeclContext(SS))
1197 return SemaRef.CheckTypenameType(
Keyword, KeywordLoc, QualifierLoc,
1198 *Id, IdLoc, DeducedTSTContext);
1211 if (
SemaRef.RequireCompleteDeclContext(SS, DC))
1216 switch (
Result.getResultKind()) {
1227 llvm_unreachable(
"Tag lookup cannot find non-tags");
1239 switch (
Result.getResultKind()) {
1245 SemaRef.Diag(IdLoc, diag::err_tag_reference_non_tag)
1246 << SomeDecl << NTK << Kind;
1251 SemaRef.Diag(IdLoc, diag::err_not_tag_in_scope)
1257 if (!
SemaRef.isAcceptableTagRedeclaration(Tag, Kind,
false,
1259 SemaRef.Diag(KeywordLoc, diag::err_use_with_wrong_tag) << Id;
1260 SemaRef.Diag(Tag->getLocation(), diag::note_previous_use);
1316 bool AllowInjectedClassName);
1329 bool AllowInjectedClassName);
1335 bool AllowInjectedClassName);
1345 Decl *AssociatedDecl,
unsigned Index,
1348 ArgPack, AssociatedDecl, Index, Final);
1402 return SemaRef.ActOnLabelStmt(IdentLoc, L, ColonLoc, SubStmt);
1412 if (
SemaRef.CheckRebuiltStmtAttributes(Attrs))
1414 return SemaRef.BuildAttributedStmt(AttrLoc, Attrs, SubStmt);
1426 Then, ElseLoc, Else);
1480 Inc, RParenLoc, Body);
1525 bool IsVolatile,
unsigned NumOutputs,
1532 NumInputs, Names, Constraints, Exprs,
1533 AsmString, Clobbers, NumLabels, RParenLoc);
1542 StringRef AsmString,
1543 unsigned NumOutputs,
unsigned NumInputs,
1549 NumOutputs, NumInputs,
1550 Constraints, Clobbers, Exprs, EndLoc);
1579 CoawaitLoc, Operand, OpCoawaitLookup);
1583 Suspend.
get(),
true);
1684 Kind, DirName, CancelRegion, Clauses, AStmt, StartLoc, EndLoc);
1696 Kind, DirName, Clauses, AStmt, StartLoc, EndLoc);
1710 NameModifier,
Condition, StartLoc, LParenLoc, NameModifierLoc, ColonLoc,
1736 Modifier, NumThreads, StartLoc, LParenLoc, ModifierLoc, EndLoc);
1797 First, Count, StartLoc, LParenLoc, FirstLoc, CountLoc, EndLoc);
1833 Kind, KindKwLoc, VCKind, VCLoc, StartLoc, LParenLoc, EndLoc);
1846 Kind, KindKwLoc, StartLoc, LParenLoc, EndLoc);
1859 M1, M2, Kind, ChunkSize, StartLoc, LParenLoc, M1Loc, M2Loc, KindLoc,
1921 VarList, LPKind, LPKindLoc, ColonLoc, StartLoc, LParenLoc, EndLoc);
1949 VarList, {Modifier, OriginalSharingModifier}, StartLoc, LParenLoc,
1950 ModifierLoc, ColonLoc, EndLoc, ReductionIdScopeSpec, ReductionId,
1951 UnresolvedReductions);
1965 VarList, StartLoc, LParenLoc, ColonLoc, EndLoc, ReductionIdScopeSpec,
1966 ReductionId, UnresolvedReductions);
1981 VarList, StartLoc, LParenLoc, ColonLoc, EndLoc, ReductionIdScopeSpec,
1982 ReductionId, UnresolvedReductions);
1995 VarList, Step, StartLoc, LParenLoc, Modifier, ModifierLoc, ColonLoc,
1996 StepModifierLoc, EndLoc);
2009 VarList, Alignment, StartLoc, LParenLoc, ColonLoc, EndLoc);
2069 Data, DepModifier, VarList, StartLoc, LParenLoc, EndLoc);
2082 Modifier,
Device, StartLoc, LParenLoc, ModifierLoc, EndLoc);
2097 IteratorModifier, MapTypeModifiers, MapTypeModifiersLoc,
2098 MapperIdScopeSpec, MapperId, MapType, IsMapTypeImplicit, MapLoc,
2099 ColonLoc, VarList, Locs,
2100 false, UnresolvedMappers);
2117 Allocate, Alignment, FirstModifier, FirstModifierLoc, SecondModifier,
2118 SecondModifierLoc, VarList, StartLoc, LParenLoc, ColonLoc, EndLoc);
2166 Modifier,
Device, StartLoc, LParenLoc, ModifierLoc, EndLoc);
2179 Modifier, NumTasks, StartLoc, LParenLoc, ModifierLoc, EndLoc);
2214 Kind, ChunkSize, StartLoc, LParenLoc, KindLoc, CommaLoc, EndLoc);
2229 MotionModifiers, MotionModifiersLoc, IteratorModifier,
2230 MapperIdScopeSpec, MapperId, ColonLoc, VarList, Locs,
2246 MotionModifiers, MotionModifiersLoc, IteratorModifier,
2247 MapperIdScopeSpec, MapperId, ColonLoc, VarList, Locs,
2299 M, Kind, StartLoc, LParenLoc, MLoc, KindLoc, EndLoc);
2346 StartLoc, LParenLoc, EndLoc,
Data);
2359 StartLoc, LParenLoc, ColonLoc, EndLoc, Modifier, Locators);
2371 Modifier, Kind, StartLoc, LParenLoc, ModifierKwLoc, KindKwLoc, EndLoc);
2384 InteropVar, InteropInfo, StartLoc, LParenLoc, VarLoc, EndLoc);
2395 LParenLoc, VarLoc, EndLoc);
2407 InteropVar, StartLoc, LParenLoc, VarLoc, EndLoc);
2478 M1, M2, Size, StartLoc, LParenLoc, M1Loc, M2Loc, EndLoc);
2559 DepType, DepLoc, ColonLoc, VarList, StartLoc, LParenLoc, EndLoc);
2607 ForLoc, Element, Collection, RParenLoc);
2625 StartLoc, IdLoc, Id);
2662 if (
DeclStmt *RangeStmt = dyn_cast<DeclStmt>(Range)) {
2663 if (RangeStmt->isSingleDecl()) {
2664 if (
VarDecl *RangeVar = dyn_cast<VarDecl>(RangeStmt->getSingleDecl())) {
2665 if (RangeVar->isInvalidDecl())
2668 Expr *RangeExpr = RangeVar->getInit();
2675 diag::err_objc_for_range_init_stmt)
2676 <<
Init->getSourceRange();
2679 ForLoc, LoopVar, RangeExpr, RParenLoc);
2686 ForLoc, CoawaitLoc,
Init, ColonLoc, Range, Begin, End,
Cond, Inc,
2700 QualifierLoc, NameInfo, Nested);
2762 SS.
Adopt(QualifierLoc);
2884 if (IsOMPArraySection)
2886 Base, LBracketLoc, LowerBound, ColonLocFirst, ColonLocSecond, Length,
2887 Stride, RBracketLoc);
2889 assert(Stride ==
nullptr && !ColonLocSecond.
isValid() &&
2890 "Stride/second colon not allowed for OpenACC");
2893 Base, LBracketLoc, LowerBound, ColonLocFirst, Length, RBracketLoc);
2905 Base, LParenLoc, RParenLoc, Dims, BracketsRanges);
2917 nullptr, IteratorKwLoc, LLoc, RLoc,
Data);
2927 Expr *ExecConfig =
nullptr) {
2929 nullptr, Callee, LParenLoc, Args, RParenLoc, ExecConfig);
2936 nullptr, Callee, LParenLoc, Args, RParenLoc);
2954 if (!
Member->getDeclName()) {
2958 assert(
Member->getType()->isRecordType() &&
2959 "unnamed member not of record type?");
2972 if (!isArrow &&
Base->isPRValue()) {
2987 SS.
Adopt(QualifierLoc);
2990 if (
Base->containsErrors())
2995 if (isArrow && !BaseType->isPointerType())
3004 if (
getSema().isUnevaluatedContext() &&
Base->isImplicitCXXThis() &&
3009 ->getAsCXXRecordDecl()) {
3013 if (!ThisClass->Equals(
Class) && !ThisClass->isDerivedFrom(
Class))
3021 FirstQualifierInScope,
3022 R, ExplicitTemplateArgs,
3032 bool ForFoldExpression =
false) {
3110 return SemaRef.BuildInitList(LBraceLoc, Inits, RBraceLoc);
3123 =
SemaRef.ActOnDesignatedInitializer(Desig, EqualOrColonLoc, GNUSyntax,
3163 unsigned NumUserSpecifiedExprs,
3168 InitLoc, LParenLoc, RParenLoc);
3198 return SemaRef.ActOnChooseExpr(BuiltinLoc,
3210 Expr *ControllingExpr,
3215 ControllingExpr, Types, Exprs);
3230 ControllingType, Types, Exprs);
3263 case Stmt::CXXStaticCastExprClass:
3264 return getDerived().RebuildCXXStaticCastExpr(OpLoc, LAngleLoc, TInfo,
3265 RAngleLoc, LParenLoc,
3266 SubExpr, RParenLoc);
3268 case Stmt::CXXDynamicCastExprClass:
3269 return getDerived().RebuildCXXDynamicCastExpr(OpLoc, LAngleLoc, TInfo,
3270 RAngleLoc, LParenLoc,
3271 SubExpr, RParenLoc);
3273 case Stmt::CXXReinterpretCastExprClass:
3274 return getDerived().RebuildCXXReinterpretCastExpr(OpLoc, LAngleLoc, TInfo,
3275 RAngleLoc, LParenLoc,
3279 case Stmt::CXXConstCastExprClass:
3280 return getDerived().RebuildCXXConstCastExpr(OpLoc, LAngleLoc, TInfo,
3281 RAngleLoc, LParenLoc,
3282 SubExpr, RParenLoc);
3284 case Stmt::CXXAddrspaceCastExprClass:
3285 return getDerived().RebuildCXXAddrspaceCastExpr(
3286 OpLoc, LAngleLoc, TInfo, RAngleLoc, LParenLoc, SubExpr, RParenLoc);
3289 llvm_unreachable(
"Invalid C++ named cast");
3367 OpLoc, tok::kw_addrspace_cast, TInfo, SubExpr,
3379 bool ListInitialization) {
3383 if (
auto *PLE = dyn_cast<ParenListExpr>(Sub))
3385 TInfo, LParenLoc,
MultiExprArg(PLE->getExprs(), PLE->getNumExprs()),
3386 RParenLoc, ListInitialization);
3388 if (
auto *PLE = dyn_cast<CXXParenListInitExpr>(Sub))
3390 TInfo, LParenLoc, PLE->getInitExprs(), RParenLoc, ListInitialization);
3394 ListInitialization);
3458 if (
getSema().CheckCXXThisType(ThisLoc, ThisType))
3468 bool IsThrownVariableInScope) {
3478 Expr *RewrittenExpr) {
3480 RewrittenExpr,
getSema().CurContext);
3514 std::optional<Expr *> ArraySize,
3533 bool IsGlobalDelete,
3584 bool IsAddressOfOperand,
3587 SS.
Adopt(QualifierLoc);
3589 if (TemplateArgs || TemplateKWLoc.
isValid())
3591 SS, TemplateKWLoc, NameInfo, TemplateArgs, IsAddressOfOperand);
3594 SS, NameInfo, IsAddressOfOperand, RecoveryTSI);
3616 bool IsElidable,
MultiExprArg Args,
bool HadMultipleCandidates,
3617 bool ListInitialization,
bool StdInitListInitialization,
3624 FoundCtor =
Constructor->getInheritedConstructor().getConstructor();
3627 if (
getSema().CompleteConstructorCall(FoundCtor,
T, Args, Loc,
3634 HadMultipleCandidates,
3636 StdInitListInitialization,
3637 RequiresZeroInit, ConstructKind,
3645 bool ConstructsVBase,
3646 bool InheritedFromVBase) {
3648 Loc,
T,
Constructor, ConstructsVBase, InheritedFromVBase);
3659 bool ListInitialization) {
3661 TSInfo, LParenOrBraceLoc, Args, RParenOrBraceLoc, ListInitialization);
3672 bool ListInitialization) {
3674 RParenLoc, ListInitialization);
3691 SS.
Adopt(QualifierLoc);
3693 return SemaRef.BuildMemberReferenceExpr(BaseE, BaseType,
3694 OperatorLoc, IsArrow,
3696 FirstQualifierInScope,
3698 TemplateArgs,
nullptr);
3714 SS.
Adopt(QualifierLoc);
3716 return SemaRef.BuildMemberReferenceExpr(BaseE, BaseType,
3717 OperatorLoc, IsArrow,
3719 FirstQualifierInScope,
3720 R, TemplateArgs,
nullptr);
3728 return SemaRef.BuildCXXNoexceptExpr(Range.getBegin(), Arg, Range.getEnd());
3741 RParenLoc, Length, PartialArgs);
3746 Expr *PackIdExpression,
Expr *IndexExpr,
3748 bool FullySubstituted =
false) {
3750 IndexExpr, RSquareLoc, ExpandedExprs,
3776 NamedConcept, TALI);
3794 LocalParameters, RParenLoc, Requirements,
3801 return SemaRef.BuildTypeRequirement(SubstDiag);
3805 return SemaRef.BuildTypeRequirement(
T);
3813 return SemaRef.BuildExprRequirement(SubstDiag, IsSimple, NoexceptLoc,
3820 return SemaRef.BuildExprRequirement(E, IsSimple, NoexceptLoc,
3827 return SemaRef.BuildNestedRequirement(InvalidConstraintEntity,
3832 return SemaRef.BuildNestedRequirement(Constraint);
3848 Expr **Elements,
unsigned NumElements) {
3858 RB,
Base, Key, getterMethod, setterMethod);
3877 return SemaRef.ObjC().BuildObjCEncodeExpression(AtLoc, EncodeTypeInfo,
3889 return SemaRef.ObjC().BuildClassMessage(
3890 ReceiverTypeInfo, ReceiverTypeInfo->
getType(),
3903 return SemaRef.ObjC().BuildInstanceMessage(Receiver, Receiver->
getType(),
3906 SelectorLocs, RBracLoc, Args);
3918 return Method->isInstanceMethod()
3919 ?
SemaRef.ObjC().BuildInstanceMessage(
3920 nullptr, SuperType, SuperLoc, Sel,
Method, LBracLoc,
3921 SelectorLocs, RBracLoc, Args)
3922 :
SemaRef.ObjC().BuildClassMessage(
nullptr, SuperType, SuperLoc,
3924 SelectorLocs, RBracLoc, Args);
3933 bool IsArrow,
bool IsFreeIvar) {
3942 if (IsFreeIvar &&
Result.isUsable())
3979 PropertyLoc,
Base));
4008 =
SemaRef.Context.Idents.get(
"__builtin_shufflevector");
4011 assert(!Lookup.
empty() &&
"No __builtin_shufflevector?");
4019 Callee =
SemaRef.ImpCastExprToType(Callee, CalleePtrTy,
4020 CK_BuiltinFnToFnPtr).get();
4036 return SemaRef.ConvertVectorExpr(SrcExpr, DstTInfo, BuiltinLoc, RParenLoc);
4051 EllipsisLoc, NumExpansions);
4075 llvm_unreachable(
"Pack expansion pattern has no parameter packs");
4111 EllipsisLoc, RHS, RParenLoc,
4120 Init->containsUnexpandedParameterPack();
4121 else if (PVD->hasUninstantiatedDefaultArg())
4123 PVD->getUninstantiatedDefaultArg()
4124 ->containsUnexpandedParameterPack();
4278 Exprs.push_back(DevNumExpr);
4279 llvm::append_range(Exprs, QueueIdExprs);
4316 AssociatedDecl, NTTP, Loc, Arg, PackIndex, Final);
4332 ObjectType, FirstQualifierInScope);
4338 QualType TransformDependentNameType(TypeLocBuilder &TLB,
4339 DependentNameTypeLoc TL,
4340 bool DeducibleTSTContext,
4341 QualType ObjectType = QualType(),
4342 NamedDecl *UnqualLookup =
nullptr);
4345 TransformOpenACCClauseList(OpenACCDirectiveKind DirKind,
4350 OpenACCDirectiveKind DirKind,
4351 const OpenACCClause *OldClause);
4354template <
typename Derived>
4364#define STMT(Node, Parent) \
4365 case Stmt::Node##Class: return getDerived().Transform##Node(cast<Node>(S));
4366#define VALUESTMT(Node, Parent) \
4367 case Stmt::Node##Class: \
4368 return getDerived().Transform##Node(cast<Node>(S), SDK);
4369#define ABSTRACT_STMT(Node)
4370#define EXPR(Node, Parent)
4371#include "clang/AST/StmtNodes.inc"
4374#define STMT(Node, Parent)
4375#define ABSTRACT_STMT(Stmt)
4376#define EXPR(Node, Parent) case Stmt::Node##Class:
4377#include "clang/AST/StmtNodes.inc"
4382 E =
getSema().ActOnStmtExprResult(E);
4390template<
typename Derived>
4398#define GEN_CLANG_CLAUSE_CLASS
4399#define CLAUSE_CLASS(Enum, Str, Class) \
4401 return getDerived().Transform##Class(cast<Class>(S));
4402#include "llvm/Frontend/OpenMP/OMP.inc"
4409template<
typename Derived>
4416#define STMT(Node, Parent) case Stmt::Node##Class: break;
4417#define ABSTRACT_STMT(Stmt)
4418#define EXPR(Node, Parent) \
4419 case Stmt::Node##Class: return getDerived().Transform##Node(cast<Node>(E));
4420#include "clang/AST/StmtNodes.inc"
4426template<
typename Derived>
4434 if (
auto *FE = dyn_cast<FullExpr>(
Init))
4435 Init = FE->getSubExpr();
4437 if (
auto *AIL = dyn_cast<ArrayInitLoopExpr>(
Init)) {
4443 Init = MTE->getSubExpr();
4446 Init = Binder->getSubExpr();
4449 Init = ICE->getSubExprAsWritten();
4452 dyn_cast<CXXStdInitializerListExpr>(
Init))
4489 getSema().currentEvaluationContext().InLifetimeExtendingContext =
4490 getSema().parentEvaluationContext().InLifetimeExtendingContext;
4491 getSema().currentEvaluationContext().RebuildDefaultArgOrDefaultInit =
4492 getSema().parentEvaluationContext().RebuildDefaultArgOrDefaultInit;
4494 bool ArgChanged =
false;
4496 true, NewArgs, &ArgChanged))
4506 if (
Parens.isInvalid()) {
4509 assert(NewArgs.empty() &&
4510 "no parens or braces but have direct init with arguments?");
4517template<
typename Derived>
4523 for (
unsigned I = 0; I != NumInputs; ++I) {
4533 Expr *Pattern = Expansion->getPattern();
4536 getSema().collectUnexpandedParameterPacks(Pattern, Unexpanded);
4537 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
4542 bool RetainExpansion =
false;
4543 UnsignedOrNone OrigNumExpansions = Expansion->getNumExpansions();
4547 Unexpanded,
true, Expand,
4548 RetainExpansion, NumExpansions))
4561 Expansion->getEllipsisLoc(),
4563 if (Out.isInvalid())
4568 Outputs.push_back(Out.get());
4574 if (ArgChanged) *ArgChanged =
true;
4578 for (
unsigned I = 0; I != *NumExpansions; ++I) {
4581 if (Out.isInvalid())
4584 if (Out.get()->containsUnexpandedParameterPack()) {
4586 Out.get(), Expansion->getEllipsisLoc(), OrigNumExpansions);
4587 if (Out.isInvalid())
4591 Outputs.push_back(Out.get());
4596 if (RetainExpansion) {
4597 ForgetPartiallySubstitutedPackRAII Forget(
getDerived());
4600 if (Out.isInvalid())
4604 Out.get(), Expansion->getEllipsisLoc(), OrigNumExpansions);
4605 if (Out.isInvalid())
4608 Outputs.push_back(Out.get());
4615 IsCall ?
getDerived().TransformInitializer(Inputs[I],
false)
4620 if (
Result.get() != Inputs[I] && ArgChanged)
4623 Outputs.push_back(
Result.get());
4629template <
typename Derived>
4640 VarDecl *ConditionVar = cast_or_null<VarDecl>(
4646 return getSema().ActOnConditionVariable(ConditionVar, Loc, Kind);
4655 return getSema().ActOnCondition(
nullptr, Loc, CondExpr.
get(), Kind,
4662template <
typename Derived>
4670 Qualifier = Qualifier.getAsNamespaceAndPrefix().Prefix)
4682 llvm_unreachable(
"unexpected null nested name specifier");
4713 QualifierLoc =
getDerived().TransformNestedNameSpecifierLoc(
4714 QualifierLoc, ObjectType, FirstQualifierInScope);
4718 FirstQualifierInScope =
nullptr;
4720 SS.
Adopt(QualifierLoc);
4724 if (
SemaRef.BuildCXXNestedNameSpecifier(
nullptr, IdInfo,
4726 FirstQualifierInScope,
false))
4734 T = TransformTypeInObjectScope(TLB, TL, ObjectType,
4735 FirstQualifierInScope);
4741 if (
T->isDependentType() ||
T->isRecordType() ||
4742 (
SemaRef.getLangOpts().CPlusPlus11 &&
T->isEnumeralType())) {
4743 if (
T->isEnumeralType())
4745 diag::warn_cxx98_compat_enum_nested_name_spec);
4752 if (!TTL || !TTL.
getDecl()->isInvalidDecl()) {
4776template<
typename Derived>
4796 TemplateDecl *NewTemplate = cast_or_null<TemplateDecl>(
4803 SemaRef.Context.DeclarationNames.getCXXDeductionGuideName(NewTemplate));
4813 NewTInfo =
getDerived().TransformType(OldTInfo);
4816 NewCanTy =
SemaRef.Context.getCanonicalType(NewTInfo->
getType());
4824 NewCanTy =
SemaRef.Context.getCanonicalType(NewT);
4837 llvm_unreachable(
"Unknown name kind.");
4840template <
typename Derived>
4844 QualType ObjectType,
bool AllowInjectedClassName) {
4846 return getDerived().RebuildTemplateName(SS, TemplateKWLoc, *II, NameLoc,
4847 ObjectType, AllowInjectedClassName);
4849 NameLoc, ObjectType,
4850 AllowInjectedClassName);
4853template <
typename Derived>
4857 NamedDecl *FirstQualifierInScope,
bool AllowInjectedClassName) {
4859 TemplateName UnderlyingName = QTN->getUnderlyingTemplate();
4862 QualifierLoc =
getDerived().TransformNestedNameSpecifierLoc(
4863 QualifierLoc, ObjectType, FirstQualifierInScope);
4870 UnderlyingQualifier, TemplateKWLoc, UnderlyingName, NameLoc, ObjectType,
4871 FirstQualifierInScope, AllowInjectedClassName);
4872 if (NewUnderlyingName.
isNull())
4874 assert(!UnderlyingQualifier &&
"unexpected qualifier");
4878 NewUnderlyingName == UnderlyingName)
4881 SS.
Adopt(QualifierLoc);
4882 return getDerived().RebuildTemplateName(SS, QTN->hasTemplateKeyword(),
4888 QualifierLoc =
getDerived().TransformNestedNameSpecifierLoc(
4889 QualifierLoc, ObjectType, FirstQualifierInScope);
4903 SS.
Adopt(QualifierLoc);
4904 return getDerived().RebuildTemplateName(SS, TemplateKWLoc, DTN->getName(),
4905 NameLoc, ObjectType,
4906 AllowInjectedClassName);
4911 assert(!QualifierLoc &&
"Unexpected qualified SubstTemplateTemplateParm");
4918 ReplacementQualifierLoc = Builder.getWithLocInContext(
SemaRef.Context);
4922 ReplacementQualifierLoc, TemplateKWLoc, ReplacementName, NameLoc,
4923 ObjectType, FirstQualifierInScope, AllowInjectedClassName);
4926 Decl *AssociatedDecl =
4927 getDerived().TransformDecl(NameLoc, S->getAssociatedDecl());
4929 AssociatedDecl == S->getAssociatedDecl())
4931 return SemaRef.Context.getSubstTemplateTemplateParm(
4932 NewName, AssociatedDecl, S->getIndex(), S->getPackIndex(),
4937 "DeducedTemplateName should not escape partial ordering");
4941 assert(!QualifierLoc &&
"Unexpected qualifier");
4948 assert(!QualifierLoc &&
4949 "Unexpected qualified SubstTemplateTemplateParmPack");
4951 SubstPack->getArgumentPack(), SubstPack->getAssociatedDecl(),
4952 SubstPack->getIndex(), SubstPack->getFinal());
4956 llvm_unreachable(
"overloaded function decl survived to here");
4959template <
typename Derived>
4964 QualifierLoc, TemplateKeywordLoc, Name, NameLoc);
4970template<
typename Derived>
4974 Output =
getSema().getTrivialTemplateArgumentLoc(
4978template <
typename Derived>
4986 llvm_unreachable(
"Unexpected TemplateArgument");
5009 if (NewT ==
T && D == NewD)
5026 llvm_unreachable(
"unexpected template argument kind");
5058 llvm_unreachable(
"Caller should expand pack expansions");
5074 E =
SemaRef.ActOnConstantExpression(E);
5089template<
typename Derived,
typename InputIterator>
5097 typedef typename std::iterator_traits<InputIterator>::difference_type
5112 : Self(Self), Iter(Iter) { }
5127 Self.InventTemplateArgumentLoc(*Iter,
Result);
5135 return X.Iter == Y.Iter;
5140 return X.Iter != Y.Iter;
5144template<
typename Derived>
5145template<
typename InputIterator>
5165 PackLocIterator(*
this, In.getArgument().pack_begin()),
5166 PackLocIterator(*
this, In.getArgument().pack_end()), *PackOutput,
5173 if (In.getArgument().isPackExpansion()) {
5185 std::optional<ForgetSubstitutionRAII> ForgetSubst;
5195 if (Out.getArgument().containsUnexpandedParameterPack()) {
5198 if (Out.getArgument().isNull())
5208 ForgetPartiallySubstitutedPackRAII Forget(
getDerived());
5216 if (Out.getArgument().isNull())
5235template <
typename Derived>
5236template <
typename InputIterator>
5245 return !Arg.isDependent() && Arg.isConceptOrConceptTemplateParameter();
5257 PackLocIterator(*
this, In.getArgument().pack_begin()),
5258 PackLocIterator(*
this, In.getArgument().pack_end()), Outputs,
5264 if (!isNonDependentConceptArgument(In.getArgument())) {
5279template <
typename Derived>
5290 Pattern =
getSema().getTemplateArgumentPackExpansionPattern(
5293 getSema().collectUnexpandedParameterPacks(Pattern, Unexpanded);
5294 if (IsLateExpansionAttempt) {
5299 return P.first.dyn_cast<
const SubstBuiltinTemplatePackType *>();
5301 if (!SawPackTypes) {
5306 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
5314 Info.
Ellipsis, Pattern.getSourceRange(), Unexpanded,
5320 if (ComputeInfo(In,
false, Info, Pattern))
5332 std::optional<Sema::ArgPackSubstIndexRAII> SubstIndex(
5333 std::in_place,
getSema(), std::nullopt);
5339 if (Out.getArgument().isNull())
5376 ForgetSubstitutionRAII ForgetSubst(
getDerived());
5377 if (ComputeInfo(Out,
true, Info, OutPattern))
5390template<
typename Derived>
5408template <
typename Derived>
5428template<
typename Derived>
5431 switch (
T.getTypeLocClass()) {
5432#define ABSTRACT_TYPELOC(CLASS, PARENT)
5433#define TYPELOC(CLASS, PARENT) \
5434 case TypeLoc::CLASS: \
5435 return getDerived().Transform##CLASS##Type(TLB, \
5436 T.castAs<CLASS##TypeLoc>());
5437#include "clang/AST/TypeLocNodes.def"
5440 llvm_unreachable(
"unhandled type loc!");
5443template<
typename Derived>
5456template <
typename Derived>
5494template<
typename Derived>
5499 TypeLoc UnqualTL =
T.getUnqualifiedLoc();
5500 auto SuppressObjCLifetime =
5501 T.getType().getLocalQualifiers().hasObjCLifetime();
5503 Result = getDerived().TransformTemplateTypeParmType(TLB, TTP,
5504 SuppressObjCLifetime);
5505 }
else if (
auto STTP = UnqualTL.
getAs<SubstTemplateTypeParmPackTypeLoc>()) {
5506 Result = getDerived().TransformSubstTemplateTypeParmPackType(
5507 TLB, STTP, SuppressObjCLifetime);
5509 Result = getDerived().TransformType(TLB, UnqualTL);
5528template <
typename Derived>
5538 SemaRef.Diag(Loc, diag::err_address_space_mismatch_templ_inst)
5545 if (
T.getPointerAuth().isPresent()) {
5546 SemaRef.Diag(Loc, diag::err_ptrauth_qualifier_redundant) << TL.
getType();
5549 if (!
T->isDependentType()) {
5550 if (!
T->isSignableType(
SemaRef.getASTContext())) {
5551 SemaRef.Diag(Loc, diag::err_ptrauth_qualifier_invalid_target) <<
T;
5559 if (
T->isFunctionType()) {
5560 T =
SemaRef.getASTContext().getAddrSpaceQualType(
T,
5570 if (
T->isReferenceType()) {
5580 if (!
T->isObjCLifetimeType() && !
T->isDependentType())
5582 else if (
T.getObjCLifetime()) {
5586 const AutoType *AutoTy;
5587 if ((AutoTy = dyn_cast<AutoType>(
T)) && AutoTy->isDeduced()) {
5589 QualType Deduced = AutoTy->getDeducedType();
5594 T =
SemaRef.Context.getAutoType(Deduced, AutoTy->getKeyword(),
5597 AutoTy->getTypeConstraintConcept(),
5598 AutoTy->getTypeConstraintArguments());
5603 SemaRef.Diag(Loc, diag::err_attr_objc_ownership_redundant) <<
T;
5609 return SemaRef.BuildQualifiedType(
T, Loc, Quals);
5612template <
typename Derived>
5613QualType TreeTransform<Derived>::TransformTypeInObjectScope(
5616 assert(!getDerived().AlreadyTransformed(TL.
getType()));
5619 case TypeLoc::TemplateSpecialization:
5620 return getDerived().TransformTemplateSpecializationType(
5622 FirstQualifierInScope,
true);
5623 case TypeLoc::DependentName:
5624 return getDerived().TransformDependentNameType(
5626 ObjectType, FirstQualifierInScope);
5630 return getDerived().TransformType(TLB, TL);
5634template <
class TyLoc>
static inline
5636 TyLoc NewT = TLB.
push<TyLoc>(
T.getType());
5637 NewT.setNameLoc(
T.getNameLoc());
5641template<
typename Derived>
5642QualType TreeTransform<Derived>::TransformBuiltinType(TypeLocBuilder &TLB,
5644 BuiltinTypeLoc NewT = TLB.push<BuiltinTypeLoc>(T.getType());
5645 NewT.setBuiltinLoc(T.getBuiltinLoc());
5646 if (T.needsExtraLocalData())
5647 NewT.getWrittenBuiltinSpecs() = T.getWrittenBuiltinSpecs();
5651template<
typename Derived>
5658template <
typename Derived>
5662 return getDerived().
TransformType(TLB, TL.getOriginalLoc());
5665template<
typename Derived>
5668 QualType OriginalType = getDerived().TransformType(TLB, TL.getOriginalLoc());
5669 if (OriginalType.isNull())
5673 if (getDerived().AlwaysRebuild() ||
5674 OriginalType != TL.getOriginalLoc().getType())
5681template <
typename Derived>
5685 QualType OriginalType = getDerived().TransformType(TLB, TL.getElementLoc());
5686 if (OriginalType.isNull())
5690 if (getDerived().AlwaysRebuild() ||
5691 OriginalType != TL.getElementLoc().getType())
5698template<
typename Derived>
5702 = getDerived().TransformType(TLB, TL.getPointeeLoc());
5703 if (PointeeType.isNull())
5707 if (PointeeType->getAs<ObjCObjectType>()) {
5719 if (getDerived().AlwaysRebuild() ||
5720 PointeeType != TL.getPointeeLoc().getType()) {
5721 Result = getDerived().RebuildPointerType(PointeeType, TL.getSigilLoc());
5728 TLB.TypeWasModifiedSafely(
Result->getPointeeType());
5735template<
typename Derived>
5740 = getDerived().TransformType(TLB, TL.getPointeeLoc());
5741 if (PointeeType.isNull())
5745 if (getDerived().AlwaysRebuild() ||
5746 PointeeType != TL.getPointeeLoc().getType()) {
5747 Result = getDerived().RebuildBlockPointerType(PointeeType,
5762template<
typename Derived>
5770 if (PointeeType.
isNull())
5775 PointeeType !=
T->getPointeeTypeAsWritten()) {
5777 T->isSpelledAsLValue(),
5799template<
typename Derived>
5803 return TransformReferenceType(TLB, TL);
5806template<
typename Derived>
5808TreeTransform<Derived>::TransformRValueReferenceType(TypeLocBuilder &TLB,
5809 RValueReferenceTypeLoc TL) {
5810 return TransformReferenceType(TLB, TL);
5813template<
typename Derived>
5817 QualType PointeeType = getDerived().TransformType(TLB, TL.getPointeeLoc());
5818 if (PointeeType.isNull())
5825 getDerived().TransformNestedNameSpecifierLoc(OldQualifierLoc);
5826 if (!NewQualifierLoc)
5829 CXXRecordDecl *OldCls =
T->getMostRecentCXXRecordDecl(), *NewCls =
nullptr;
5831 NewCls = cast_or_null<CXXRecordDecl>(
5832 getDerived().TransformDecl(TL.getStarLoc(), OldCls));
5838 if (getDerived().AlwaysRebuild() || PointeeType !=
T->getPointeeType() ||
5839 NewQualifierLoc.getNestedNameSpecifier() !=
5840 OldQualifierLoc.getNestedNameSpecifier() ||
5843 SS.
Adopt(NewQualifierLoc);
5844 Result = getDerived().RebuildMemberPointerType(PointeeType, SS, NewCls,
5853 if (MPT && PointeeType != MPT->getPointeeType()) {
5860 NewTL.setQualifierLoc(NewQualifierLoc);
5865template<
typename Derived>
5870 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
5871 if (ElementType.isNull())
5875 Expr *OldSize = TL.getSizeExpr();
5877 OldSize =
const_cast<Expr*
>(
T->getSizeExpr());
5878 Expr *NewSize =
nullptr;
5882 NewSize = getDerived().TransformExpr(OldSize).template getAs<Expr>();
5887 if (getDerived().AlwaysRebuild() ||
5888 ElementType !=
T->getElementType() ||
5889 (
T->getSizeExpr() && NewSize != OldSize)) {
5890 Result = getDerived().RebuildConstantArrayType(ElementType,
5891 T->getSizeModifier(),
5892 T->getSize(), NewSize,
5893 T->getIndexTypeCVRQualifiers(),
5894 TL.getBracketsRange());
5905 NewTL.setRBracketLoc(TL.getRBracketLoc());
5906 NewTL.setSizeExpr(NewSize);
5911template<
typename Derived>
5916 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
5917 if (ElementType.isNull())
5921 if (getDerived().AlwaysRebuild() ||
5922 ElementType !=
T->getElementType()) {
5923 Result = getDerived().RebuildIncompleteArrayType(ElementType,
5924 T->getSizeModifier(),
5925 T->getIndexTypeCVRQualifiers(),
5926 TL.getBracketsRange());
5933 NewTL.setRBracketLoc(TL.getRBracketLoc());
5934 NewTL.setSizeExpr(
nullptr);
5939template<
typename Derived>
5944 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
5945 if (ElementType.isNull())
5952 SizeResult = getDerived().TransformExpr(
T->getSizeExpr());
5954 if (SizeResult.isInvalid())
5958 if (SizeResult.isInvalid())
5964 if (getDerived().AlwaysRebuild() ||
5965 ElementType !=
T->getElementType() ||
5966 Size !=
T->getSizeExpr()) {
5967 Result = getDerived().RebuildVariableArrayType(ElementType,
5968 T->getSizeModifier(),
5970 T->getIndexTypeCVRQualifiers(),
5971 TL.getBracketsRange());
5980 NewTL.setRBracketLoc(TL.getRBracketLoc());
5981 NewTL.setSizeExpr(Size);
5986template<
typename Derived>
5991 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
5992 if (ElementType.isNull())
6000 SemaRef.
ExprEvalContexts.back().InConditionallyConstantEvaluateContext =
true;
6003 Expr *origSize = TL.getSizeExpr();
6004 if (!origSize) origSize =
T->getSizeExpr();
6007 = getDerived().TransformExpr(origSize);
6009 if (sizeResult.isInvalid())
6012 Expr *size = sizeResult.get();
6015 if (getDerived().AlwaysRebuild() ||
6016 ElementType !=
T->getElementType() ||
6018 Result = getDerived().RebuildDependentSizedArrayType(ElementType,
6019 T->getSizeModifier(),
6021 T->getIndexTypeCVRQualifiers(),
6022 TL.getBracketsRange());
6031 NewTL.setRBracketLoc(TL.getRBracketLoc());
6032 NewTL.setSizeExpr(size);
6037template <
typename Derived>
6041 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
6042 if (ElementType.isNull())
6050 if (
Size.isInvalid())
6054 if (getDerived().AlwaysRebuild() || ElementType !=
T->getElementType() ||
6055 Size.get() !=
T->getSizeExpr()) {
6056 Result = getDerived().RebuildDependentVectorType(
6057 ElementType,
Size.get(),
T->getAttributeLoc(),
T->getVectorKind());
6075template<
typename Derived>
6082 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
6083 if (ElementType.isNull())
6092 if (
Size.isInvalid())
6096 if (getDerived().AlwaysRebuild() ||
6097 ElementType !=
T->getElementType() ||
6098 Size.get() !=
T->getSizeExpr()) {
6099 Result = getDerived().RebuildDependentSizedExtVectorType(ElementType,
6101 T->getAttributeLoc());
6119template <
typename Derived>
6124 QualType ElementType = getDerived().TransformType(
T->getElementType());
6125 if (ElementType.isNull())
6129 if (getDerived().AlwaysRebuild() || ElementType !=
T->getElementType()) {
6130 Result = getDerived().RebuildConstantMatrixType(
6131 ElementType,
T->getNumRows(),
T->getNumColumns());
6138 NewTL.setAttrOperandParensRange(TL.getAttrOperandParensRange());
6139 NewTL.setAttrRowOperand(TL.getAttrRowOperand());
6140 NewTL.setAttrColumnOperand(TL.getAttrColumnOperand());
6145template <
typename Derived>
6150 QualType ElementType = getDerived().TransformType(
T->getElementType());
6151 if (ElementType.isNull()) {
6159 Expr *origRows = TL.getAttrRowOperand();
6161 origRows =
T->getRowExpr();
6162 Expr *origColumns = TL.getAttrColumnOperand();
6164 origColumns =
T->getColumnExpr();
6166 ExprResult rowResult = getDerived().TransformExpr(origRows);
6168 if (rowResult.isInvalid())
6171 ExprResult columnResult = getDerived().TransformExpr(origColumns);
6173 if (columnResult.isInvalid())
6176 Expr *rows = rowResult.get();
6177 Expr *columns = columnResult.get();
6180 if (getDerived().AlwaysRebuild() || ElementType !=
T->getElementType() ||
6181 rows != origRows || columns != origColumns) {
6182 Result = getDerived().RebuildDependentSizedMatrixType(
6183 ElementType, rows, columns,
T->getAttributeLoc());
6193 NewTL.setAttrOperandParensRange(TL.getAttrOperandParensRange());
6194 NewTL.setAttrRowOperand(rows);
6195 NewTL.setAttrColumnOperand(columns);
6199template <
typename Derived>
6205 getDerived().TransformType(TLB, TL.getPointeeTypeLoc());
6207 if (pointeeType.isNull())
6214 ExprResult AddrSpace = getDerived().TransformExpr(
T->getAddrSpaceExpr());
6216 if (AddrSpace.isInvalid())
6220 if (getDerived().AlwaysRebuild() || pointeeType !=
T->getPointeeType() ||
6221 AddrSpace.get() !=
T->getAddrSpaceExpr()) {
6222 Result = getDerived().RebuildDependentAddressSpaceType(
6223 pointeeType, AddrSpace.get(),
T->getAttributeLoc());
6234 NewTL.setAttrExprOperand(TL.getAttrExprOperand());
6235 NewTL.setAttrNameLoc(TL.getAttrNameLoc());
6238 TLB.TypeWasModifiedSafely(
Result);
6244template <
typename Derived>
6248 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
6249 if (ElementType.isNull())
6253 if (getDerived().AlwaysRebuild() ||
6254 ElementType !=
T->getElementType()) {
6255 Result = getDerived().RebuildVectorType(ElementType,
T->getNumElements(),
6256 T->getVectorKind());
6267template<
typename Derived>
6271 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
6272 if (ElementType.isNull())
6276 if (getDerived().AlwaysRebuild() ||
6277 ElementType !=
T->getElementType()) {
6278 Result = getDerived().RebuildExtVectorType(ElementType,
6279 T->getNumElements(),
6291template <
typename Derived>
6294 bool ExpectParameterPack) {
6329 if (NewTSI == OldTSI && indexAdjustment == 0)
6339 getDerived().transformedLocalDecl(OldParm, {newParm});
6343template <
typename Derived>
6351 unsigned *LastParamTransformed) {
6352 int indexAdjustment = 0;
6354 unsigned NumParams = Params.size();
6355 for (
unsigned i = 0; i != NumParams; ++i) {
6356 if (LastParamTransformed)
6357 *LastParamTransformed = i;
6359 assert(OldParm->getFunctionScopeIndex() == i);
6363 if (OldParm->isParameterPack()) {
6368 TypeLoc TL = OldParm->getTypeSourceInfo()->getTypeLoc();
6371 SemaRef.collectUnexpandedParameterPacks(Pattern, Unexpanded);
6374 bool ShouldExpand =
false;
6375 bool RetainExpansion =
false;
6377 if (Unexpanded.size() > 0) {
6378 OrigNumExpansions = ExpansionTL.
getTypePtr()->getNumExpansions();
6379 NumExpansions = OrigNumExpansions;
6383 ShouldExpand, RetainExpansion, NumExpansions)) {
6388 const AutoType *AT =
6389 Pattern.getType().getTypePtr()->getContainedAutoType();
6390 assert((AT && (!AT->isDeduced() || AT->getDeducedType().isNull())) &&
6391 "Could not find parameter packs or undeduced auto type!");
6398 getDerived().ExpandingFunctionParameterPack(OldParm);
6399 for (
unsigned I = 0; I != *NumExpansions; ++I) {
6402 =
getDerived().TransformFunctionTypeParam(OldParm,
6410 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6411 OutParamTypes.push_back(NewParm->
getType());
6413 PVars->push_back(NewParm);
6418 if (RetainExpansion) {
6419 ForgetPartiallySubstitutedPackRAII Forget(
getDerived());
6421 =
getDerived().TransformFunctionTypeParam(OldParm,
6429 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6430 OutParamTypes.push_back(NewParm->
getType());
6432 PVars->push_back(NewParm);
6448 NewParm =
getDerived().TransformFunctionTypeParam(OldParm,
6453 "Parameter pack no longer a parameter pack after "
6456 NewParm =
getDerived().TransformFunctionTypeParam(
6457 OldParm, indexAdjustment, std::nullopt,
6465 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6466 OutParamTypes.push_back(NewParm->
getType());
6468 PVars->push_back(NewParm);
6476 bool IsPackExpansion =
false;
6479 if (
const PackExpansionType *Expansion
6480 = dyn_cast<PackExpansionType>(OldType)) {
6482 QualType Pattern = Expansion->getPattern();
6484 getSema().collectUnexpandedParameterPacks(Pattern, Unexpanded);
6487 bool ShouldExpand =
false;
6488 bool RetainExpansion =
false;
6492 RetainExpansion, NumExpansions)) {
6499 for (
unsigned I = 0; I != *NumExpansions; ++I) {
6506 NewType =
getSema().getASTContext().getPackExpansionType(
6507 NewType, std::nullopt);
6514 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6515 OutParamTypes.push_back(NewType);
6517 PVars->push_back(
nullptr);
6526 if (RetainExpansion) {
6527 ForgetPartiallySubstitutedPackRAII Forget(
getDerived());
6533 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6534 OutParamTypes.push_back(NewType);
6536 PVars->push_back(
nullptr);
6541 OldType = Expansion->getPattern();
6542 IsPackExpansion =
true;
6544 NewType =
getDerived().TransformType(OldType);
6546 NewType =
getDerived().TransformType(OldType);
6552 if (IsPackExpansion)
6553 NewType =
getSema().Context.getPackExpansionType(NewType,
6557 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6558 OutParamTypes.push_back(NewType);
6560 PVars->push_back(
nullptr);
6565 for (
unsigned i = 0, e = PVars->size(); i != e; ++i)
6567 assert(parm->getFunctionScopeIndex() == i);
6574template<
typename Derived>
6579 return getDerived().TransformFunctionProtoType(
6583 ExceptionStorage, Changed);
6587template<
typename Derived>
template<
typename Fn>
6606 if (
T->hasTrailingReturn()) {
6610 T->getExtParameterInfosOrNull(),
6611 ParamTypes, &ParamDecls, ExtParamInfos))
6621 auto *RD = dyn_cast<CXXRecordDecl>(
SemaRef.getCurLexicalContext());
6623 SemaRef, !ThisContext && RD ? RD : ThisContext, ThisTypeQuals);
6638 T->getExtParameterInfosOrNull(),
6639 ParamTypes, &ParamDecls, ExtParamInfos))
6645 bool EPIChanged =
false;
6650 if (
auto NewExtParamInfos =
6666 std::optional<FunctionEffectSet> NewFX;
6678 std::optional<FunctionEffectMode> Mode =
6698 "FunctionEffectMode::None shouldn't be possible here");
6701 if (!
SemaRef.diagnoseConflictingFunctionEffect(*NewFX, NewEC,
6704 NewFX->insert(NewEC, Errs);
6705 assert(Errs.empty());
6715 Result =
getDerived().RebuildFunctionProtoType(ResultType, ParamTypes, EPI);
6726 for (
unsigned i = 0, e = NewTL.
getNumParams(); i != e; ++i)
6732template<
typename Derived>
6755 getSema().ActOnNoexceptSpec(NoexceptExpr.
get(), EST);
6770 if (
const PackExpansionType *PackExpansion =
6771 T->getAs<PackExpansionType>()) {
6776 SemaRef.collectUnexpandedParameterPacks(PackExpansion->getPattern(),
6778 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
6783 bool Expand =
false;
6784 bool RetainExpansion =
false;
6785 UnsignedOrNone NumExpansions = PackExpansion->getNumExpansions();
6790 true, Expand, RetainExpansion,
6803 U =
SemaRef.Context.getPackExpansionType(
U, NumExpansions);
6804 Exceptions.push_back(
U);
6810 for (
unsigned ArgIdx = 0; ArgIdx != *NumExpansions; ++ArgIdx) {
6814 if (
U.isNull() ||
SemaRef.CheckSpecifiedExceptionType(
U, Loc))
6817 Exceptions.push_back(
U);
6821 if (
U.isNull() ||
SemaRef.CheckSpecifiedExceptionType(
U, Loc))
6826 Exceptions.push_back(
U);
6836template<
typename Derived>
6846 if (getDerived().AlwaysRebuild() || ResultType !=
T->getReturnType())
6847 Result = getDerived().RebuildFunctionNoProtoType(ResultType);
6858template <
typename Derived>
6859QualType TreeTransform<Derived>::TransformUnresolvedUsingType(
6860 TypeLocBuilder &TLB, UnresolvedUsingTypeLoc TL) {
6862 const UnresolvedUsingType *T = TL.getTypePtr();
6863 bool Changed =
false;
6865 NestedNameSpecifierLoc QualifierLoc = TL.getQualifierLoc();
6866 if (NestedNameSpecifierLoc OldQualifierLoc = QualifierLoc) {
6867 QualifierLoc = getDerived().TransformNestedNameSpecifierLoc(QualifierLoc);
6870 Changed |= QualifierLoc != OldQualifierLoc;
6873 auto *D = getDerived().TransformDecl(TL.getNameLoc(),
T->getDecl());
6879 if (getDerived().AlwaysRebuild() || Changed) {
6880 Result = getDerived().RebuildUnresolvedUsingType(
6881 T->getKeyword(), QualifierLoc.getNestedNameSpecifier(), TL.getNameLoc(),
6889 QualifierLoc, TL.getNameLoc());
6892 QualifierLoc, TL.getNameLoc());
6896template <
typename Derived>
6904 QualifierLoc = getDerived().TransformNestedNameSpecifierLoc(QualifierLoc);
6907 Changed |= QualifierLoc != OldQualifierLoc;
6910 auto *D = cast_or_null<UsingShadowDecl>(
6911 getDerived().TransformDecl(TL.getNameLoc(),
T->getDecl()));
6916 QualType UnderlyingType = getDerived().TransformType(
T->desugar());
6917 if (UnderlyingType.isNull())
6919 Changed |= UnderlyingType !=
T->desugar();
6922 if (getDerived().AlwaysRebuild() || Changed) {
6923 Result = getDerived().RebuildUsingType(
6924 T->getKeyword(), QualifierLoc.getNestedNameSpecifier(), D,
6934template<
typename Derived>
6942 QualifierLoc = getDerived().TransformNestedNameSpecifierLoc(QualifierLoc);
6945 Changed |= QualifierLoc != OldQualifierLoc;
6948 auto *
Typedef = cast_or_null<TypedefNameDecl>(
6949 getDerived().TransformDecl(TL.getNameLoc(),
T->getDecl()));
6957 if (getDerived().AlwaysRebuild() || Changed) {
6958 Result = getDerived().RebuildTypedefType(
6959 T->getKeyword(), QualifierLoc.getNestedNameSpecifier(),
Typedef);
6965 QualifierLoc, TL.getNameLoc());
6969template<
typename Derived>
6977 ExprResult E = getDerived().TransformExpr(TL.getUnderlyingExpr());
6987 if (getDerived().AlwaysRebuild() || E.get() != TL.getUnderlyingExpr()) {
6989 getDerived().RebuildTypeOfExprType(E.get(), TL.getTypeofLoc(), Kind);
6996 NewTL.setLParenLoc(TL.getLParenLoc());
6997 NewTL.setRParenLoc(TL.getRParenLoc());
7002template<
typename Derived>
7006 TypeSourceInfo* New_Under_TI = getDerived().TransformType(Old_Under_TI);
7012 if (getDerived().AlwaysRebuild() || New_Under_TI != Old_Under_TI) {
7013 Result = getDerived().RebuildTypeOfType(New_Under_TI->getType(), Kind);
7020 NewTL.setLParenLoc(TL.getLParenLoc());
7021 NewTL.setRParenLoc(TL.getRParenLoc());
7022 NewTL.setUnmodifiedTInfo(New_Under_TI);
7027template<
typename Derived>
7030 const DecltypeType *
T = TL.getTypePtr();
7037 ExprResult E = getDerived().TransformExpr(
T->getUnderlyingExpr());
7041 E = getSema().ActOnDecltypeExpression(E.get());
7046 if (getDerived().AlwaysRebuild() ||
7047 E.get() !=
T->getUnderlyingExpr()) {
7048 Result = getDerived().RebuildDecltypeType(E.get(), TL.getDecltypeLoc());
7056 NewTL.setRParenLoc(TL.getRParenLoc());
7060template <
typename Derived>
7070 IndexExpr = getDerived().TransformExpr(TL.getIndexExpr());
7071 if (IndexExpr.isInvalid())
7074 QualType Pattern = TL.getPattern();
7076 const PackIndexingType *PIT = TL.
getTypePtr();
7080 bool NotYetExpanded = Types.empty();
7081 bool FullySubstituted =
true;
7083 if (Types.empty() && !PIT->expandsToEmptyPack())
7087 if (!
T->containsUnexpandedParameterPack()) {
7088 QualType Transformed = getDerived().TransformType(
T);
7089 if (Transformed.isNull())
7091 SubtitutedTypes.push_back(Transformed);
7096 getSema().collectUnexpandedParameterPacks(
T, Unexpanded);
7097 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
7100 bool ShouldExpand =
true;
7101 bool RetainExpansion =
false;
7103 if (getDerived().TryExpandParameterPacks(
7106 RetainExpansion, NumExpansions))
7108 if (!ShouldExpand) {
7114 QualType Pack = getDerived().TransformType(TLB, TI->getTypeLoc());
7117 if (NotYetExpanded) {
7118 FullySubstituted =
false;
7119 QualType Out = getDerived().RebuildPackIndexingType(
7129 SubtitutedTypes.push_back(Pack);
7132 for (
unsigned I = 0; I != *NumExpansions; ++I) {
7137 SubtitutedTypes.push_back(Out);
7138 FullySubstituted &= !
Out->containsUnexpandedParameterPack();
7142 if (RetainExpansion) {
7143 FullySubstituted =
false;
7144 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
7148 SubtitutedTypes.push_back(Out);
7156 QualType Result = getDerived().TransformType(TLB, TL.getPatternLoc());
7158 QualType Out = getDerived().RebuildPackIndexingType(
7160 FullySubstituted, SubtitutedTypes);
7169template<
typename Derived>
7175 if (
Result->isDependentType()) {
7176 const UnaryTransformType *
T = TL.getTypePtr();
7178 NewBaseTSI = getDerived().TransformType(TL.getUnderlyingTInfo());
7181 QualType NewBase = NewBaseTSI->getType();
7183 Result = getDerived().RebuildUnaryTransformType(NewBase,
7192 NewTL.setParensRange(TL.getParensRange());
7193 NewTL.setUnderlyingTInfo(NewBaseTSI);
7197template<
typename Derived>
7200 const DeducedTemplateSpecializationType *
T = TL.getTypePtr();
7205 TL.getTemplateNameLoc());
7209 QualType OldDeduced =
T->getDeducedType();
7211 if (!OldDeduced.isNull()) {
7212 NewDeduced = getDerived().TransformType(OldDeduced);
7213 if (NewDeduced.isNull())
7217 QualType Result = getDerived().RebuildDeducedTemplateSpecializationType(
7224 NewTL.setTemplateNameLoc(TL.getTemplateNameLoc());
7225 NewTL.setQualifierLoc(QualifierLoc);
7229template <
typename Derived>
7236 QualifierLoc =
getDerived().TransformNestedNameSpecifierLoc(QualifierLoc);
7241 auto *TD = cast_or_null<TagDecl>(
7248 TD !=
T->getDecl()) {
7249 if (
T->isCanonicalUnqualified())
7266template <
typename Derived>
7272template <
typename Derived>
7273QualType TreeTransform<Derived>::TransformRecordType(TypeLocBuilder &TLB,
7275 return getDerived().TransformTagType(TLB, TL);
7278template<
typename Derived>
7285template<
typename Derived>
7289 return getDerived().TransformTemplateTypeParmType(
7294template <
typename Derived>
7300template<
typename Derived>
7301QualType TreeTransform<Derived>::TransformSubstTemplateTypeParmType(
7302 TypeLocBuilder &TLB,
7303 SubstTemplateTypeParmTypeLoc TL) {
7304 const SubstTemplateTypeParmType *T = TL.getTypePtr();
7307 getDerived().TransformDecl(TL.getNameLoc(), T->getAssociatedDecl());
7312 TemporaryBase Rebase(*
this, TL.getNameLoc(), DeclarationName());
7313 QualType Replacement = getDerived().TransformType(T->getReplacementType());
7314 if (Replacement.isNull())
7318 Replacement, NewReplaced, T->getIndex(), T->getPackIndex(),
7322 SubstTemplateTypeParmTypeLoc NewTL
7323 = TLB.push<SubstTemplateTypeParmTypeLoc>(Result);
7324 NewTL.setNameLoc(TL.getNameLoc());
7328template <
typename Derived>
7334template<
typename Derived>
7338 return getDerived().TransformSubstTemplateTypeParmPackType(
7342template <
typename Derived>
7348template<
typename Derived>
7349QualType TreeTransform<Derived>::TransformAtomicType(TypeLocBuilder &TLB,
7351 QualType ValueType = getDerived().TransformType(TLB, TL.getValueLoc());
7352 if (ValueType.isNull())
7355 QualType Result = TL.getType();
7356 if (getDerived().AlwaysRebuild() ||
7357 ValueType != TL.getValueLoc().getType()) {
7358 Result = getDerived().RebuildAtomicType(ValueType, TL.getKWLoc());
7359 if (Result.isNull())
7365 NewTL.setLParenLoc(TL.getLParenLoc());
7366 NewTL.setRParenLoc(TL.getRParenLoc());
7371template <
typename Derived>
7374 QualType ValueType = getDerived().TransformType(TLB, TL.getValueLoc());
7375 if (ValueType.isNull())
7379 if (getDerived().AlwaysRebuild() || ValueType != TL.getValueLoc().getType()) {
7382 Result = getDerived().RebuildPipeType(ValueType, TL.getKWLoc(), isReadPipe);
7393template <
typename Derived>
7399 if (getDerived().AlwaysRebuild()) {
7400 Result = getDerived().RebuildBitIntType(EIT->isUnsigned(),
7401 EIT->getNumBits(), TL.getNameLoc());
7411template <
typename Derived>
7418 ExprResult BitsExpr = getDerived().TransformExpr(EIT->getNumBitsExpr());
7421 if (BitsExpr.isInvalid())
7426 if (getDerived().AlwaysRebuild() || BitsExpr.get() != EIT->getNumBitsExpr()) {
7427 Result = getDerived().RebuildDependentBitIntType(
7428 EIT->isUnsigned(), BitsExpr.get(), TL.getNameLoc());
7444template <
typename Derived>
7447 llvm_unreachable(
"This type does not need to be transformed.");
7455 template<
typename ArgLocContainer>
7457 ArgLocContainer *Container;
7482 : Container(&Container), Index(Index) { }
7496 return Container->getArgLoc(Index);
7500 return pointer(Container->getArgLoc(Index));
7505 return X.Container == Y.Container &&
X.Index == Y.Index;
7514template<
typename Derived>
7515QualType TreeTransform<Derived>::TransformAutoType(TypeLocBuilder &TLB,
7517 const AutoType *T = TL.getTypePtr();
7518 QualType OldDeduced = T->getDeducedType();
7519 QualType NewDeduced;
7520 if (!OldDeduced.isNull()) {
7521 NewDeduced = getDerived().TransformType(OldDeduced);
7522 if (NewDeduced.isNull())
7529 if (
T->isConstrained()) {
7530 assert(TL.getConceptReference());
7531 NewCD = cast_or_null<ConceptDecl>(getDerived().TransformDecl(
7532 TL.getConceptNameLoc(),
T->getTypeConstraintConcept()));
7534 NewTemplateArgs.setLAngleLoc(TL.getLAngleLoc());
7535 NewTemplateArgs.setRAngleLoc(TL.getRAngleLoc());
7537 if (getDerived().TransformTemplateArguments(
7538 ArgIterator(TL, 0), ArgIterator(TL, TL.getNumArgs()),
7542 if (TL.getNestedNameSpecifierLoc()) {
7544 = getDerived().TransformNestedNameSpecifierLoc(
7545 TL.getNestedNameSpecifierLoc());
7546 if (!NewNestedNameSpec)
7552 if (getDerived().AlwaysRebuild() || NewDeduced != OldDeduced ||
7553 T->isDependentType() ||
T->isConstrained()) {
7556 NewArgList.reserve(NewTemplateArgs.size());
7557 for (
const auto &ArgLoc : NewTemplateArgs.arguments())
7558 NewArgList.push_back(ArgLoc.getArgument());
7559 Result = getDerived().RebuildAutoType(NewDeduced,
T->getKeyword(), NewCD,
7567 NewTL.setRParenLoc(TL.getRParenLoc());
7568 NewTL.setConceptReference(
nullptr);
7570 if (
T->isConstrained()) {
7572 TL.getTypePtr()->getTypeConstraintConcept()->getDeclName(),
7573 TL.getConceptNameLoc(),
7574 TL.getTypePtr()->getTypeConstraintConcept()->getDeclName());
7576 SemaRef.
Context, NewNestedNameSpec, TL.getTemplateKWLoc(), DNI,
7577 TL.getFoundDecl(), TL.getTypePtr()->getTypeConstraintConcept(),
7579 NewTL.setConceptReference(CR);
7585template <
typename Derived>
7588 return getDerived().TransformTemplateSpecializationType(
7593template <
typename Derived>
7596 NamedDecl *FirstQualifierInScope,
bool AllowInjectedClassName) {
7597 const TemplateSpecializationType *
T = TL.
getTypePtr();
7603 AllowInjectedClassName);
7612 if (getDerived().TransformTemplateArguments(ArgIterator(TL, 0),
7621 QualType Result = getDerived().RebuildTemplateSpecializationType(
7634template <
typename Derived>
7638 QualType modifiedType = getDerived().TransformType(TLB, TL.getModifiedLoc());
7639 if (modifiedType.isNull())
7643 const Attr *oldAttr = TL.getAttr();
7644 const Attr *newAttr = oldAttr ? getDerived().TransformAttr(oldAttr) :
nullptr;
7645 if (oldAttr && !newAttr)
7651 if (getDerived().AlwaysRebuild() ||
7652 modifiedType != oldType->getModifiedType()) {
7665 QualType equivalentType = modifiedType;
7666 if (TL.getModifiedLoc().getType() != TL.getEquivalentTypeLoc().getType()) {
7668 AuxiliaryTLB.
reserve(TL.getFullDataSize());
7670 getDerived().TransformType(AuxiliaryTLB, TL.getEquivalentTypeLoc());
7671 if (equivalentType.isNull())
7677 if (
auto nullability = oldType->getImmediateNullability()) {
7678 if (!modifiedType->canHaveNullability()) {
7679 SemaRef.
Diag((TL.getAttr() ? TL.getAttr()->getLocation()
7680 : TL.getModifiedLoc().getBeginLoc()),
7681 diag::err_nullability_nonpointer)
7698template <
typename Derived>
7702 QualType InnerTy = getDerived().TransformType(TLB, TL.getInnerLoc());
7703 if (InnerTy.isNull())
7706 Expr *OldCount = TL.getCountExpr();
7707 Expr *NewCount =
nullptr;
7709 ExprResult CountResult = getDerived().TransformExpr(OldCount);
7710 if (CountResult.isInvalid())
7712 NewCount = CountResult.get();
7716 if (getDerived().AlwaysRebuild() || InnerTy != OldTy->desugar() ||
7717 OldCount != NewCount) {
7720 InnerTy, NewCount, OldTy->isCountInBytes(), OldTy->isOrNull());
7727template <
typename Derived>
7731 llvm_unreachable(
"Unexpected TreeTransform for BTFTagAttributedType");
7734template <
typename Derived>
7738 const HLSLAttributedResourceType *oldType = TL.getTypePtr();
7740 QualType WrappedTy = getDerived().TransformType(TLB, TL.getWrappedLoc());
7741 if (WrappedTy.isNull())
7745 QualType OldContainedTy = oldType->getContainedType();
7746 if (!OldContainedTy.isNull()) {
7747 TypeSourceInfo *oldContainedTSI = TL.getContainedTypeSourceInfo();
7748 if (!oldContainedTSI)
7749 oldContainedTSI = getSema().getASTContext().getTrivialTypeSourceInfo(
7751 TypeSourceInfo *ContainedTSI = getDerived().TransformType(oldContainedTSI);
7754 ContainedTy = ContainedTSI->getType();
7758 if (getDerived().AlwaysRebuild() || WrappedTy != oldType->getWrappedType() ||
7759 ContainedTy != oldType->getContainedType()) {
7761 WrappedTy, ContainedTy, oldType->getAttrs());
7768template <
typename Derived>
7772 return TL.getType();
7775template<
typename Derived>
7779 QualType Inner = getDerived().TransformType(TLB, TL.getInnerLoc());
7784 if (getDerived().AlwaysRebuild() ||
7785 Inner != TL.getInnerLoc().getType()) {
7786 Result = getDerived().RebuildParenType(Inner);
7793 NewTL.setRParenLoc(TL.getRParenLoc());
7797template <
typename Derived>
7801 QualType Inner = getDerived().TransformType(TLB, TL.getInnerLoc());
7806 if (getDerived().AlwaysRebuild() || Inner != TL.getInnerLoc().getType()) {
7808 getDerived().RebuildMacroQualifiedType(Inner, TL.getMacroIdentifier());
7818template<
typename Derived>
7819QualType TreeTransform<Derived>::TransformDependentNameType(
7821 return TransformDependentNameType(TLB, TL,
false);
7824template <
typename Derived>
7825QualType TreeTransform<Derived>::TransformDependentNameType(
7828 const DependentNameType *
T = TL.getTypePtr();
7832 QualifierLoc = getDerived().TransformNestedNameSpecifierLoc(
7833 QualifierLoc, ObjectType, UnqualLookup);
7837 assert((ObjectType.isNull() && !UnqualLookup) &&
7838 "must be transformed by TransformNestedNameSpecifierLoc");
7842 = getDerived().RebuildDependentNameType(
T->getKeyword(),
7843 TL.getElaboratedKeywordLoc(),
7854 NewTL.setQualifierLoc(QualifierLoc);
7855 NewTL.setNameLoc(TL.getNameLoc());
7859 NewTL.setTemplateNameLoc(TL.getNameLoc());
7860 NewTL.setQualifierLoc(QualifierLoc);
7863 QualifierLoc, TL.getNameLoc());
7866 NewTL.
set(TL.getElaboratedKeywordLoc(), QualifierLoc, TL.getNameLoc());
7870 NewTL.setQualifierLoc(QualifierLoc);
7871 NewTL.setNameLoc(TL.getNameLoc());
7876template<
typename Derived>
7880 = getDerived().TransformType(TLB, TL.getPatternLoc());
7881 if (Pattern.isNull())
7885 if (getDerived().AlwaysRebuild() ||
7886 Pattern != TL.getPatternLoc().getType()) {
7887 Result = getDerived().RebuildPackExpansionType(Pattern,
7888 TL.getPatternLoc().getSourceRange(),
7889 TL.getEllipsisLoc(),
7890 TL.getTypePtr()->getNumExpansions());
7900template<
typename Derived>
7905 TLB.pushFullCopy(TL);
7906 return TL.getType();
7909template<
typename Derived>
7913 const ObjCTypeParamType *
T = TL.getTypePtr();
7915 getDerived().TransformDecl(
T->getDecl()->getLocation(),
T->getDecl()));
7920 if (getDerived().AlwaysRebuild() ||
7921 OTP !=
T->getDecl()) {
7922 Result = getDerived().RebuildObjCTypeParamType(
7923 OTP, TL.getProtocolLAngleLoc(),
7924 llvm::ArrayRef(TL.getTypePtr()->qual_begin(), TL.getNumProtocols()),
7925 TL.getProtocolLocs(), TL.getProtocolRAngleLoc());
7931 if (TL.getNumProtocols()) {
7932 NewTL.setProtocolLAngleLoc(TL.getProtocolLAngleLoc());
7933 for (
unsigned i = 0, n = TL.getNumProtocols(); i != n; ++i)
7934 NewTL.setProtocolLoc(i, TL.getProtocolLoc(i));
7935 NewTL.setProtocolRAngleLoc(TL.getProtocolRAngleLoc());
7940template<
typename Derived>
7945 QualType BaseType = getDerived().TransformType(TLB, TL.getBaseLoc());
7946 if (BaseType.isNull())
7949 bool AnyChanged = BaseType != TL.getBaseLoc().getType();
7953 for (
unsigned i = 0, n = TL.getNumTypeArgs(); i != n; ++i) {
7955 TypeLoc TypeArgLoc = TypeArgInfo->getTypeLoc();
7956 QualType TypeArg = TypeArgInfo->getType();
7961 const auto *PackExpansion = PackExpansionLoc.getType()
7962 ->castAs<PackExpansionType>();
7966 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
7970 TypeLoc PatternLoc = PackExpansionLoc.getPatternLoc();
7971 bool Expand =
false;
7972 bool RetainExpansion =
false;
7973 UnsignedOrNone NumExpansions = PackExpansion->getNumExpansions();
7974 if (getDerived().TryExpandParameterPacks(
7975 PackExpansionLoc.getEllipsisLoc(), PatternLoc.getSourceRange(),
7976 Unexpanded,
true, Expand,
7977 RetainExpansion, NumExpansions))
7987 TypeArgBuilder.
reserve(PatternLoc.getFullDataSize());
7988 QualType NewPatternType = getDerived().TransformType(TypeArgBuilder,
7990 if (NewPatternType.isNull())
7994 NewPatternType, NumExpansions);
7996 NewExpansionLoc.
setEllipsisLoc(PackExpansionLoc.getEllipsisLoc());
7997 NewTypeArgInfos.push_back(
7998 TypeArgBuilder.getTypeSourceInfo(SemaRef.
Context, NewExpansionType));
8004 for (
unsigned ArgIdx = 0; ArgIdx != *NumExpansions; ++ArgIdx) {
8008 TypeArgBuilder.
reserve(PatternLoc.getFullDataSize());
8010 QualType NewTypeArg = getDerived().TransformType(TypeArgBuilder,
8012 if (NewTypeArg.isNull())
8015 NewTypeArgInfos.push_back(
8016 TypeArgBuilder.getTypeSourceInfo(SemaRef.
Context, NewTypeArg));
8023 TypeArgBuilder.
reserve(TypeArgLoc.getFullDataSize());
8025 getDerived().TransformType(TypeArgBuilder, TypeArgLoc);
8026 if (NewTypeArg.isNull())
8030 if (NewTypeArg == TypeArg) {
8031 NewTypeArgInfos.push_back(TypeArgInfo);
8035 NewTypeArgInfos.push_back(
8036 TypeArgBuilder.getTypeSourceInfo(SemaRef.
Context, NewTypeArg));
8041 if (getDerived().AlwaysRebuild() || AnyChanged) {
8043 Result = getDerived().RebuildObjCObjectType(
8044 BaseType, TL.getBeginLoc(), TL.getTypeArgsLAngleLoc(), NewTypeArgInfos,
8045 TL.getTypeArgsRAngleLoc(), TL.getProtocolLAngleLoc(),
8046 llvm::ArrayRef(TL.getTypePtr()->qual_begin(), TL.getNumProtocols()),
8047 TL.getProtocolLocs(), TL.getProtocolRAngleLoc());
8055 NewT.setTypeArgsLAngleLoc(TL.getTypeArgsLAngleLoc());
8056 for (
unsigned i = 0, n = TL.getNumTypeArgs(); i != n; ++i)
8057 NewT.setTypeArgTInfo(i, NewTypeArgInfos[i]);
8058 NewT.setTypeArgsRAngleLoc(TL.getTypeArgsRAngleLoc());
8059 NewT.setProtocolLAngleLoc(TL.getProtocolLAngleLoc());
8060 for (
unsigned i = 0, n = TL.getNumProtocols(); i != n; ++i)
8061 NewT.setProtocolLoc(i, TL.getProtocolLoc(i));
8062 NewT.setProtocolRAngleLoc(TL.getProtocolRAngleLoc());
8066template<
typename Derived>
8070 QualType PointeeType = getDerived().TransformType(TLB, TL.getPointeeLoc());
8071 if (PointeeType.isNull())
8075 if (getDerived().AlwaysRebuild() ||
8076 PointeeType != TL.getPointeeLoc().getType()) {
8077 Result = getDerived().RebuildObjCObjectPointerType(PointeeType,
8091template<
typename Derived>
8097template<
typename Derived>
8100 return getDerived().TransformCompoundStmt(S,
false);
8103template<
typename Derived>
8110 getSema().resetFPOptions(
8113 bool SubStmtInvalid =
false;
8114 bool SubStmtChanged =
false;
8116 for (
auto *B : S->
body()) {
8118 B, IsStmtExpr && B == S->
body_back() ? StmtDiscardKind::StmtExprResult
8119 : StmtDiscardKind::Discarded);
8121 if (
Result.isInvalid()) {
8128 SubStmtInvalid =
true;
8132 SubStmtChanged = SubStmtChanged || Result.get() != B;
8133 Statements.push_back(Result.getAs<Stmt>());
8139 if (!getDerived().AlwaysRebuild() &&
8143 return getDerived().RebuildCompoundStmt(S->
getLBracLoc(),
8149template<
typename Derived>
8158 LHS = getDerived().TransformExpr(S->getLHS());
8160 if (LHS.isInvalid())
8164 RHS = getDerived().TransformExpr(S->getRHS());
8166 if (RHS.isInvalid())
8173 StmtResult Case = getDerived().RebuildCaseStmt(S->getCaseLoc(),
8175 S->getEllipsisLoc(),
8178 if (Case.isInvalid())
8183 getDerived().TransformStmt(S->getSubStmt());
8184 if (SubStmt.isInvalid())
8188 return getDerived().RebuildCaseStmtBody(Case.get(), SubStmt.get());
8191template <
typename Derived>
8195 getDerived().TransformStmt(S->getSubStmt());
8196 if (SubStmt.isInvalid())
8200 return getDerived().RebuildDefaultStmt(S->getDefaultLoc(), S->getColonLoc(),
8204template<
typename Derived>
8207 StmtResult SubStmt = getDerived().TransformStmt(S->getSubStmt(), SDK);
8208 if (SubStmt.isInvalid())
8211 Decl *LD = getDerived().TransformDecl(S->getDecl()->getLocation(),
8219 if (LD == S->getDecl())
8220 S->getDecl()->setStmt(
nullptr);
8223 return getDerived().RebuildLabelStmt(S->getIdentLoc(),
8228template <
typename Derived>
8237 return getDerived().Transform##X##Attr(cast<X##Attr>(R));
8238#include "clang/Basic/AttrList.inc"
8243template <
typename Derived>
8254 return getDerived().TransformStmt##X##Attr(OrigS, InstS, cast<X##Attr>(R));
8255#include "clang/Basic/AttrList.inc"
8260template <
typename Derived>
8263 StmtDiscardKind SDK) {
8268 bool AttrsChanged =
false;
8272 for (
const auto *I : S->
getAttrs()) {
8274 getDerived().TransformStmtAttr(S->
getSubStmt(), SubStmt.
get(), I);
8275 AttrsChanged |= (I != R);
8288 return getDerived().RebuildAttributedStmt(S->
getAttrLoc(), Attrs,
8292template<
typename Derived>
8297 if (
Init.isInvalid())
8301 if (!S->isConsteval()) {
8303 Cond = getDerived().TransformCondition(
8304 S->getIfLoc(), S->getConditionVariable(), S->getCond(),
8307 if (
Cond.isInvalid())
8312 std::optional<bool> ConstexprConditionValue;
8313 if (S->isConstexpr())
8314 ConstexprConditionValue =
Cond.getKnownValue();
8318 if (!ConstexprConditionValue || *ConstexprConditionValue) {
8322 S->isNonNegatedConsteval());
8324 Then = getDerived().TransformStmt(S->getThen());
8325 if (Then.isInvalid())
8331 Then =
new (getSema().Context)
8332 CompoundStmt(S->getThen()->getBeginLoc(), S->getThen()->getEndLoc());
8337 if (!ConstexprConditionValue || !*ConstexprConditionValue) {
8341 S->isNegatedConsteval());
8343 Else = getDerived().TransformStmt(S->getElse());
8344 if (Else.isInvalid())
8346 }
else if (S->getElse() && ConstexprConditionValue &&
8347 *ConstexprConditionValue) {
8351 Else =
new (getSema().Context)
8352 CompoundStmt(S->getElse()->getBeginLoc(), S->getElse()->getEndLoc());
8355 if (!getDerived().AlwaysRebuild() &&
8356 Init.get() == S->getInit() &&
8357 Cond.get() == std::make_pair(S->getConditionVariable(), S->getCond()) &&
8358 Then.get() == S->getThen() &&
8359 Else.get() == S->getElse())
8362 return getDerived().RebuildIfStmt(
8363 S->getIfLoc(), S->getStatementKind(), S->getLParenLoc(),
Cond,
8364 S->getRParenLoc(),
Init.get(), Then.get(), S->getElseLoc(), Else.get());
8367template<
typename Derived>
8372 if (
Init.isInvalid())
8377 S->getSwitchLoc(), S->getConditionVariable(), S->getCond(),
8379 if (
Cond.isInvalid())
8384 getDerived().RebuildSwitchStmtStart(S->getSwitchLoc(), S->getLParenLoc(),
8385 Init.get(),
Cond, S->getRParenLoc());
8390 StmtResult Body = getDerived().TransformStmt(S->getBody());
8391 if (Body.isInvalid())
8395 return getDerived().RebuildSwitchStmtBody(S->getSwitchLoc(),
Switch.get(),
8399template<
typename Derived>
8404 S->getWhileLoc(), S->getConditionVariable(), S->getCond(),
8406 if (
Cond.isInvalid())
8415 StmtResult Body = getDerived().TransformStmt(S->getBody());
8416 if (Body.isInvalid())
8419 if (!getDerived().AlwaysRebuild() &&
8420 Cond.get() == std::make_pair(S->getConditionVariable(), S->getCond()) &&
8421 Body.get() == S->getBody())
8424 return getDerived().RebuildWhileStmt(S->getWhileLoc(), S->getLParenLoc(),
8425 Cond, S->getRParenLoc(), Body.get());
8428template<
typename Derived>
8437 StmtResult Body = getDerived().TransformStmt(S->getBody());
8438 if (Body.isInvalid())
8443 if (
Cond.isInvalid())
8446 if (!getDerived().AlwaysRebuild() &&
8447 Cond.get() == S->getCond() &&
8448 Body.get() == S->getBody())
8451 return getDerived().RebuildDoStmt(S->getDoLoc(), Body.get(), S->getWhileLoc(),
8452 S->getWhileLoc(),
Cond.get(),
8456template<
typename Derived>
8459 if (getSema().getLangOpts().OpenMP)
8460 getSema().OpenMP().startOpenMPLoop();
8464 if (
Init.isInvalid())
8469 if (getSema().getLangOpts().OpenMP &&
Init.isUsable())
8470 getSema().OpenMP().ActOnOpenMPLoopInitialization(S->getForLoc(),
8475 S->getForLoc(), S->getConditionVariable(), S->getCond(),
8477 if (
Cond.isInvalid())
8482 if (
Inc.isInvalid())
8486 if (S->getInc() && !FullInc.get())
8493 S->getBeginLoc(), S->getInit(),
Init.get(), S->getCond(),
8494 Cond.get().second, S->getInc(),
Inc.get());
8497 StmtResult Body = getDerived().TransformStmt(S->getBody());
8498 if (Body.isInvalid())
8503 if (!getDerived().AlwaysRebuild() &&
8504 Init.get() == S->getInit() &&
8505 Cond.get() == std::make_pair(S->getConditionVariable(), S->getCond()) &&
8506 Inc.get() == S->getInc() &&
8507 Body.get() == S->getBody())
8510 return getDerived().RebuildForStmt(S->getForLoc(), S->getLParenLoc(),
8512 S->getRParenLoc(), Body.get());
8515template<
typename Derived>
8518 Decl *LD = getDerived().TransformDecl(S->getLabel()->getLocation(),
8524 return getDerived().RebuildGotoStmt(S->getGotoLoc(), S->getLabelLoc(),
8528template<
typename Derived>
8536 if (!getDerived().AlwaysRebuild() &&
8537 Target.get() == S->getTarget())
8540 return getDerived().RebuildIndirectGotoStmt(S->getGotoLoc(), S->getStarLoc(),
8544template<
typename Derived>
8547 if (!S->hasLabelTarget())
8550 Decl *LD = getDerived().TransformDecl(S->getLabelDecl()->getLocation(),
8559template<
typename Derived>
8562 if (!S->hasLabelTarget())
8565 Decl *LD = getDerived().TransformDecl(S->getLabelDecl()->getLocation(),
8574template <
typename Derived>
8582template<
typename Derived>
8592 return getDerived().RebuildReturnStmt(S->getReturnLoc(),
Result.get());
8595template<
typename Derived>
8598 bool DeclChanged =
false;
8601 for (
auto *D : S->decls()) {
8602 Decl *Transformed = getDerived().TransformDefinition(D->getLocation(), D);
8606 if (Transformed != D)
8610 if (
auto *TD = dyn_cast<TypeDecl>(Transformed)) {
8611 if (
auto *TN = dyn_cast<TypedefNameDecl>(TD)) {
8612 LSI->ContainsUnexpandedParameterPack |=
8613 TN->getUnderlyingType()->containsUnexpandedParameterPack();
8615 LSI->ContainsUnexpandedParameterPack |=
8618 .getTypeDeclType(TD)
8619 ->containsUnexpandedParameterPack();
8622 if (
auto *VD = dyn_cast<VarDecl>(Transformed))
8623 LSI->ContainsUnexpandedParameterPack |=
8624 VD->getType()->containsUnexpandedParameterPack();
8627 Decls.push_back(Transformed);
8630 if (!getDerived().AlwaysRebuild() && !DeclChanged)
8633 return getDerived().RebuildDeclStmt(Decls, S->getBeginLoc(), S->getEndLoc());
8636template<
typename Derived>
8646 bool ExprsChanged =
false;
8648 auto RebuildString = [&](
Expr *E) {
8653 ExprsChanged =
true;
8660 for (
unsigned I = 0, E = S->getNumOutputs(); I != E; ++I) {
8661 Names.push_back(S->getOutputIdentifier(I));
8667 Constraints.push_back(
Result.get());
8670 Expr *OutputExpr = S->getOutputExpr(I);
8671 Result = getDerived().TransformExpr(OutputExpr);
8675 ExprsChanged |=
Result.get() != OutputExpr;
8677 Exprs.push_back(
Result.get());
8681 for (
unsigned I = 0, E = S->getNumInputs(); I != E; ++I) {
8682 Names.push_back(S->getInputIdentifier(I));
8688 Constraints.push_back(
Result.get());
8691 Expr *InputExpr = S->getInputExpr(I);
8692 Result = getDerived().TransformExpr(InputExpr);
8696 ExprsChanged |=
Result.get() != InputExpr;
8698 Exprs.push_back(
Result.get());
8702 for (
unsigned I = 0, E = S->getNumLabels(); I != E; ++I) {
8703 Names.push_back(S->getLabelIdentifier(I));
8708 ExprsChanged |=
Result.get() != S->getLabelExpr(I);
8709 Exprs.push_back(
Result.get());
8713 for (
unsigned I = 0, E = S->getNumClobbers(); I != E; ++I) {
8717 Clobbers.push_back(
Result.get());
8720 ExprResult AsmString = RebuildString(S->getAsmStringExpr());
8721 if (AsmString.isInvalid())
8724 if (!getDerived().AlwaysRebuild() && !ExprsChanged)
8727 return getDerived().RebuildGCCAsmStmt(S->getAsmLoc(), S->isSimple(),
8728 S->isVolatile(), S->getNumOutputs(),
8729 S->getNumInputs(), Names.data(),
8730 Constraints, Exprs, AsmString.get(),
8731 Clobbers, S->getNumLabels(),
8735template<
typename Derived>
8740 bool HadError =
false, HadChange =
false;
8744 TransformedExprs.reserve(SrcExprs.size());
8745 for (
unsigned i = 0, e = SrcExprs.size(); i != e; ++i) {
8747 if (!
Result.isUsable()) {
8750 HadChange |= (
Result.get() != SrcExprs[i]);
8751 TransformedExprs.push_back(
Result.get());
8756 if (!HadChange && !getDerived().AlwaysRebuild())
8759 return getDerived().RebuildMSAsmStmt(S->getAsmLoc(), S->getLBraceLoc(),
8760 AsmToks, S->getAsmString(),
8761 S->getNumOutputs(), S->getNumInputs(),
8762 S->getAllConstraints(), S->getClobbers(),
8763 TransformedExprs, S->getEndLoc());
8767template<
typename Derived>
8772 assert(FD && ScopeInfo && !ScopeInfo->CoroutinePromise &&
8773 ScopeInfo->NeedsCoroutineSuspends &&
8774 ScopeInfo->CoroutineSuspends.first ==
nullptr &&
8775 ScopeInfo->CoroutineSuspends.second ==
nullptr &&
8776 "expected clean scope info");
8780 ScopeInfo->setNeedsCoroutineSuspends(
false);
8793 getDerived().transformedLocalDecl(S->getPromiseDecl(), {Promise});
8794 ScopeInfo->CoroutinePromise = Promise;
8799 StmtResult InitSuspend = getDerived().TransformStmt(S->getInitSuspendStmt());
8800 if (InitSuspend.isInvalid())
8803 getDerived().TransformStmt(S->getFinalSuspendStmt());
8804 if (FinalSuspend.isInvalid() ||
8807 ScopeInfo->setCoroutineSuspends(InitSuspend.get(), FinalSuspend.get());
8810 StmtResult BodyRes = getDerived().TransformStmt(S->getBody());
8811 if (BodyRes.isInvalid())
8815 if (Builder.isInvalid())
8818 Expr *ReturnObject = S->getReturnValueInit();
8819 assert(ReturnObject &&
"the return object is expected to be valid");
8820 ExprResult Res = getDerived().TransformInitializer(ReturnObject,
8822 if (Res.isInvalid())
8824 Builder.ReturnValue = Res.get();
8829 if (S->hasDependentPromiseType()) {
8832 if (!Promise->getType()->isDependentType()) {
8833 assert(!S->getFallthroughHandler() && !S->getExceptionHandler() &&
8834 !S->getReturnStmtOnAllocFailure() && !S->getDeallocate() &&
8835 "these nodes should not have been built yet");
8836 if (!Builder.buildDependentStatements())
8840 if (
auto *OnFallthrough = S->getFallthroughHandler()) {
8841 StmtResult Res = getDerived().TransformStmt(OnFallthrough);
8842 if (Res.isInvalid())
8844 Builder.OnFallthrough = Res.get();
8847 if (
auto *OnException = S->getExceptionHandler()) {
8848 StmtResult Res = getDerived().TransformStmt(OnException);
8849 if (Res.isInvalid())
8851 Builder.OnException = Res.get();
8854 if (
auto *OnAllocFailure = S->getReturnStmtOnAllocFailure()) {
8855 StmtResult Res = getDerived().TransformStmt(OnAllocFailure);
8856 if (Res.isInvalid())
8858 Builder.ReturnStmtOnAllocFailure = Res.get();
8862 assert(S->getAllocate() && S->getDeallocate() &&
8863 "allocation and deallocation calls must already be built");
8864 ExprResult AllocRes = getDerived().TransformExpr(S->getAllocate());
8865 if (AllocRes.isInvalid())
8867 Builder.Allocate = AllocRes.get();
8869 ExprResult DeallocRes = getDerived().TransformExpr(S->getDeallocate());
8870 if (DeallocRes.isInvalid())
8872 Builder.Deallocate = DeallocRes.get();
8874 if (
auto *ResultDecl = S->getResultDecl()) {
8875 StmtResult Res = getDerived().TransformStmt(ResultDecl);
8876 if (Res.isInvalid())
8878 Builder.ResultDecl = Res.get();
8883 if (Res.isInvalid())
8885 Builder.ReturnStmt = Res.get();
8889 return getDerived().RebuildCoroutineBodyStmt(Builder);
8892template<
typename Derived>
8902 return getDerived().RebuildCoreturnStmt(S->getKeywordLoc(),
Result.get(),
8906template <
typename Derived>
8919 ExprResult Lookup = getSema().BuildOperatorCoawaitLookupExpr(
8920 getSema().getCurScope(), E->getKeywordLoc());
8924 return getDerived().RebuildCoawaitExpr(
8925 E->getKeywordLoc(),
Operand.get(),
8929template <
typename Derived>
8932 ExprResult OperandResult = getDerived().TransformInitializer(E->getOperand(),
8934 if (OperandResult.isInvalid())
8938 E->getOperatorCoawaitLookup());
8945 return getDerived().RebuildDependentCoawaitExpr(
8946 E->getKeywordLoc(), OperandResult.get(),
8950template<
typename Derived>
8960 return getDerived().RebuildCoyieldExpr(E->getKeywordLoc(),
Result.get());
8965template<
typename Derived>
8969 StmtResult TryBody = getDerived().TransformStmt(S->getTryBody());
8970 if (TryBody.isInvalid())
8974 bool AnyCatchChanged =
false;
8976 for (
unsigned I = 0, N = S->getNumCatchStmts(); I != N; ++I) {
8977 StmtResult Catch = getDerived().TransformStmt(S->getCatchStmt(I));
8978 if (Catch.isInvalid())
8980 if (Catch.get() != S->getCatchStmt(I))
8981 AnyCatchChanged =
true;
8982 CatchStmts.push_back(Catch.get());
8987 if (S->getFinallyStmt()) {
8988 Finally = getDerived().TransformStmt(S->getFinallyStmt());
8989 if (Finally.isInvalid())
8994 if (!getDerived().AlwaysRebuild() &&
8995 TryBody.get() == S->getTryBody() &&
8997 Finally.get() == S->getFinallyStmt())
9001 return getDerived().RebuildObjCAtTryStmt(S->getAtTryLoc(), TryBody.get(),
9002 CatchStmts, Finally.get());
9005template<
typename Derived>
9010 if (
VarDecl *FromVar = S->getCatchParamDecl()) {
9012 if (FromVar->getTypeSourceInfo()) {
9013 TSInfo = getDerived().TransformType(FromVar->getTypeSourceInfo());
9020 T = TSInfo->getType();
9022 T = getDerived().TransformType(FromVar->getType());
9027 Var = getDerived().RebuildObjCExceptionDecl(FromVar, TSInfo,
T);
9032 StmtResult Body = getDerived().TransformStmt(S->getCatchBody());
9033 if (Body.isInvalid())
9036 return getDerived().RebuildObjCAtCatchStmt(S->getAtCatchLoc(),
9041template<
typename Derived>
9045 StmtResult Body = getDerived().TransformStmt(S->getFinallyBody());
9046 if (Body.isInvalid())
9050 if (!getDerived().AlwaysRebuild() &&
9051 Body.get() == S->getFinallyBody())
9055 return getDerived().RebuildObjCAtFinallyStmt(S->getAtFinallyLoc(),
9059template<
typename Derived>
9063 if (S->getThrowExpr()) {
9064 Operand = getDerived().TransformExpr(S->getThrowExpr());
9069 if (!getDerived().AlwaysRebuild() &&
9070 Operand.get() == S->getThrowExpr())
9073 return getDerived().RebuildObjCAtThrowStmt(S->getThrowLoc(),
Operand.get());
9076template<
typename Derived>
9085 getDerived().RebuildObjCAtSynchronizedOperand(S->getAtSynchronizedLoc(),
9091 StmtResult Body = getDerived().TransformStmt(S->getSynchBody());
9092 if (Body.isInvalid())
9096 if (!getDerived().AlwaysRebuild() &&
9097 Object.get() == S->getSynchExpr() &&
9098 Body.get() == S->getSynchBody())
9102 return getDerived().RebuildObjCAtSynchronizedStmt(S->getAtSynchronizedLoc(),
9103 Object.get(), Body.get());
9106template<
typename Derived>
9111 StmtResult Body = getDerived().TransformStmt(S->getSubStmt());
9112 if (Body.isInvalid())
9116 if (!getDerived().AlwaysRebuild() &&
9117 Body.get() == S->getSubStmt())
9121 return getDerived().RebuildObjCAutoreleasePoolStmt(
9122 S->getAtLoc(), Body.get());
9125template<
typename Derived>
9130 StmtResult Element = getDerived().TransformStmt(
9131 S->getElement(), StmtDiscardKind::NotDiscarded);
9132 if (Element.isInvalid())
9136 ExprResult Collection = getDerived().TransformExpr(S->getCollection());
9137 if (Collection.isInvalid())
9141 StmtResult Body = getDerived().TransformStmt(S->getBody());
9142 if (Body.isInvalid())
9146 if (!getDerived().AlwaysRebuild() &&
9147 Element.get() == S->getElement() &&
9148 Collection.get() == S->getCollection() &&
9149 Body.get() == S->getBody())
9153 return getDerived().RebuildObjCForCollectionStmt(S->getForLoc(),
9160template <
typename Derived>
9164 if (
VarDecl *ExceptionDecl = S->getExceptionDecl()) {
9166 getDerived().TransformType(ExceptionDecl->getTypeSourceInfo());
9170 Var = getDerived().RebuildExceptionDecl(
9171 ExceptionDecl,
T, ExceptionDecl->getInnerLocStart(),
9172 ExceptionDecl->getLocation(), ExceptionDecl->getIdentifier());
9173 if (!Var || Var->isInvalidDecl())
9178 StmtResult Handler = getDerived().TransformStmt(S->getHandlerBlock());
9179 if (Handler.isInvalid())
9182 if (!getDerived().AlwaysRebuild() && !Var &&
9183 Handler.get() == S->getHandlerBlock())
9186 return getDerived().RebuildCXXCatchStmt(S->getCatchLoc(), Var, Handler.get());
9189template <
typename Derived>
9192 StmtResult TryBlock = getDerived().TransformCompoundStmt(S->getTryBlock());
9193 if (TryBlock.isInvalid())
9197 bool HandlerChanged =
false;
9199 for (
unsigned I = 0, N = S->getNumHandlers(); I != N; ++I) {
9200 StmtResult Handler = getDerived().TransformCXXCatchStmt(S->getHandler(I));
9201 if (Handler.isInvalid())
9204 HandlerChanged = HandlerChanged || Handler.get() != S->getHandler(I);
9205 Handlers.push_back(Handler.getAs<
Stmt>());
9208 getSema().DiagnoseExceptionUse(S->getTryLoc(),
true);
9210 if (!getDerived().AlwaysRebuild() && TryBlock.get() == S->getTryBlock() &&
9214 return getDerived().RebuildCXXTryStmt(S->getTryLoc(), TryBlock.get(),
9218template<
typename Derived>
9229 auto &LastRecord = getSema().currentEvaluationContext();
9230 LastRecord.InLifetimeExtendingContext =
true;
9231 LastRecord.RebuildDefaultArgOrDefaultInit =
true;
9234 S->getInit() ? getDerived().TransformStmt(S->getInit()) :
StmtResult();
9235 if (
Init.isInvalid())
9239 if (
Range.isInvalid())
9244 getSema().ExprEvalContexts.back().ForRangeLifetimeExtendTemps.empty());
9245 auto ForRangeLifetimeExtendTemps =
9246 getSema().ExprEvalContexts.back().ForRangeLifetimeExtendTemps;
9248 StmtResult Begin = getDerived().TransformStmt(S->getBeginStmt());
9249 if (Begin.isInvalid())
9251 StmtResult End = getDerived().TransformStmt(S->getEndStmt());
9252 if (End.isInvalid())
9256 if (
Cond.isInvalid())
9260 if (
Cond.isInvalid())
9266 if (
Inc.isInvalid())
9271 StmtResult LoopVar = getDerived().TransformStmt(S->getLoopVarStmt());
9272 if (LoopVar.isInvalid())
9276 if (getDerived().AlwaysRebuild() ||
9277 Init.get() != S->getInit() ||
9278 Range.get() != S->getRangeStmt() ||
9279 Begin.get() != S->getBeginStmt() ||
9280 End.get() != S->getEndStmt() ||
9281 Cond.get() != S->getCond() ||
9282 Inc.get() != S->getInc() ||
9283 LoopVar.get() != S->getLoopVarStmt()) {
9284 NewStmt = getDerived().RebuildCXXForRangeStmt(
9285 S->getForLoc(), S->getCoawaitLoc(),
Init.get(), S->getColonLoc(),
9286 Range.get(), Begin.get(), End.get(),
Cond.get(),
Inc.get(),
9287 LoopVar.get(), S->getRParenLoc(), ForRangeLifetimeExtendTemps);
9288 if (NewStmt.isInvalid() && LoopVar.get() != S->getLoopVarStmt()) {
9290 getSema().ActOnInitializerError(
9301 StmtResult Body = getDerived().TransformStmt(S->getBody());
9302 if (Body.isInvalid())
9309 if (Body.get() != S->getBody() && NewStmt.get() == S) {
9310 NewStmt = getDerived().RebuildCXXForRangeStmt(
9311 S->getForLoc(), S->getCoawaitLoc(),
Init.get(), S->getColonLoc(),
9312 Range.get(), Begin.get(), End.get(),
Cond.get(),
Inc.get(),
9313 LoopVar.get(), S->getRParenLoc(), ForRangeLifetimeExtendTemps);
9314 if (NewStmt.isInvalid())
9318 if (NewStmt.get() == S)
9321 return FinishCXXForRangeStmt(NewStmt.get(), Body.get());
9324template<
typename Derived>
9330 if (S->getQualifierLoc()) {
9332 = getDerived().TransformNestedNameSpecifierLoc(S->getQualifierLoc());
9339 if (NameInfo.getName()) {
9340 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
9341 if (!NameInfo.getName())
9346 if (!getDerived().AlwaysRebuild() &&
9347 QualifierLoc == S->getQualifierLoc() &&
9348 NameInfo.getName() == S->getNameInfo().getName())
9353 SS.
Adopt(QualifierLoc);
9355 switch (getSema().CheckMicrosoftIfExistsSymbol(
nullptr, SS, NameInfo)) {
9357 if (S->isIfExists())
9360 return new (getSema().Context)
NullStmt(S->getKeywordLoc());
9363 if (S->isIfNotExists())
9366 return new (getSema().Context)
NullStmt(S->getKeywordLoc());
9377 StmtResult SubStmt = getDerived().TransformCompoundStmt(S->getSubStmt());
9378 if (SubStmt.isInvalid())
9386 return getDerived().RebuildMSDependentExistsStmt(S->getKeywordLoc(),
9393template<
typename Derived>
9397 if (E->getQualifierLoc()) {
9399 = getDerived().TransformNestedNameSpecifierLoc(E->getQualifierLoc());
9405 getDerived().TransformDecl(E->getMemberLoc(), E->getPropertyDecl()));
9410 if (
Base.isInvalid())
9416 QualifierLoc, E->getMemberLoc());
9419template <
typename Derived>
9423 if (BaseRes.isInvalid())
9425 auto IdxRes = getDerived().TransformExpr(E->getIdx());
9426 if (IdxRes.isInvalid())
9429 if (!getDerived().AlwaysRebuild() &&
9430 BaseRes.get() == E->getBase() &&
9431 IdxRes.get() == E->getIdx())
9434 return getDerived().RebuildArraySubscriptExpr(
9435 BaseRes.get(),
SourceLocation(), IdxRes.get(), E->getRBracketLoc());
9438template <
typename Derived>
9440 StmtResult TryBlock = getDerived().TransformCompoundStmt(S->getTryBlock());
9441 if (TryBlock.isInvalid())
9444 StmtResult Handler = getDerived().TransformSEHHandler(S->getHandler());
9445 if (Handler.isInvalid())
9448 if (!getDerived().AlwaysRebuild() && TryBlock.get() == S->getTryBlock() &&
9449 Handler.get() == S->getHandler())
9452 return getDerived().RebuildSEHTryStmt(S->getIsCXXTry(), S->getTryLoc(),
9453 TryBlock.get(), Handler.get());
9456template <
typename Derived>
9459 if (
Block.isInvalid())
9462 return getDerived().RebuildSEHFinallyStmt(S->getFinallyLoc(),
Block.get());
9465template <
typename Derived>
9467 ExprResult FilterExpr = getDerived().TransformExpr(S->getFilterExpr());
9468 if (FilterExpr.isInvalid())
9472 if (
Block.isInvalid())
9475 return getDerived().RebuildSEHExceptStmt(S->getExceptLoc(), FilterExpr.get(),
9479template <
typename Derived>
9487template<
typename Derived>
9497template <
typename Derived>
9499TreeTransform<Derived>::TransformOMPCanonicalLoop(OMPCanonicalLoop *L) {
9503 return getDerived().TransformStmt(L->getLoopStmt());
9506template <
typename Derived>
9513 TClauses.reserve(Clauses.size());
9517 getDerived().getSema().OpenMP().StartOpenMPClause((*I)->getClauseKind());
9519 getDerived().getSema().OpenMP().EndOpenMPClause();
9521 TClauses.push_back(Clause);
9523 TClauses.push_back(
nullptr);
9527 if (D->hasAssociatedStmt() && D->getAssociatedStmt()) {
9528 getDerived().getSema().OpenMP().ActOnOpenMPRegionStart(
9529 D->getDirectiveKind(),
9535 if (D->getDirectiveKind() == OMPD_atomic ||
9536 D->getDirectiveKind() == OMPD_critical ||
9537 D->getDirectiveKind() == OMPD_section ||
9538 D->getDirectiveKind() == OMPD_master)
9539 CS = D->getAssociatedStmt();
9541 CS = D->getRawStmt();
9544 getSema().getLangOpts().OpenMPIRBuilder)
9548 getDerived().getSema().OpenMP().ActOnOpenMPRegionEnd(Body, TClauses);
9553 if (TClauses.size() != Clauses.size()) {
9559 if (D->getDirectiveKind() == OMPD_critical) {
9561 DirName =
getDerived().TransformDeclarationNameInfo(DirName);
9564 if (D->getDirectiveKind() == OMPD_cancellation_point) {
9566 }
else if (D->getDirectiveKind() == OMPD_cancel) {
9570 return getDerived().RebuildOMPExecutableDirective(
9571 D->getDirectiveKind(), DirName, CancelRegion, TClauses,
9572 AssociatedStmt.
get(), D->getBeginLoc(), D->getEndLoc());
9580template <
typename Derived>
9587 TClauses.reserve(Clauses.size());
9590 getDerived().getSema().OpenMP().StartOpenMPClause(
C->getClauseKind());
9592 getDerived().getSema().OpenMP().EndOpenMPClause();
9594 TClauses.push_back(Clause);
9596 TClauses.push_back(
nullptr);
9600 if (D->hasAssociatedStmt() && D->getAssociatedStmt()) {
9601 getDerived().getSema().OpenMP().ActOnOpenMPRegionStart(
9602 D->getDirectiveKind(),
9607 assert(D->getDirectiveKind() == OMPD_assume &&
9608 "Unexpected informational directive");
9609 Stmt *CS = D->getAssociatedStmt();
9613 getDerived().getSema().OpenMP().ActOnOpenMPRegionEnd(Body, TClauses);
9617 if (TClauses.size() != Clauses.size())
9622 return getDerived().RebuildOMPInformationalDirective(
9623 D->getDirectiveKind(), DirName, TClauses, AssociatedStmt.
get(),
9624 D->getBeginLoc(), D->getEndLoc());
9627template <
typename Derived>
9632 SemaRef.
Diag(D->getBeginLoc(), diag::err_omp_instantiation_not_supported)
9633 << getOpenMPDirectiveName(D->getDirectiveKind(), OMPVersion);
9637template <
typename Derived>
9639TreeTransform<Derived>::TransformOMPParallelDirective(OMPParallelDirective *D) {
9640 DeclarationNameInfo DirName;
9641 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9642 OMPD_parallel, DirName,
nullptr, D->getBeginLoc());
9643 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9644 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9648template <
typename Derived>
9652 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9653 OMPD_simd, DirName,
nullptr, D->getBeginLoc());
9654 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9655 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9659template <
typename Derived>
9663 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9664 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
9665 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9666 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9670template <
typename Derived>
9674 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9675 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
9676 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9677 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9681template <
typename Derived>
9685 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9686 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
9687 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9688 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9692template <
typename Derived>
9696 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9697 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
9698 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9699 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9703template <
typename Derived>
9705 OMPInterchangeDirective *D) {
9707 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9708 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
9709 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9710 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9714template <
typename Derived>
9718 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9719 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
9720 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9721 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9725template <
typename Derived>
9729 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9730 OMPD_for, DirName,
nullptr, D->getBeginLoc());
9731 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9732 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9736template <
typename Derived>
9740 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9741 OMPD_for_simd, DirName,
nullptr, D->getBeginLoc());
9742 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9743 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9747template <
typename Derived>
9751 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9752 OMPD_sections, DirName,
nullptr, D->getBeginLoc());
9753 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9754 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9758template <
typename Derived>
9762 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9763 OMPD_section, DirName,
nullptr, D->getBeginLoc());
9764 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9765 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9769template <
typename Derived>
9773 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9774 OMPD_scope, DirName,
nullptr, D->getBeginLoc());
9775 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9776 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9780template <
typename Derived>
9784 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9785 OMPD_single, DirName,
nullptr, D->getBeginLoc());
9786 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9787 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9791template <
typename Derived>
9795 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9796 OMPD_master, DirName,
nullptr, D->getBeginLoc());
9797 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9798 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9802template <
typename Derived>
9806 OMPD_critical, D->getDirectiveName(),
nullptr, D->getBeginLoc());
9807 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9808 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9812template <
typename Derived>
9814 OMPParallelForDirective *D) {
9816 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9817 OMPD_parallel_for, DirName,
nullptr, D->getBeginLoc());
9818 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9819 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9823template <
typename Derived>
9825 OMPParallelForSimdDirective *D) {
9827 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9828 OMPD_parallel_for_simd, DirName,
nullptr, D->getBeginLoc());
9829 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9830 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9834template <
typename Derived>
9836 OMPParallelMasterDirective *D) {
9838 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9839 OMPD_parallel_master, DirName,
nullptr, D->getBeginLoc());
9840 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9841 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9845template <
typename Derived>
9847 OMPParallelMaskedDirective *D) {
9849 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9850 OMPD_parallel_masked, DirName,
nullptr, D->getBeginLoc());
9851 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9852 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9856template <
typename Derived>
9858 OMPParallelSectionsDirective *D) {
9860 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9861 OMPD_parallel_sections, DirName,
nullptr, D->getBeginLoc());
9862 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9863 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9867template <
typename Derived>
9871 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9872 OMPD_task, DirName,
nullptr, D->getBeginLoc());
9873 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9874 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9878template <
typename Derived>
9880 OMPTaskyieldDirective *D) {
9882 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9883 OMPD_taskyield, DirName,
nullptr, D->getBeginLoc());
9884 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9885 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9889template <
typename Derived>
9893 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9894 OMPD_barrier, DirName,
nullptr, D->getBeginLoc());
9895 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9896 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9900template <
typename Derived>
9904 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9905 OMPD_taskwait, DirName,
nullptr, D->getBeginLoc());
9906 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9907 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9911template <
typename Derived>
9915 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9916 OMPD_assume, DirName,
nullptr, D->getBeginLoc());
9917 StmtResult Res = getDerived().TransformOMPInformationalDirective(D);
9918 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9922template <
typename Derived>
9926 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9927 OMPD_error, DirName,
nullptr, D->getBeginLoc());
9928 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9929 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9933template <
typename Derived>
9935 OMPTaskgroupDirective *D) {
9937 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9938 OMPD_taskgroup, DirName,
nullptr, D->getBeginLoc());
9939 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9940 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9944template <
typename Derived>
9948 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9949 OMPD_flush, DirName,
nullptr, D->getBeginLoc());
9950 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9951 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9955template <
typename Derived>
9959 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9960 OMPD_depobj, DirName,
nullptr, D->getBeginLoc());
9961 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9962 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9966template <
typename Derived>
9970 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9971 OMPD_scan, DirName,
nullptr, D->getBeginLoc());
9972 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9973 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9977template <
typename Derived>
9981 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9982 OMPD_ordered, DirName,
nullptr, D->getBeginLoc());
9983 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9984 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9988template <
typename Derived>
9992 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9993 OMPD_atomic, DirName,
nullptr, D->getBeginLoc());
9994 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9995 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9999template <
typename Derived>
10003 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10004 OMPD_target, DirName,
nullptr, D->getBeginLoc());
10005 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10006 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10010template <
typename Derived>
10012 OMPTargetDataDirective *D) {
10014 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10015 OMPD_target_data, DirName,
nullptr, D->getBeginLoc());
10016 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10017 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10021template <
typename Derived>
10023 OMPTargetEnterDataDirective *D) {
10025 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10026 OMPD_target_enter_data, DirName,
nullptr, D->getBeginLoc());
10027 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10028 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10032template <
typename Derived>
10034 OMPTargetExitDataDirective *D) {
10036 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10037 OMPD_target_exit_data, DirName,
nullptr, D->getBeginLoc());
10038 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10039 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10043template <
typename Derived>
10045 OMPTargetParallelDirective *D) {
10047 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10048 OMPD_target_parallel, DirName,
nullptr, D->getBeginLoc());
10049 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10050 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10054template <
typename Derived>
10056 OMPTargetParallelForDirective *D) {
10058 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10059 OMPD_target_parallel_for, DirName,
nullptr, D->getBeginLoc());
10060 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10061 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10065template <
typename Derived>
10067 OMPTargetUpdateDirective *D) {
10069 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10070 OMPD_target_update, DirName,
nullptr, D->getBeginLoc());
10071 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10072 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10076template <
typename Derived>
10080 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10081 OMPD_teams, DirName,
nullptr, D->getBeginLoc());
10082 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10083 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10087template <
typename Derived>
10089 OMPCancellationPointDirective *D) {
10091 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10092 OMPD_cancellation_point, DirName,
nullptr, D->getBeginLoc());
10093 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10094 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10098template <
typename Derived>
10102 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10103 OMPD_cancel, DirName,
nullptr, D->getBeginLoc());
10104 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10105 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10109template <
typename Derived>
10113 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10114 OMPD_taskloop, DirName,
nullptr, D->getBeginLoc());
10115 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10116 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10120template <
typename Derived>
10122 OMPTaskLoopSimdDirective *D) {
10124 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10125 OMPD_taskloop_simd, DirName,
nullptr, D->getBeginLoc());
10126 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10127 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10131template <
typename Derived>
10133 OMPMasterTaskLoopDirective *D) {
10135 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10136 OMPD_master_taskloop, DirName,
nullptr, D->getBeginLoc());
10137 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10138 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10142template <
typename Derived>
10144 OMPMaskedTaskLoopDirective *D) {
10146 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10147 OMPD_masked_taskloop, DirName,
nullptr, D->getBeginLoc());
10148 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10149 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10153template <
typename Derived>
10155 OMPMasterTaskLoopSimdDirective *D) {
10157 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10158 OMPD_master_taskloop_simd, DirName,
nullptr, D->getBeginLoc());
10159 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10160 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10164template <
typename Derived>
10166 OMPMaskedTaskLoopSimdDirective *D) {
10168 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10169 OMPD_masked_taskloop_simd, DirName,
nullptr, D->getBeginLoc());
10170 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10171 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10175template <
typename Derived>
10177 OMPParallelMasterTaskLoopDirective *D) {
10179 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10180 OMPD_parallel_master_taskloop, DirName,
nullptr, D->getBeginLoc());
10181 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10182 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10186template <
typename Derived>
10188 OMPParallelMaskedTaskLoopDirective *D) {
10190 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10191 OMPD_parallel_masked_taskloop, DirName,
nullptr, D->getBeginLoc());
10192 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10193 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10197template <
typename Derived>
10200 OMPParallelMasterTaskLoopSimdDirective *D) {
10202 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10203 OMPD_parallel_master_taskloop_simd, DirName,
nullptr, D->getBeginLoc());
10204 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10205 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10209template <
typename Derived>
10212 OMPParallelMaskedTaskLoopSimdDirective *D) {
10214 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10215 OMPD_parallel_masked_taskloop_simd, DirName,
nullptr, D->getBeginLoc());
10216 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10217 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10221template <
typename Derived>
10223 OMPDistributeDirective *D) {
10225 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10226 OMPD_distribute, DirName,
nullptr, D->getBeginLoc());
10227 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10228 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10232template <
typename Derived>
10234 OMPDistributeParallelForDirective *D) {
10236 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10237 OMPD_distribute_parallel_for, DirName,
nullptr, D->getBeginLoc());
10238 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10239 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10243template <
typename Derived>
10246 OMPDistributeParallelForSimdDirective *D) {
10248 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10249 OMPD_distribute_parallel_for_simd, DirName,
nullptr, D->getBeginLoc());
10250 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10251 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10255template <
typename Derived>
10257 OMPDistributeSimdDirective *D) {
10259 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10260 OMPD_distribute_simd, DirName,
nullptr, D->getBeginLoc());
10261 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10262 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10266template <
typename Derived>
10268 OMPTargetParallelForSimdDirective *D) {
10270 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10271 OMPD_target_parallel_for_simd, DirName,
nullptr, D->getBeginLoc());
10272 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10273 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10277template <
typename Derived>
10279 OMPTargetSimdDirective *D) {
10281 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10282 OMPD_target_simd, DirName,
nullptr, D->getBeginLoc());
10283 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10284 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10288template <
typename Derived>
10290 OMPTeamsDistributeDirective *D) {
10292 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10293 OMPD_teams_distribute, DirName,
nullptr, D->getBeginLoc());
10294 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10295 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10299template <
typename Derived>
10301 OMPTeamsDistributeSimdDirective *D) {
10303 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10304 OMPD_teams_distribute_simd, DirName,
nullptr, D->getBeginLoc());
10305 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10306 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10310template <
typename Derived>
10312 OMPTeamsDistributeParallelForSimdDirective *D) {
10314 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10315 OMPD_teams_distribute_parallel_for_simd, DirName,
nullptr,
10317 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10318 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10322template <
typename Derived>
10324 OMPTeamsDistributeParallelForDirective *D) {
10326 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10327 OMPD_teams_distribute_parallel_for, DirName,
nullptr, D->getBeginLoc());
10328 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10329 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10333template <
typename Derived>
10335 OMPTargetTeamsDirective *D) {
10337 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10338 OMPD_target_teams, DirName,
nullptr, D->getBeginLoc());
10339 auto Res = getDerived().TransformOMPExecutableDirective(D);
10340 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10344template <
typename Derived>
10346 OMPTargetTeamsDistributeDirective *D) {
10348 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10349 OMPD_target_teams_distribute, DirName,
nullptr, D->getBeginLoc());
10350 auto Res = getDerived().TransformOMPExecutableDirective(D);
10351 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10355template <
typename Derived>
10358 OMPTargetTeamsDistributeParallelForDirective *D) {
10360 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10361 OMPD_target_teams_distribute_parallel_for, DirName,
nullptr,
10363 auto Res = getDerived().TransformOMPExecutableDirective(D);
10364 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10368template <
typename Derived>
10371 OMPTargetTeamsDistributeParallelForSimdDirective *D) {
10373 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10374 OMPD_target_teams_distribute_parallel_for_simd, DirName,
nullptr,
10376 auto Res = getDerived().TransformOMPExecutableDirective(D);
10377 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10381template <
typename Derived>
10384 OMPTargetTeamsDistributeSimdDirective *D) {
10386 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10387 OMPD_target_teams_distribute_simd, DirName,
nullptr, D->getBeginLoc());
10388 auto Res = getDerived().TransformOMPExecutableDirective(D);
10389 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10393template <
typename Derived>
10397 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10398 OMPD_interop, DirName,
nullptr, D->getBeginLoc());
10399 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10400 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10404template <
typename Derived>
10408 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10409 OMPD_dispatch, DirName,
nullptr, D->getBeginLoc());
10410 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10411 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10415template <
typename Derived>
10419 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10420 OMPD_masked, DirName,
nullptr, D->getBeginLoc());
10421 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10422 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10426template <
typename Derived>
10428 OMPGenericLoopDirective *D) {
10430 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10431 OMPD_loop, DirName,
nullptr, D->getBeginLoc());
10432 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10433 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10437template <
typename Derived>
10439 OMPTeamsGenericLoopDirective *D) {
10441 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10442 OMPD_teams_loop, DirName,
nullptr, D->getBeginLoc());
10443 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10444 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10448template <
typename Derived>
10450 OMPTargetTeamsGenericLoopDirective *D) {
10452 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10453 OMPD_target_teams_loop, DirName,
nullptr, D->getBeginLoc());
10454 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10455 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10459template <
typename Derived>
10461 OMPParallelGenericLoopDirective *D) {
10463 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10464 OMPD_parallel_loop, DirName,
nullptr, D->getBeginLoc());
10465 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10466 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10470template <
typename Derived>
10473 OMPTargetParallelGenericLoopDirective *D) {
10475 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10476 OMPD_target_parallel_loop, DirName,
nullptr, D->getBeginLoc());
10477 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10478 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10485template <
typename Derived>
10488 if (
Cond.isInvalid())
10490 return getDerived().RebuildOMPIfClause(
10491 C->getNameModifier(),
Cond.get(),
C->getBeginLoc(),
C->getLParenLoc(),
10492 C->getNameModifierLoc(),
C->getColonLoc(),
C->getEndLoc());
10495template <
typename Derived>
10498 if (
Cond.isInvalid())
10500 return getDerived().RebuildOMPFinalClause(
Cond.get(),
C->getBeginLoc(),
10501 C->getLParenLoc(),
C->getEndLoc());
10504template <
typename Derived>
10507 ExprResult NumThreads = getDerived().TransformExpr(
C->getNumThreads());
10508 if (NumThreads.isInvalid())
10510 return getDerived().RebuildOMPNumThreadsClause(
10511 C->getModifier(), NumThreads.get(),
C->getBeginLoc(),
C->getLParenLoc(),
10512 C->getModifierLoc(),
C->getEndLoc());
10515template <
typename Derived>
10518 ExprResult E = getDerived().TransformExpr(
C->getSafelen());
10521 return getDerived().RebuildOMPSafelenClause(
10522 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10525template <
typename Derived>
10528 ExprResult E = getDerived().TransformExpr(
C->getAllocator());
10531 return getDerived().RebuildOMPAllocatorClause(
10532 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10535template <
typename Derived>
10538 ExprResult E = getDerived().TransformExpr(
C->getSimdlen());
10541 return getDerived().RebuildOMPSimdlenClause(
10542 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10545template <
typename Derived>
10548 TransformedSizes.reserve(
C->getNumSizes());
10550 for (
Expr *E :
C->getSizesRefs()) {
10552 TransformedSizes.push_back(
nullptr);
10561 TransformedSizes.push_back(
T.get());
10564 if (!Changed && !getDerived().AlwaysRebuild())
10566 return RebuildOMPSizesClause(TransformedSizes,
C->getBeginLoc(),
10567 C->getLParenLoc(),
C->getEndLoc());
10570template <
typename Derived>
10574 TransformedArgs.reserve(
C->getNumLoops());
10576 for (
Expr *E :
C->getArgsRefs()) {
10578 TransformedArgs.push_back(
nullptr);
10587 TransformedArgs.push_back(
T.get());
10590 if (!Changed && !getDerived().AlwaysRebuild())
10592 return RebuildOMPPermutationClause(TransformedArgs,
C->getBeginLoc(),
10593 C->getLParenLoc(),
C->getEndLoc());
10596template <
typename Derived>
10598 if (!getDerived().AlwaysRebuild())
10600 return RebuildOMPFullClause(
C->getBeginLoc(),
C->getEndLoc());
10603template <
typename Derived>
10606 ExprResult T = getDerived().TransformExpr(
C->getFactor());
10609 Expr *Factor =
T.get();
10610 bool Changed = Factor !=
C->getFactor();
10612 if (!Changed && !getDerived().AlwaysRebuild())
10614 return RebuildOMPPartialClause(Factor,
C->getBeginLoc(),
C->getLParenLoc(),
10618template <
typename Derived>
10621 ExprResult F = getDerived().TransformExpr(
C->getFirst());
10625 ExprResult Cn = getDerived().TransformExpr(
C->getCount());
10626 if (Cn.isInvalid())
10630 Expr *Count = Cn.get();
10632 bool Changed = (
First !=
C->getFirst()) || (Count !=
C->getCount());
10635 if (!Changed && !getDerived().AlwaysRebuild())
10638 return RebuildOMPLoopRangeClause(
First, Count,
C->getBeginLoc(),
10639 C->getLParenLoc(),
C->getFirstLoc(),
10640 C->getCountLoc(),
C->getEndLoc());
10643template <
typename Derived>
10646 ExprResult E = getDerived().TransformExpr(
C->getNumForLoops());
10649 return getDerived().RebuildOMPCollapseClause(
10650 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10653template <
typename Derived>
10657 C->getDefaultKind(),
C->getDefaultKindKwLoc(),
C->getDefaultVC(),
10658 C->getDefaultVCLoc(),
C->getBeginLoc(),
C->getLParenLoc(),
10662template <
typename Derived>
10669template <
typename Derived>
10673 C->getProcBindKind(),
C->getProcBindKindKwLoc(),
C->getBeginLoc(),
10674 C->getLParenLoc(),
C->getEndLoc());
10677template <
typename Derived>
10680 ExprResult E = getDerived().TransformExpr(
C->getChunkSize());
10683 return getDerived().RebuildOMPScheduleClause(
10684 C->getFirstScheduleModifier(),
C->getSecondScheduleModifier(),
10685 C->getScheduleKind(), E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
10686 C->getFirstScheduleModifierLoc(),
C->getSecondScheduleModifierLoc(),
10687 C->getScheduleKindLoc(),
C->getCommaLoc(),
C->getEndLoc());
10690template <
typename Derived>
10694 if (
auto *
Num =
C->getNumForLoops()) {
10695 E = getDerived().TransformExpr(
Num);
10699 return getDerived().RebuildOMPOrderedClause(
C->getBeginLoc(),
C->getEndLoc(),
10700 C->getLParenLoc(), E.get());
10703template <
typename Derived>
10707 if (
Expr *Evt =
C->getEventHandler()) {
10708 E = getDerived().TransformExpr(Evt);
10712 return getDerived().RebuildOMPDetachClause(E.get(),
C->getBeginLoc(),
10713 C->getLParenLoc(),
C->getEndLoc());
10716template <
typename Derived>
10722 if (
Cond.isInvalid())
10725 return getDerived().RebuildOMPNowaitClause(
Cond.get(),
C->getBeginLoc(),
10726 C->getLParenLoc(),
C->getEndLoc());
10729template <
typename Derived>
10736template <
typename Derived>
10743template <
typename Derived>
10749template <
typename Derived>
10755template <
typename Derived>
10762template <
typename Derived>
10769template <
typename Derived>
10776template <
typename Derived>
10782template <
typename Derived>
10788template <
typename Derived>
10790 ExprResult E = getDerived().TransformExpr(
C->getExpr());
10793 return getDerived().RebuildOMPHoldsClause(E.get(),
C->getBeginLoc(),
10794 C->getLParenLoc(),
C->getEndLoc());
10797template <
typename Derived>
10803template <
typename Derived>
10808template <
typename Derived>
10813template <
typename Derived>
10818template <
typename Derived>
10824template <
typename Derived>
10831template <
typename Derived>
10838template <
typename Derived>
10845template <
typename Derived>
10852template <
typename Derived>
10859template <
typename Derived>
10865template <
typename Derived>
10872template <
typename Derived>
10878template <
typename Derived>
10885template <
typename Derived>
10887 ExprResult IVR = getDerived().TransformExpr(
C->getInteropVar());
10888 if (IVR.isInvalid())
10892 InteropInfo.PreferTypes.reserve(
C->varlist_size() - 1);
10893 for (
Expr *E : llvm::drop_begin(
C->varlist())) {
10895 if (ER.isInvalid())
10897 InteropInfo.PreferTypes.push_back(ER.get());
10899 return getDerived().RebuildOMPInitClause(IVR.get(), InteropInfo,
10900 C->getBeginLoc(),
C->getLParenLoc(),
10901 C->getVarLoc(),
C->getEndLoc());
10904template <
typename Derived>
10906 ExprResult ER = getDerived().TransformExpr(
C->getInteropVar());
10907 if (ER.isInvalid())
10909 return getDerived().RebuildOMPUseClause(ER.get(),
C->getBeginLoc(),
10910 C->getLParenLoc(),
C->getVarLoc(),
10914template <
typename Derived>
10918 if (
Expr *IV =
C->getInteropVar()) {
10919 ER = getDerived().TransformExpr(IV);
10920 if (ER.isInvalid())
10923 return getDerived().RebuildOMPDestroyClause(ER.get(),
C->getBeginLoc(),
10924 C->getLParenLoc(),
C->getVarLoc(),
10928template <
typename Derived>
10932 if (
Cond.isInvalid())
10934 return getDerived().RebuildOMPNovariantsClause(
10935 Cond.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10938template <
typename Derived>
10942 if (
Cond.isInvalid())
10944 return getDerived().RebuildOMPNocontextClause(
10945 Cond.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10948template <
typename Derived>
10951 ExprResult ThreadID = getDerived().TransformExpr(
C->getThreadID());
10952 if (ThreadID.isInvalid())
10954 return getDerived().RebuildOMPFilterClause(ThreadID.get(),
C->getBeginLoc(),
10955 C->getLParenLoc(),
C->getEndLoc());
10958template <
typename Derived>
10960 ExprResult E = getDerived().TransformExpr(
C->getAlignment());
10963 return getDerived().RebuildOMPAlignClause(E.get(),
C->getBeginLoc(),
10964 C->getLParenLoc(),
C->getEndLoc());
10967template <
typename Derived>
10970 llvm_unreachable(
"unified_address clause cannot appear in dependent context");
10973template <
typename Derived>
10977 "unified_shared_memory clause cannot appear in dependent context");
10980template <
typename Derived>
10983 llvm_unreachable(
"reverse_offload clause cannot appear in dependent context");
10986template <
typename Derived>
10990 "dynamic_allocators clause cannot appear in dependent context");
10993template <
typename Derived>
10997 "atomic_default_mem_order clause cannot appear in dependent context");
11000template <
typename Derived>
11003 llvm_unreachable(
"self_maps clause cannot appear in dependent context");
11006template <
typename Derived>
11009 C->getBeginLoc(),
C->getLParenLoc(),
11013template <
typename Derived>
11017 C->getSeverityKind(),
C->getSeverityKindKwLoc(),
C->getBeginLoc(),
11018 C->getLParenLoc(),
C->getEndLoc());
11021template <
typename Derived>
11024 ExprResult E = getDerived().TransformExpr(
C->getMessageString());
11027 return getDerived().RebuildOMPMessageClause(
11028 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11031template <
typename Derived>
11035 Vars.reserve(
C->varlist_size());
11036 for (
auto *
VE :
C->varlist()) {
11038 if (EVar.isInvalid())
11040 Vars.push_back(EVar.get());
11042 return getDerived().RebuildOMPPrivateClause(
11043 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11046template <
typename Derived>
11050 Vars.reserve(
C->varlist_size());
11051 for (
auto *
VE :
C->varlist()) {
11053 if (EVar.isInvalid())
11055 Vars.push_back(EVar.get());
11057 return getDerived().RebuildOMPFirstprivateClause(
11058 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11061template <
typename Derived>
11065 Vars.reserve(
C->varlist_size());
11066 for (
auto *
VE :
C->varlist()) {
11068 if (EVar.isInvalid())
11070 Vars.push_back(EVar.get());
11072 return getDerived().RebuildOMPLastprivateClause(
11073 Vars,
C->getKind(),
C->getKindLoc(),
C->getColonLoc(),
C->getBeginLoc(),
11074 C->getLParenLoc(),
C->getEndLoc());
11077template <
typename Derived>
11081 Vars.reserve(
C->varlist_size());
11082 for (
auto *
VE :
C->varlist()) {
11084 if (EVar.isInvalid())
11086 Vars.push_back(EVar.get());
11088 return getDerived().RebuildOMPSharedClause(Vars,
C->getBeginLoc(),
11089 C->getLParenLoc(),
C->getEndLoc());
11092template <
typename Derived>
11096 Vars.reserve(
C->varlist_size());
11097 for (
auto *
VE :
C->varlist()) {
11099 if (EVar.isInvalid())
11101 Vars.push_back(EVar.get());
11104 ReductionIdScopeSpec.
Adopt(
C->getQualifierLoc());
11107 if (NameInfo.getName()) {
11108 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
11109 if (!NameInfo.getName())
11115 for (
auto *E :
C->reduction_ops()) {
11120 for (
auto *D : ULE->decls()) {
11123 Decls.addDecl(InstD, InstD->getAccess());
11127 ReductionIdScopeSpec.getWithLocInContext(SemaRef.
Context), NameInfo,
11128 true, Decls.begin(), Decls.end(),
11131 UnresolvedReductions.push_back(
nullptr);
11133 return getDerived().RebuildOMPReductionClause(
11134 Vars,
C->getModifier(),
C->getOriginalSharingModifier(),
C->getBeginLoc(),
11135 C->getLParenLoc(),
C->getModifierLoc(),
C->getColonLoc(),
C->getEndLoc(),
11136 ReductionIdScopeSpec, NameInfo, UnresolvedReductions);
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());
11151 ReductionIdScopeSpec.
Adopt(
C->getQualifierLoc());
11154 if (NameInfo.getName()) {
11155 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
11156 if (!NameInfo.getName())
11162 for (
auto *E :
C->reduction_ops()) {
11167 for (
auto *D : ULE->decls()) {
11170 Decls.addDecl(InstD, InstD->getAccess());
11174 ReductionIdScopeSpec.getWithLocInContext(SemaRef.
Context), NameInfo,
11175 true, Decls.begin(), Decls.end(),
11178 UnresolvedReductions.push_back(
nullptr);
11180 return getDerived().RebuildOMPTaskReductionClause(
11181 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getColonLoc(),
11182 C->getEndLoc(), ReductionIdScopeSpec, NameInfo, UnresolvedReductions);
11185template <
typename Derived>
11189 Vars.reserve(
C->varlist_size());
11190 for (
auto *
VE :
C->varlist()) {
11192 if (EVar.isInvalid())
11194 Vars.push_back(EVar.get());
11197 ReductionIdScopeSpec.
Adopt(
C->getQualifierLoc());
11200 if (NameInfo.getName()) {
11201 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
11202 if (!NameInfo.getName())
11208 for (
auto *E :
C->reduction_ops()) {
11213 for (
auto *D : ULE->decls()) {
11216 Decls.addDecl(InstD, InstD->getAccess());
11220 ReductionIdScopeSpec.getWithLocInContext(SemaRef.
Context), NameInfo,
11221 true, Decls.begin(), Decls.end(),
11224 UnresolvedReductions.push_back(
nullptr);
11226 return getDerived().RebuildOMPInReductionClause(
11227 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getColonLoc(),
11228 C->getEndLoc(), ReductionIdScopeSpec, NameInfo, UnresolvedReductions);
11231template <
typename Derived>
11235 Vars.reserve(
C->varlist_size());
11236 for (
auto *
VE :
C->varlist()) {
11238 if (EVar.isInvalid())
11240 Vars.push_back(EVar.get());
11242 ExprResult Step = getDerived().TransformExpr(
C->getStep());
11243 if (Step.isInvalid())
11245 return getDerived().RebuildOMPLinearClause(
11246 Vars, Step.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getModifier(),
11247 C->getModifierLoc(),
C->getColonLoc(),
C->getStepModifierLoc(),
11251template <
typename Derived>
11255 Vars.reserve(
C->varlist_size());
11256 for (
auto *
VE :
C->varlist()) {
11258 if (EVar.isInvalid())
11260 Vars.push_back(EVar.get());
11262 ExprResult Alignment = getDerived().TransformExpr(
C->getAlignment());
11263 if (Alignment.isInvalid())
11265 return getDerived().RebuildOMPAlignedClause(
11266 Vars, Alignment.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11267 C->getColonLoc(),
C->getEndLoc());
11270template <
typename Derived>
11274 Vars.reserve(
C->varlist_size());
11275 for (
auto *
VE :
C->varlist()) {
11277 if (EVar.isInvalid())
11279 Vars.push_back(EVar.get());
11281 return getDerived().RebuildOMPCopyinClause(Vars,
C->getBeginLoc(),
11282 C->getLParenLoc(),
C->getEndLoc());
11285template <
typename Derived>
11289 Vars.reserve(
C->varlist_size());
11290 for (
auto *
VE :
C->varlist()) {
11292 if (EVar.isInvalid())
11294 Vars.push_back(EVar.get());
11296 return getDerived().RebuildOMPCopyprivateClause(
11297 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11300template <
typename Derived>
11303 Vars.reserve(
C->varlist_size());
11304 for (
auto *
VE :
C->varlist()) {
11306 if (EVar.isInvalid())
11308 Vars.push_back(EVar.get());
11310 return getDerived().RebuildOMPFlushClause(Vars,
C->getBeginLoc(),
11311 C->getLParenLoc(),
C->getEndLoc());
11314template <
typename Derived>
11317 ExprResult E = getDerived().TransformExpr(
C->getDepobj());
11320 return getDerived().RebuildOMPDepobjClause(E.get(),
C->getBeginLoc(),
11321 C->getLParenLoc(),
C->getEndLoc());
11324template <
typename Derived>
11328 Expr *DepModifier =
C->getModifier();
11330 ExprResult DepModRes = getDerived().TransformExpr(DepModifier);
11331 if (DepModRes.isInvalid())
11333 DepModifier = DepModRes.get();
11335 Vars.reserve(
C->varlist_size());
11336 for (
auto *
VE :
C->varlist()) {
11338 if (EVar.isInvalid())
11340 Vars.push_back(EVar.get());
11342 return getDerived().RebuildOMPDependClause(
11343 {
C->getDependencyKind(),
C->getDependencyLoc(),
C->getColonLoc(),
11344 C->getOmpAllMemoryLoc()},
11345 DepModifier, Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11348template <
typename Derived>
11351 ExprResult E = getDerived().TransformExpr(
C->getDevice());
11354 return getDerived().RebuildOMPDeviceClause(
11355 C->getModifier(), E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11356 C->getModifierLoc(),
C->getEndLoc());
11359template <
typename Derived,
class T>
11366 Vars.reserve(
C->varlist_size());
11367 for (
auto *
VE :
C->varlist()) {
11371 Vars.push_back(EVar.
get());
11375 if (
C->getMapperQualifierLoc()) {
11376 QualifierLoc = TT.
getDerived().TransformNestedNameSpecifierLoc(
11377 C->getMapperQualifierLoc());
11381 MapperIdScopeSpec.
Adopt(QualifierLoc);
11382 MapperIdInfo =
C->getMapperIdInfo();
11383 if (MapperIdInfo.
getName()) {
11384 MapperIdInfo = TT.
getDerived().TransformDeclarationNameInfo(MapperIdInfo);
11390 for (
auto *E :
C->mapperlists()) {
11395 for (
auto *D : ULE->decls()) {
11398 Decls.addDecl(InstD, InstD->
getAccess());
11403 MapperIdInfo,
true, Decls.begin(), Decls.end(),
11406 UnresolvedMappers.push_back(
nullptr);
11412template <
typename Derived>
11413OMPClause *TreeTransform<Derived>::TransformOMPMapClause(OMPMapClause *
C) {
11414 OMPVarListLocTy Locs(
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11416 Expr *IteratorModifier =
C->getIteratorModifier();
11417 if (IteratorModifier) {
11418 ExprResult MapModRes = getDerived().TransformExpr(IteratorModifier);
11419 if (MapModRes.isInvalid())
11421 IteratorModifier = MapModRes.
get();
11427 *
this,
C, Vars, MapperIdScopeSpec, MapperIdInfo, UnresolvedMappers))
11429 return getDerived().RebuildOMPMapClause(
11430 IteratorModifier,
C->getMapTypeModifiers(),
C->getMapTypeModifiersLoc(),
11431 MapperIdScopeSpec, MapperIdInfo,
C->getMapType(),
C->isImplicitMapType(),
11432 C->getMapLoc(),
C->getColonLoc(), Vars, Locs, UnresolvedMappers);
11435template <
typename Derived>
11438 Expr *Allocator =
C->getAllocator();
11440 ExprResult AllocatorRes = getDerived().TransformExpr(Allocator);
11441 if (AllocatorRes.isInvalid())
11443 Allocator = AllocatorRes.get();
11445 Expr *Alignment =
C->getAlignment();
11447 ExprResult AlignmentRes = getDerived().TransformExpr(Alignment);
11448 if (AlignmentRes.isInvalid())
11450 Alignment = AlignmentRes.get();
11453 Vars.reserve(
C->varlist_size());
11454 for (
auto *
VE :
C->varlist()) {
11456 if (EVar.isInvalid())
11458 Vars.push_back(EVar.get());
11460 return getDerived().RebuildOMPAllocateClause(
11461 Allocator, Alignment,
C->getFirstAllocateModifier(),
11462 C->getFirstAllocateModifierLoc(),
C->getSecondAllocateModifier(),
11463 C->getSecondAllocateModifierLoc(), Vars,
C->getBeginLoc(),
11464 C->getLParenLoc(),
C->getColonLoc(),
C->getEndLoc());
11467template <
typename Derived>
11471 Vars.reserve(
C->varlist_size());
11472 for (
auto *
VE :
C->varlist()) {
11474 if (EVar.isInvalid())
11476 Vars.push_back(EVar.get());
11478 return getDerived().RebuildOMPNumTeamsClause(
11479 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11482template <
typename Derived>
11486 Vars.reserve(
C->varlist_size());
11487 for (
auto *
VE :
C->varlist()) {
11489 if (EVar.isInvalid())
11491 Vars.push_back(EVar.get());
11493 return getDerived().RebuildOMPThreadLimitClause(
11494 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11497template <
typename Derived>
11500 ExprResult E = getDerived().TransformExpr(
C->getPriority());
11503 return getDerived().RebuildOMPPriorityClause(
11504 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11507template <
typename Derived>
11510 ExprResult E = getDerived().TransformExpr(
C->getGrainsize());
11513 return getDerived().RebuildOMPGrainsizeClause(
11514 C->getModifier(), E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11515 C->getModifierLoc(),
C->getEndLoc());
11518template <
typename Derived>
11521 ExprResult E = getDerived().TransformExpr(
C->getNumTasks());
11524 return getDerived().RebuildOMPNumTasksClause(
11525 C->getModifier(), E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11526 C->getModifierLoc(),
C->getEndLoc());
11529template <
typename Derived>
11531 ExprResult E = getDerived().TransformExpr(
C->getHint());
11534 return getDerived().RebuildOMPHintClause(E.get(),
C->getBeginLoc(),
11535 C->getLParenLoc(),
C->getEndLoc());
11538template <
typename Derived>
11541 ExprResult E = getDerived().TransformExpr(
C->getChunkSize());
11544 return getDerived().RebuildOMPDistScheduleClause(
11545 C->getDistScheduleKind(), E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11546 C->getDistScheduleKindLoc(),
C->getCommaLoc(),
C->getEndLoc());
11549template <
typename Derived>
11555 C->getDefaultmapKind(),
11558 C->getDefaultmapModifierLoc(),
11559 C->getDefaultmapKindLoc(),
11563template <
typename Derived>
11567 Expr *IteratorModifier =
C->getIteratorModifier();
11568 if (IteratorModifier) {
11569 ExprResult MapModRes = getDerived().TransformExpr(IteratorModifier);
11570 if (MapModRes.isInvalid())
11572 IteratorModifier = MapModRes.get();
11578 *
this,
C, Vars, MapperIdScopeSpec, MapperIdInfo, UnresolvedMappers))
11580 return getDerived().RebuildOMPToClause(
11581 C->getMotionModifiers(),
C->getMotionModifiersLoc(), IteratorModifier,
11582 MapperIdScopeSpec, MapperIdInfo,
C->getColonLoc(), Vars, Locs,
11583 UnresolvedMappers);
11586template <
typename Derived>
11590 Expr *IteratorModifier =
C->getIteratorModifier();
11591 if (IteratorModifier) {
11592 ExprResult MapModRes = getDerived().TransformExpr(IteratorModifier);
11593 if (MapModRes.isInvalid())
11595 IteratorModifier = MapModRes.get();
11601 *
this,
C, Vars, MapperIdScopeSpec, MapperIdInfo, UnresolvedMappers))
11603 return getDerived().RebuildOMPFromClause(
11604 C->getMotionModifiers(),
C->getMotionModifiersLoc(), IteratorModifier,
11605 MapperIdScopeSpec, MapperIdInfo,
C->getColonLoc(), Vars, Locs,
11606 UnresolvedMappers);
11609template <
typename Derived>
11613 Vars.reserve(
C->varlist_size());
11614 for (
auto *
VE :
C->varlist()) {
11616 if (EVar.isInvalid())
11618 Vars.push_back(EVar.get());
11621 return getDerived().RebuildOMPUseDevicePtrClause(Vars, Locs);
11624template <
typename Derived>
11628 Vars.reserve(
C->varlist_size());
11629 for (
auto *
VE :
C->varlist()) {
11631 if (EVar.isInvalid())
11633 Vars.push_back(EVar.get());
11636 return getDerived().RebuildOMPUseDeviceAddrClause(Vars, Locs);
11639template <
typename Derived>
11643 Vars.reserve(
C->varlist_size());
11644 for (
auto *
VE :
C->varlist()) {
11646 if (EVar.isInvalid())
11648 Vars.push_back(EVar.get());
11651 return getDerived().RebuildOMPIsDevicePtrClause(Vars, Locs);
11654template <
typename Derived>
11658 Vars.reserve(
C->varlist_size());
11659 for (
auto *
VE :
C->varlist()) {
11661 if (EVar.isInvalid())
11663 Vars.push_back(EVar.get());
11666 return getDerived().RebuildOMPHasDeviceAddrClause(Vars, Locs);
11669template <
typename Derived>
11673 Vars.reserve(
C->varlist_size());
11674 for (
auto *
VE :
C->varlist()) {
11676 if (EVar.isInvalid())
11678 Vars.push_back(EVar.get());
11680 return getDerived().RebuildOMPNontemporalClause(
11681 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11684template <
typename Derived>
11688 Vars.reserve(
C->varlist_size());
11689 for (
auto *
VE :
C->varlist()) {
11691 if (EVar.isInvalid())
11693 Vars.push_back(EVar.get());
11695 return getDerived().RebuildOMPInclusiveClause(
11696 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11699template <
typename Derived>
11703 Vars.reserve(
C->varlist_size());
11704 for (
auto *
VE :
C->varlist()) {
11706 if (EVar.isInvalid())
11708 Vars.push_back(EVar.get());
11710 return getDerived().RebuildOMPExclusiveClause(
11711 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11714template <
typename Derived>
11718 Data.reserve(
C->getNumberOfAllocators());
11719 for (
unsigned I = 0, E =
C->getNumberOfAllocators(); I < E; ++I) {
11721 ExprResult Allocator = getDerived().TransformExpr(D.Allocator);
11722 if (Allocator.isInvalid())
11725 if (
Expr *AT = D.AllocatorTraits) {
11726 AllocatorTraits = getDerived().TransformExpr(AT);
11727 if (AllocatorTraits.isInvalid())
11731 NewD.Allocator = Allocator.get();
11732 NewD.AllocatorTraits = AllocatorTraits.get();
11733 NewD.LParenLoc = D.LParenLoc;
11734 NewD.RParenLoc = D.RParenLoc;
11736 return getDerived().RebuildOMPUsesAllocatorsClause(
11737 Data,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11740template <
typename Derived>
11744 Locators.reserve(
C->varlist_size());
11746 if (
Expr *Modifier =
C->getModifier()) {
11747 ModifierRes = getDerived().TransformExpr(Modifier);
11748 if (ModifierRes.isInvalid())
11751 for (
Expr *E :
C->varlist()) {
11752 ExprResult Locator = getDerived().TransformExpr(E);
11753 if (Locator.isInvalid())
11755 Locators.push_back(Locator.get());
11757 return getDerived().RebuildOMPAffinityClause(
11758 C->getBeginLoc(),
C->getLParenLoc(),
C->getColonLoc(),
C->getEndLoc(),
11759 ModifierRes.get(), Locators);
11762template <
typename Derived>
11765 C->getKind(),
C->getKindKwLoc(),
C->getBeginLoc(),
C->getLParenLoc(),
11766 C->getEndLoc(),
C->getModifier(),
C->getModifierKwLoc());
11769template <
typename Derived>
11772 C->getBindKind(),
C->getBindKindLoc(),
C->getBeginLoc(),
11773 C->getLParenLoc(),
C->getEndLoc());
11776template <
typename Derived>
11780 if (
Size.isInvalid())
11782 return getDerived().RebuildOMPXDynCGroupMemClause(
11783 Size.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11786template <
typename Derived>
11790 if (
Size.isInvalid())
11792 return getDerived().RebuildOMPDynGroupprivateClause(
11793 C->getDynGroupprivateModifier(),
C->getDynGroupprivateFallbackModifier(),
11794 Size.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11795 C->getDynGroupprivateModifierLoc(),
11796 C->getDynGroupprivateFallbackModifierLoc(),
C->getEndLoc());
11799template <
typename Derived>
11803 Vars.reserve(
C->varlist_size());
11804 for (
auto *
VE :
C->varlist()) {
11806 if (EVar.isInvalid())
11808 Vars.push_back(EVar.get());
11810 return getDerived().RebuildOMPDoacrossClause(
11811 C->getDependenceType(),
C->getDependenceLoc(),
C->getColonLoc(), Vars,
11812 C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11815template <
typename Derived>
11819 for (
auto *A :
C->getAttrs())
11820 NewAttrs.push_back(getDerived().TransformAttr(A));
11821 return getDerived().RebuildOMPXAttributeClause(
11822 NewAttrs,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11825template <
typename Derived>
11834template <
typename Derived>
11835class OpenACCClauseTransform final
11837 TreeTransform<Derived> &Self;
11838 ArrayRef<const OpenACCClause *> ExistingClauses;
11839 SemaOpenACC::OpenACCParsedClause &ParsedClause;
11840 OpenACCClause *NewClause =
nullptr;
11843 ExprResult Res = Self.TransformExpr(VarRef);
11845 if (!Res.isUsable())
11848 Res = Self.getSema().OpenACC().ActOnVar(ParsedClause.getDirectiveKind(),
11849 ParsedClause.getClauseKind(),
11855 llvm::SmallVector<Expr *> VisitVarList(ArrayRef<Expr *> VarList) {
11856 llvm::SmallVector<Expr *> InstantiatedVarList;
11857 for (Expr *CurVar : VarList) {
11860 if (VarRef.isUsable())
11861 InstantiatedVarList.push_back(VarRef.get());
11864 return InstantiatedVarList;
11868 OpenACCClauseTransform(TreeTransform<Derived> &Self,
11869 ArrayRef<const OpenACCClause *> ExistingClauses,
11870 SemaOpenACC::OpenACCParsedClause &PC)
11871 : Self(Self), ExistingClauses(ExistingClauses), ParsedClause(PC) {}
11873 OpenACCClause *CreatedClause()
const {
return NewClause; }
11875#define VISIT_CLAUSE(CLAUSE_NAME) \
11876 void Visit##CLAUSE_NAME##Clause(const OpenACC##CLAUSE_NAME##Clause &Clause);
11877#include "clang/Basic/OpenACCClauses.def"
11880template <
typename Derived>
11881void OpenACCClauseTransform<Derived>::VisitDefaultClause(
11883 ParsedClause.setDefaultDetails(
C.getDefaultClauseKind());
11886 Self.getSema().getASTContext(), ParsedClause.getDefaultClauseKind(),
11887 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
11888 ParsedClause.getEndLoc());
11891template <
typename Derived>
11892void OpenACCClauseTransform<Derived>::VisitIfClause(
const OpenACCIfClause &
C) {
11894 assert(
Cond &&
"If constructed with invalid Condition");
11898 if (Res.isInvalid() || !Res.get().second)
11901 ParsedClause.setConditionDetails(Res.get().second);
11904 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
11905 ParsedClause.getLParenLoc(), ParsedClause.getConditionExpr(),
11906 ParsedClause.getEndLoc());
11909template <
typename Derived>
11910void OpenACCClauseTransform<Derived>::VisitSelfClause(
11916 for (
Expr *CurVar :
C.getVarList()) {
11919 if (!Res.isUsable())
11922 Res =
Self.getSema().OpenACC().ActOnVar(ParsedClause.getDirectiveKind(),
11923 ParsedClause.getClauseKind(),
11926 if (Res.isUsable())
11927 InstantiatedVarList.push_back(Res.get());
11930 ParsedClause.setVarListDetails(InstantiatedVarList,
11934 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
11935 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
11936 ParsedClause.getEndLoc());
11939 if (
C.hasConditionExpr()) {
11942 Self.TransformCondition(
Cond->getExprLoc(),
nullptr,
Cond,
11945 if (Res.isInvalid() || !Res.get().second)
11948 ParsedClause.setConditionDetails(Res.get().second);
11952 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
11953 ParsedClause.getLParenLoc(), ParsedClause.getConditionExpr(),
11954 ParsedClause.getEndLoc());
11958template <
typename Derived>
11959void OpenACCClauseTransform<Derived>::VisitNumGangsClause(
11963 for (
Expr *CurIntExpr :
C.getIntExprs()) {
11966 if (!Res.isUsable())
11971 C.getBeginLoc(), Res.get());
11972 if (!Res.isUsable())
11975 InstantiatedIntExprs.push_back(Res.get());
11978 ParsedClause.setIntExprDetails(InstantiatedIntExprs);
11980 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
11981 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs(),
11982 ParsedClause.getEndLoc());
11985template <
typename Derived>
11986void OpenACCClauseTransform<Derived>::VisitPrivateClause(
11991 for (
const auto [RefExpr, InitRecipe] :
11992 llvm::zip(
C.getVarList(),
C.getInitRecipes())) {
11995 if (VarRef.isUsable()) {
11996 InstantiatedVarList.push_back(VarRef.get());
12000 if (InitRecipe.isSet())
12001 InitRecipes.push_back(InitRecipe);
12003 InitRecipes.push_back(
12004 Self.getSema().OpenACC().CreatePrivateInitRecipe(VarRef.get()));
12007 ParsedClause.setVarListDetails(InstantiatedVarList,
12011 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12012 ParsedClause.getLParenLoc(), ParsedClause.getVarList(), InitRecipes,
12013 ParsedClause.getEndLoc());
12016template <
typename Derived>
12017void OpenACCClauseTransform<Derived>::VisitHostClause(
12019 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12023 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12024 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12025 ParsedClause.getEndLoc());
12028template <
typename Derived>
12029void OpenACCClauseTransform<Derived>::VisitDeviceClause(
12031 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12035 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12036 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12037 ParsedClause.getEndLoc());
12040template <
typename Derived>
12041void OpenACCClauseTransform<Derived>::VisitFirstPrivateClause(
12046 for (
const auto [RefExpr, InitRecipe] :
12047 llvm::zip(
C.getVarList(),
C.getInitRecipes())) {
12050 if (VarRef.isUsable()) {
12051 InstantiatedVarList.push_back(VarRef.get());
12055 if (InitRecipe.isSet())
12056 InitRecipes.push_back(InitRecipe);
12058 InitRecipes.push_back(
12059 Self.getSema().OpenACC().CreateFirstPrivateInitRecipe(
12063 ParsedClause.setVarListDetails(InstantiatedVarList,
12067 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12068 ParsedClause.getLParenLoc(), ParsedClause.getVarList(), InitRecipes,
12069 ParsedClause.getEndLoc());
12072template <
typename Derived>
12073void OpenACCClauseTransform<Derived>::VisitNoCreateClause(
12075 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12079 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12080 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12081 ParsedClause.getEndLoc());
12084template <
typename Derived>
12085void OpenACCClauseTransform<Derived>::VisitPresentClause(
12087 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12091 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12092 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12093 ParsedClause.getEndLoc());
12096template <
typename Derived>
12097void OpenACCClauseTransform<Derived>::VisitCopyClause(
12099 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12100 C.getModifierList());
12103 Self.getSema().getASTContext(), ParsedClause.getClauseKind(),
12104 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12105 ParsedClause.getModifierList(), ParsedClause.getVarList(),
12106 ParsedClause.getEndLoc());
12109template <
typename Derived>
12110void OpenACCClauseTransform<Derived>::VisitLinkClause(
12112 llvm_unreachable(
"link clause not valid unless a decl transform");
12115template <
typename Derived>
12116void OpenACCClauseTransform<Derived>::VisitDeviceResidentClause(
12118 llvm_unreachable(
"device_resident clause not valid unless a decl transform");
12120template <
typename Derived>
12121void OpenACCClauseTransform<Derived>::VisitNoHostClause(
12123 llvm_unreachable(
"nohost clause not valid unless a decl transform");
12125template <
typename Derived>
12126void OpenACCClauseTransform<Derived>::VisitBindClause(
12128 llvm_unreachable(
"bind clause not valid unless a decl transform");
12131template <
typename Derived>
12132void OpenACCClauseTransform<Derived>::VisitCopyInClause(
12134 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12135 C.getModifierList());
12138 Self.getSema().getASTContext(), ParsedClause.getClauseKind(),
12139 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12140 ParsedClause.getModifierList(), ParsedClause.getVarList(),
12141 ParsedClause.getEndLoc());
12144template <
typename Derived>
12145void OpenACCClauseTransform<Derived>::VisitCopyOutClause(
12147 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12148 C.getModifierList());
12151 Self.getSema().getASTContext(), ParsedClause.getClauseKind(),
12152 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12153 ParsedClause.getModifierList(), ParsedClause.getVarList(),
12154 ParsedClause.getEndLoc());
12157template <
typename Derived>
12158void OpenACCClauseTransform<Derived>::VisitCreateClause(
12160 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12161 C.getModifierList());
12164 Self.getSema().getASTContext(), ParsedClause.getClauseKind(),
12165 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12166 ParsedClause.getModifierList(), ParsedClause.getVarList(),
12167 ParsedClause.getEndLoc());
12169template <
typename Derived>
12170void OpenACCClauseTransform<Derived>::VisitAttachClause(
12175 llvm::erase_if(VarList, [&](
Expr *E) {
12176 return Self.getSema().OpenACC().CheckVarIsPointerType(
12182 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12183 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12184 ParsedClause.getEndLoc());
12187template <
typename Derived>
12188void OpenACCClauseTransform<Derived>::VisitDetachClause(
12193 llvm::erase_if(VarList, [&](
Expr *E) {
12194 return Self.getSema().OpenACC().CheckVarIsPointerType(
12200 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12201 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12202 ParsedClause.getEndLoc());
12205template <
typename Derived>
12206void OpenACCClauseTransform<Derived>::VisitDeleteClause(
12208 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12211 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12212 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12213 ParsedClause.getEndLoc());
12216template <
typename Derived>
12217void OpenACCClauseTransform<Derived>::VisitUseDeviceClause(
12219 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12222 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12223 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12224 ParsedClause.getEndLoc());
12227template <
typename Derived>
12228void OpenACCClauseTransform<Derived>::VisitDevicePtrClause(
12233 llvm::erase_if(VarList, [&](
Expr *E) {
12234 return Self.getSema().OpenACC().CheckVarIsPointerType(
12240 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12241 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12242 ParsedClause.getEndLoc());
12245template <
typename Derived>
12246void OpenACCClauseTransform<Derived>::VisitNumWorkersClause(
12248 Expr *IntExpr =
const_cast<Expr *
>(
C.getIntExpr());
12249 assert(IntExpr &&
"num_workers clause constructed with invalid int expr");
12252 if (!Res.isUsable())
12257 C.getBeginLoc(), Res.get());
12258 if (!Res.isUsable())
12261 ParsedClause.setIntExprDetails(Res.get());
12263 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12264 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs()[0],
12265 ParsedClause.getEndLoc());
12268template <
typename Derived>
12269void OpenACCClauseTransform<Derived>::VisitDeviceNumClause (
12271 Expr *IntExpr =
const_cast<Expr *
>(
C.getIntExpr());
12272 assert(IntExpr &&
"device_num clause constructed with invalid int expr");
12275 if (!Res.isUsable())
12280 C.getBeginLoc(), Res.get());
12281 if (!Res.isUsable())
12284 ParsedClause.setIntExprDetails(Res.get());
12286 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12287 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs()[0],
12288 ParsedClause.getEndLoc());
12291template <
typename Derived>
12292void OpenACCClauseTransform<Derived>::VisitDefaultAsyncClause(
12294 Expr *IntExpr =
const_cast<Expr *
>(
C.getIntExpr());
12295 assert(IntExpr &&
"default_async clause constructed with invalid int expr");
12298 if (!Res.isUsable())
12303 C.getBeginLoc(), Res.get());
12304 if (!Res.isUsable())
12307 ParsedClause.setIntExprDetails(Res.get());
12309 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12310 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs()[0],
12311 ParsedClause.getEndLoc());
12314template <
typename Derived>
12315void OpenACCClauseTransform<Derived>::VisitVectorLengthClause(
12317 Expr *IntExpr =
const_cast<Expr *
>(
C.getIntExpr());
12318 assert(IntExpr &&
"vector_length clause constructed with invalid int expr");
12321 if (!Res.isUsable())
12326 C.getBeginLoc(), Res.get());
12327 if (!Res.isUsable())
12330 ParsedClause.setIntExprDetails(Res.get());
12332 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12333 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs()[0],
12334 ParsedClause.getEndLoc());
12337template <
typename Derived>
12338void OpenACCClauseTransform<Derived>::VisitAsyncClause(
12340 if (
C.hasIntExpr()) {
12342 if (!Res.isUsable())
12347 C.getBeginLoc(), Res.get());
12348 if (!Res.isUsable())
12350 ParsedClause.setIntExprDetails(Res.get());
12354 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12355 ParsedClause.getLParenLoc(),
12356 ParsedClause.getNumIntExprs() != 0 ? ParsedClause.getIntExprs()[0]
12358 ParsedClause.getEndLoc());
12361template <
typename Derived>
12362void OpenACCClauseTransform<Derived>::VisitWorkerClause(
12364 if (
C.hasIntExpr()) {
12369 if (!Res.isUsable())
12374 C.getBeginLoc(), Res.get());
12375 if (!Res.isUsable())
12377 ParsedClause.setIntExprDetails(Res.get());
12381 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12382 ParsedClause.getLParenLoc(),
12383 ParsedClause.getNumIntExprs() != 0 ? ParsedClause.getIntExprs()[0]
12385 ParsedClause.getEndLoc());
12388template <
typename Derived>
12389void OpenACCClauseTransform<Derived>::VisitVectorClause(
12391 if (
C.hasIntExpr()) {
12396 if (!Res.isUsable())
12401 C.getBeginLoc(), Res.get());
12402 if (!Res.isUsable())
12404 ParsedClause.setIntExprDetails(Res.get());
12408 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12409 ParsedClause.getLParenLoc(),
12410 ParsedClause.getNumIntExprs() != 0 ? ParsedClause.getIntExprs()[0]
12412 ParsedClause.getEndLoc());
12415template <
typename Derived>
12416void OpenACCClauseTransform<Derived>::VisitWaitClause(
12418 if (
C.hasExprs()) {
12419 Expr *DevNumExpr =
nullptr;
12423 if (
C.getDevNumExpr()) {
12425 if (!Res.isUsable())
12429 C.getBeginLoc(), Res.get());
12430 if (!Res.isUsable())
12433 DevNumExpr = Res.get();
12437 for (
Expr *CurQueueIdExpr :
C.getQueueIdExprs()) {
12439 if (!Res.isUsable())
12443 C.getBeginLoc(), Res.get());
12444 if (!Res.isUsable())
12447 InstantiatedQueueIdExprs.push_back(Res.get());
12450 ParsedClause.setWaitDetails(DevNumExpr,
C.getQueuesLoc(),
12451 std::move(InstantiatedQueueIdExprs));
12455 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12456 ParsedClause.getLParenLoc(), ParsedClause.getDevNumExpr(),
12457 ParsedClause.getQueuesLoc(), ParsedClause.getQueueIdExprs(),
12458 ParsedClause.getEndLoc());
12461template <
typename Derived>
12462void OpenACCClauseTransform<Derived>::VisitDeviceTypeClause(
12466 Self.getSema().getASTContext(),
C.getClauseKind(),
12467 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12468 C.getArchitectures(), ParsedClause.getEndLoc());
12471template <
typename Derived>
12472void OpenACCClauseTransform<Derived>::VisitAutoClause(
12476 ParsedClause.getBeginLoc(),
12477 ParsedClause.getEndLoc());
12480template <
typename Derived>
12481void OpenACCClauseTransform<Derived>::VisitIndependentClause(
12484 ParsedClause.getBeginLoc(),
12485 ParsedClause.getEndLoc());
12488template <
typename Derived>
12489void OpenACCClauseTransform<Derived>::VisitSeqClause(
12492 ParsedClause.getBeginLoc(),
12493 ParsedClause.getEndLoc());
12495template <
typename Derived>
12496void OpenACCClauseTransform<Derived>::VisitFinalizeClause(
12499 ParsedClause.getBeginLoc(),
12500 ParsedClause.getEndLoc());
12503template <
typename Derived>
12504void OpenACCClauseTransform<Derived>::VisitIfPresentClause(
12507 ParsedClause.getBeginLoc(),
12508 ParsedClause.getEndLoc());
12511template <
typename Derived>
12512void OpenACCClauseTransform<Derived>::VisitReductionClause(
12518 for (
const auto [Var, OrigRecipe] :
12519 llvm::zip(TransformedVars,
C.getRecipes())) {
12521 ParsedClause.getDirectiveKind(),
C.getReductionOp(), Var);
12522 if (Res.isUsable()) {
12523 ValidVars.push_back(Res.get());
12525 if (OrigRecipe.isSet())
12526 Recipes.emplace_back(OrigRecipe.AllocaDecl, OrigRecipe.CombinerRecipes);
12528 Recipes.push_back(
Self.getSema().OpenACC().CreateReductionInitRecipe(
12529 C.getReductionOp(), Res.get()));
12533 NewClause =
Self.getSema().OpenACC().CheckReductionClause(
12534 ExistingClauses, ParsedClause.getDirectiveKind(),
12535 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12536 C.getReductionOp(), ValidVars, Recipes, ParsedClause.getEndLoc());
12539template <
typename Derived>
12540void OpenACCClauseTransform<Derived>::VisitCollapseClause(
12542 Expr *LoopCount =
const_cast<Expr *
>(
C.getLoopCount());
12543 assert(LoopCount &&
"collapse clause constructed with invalid loop count");
12547 NewLoopCount =
Self.getSema().OpenACC().ActOnIntExpr(
12549 NewLoopCount.get()->getBeginLoc(), NewLoopCount.get());
12552 Self.getSema().OpenACC().CheckCollapseLoopCount(NewLoopCount.get());
12554 ParsedClause.setCollapseDetails(
C.hasForce(), NewLoopCount.get());
12556 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12557 ParsedClause.getLParenLoc(), ParsedClause.isForce(),
12558 ParsedClause.getLoopCount(), ParsedClause.getEndLoc());
12561template <
typename Derived>
12562void OpenACCClauseTransform<Derived>::VisitTileClause(
12567 for (
Expr *E :
C.getSizeExprs()) {
12570 if (!NewSizeExpr.isUsable())
12573 NewSizeExpr =
Self.getSema().OpenACC().ActOnIntExpr(
12575 NewSizeExpr.get()->getBeginLoc(), NewSizeExpr.get());
12577 NewSizeExpr =
Self.getSema().OpenACC().CheckTileSizeExpr(NewSizeExpr.get());
12579 if (!NewSizeExpr.isUsable())
12581 TransformedExprs.push_back(NewSizeExpr.get());
12584 ParsedClause.setIntExprDetails(TransformedExprs);
12586 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12587 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs(),
12588 ParsedClause.getEndLoc());
12590template <
typename Derived>
12591void OpenACCClauseTransform<Derived>::VisitGangClause(
12596 for (
unsigned I = 0; I <
C.getNumExprs(); ++I) {
12598 if (!ER.isUsable())
12601 ER =
Self.getSema().OpenACC().CheckGangExpr(ExistingClauses,
12602 ParsedClause.getDirectiveKind(),
12603 C.getExpr(I).first, ER.get());
12604 if (!ER.isUsable())
12606 TransformedGangKinds.push_back(
C.getExpr(I).first);
12607 TransformedIntExprs.push_back(ER.get());
12610 NewClause =
Self.getSema().OpenACC().CheckGangClause(
12611 ParsedClause.getDirectiveKind(), ExistingClauses,
12612 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12613 TransformedGangKinds, TransformedIntExprs, ParsedClause.getEndLoc());
12616template <
typename Derived>
12617OpenACCClause *TreeTransform<Derived>::TransformOpenACCClause(
12622 DirKind, OldClause->getClauseKind(), OldClause->getBeginLoc());
12623 ParsedClause.setEndLoc(OldClause->getEndLoc());
12625 if (
const auto *WithParms = dyn_cast<OpenACCClauseWithParams>(OldClause))
12626 ParsedClause.setLParenLoc(WithParms->getLParenLoc());
12628 OpenACCClauseTransform<Derived> Transform{*
this, ExistingClauses,
12630 Transform.Visit(OldClause);
12632 return Transform.CreatedClause();
12635template <
typename Derived>
12637TreeTransform<Derived>::TransformOpenACCClauseList(
12640 for (
const auto *Clause : OldClauses) {
12641 if (
OpenACCClause *TransformedClause = getDerived().TransformOpenACCClause(
12642 TransformedClauses, DirKind, Clause))
12643 TransformedClauses.push_back(TransformedClause);
12645 return TransformedClauses;
12648template <
typename Derived>
12651 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12654 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12657 if (getSema().OpenACC().ActOnStartStmtDirective(
12658 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12663 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
12664 C->clauses(), TransformedClauses);
12665 StmtResult StrBlock = getDerived().TransformStmt(
C->getStructuredBlock());
12666 StrBlock = getSema().OpenACC().ActOnAssociatedStmt(
12667 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses, StrBlock);
12669 return getDerived().RebuildOpenACCComputeConstruct(
12670 C->getDirectiveKind(),
C->getBeginLoc(),
C->getDirectiveLoc(),
12671 C->getEndLoc(), TransformedClauses, StrBlock);
12674template <
typename Derived>
12678 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12681 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12684 if (getSema().OpenACC().ActOnStartStmtDirective(
12685 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12690 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
12691 C->clauses(), TransformedClauses);
12693 Loop = getSema().OpenACC().ActOnAssociatedStmt(
12694 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses,
Loop);
12696 return getDerived().RebuildOpenACCLoopConstruct(
12697 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12698 TransformedClauses,
Loop);
12701template <
typename Derived>
12703 OpenACCCombinedConstruct *
C) {
12704 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12707 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12710 if (getSema().OpenACC().ActOnStartStmtDirective(
12711 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12716 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
12717 C->clauses(), TransformedClauses);
12719 Loop = getSema().OpenACC().ActOnAssociatedStmt(
12720 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses,
Loop);
12722 return getDerived().RebuildOpenACCCombinedConstruct(
12723 C->getDirectiveKind(),
C->getBeginLoc(),
C->getDirectiveLoc(),
12724 C->getEndLoc(), TransformedClauses,
Loop);
12727template <
typename Derived>
12730 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12733 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12735 if (getSema().OpenACC().ActOnStartStmtDirective(
12736 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12740 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
12741 C->clauses(), TransformedClauses);
12742 StmtResult StrBlock = getDerived().TransformStmt(
C->getStructuredBlock());
12743 StrBlock = getSema().OpenACC().ActOnAssociatedStmt(
12744 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses, StrBlock);
12746 return getDerived().RebuildOpenACCDataConstruct(
12747 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12748 TransformedClauses, StrBlock);
12751template <
typename Derived>
12753 OpenACCEnterDataConstruct *
C) {
12754 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12757 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12759 if (getSema().OpenACC().ActOnStartStmtDirective(
12760 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12763 return getDerived().RebuildOpenACCEnterDataConstruct(
12764 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12765 TransformedClauses);
12768template <
typename Derived>
12770 OpenACCExitDataConstruct *
C) {
12771 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12774 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12776 if (getSema().OpenACC().ActOnStartStmtDirective(
12777 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12780 return getDerived().RebuildOpenACCExitDataConstruct(
12781 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12782 TransformedClauses);
12785template <
typename Derived>
12787 OpenACCHostDataConstruct *
C) {
12788 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12791 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12793 if (getSema().OpenACC().ActOnStartStmtDirective(
12794 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12798 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
12799 C->clauses(), TransformedClauses);
12800 StmtResult StrBlock = getDerived().TransformStmt(
C->getStructuredBlock());
12801 StrBlock = getSema().OpenACC().ActOnAssociatedStmt(
12802 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses, StrBlock);
12804 return getDerived().RebuildOpenACCHostDataConstruct(
12805 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12806 TransformedClauses, StrBlock);
12809template <
typename Derived>
12812 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12815 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12817 if (getSema().OpenACC().ActOnStartStmtDirective(
12818 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12821 return getDerived().RebuildOpenACCInitConstruct(
12822 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12823 TransformedClauses);
12826template <
typename Derived>
12828 OpenACCShutdownConstruct *
C) {
12829 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12832 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12834 if (getSema().OpenACC().ActOnStartStmtDirective(
12835 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12838 return getDerived().RebuildOpenACCShutdownConstruct(
12839 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12840 TransformedClauses);
12842template <
typename Derived>
12845 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12848 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12850 if (getSema().OpenACC().ActOnStartStmtDirective(
12851 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12854 return getDerived().RebuildOpenACCSetConstruct(
12855 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12856 TransformedClauses);
12859template <
typename Derived>
12861 OpenACCUpdateConstruct *
C) {
12862 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12865 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12867 if (getSema().OpenACC().ActOnStartStmtDirective(
12868 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12871 return getDerived().RebuildOpenACCUpdateConstruct(
12872 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12873 TransformedClauses);
12876template <
typename Derived>
12879 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12882 if (
C->hasDevNumExpr()) {
12883 DevNumExpr = getDerived().TransformExpr(
C->getDevNumExpr());
12885 if (DevNumExpr.isUsable())
12886 DevNumExpr = getSema().OpenACC().ActOnIntExpr(
12888 C->getBeginLoc(), DevNumExpr.get());
12893 for (
Expr *QE :
C->getQueueIdExprs()) {
12894 assert(QE &&
"Null queue id expr?");
12895 ExprResult NewEQ = getDerived().TransformExpr(QE);
12897 if (!NewEQ.isUsable())
12901 C->getBeginLoc(), NewEQ.get());
12902 if (NewEQ.isUsable())
12903 QueueIdExprs.push_back(NewEQ.get());
12907 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12910 if (getSema().OpenACC().ActOnStartStmtDirective(
12911 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12914 return getDerived().RebuildOpenACCWaitConstruct(
12915 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getLParenLoc(),
12916 DevNumExpr.isUsable() ? DevNumExpr.get() :
nullptr,
C->getQueuesLoc(),
12917 QueueIdExprs,
C->getRParenLoc(),
C->getEndLoc(), TransformedClauses);
12919template <
typename Derived>
12921 OpenACCCacheConstruct *
C) {
12922 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12925 for (
Expr *Var :
C->getVarList()) {
12926 assert(Var &&
"Null var listexpr?");
12928 ExprResult NewVar = getDerived().TransformExpr(Var);
12930 if (!NewVar.isUsable())
12933 NewVar = getSema().OpenACC().ActOnVar(
12935 if (!NewVar.isUsable())
12938 TransformedVarList.push_back(NewVar.get());
12941 if (getSema().OpenACC().ActOnStartStmtDirective(
C->getDirectiveKind(),
12942 C->getBeginLoc(), {}))
12945 return getDerived().RebuildOpenACCCacheConstruct(
12946 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getLParenLoc(),
12947 C->getReadOnlyLoc(), TransformedVarList,
C->getRParenLoc(),
12951template <
typename Derived>
12953 OpenACCAtomicConstruct *
C) {
12954 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12957 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12960 if (getSema().OpenACC().ActOnStartStmtDirective(
C->getDirectiveKind(),
12961 C->getBeginLoc(), {}))
12966 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(), {}, {});
12968 StmtResult AssocStmt = getDerived().TransformStmt(
C->getAssociatedStmt());
12969 AssocStmt = getSema().OpenACC().ActOnAssociatedStmt(
12970 C->getBeginLoc(),
C->getDirectiveKind(),
C->getAtomicKind(), {},
12973 return getDerived().RebuildOpenACCAtomicConstruct(
12974 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getAtomicKind(),
12975 C->getEndLoc(), TransformedClauses, AssocStmt);
12978template <
typename Derived>
12981 if (getDerived().AlwaysRebuild())
12990template<
typename Derived>
12993 return TransformExpr(E->getSubExpr());
12996template <
typename Derived>
12999 if (!E->isTypeDependent())
13002 TypeSourceInfo *NewT = getDerived().TransformType(E->getTypeSourceInfo());
13007 if (!getDerived().AlwaysRebuild() && E->getTypeSourceInfo() == NewT)
13010 return getDerived().RebuildSYCLUniqueStableNameExpr(
13011 E->getLocation(), E->getLParenLocation(), E->getRParenLocation(), NewT);
13014template<
typename Derived>
13017 if (!E->isTypeDependent())
13021 E->getIdentKind());
13024template<
typename Derived>
13028 if (E->getQualifierLoc()) {
13030 = getDerived().TransformNestedNameSpecifierLoc(E->getQualifierLoc());
13036 = cast_or_null<ValueDecl>(getDerived().TransformDecl(E->getLocation(),
13038 if (!ND || ND->isInvalidDecl())
13042 if (E->getFoundDecl() != E->getDecl()) {
13043 Found = cast_or_null<NamedDecl>(
13044 getDerived().TransformDecl(E->getLocation(), E->getFoundDecl()));
13050 if (NameInfo.getName()) {
13051 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
13052 if (!NameInfo.getName())
13056 if (!getDerived().AlwaysRebuild() &&
13057 !E->isCapturedByCopyInLambdaWithExplicitObjectParameter() &&
13058 QualifierLoc == E->getQualifierLoc() && ND == E->getDecl() &&
13059 Found == E->getFoundDecl() &&
13060 NameInfo.getName() == E->getDecl()->getDeclName() &&
13061 !E->hasExplicitTemplateArgs()) {
13071 if (E->hasExplicitTemplateArgs()) {
13072 TemplateArgs = &TransArgs;
13073 TransArgs.setLAngleLoc(E->getLAngleLoc());
13074 TransArgs.setRAngleLoc(E->getRAngleLoc());
13075 if (getDerived().TransformTemplateArguments(E->getTemplateArgs(),
13076 E->getNumTemplateArgs(),
13081 return getDerived().RebuildDeclRefExpr(QualifierLoc, ND, NameInfo,
13082 Found, TemplateArgs);
13085template<
typename Derived>
13091template <
typename Derived>
13097template<
typename Derived>
13103template<
typename Derived>
13109template<
typename Derived>
13115template<
typename Derived>
13121template<
typename Derived>
13124 return getDerived().TransformCallExpr(E);
13127template<
typename Derived>
13132 if (E->isExprPredicate())
13133 ControllingExpr = getDerived().TransformExpr(E->getControllingExpr());
13135 ControllingType = getDerived().TransformType(E->getControllingType());
13137 if (ControllingExpr.isInvalid() && !ControllingType)
13148 AssocTypes.push_back(AssocType);
13150 AssocTypes.push_back(
nullptr);
13154 getDerived().TransformExpr(Assoc.getAssociationExpr());
13155 if (AssocExpr.isInvalid())
13157 AssocExprs.push_back(AssocExpr.get());
13160 if (!ControllingType)
13161 return getDerived().RebuildGenericSelectionExpr(E->getGenericLoc(),
13162 E->getDefaultLoc(),
13164 ControllingExpr.get(),
13167 return getDerived().RebuildGenericSelectionExpr(
13168 E->getGenericLoc(), E->getDefaultLoc(), E->getRParenLoc(),
13169 ControllingType, AssocTypes, AssocExprs);
13172template<
typename Derived>
13175 ExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
13176 if (SubExpr.isInvalid())
13179 if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getSubExpr())
13182 return getDerived().RebuildParenExpr(SubExpr.get(), E->getLParen(),
13189template<
typename Derived>
13193 return getDerived().TransformDependentScopeDeclRefExpr(
13194 DRE,
true,
nullptr);
13196 return getDerived().TransformUnresolvedLookupExpr(
13202template<
typename Derived>
13207 SubExpr = TransformAddressOfOperand(E->
getSubExpr());
13213 if (!getDerived().AlwaysRebuild() && SubExpr.
get() == E->
getSubExpr())
13221template<
typename Derived>
13223TreeTransform<Derived>::TransformOffsetOfExpr(OffsetOfExpr *E) {
13225 TypeSourceInfo *Type = getDerived().TransformType(E->getTypeSourceInfo());
13235 bool ExprChanged =
false;
13236 typedef Sema::OffsetOfComponent Component;
13238 for (
unsigned I = 0, N = E->getNumComponents(); I != N; ++I) {
13239 const OffsetOfNode &ON = E->getComponent(I);
13241 Comp.isBrackets =
true;
13242 Comp.LocStart = ON.getSourceRange().getBegin();
13243 Comp.LocEnd = ON.getSourceRange().getEnd();
13244 switch (ON.getKind()) {
13246 Expr *FromIndex = E->getIndexExpr(ON.getArrayExprIndex());
13247 ExprResult Index = getDerived().TransformExpr(FromIndex);
13248 if (Index.isInvalid())
13251 ExprChanged = ExprChanged || Index.get() != FromIndex;
13252 Comp.isBrackets =
true;
13253 Comp.U.E = Index.get();
13259 Comp.isBrackets =
false;
13260 Comp.U.IdentInfo = ON.getFieldName();
13261 if (!
Comp.U.IdentInfo)
13271 Components.push_back(Comp);
13275 if (!getDerived().AlwaysRebuild() &&
13276 Type == E->getTypeSourceInfo() &&
13281 return getDerived().RebuildOffsetOfExpr(E->getOperatorLoc(),
Type,
13282 Components, E->getRParenLoc());
13285template<
typename Derived>
13288 assert((!E->getSourceExpr() || getDerived().AlreadyTransformed(E->getType())) &&
13289 "opaque value expression requires transformation");
13293template <
typename Derived>
13297 for (
Expr *
C : E->subExpressions()) {
13299 if (NewC.isInvalid())
13305 if (!getDerived().AlwaysRebuild() && !Changed)
13307 return getDerived().RebuildRecoveryExpr(E->getBeginLoc(), E->getEndLoc(),
13311template<
typename Derived>
13321 ExprResult result = getDerived().TransformExpr(newSyntacticForm);
13322 if (result.isInvalid())
return ExprError();
13327 if (result.get()->hasPlaceholderType(BuiltinType::PseudoObject))
13333template<
typename Derived>
13337 if (E->isArgumentType()) {
13344 if (!getDerived().AlwaysRebuild() && OldT == NewT)
13347 return getDerived().RebuildUnaryExprOrTypeTrait(NewT, E->getOperatorLoc(),
13349 E->getSourceRange());
13363 auto *PE = dyn_cast<ParenExpr>(E->getArgumentExpr());
13365 PE ? dyn_cast<DependentScopeDeclRefExpr>(PE->getSubExpr()) :
nullptr)
13366 SubExpr = getDerived().TransformParenDependentScopeDeclRefExpr(
13367 PE, DRE,
false, &RecoveryTSI);
13369 SubExpr = getDerived().TransformExpr(E->getArgumentExpr());
13372 return getDerived().RebuildUnaryExprOrTypeTrait(
13373 RecoveryTSI, E->getOperatorLoc(), E->getKind(), E->getSourceRange());
13374 }
else if (SubExpr.isInvalid())
13377 if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getArgumentExpr())
13380 return getDerived().RebuildUnaryExprOrTypeTrait(SubExpr.get(),
13381 E->getOperatorLoc(),
13383 E->getSourceRange());
13386template<
typename Derived>
13389 ExprResult LHS = getDerived().TransformExpr(E->getLHS());
13390 if (LHS.isInvalid())
13393 ExprResult RHS = getDerived().TransformExpr(E->getRHS());
13394 if (RHS.isInvalid())
13398 if (!getDerived().AlwaysRebuild() &&
13399 LHS.get() == E->getLHS() &&
13400 RHS.get() == E->getRHS())
13403 return getDerived().RebuildArraySubscriptExpr(
13405 E->getLHS()->getBeginLoc(), RHS.get(), E->getRBracketLoc());
13408template <
typename Derived>
13412 if (
Base.isInvalid())
13415 ExprResult RowIdx = getDerived().TransformExpr(E->getRowIdx());
13416 if (RowIdx.isInvalid())
13419 if (!getDerived().AlwaysRebuild() &&
Base.get() == E->getBase() &&
13420 RowIdx.get() == E->getRowIdx())
13423 return getDerived().RebuildMatrixSingleSubscriptExpr(
Base.get(), RowIdx.get(),
13424 E->getRBracketLoc());
13427template <
typename Derived>
13431 if (
Base.isInvalid())
13434 ExprResult RowIdx = getDerived().TransformExpr(E->getRowIdx());
13435 if (RowIdx.isInvalid())
13438 ExprResult ColumnIdx = getDerived().TransformExpr(E->getColumnIdx());
13439 if (ColumnIdx.isInvalid())
13442 if (!getDerived().AlwaysRebuild() &&
Base.get() == E->getBase() &&
13443 RowIdx.get() == E->getRowIdx() && ColumnIdx.get() == E->getColumnIdx())
13446 return getDerived().RebuildMatrixSubscriptExpr(
13447 Base.get(), RowIdx.get(), ColumnIdx.get(), E->getRBracketLoc());
13450template <
typename Derived>
13454 if (
Base.isInvalid())
13458 if (E->getLowerBound()) {
13459 LowerBound = getDerived().TransformExpr(E->getLowerBound());
13460 if (LowerBound.isInvalid())
13465 if (E->getLength()) {
13466 Length = getDerived().TransformExpr(E->getLength());
13467 if (Length.isInvalid())
13472 if (E->isOMPArraySection()) {
13473 if (
Expr *Str = E->getStride()) {
13474 Stride = getDerived().TransformExpr(Str);
13475 if (Stride.isInvalid())
13480 if (!getDerived().AlwaysRebuild() &&
Base.get() == E->getBase() &&
13481 LowerBound.get() == E->getLowerBound() &&
13482 Length.get() == E->getLength() &&
13483 (E->isOpenACCArraySection() || Stride.get() == E->getStride()))
13486 return getDerived().RebuildArraySectionExpr(
13487 E->isOMPArraySection(),
Base.get(), E->getBase()->getEndLoc(),
13488 LowerBound.get(), E->getColonLocFirst(),
13489 E->isOMPArraySection() ? E->getColonLocSecond() :
SourceLocation{},
13490 Length.get(), Stride.get(), E->getRBracketLoc());
13493template <
typename Derived>
13497 if (
Base.isInvalid())
13501 bool ErrorFound =
false;
13502 for (
Expr *
Dim : E->getDimensions()) {
13504 if (DimRes.isInvalid()) {
13508 Dims.push_back(DimRes.get());
13513 return getDerived().RebuildOMPArrayShapingExpr(
Base.get(), E->getLParenLoc(),
13514 E->getRParenLoc(), Dims,
13515 E->getBracketsRanges());
13518template <
typename Derived>
13521 unsigned NumIterators = E->numOfIterators();
13524 bool ErrorFound =
false;
13525 bool NeedToRebuild = getDerived().AlwaysRebuild();
13526 for (
unsigned I = 0; I < NumIterators; ++I) {
13528 Data[I].DeclIdent = D->getIdentifier();
13529 Data[I].DeclIdentLoc = D->getLocation();
13530 if (D->getLocation() == D->getBeginLoc()) {
13532 "Implicit type must be int.");
13534 TypeSourceInfo *TSI = getDerived().TransformType(D->getTypeSourceInfo());
13542 ErrorFound = ErrorFound ||
13543 !(!D->getTypeSourceInfo() || (
Data[I].
Type.getAsOpaquePtr() &&
13544 !
Data[I].Type.get().isNull())) ||
13545 Begin.isInvalid() || End.isInvalid() || Step.isInvalid();
13548 Data[I].Range.Begin = Begin.get();
13549 Data[I].Range.End = End.get();
13550 Data[I].Range.Step = Step.get();
13551 Data[I].AssignLoc = E->getAssignLoc(I);
13552 Data[I].ColonLoc = E->getColonLoc(I);
13553 Data[I].SecColonLoc = E->getSecondColonLoc(I);
13556 (D->getTypeSourceInfo() &&
Data[I].
Type.get().getTypePtrOrNull() !=
13557 D->getType().getTypePtrOrNull()) ||
13563 if (!NeedToRebuild)
13566 ExprResult Res = getDerived().RebuildOMPIteratorExpr(
13567 E->getIteratorKwLoc(), E->getLParenLoc(), E->getRParenLoc(),
Data);
13568 if (!Res.isUsable())
13571 for (
unsigned I = 0; I < NumIterators; ++I)
13572 getDerived().transformedLocalDecl(E->getIteratorDecl(I),
13573 IE->getIteratorDecl(I));
13577template<
typename Derived>
13586 bool ArgChanged =
false;
13588 if (getDerived().TransformExprs(E->getArgs(), E->getNumArgs(),
true, Args,
13592 if (!getDerived().AlwaysRebuild() &&
13593 Callee.get() == E->getCallee() &&
13599 = ((
Expr *)
Callee.get())->getSourceRange().getBegin();
13602 if (E->hasStoredFPFeatures()) {
13604 getSema().CurFPFeatures =
13606 getSema().FpPragmaStack.CurrentValue = NewOverrides;
13609 return getDerived().RebuildCallExpr(
Callee.get(), FakeLParenLoc,
13611 E->getRParenLoc());
13614template<
typename Derived>
13618 if (
Base.isInvalid())
13622 if (E->hasQualifier()) {
13624 = getDerived().TransformNestedNameSpecifierLoc(E->getQualifierLoc());
13632 = cast_or_null<ValueDecl>(getDerived().TransformDecl(E->getMemberLoc(),
13633 E->getMemberDecl()));
13637 NamedDecl *FoundDecl = E->getFoundDecl();
13638 if (FoundDecl == E->getMemberDecl()) {
13641 FoundDecl = cast_or_null<NamedDecl>(
13642 getDerived().TransformDecl(E->getMemberLoc(), FoundDecl));
13647 if (!getDerived().AlwaysRebuild() &&
13648 Base.get() == E->getBase() &&
13649 QualifierLoc == E->getQualifierLoc() &&
13650 Member == E->getMemberDecl() &&
13651 FoundDecl == E->getFoundDecl() &&
13652 !E->hasExplicitTemplateArgs()) {
13657 getSema().OpenMP().isOpenMPRebuildMemberExpr(
13667 if (E->hasExplicitTemplateArgs()) {
13668 TransArgs.setLAngleLoc(E->getLAngleLoc());
13669 TransArgs.setRAngleLoc(E->getRAngleLoc());
13670 if (getDerived().TransformTemplateArguments(E->getTemplateArgs(),
13671 E->getNumTemplateArgs(),
13684 NamedDecl *FirstQualifierInScope =
nullptr;
13686 if (MemberNameInfo.getName()) {
13687 MemberNameInfo = getDerived().TransformDeclarationNameInfo(MemberNameInfo);
13688 if (!MemberNameInfo.getName())
13692 return getDerived().RebuildMemberExpr(
Base.get(), FakeOperatorLoc,
13699 (E->hasExplicitTemplateArgs()
13700 ? &TransArgs :
nullptr),
13701 FirstQualifierInScope);
13704template<
typename Derived>
13707 ExprResult LHS = getDerived().TransformExpr(E->getLHS());
13708 if (LHS.isInvalid())
13712 getDerived().TransformInitializer(E->getRHS(),
false);
13713 if (RHS.isInvalid())
13716 if (!getDerived().AlwaysRebuild() &&
13717 LHS.get() == E->getLHS() &&
13718 RHS.get() == E->getRHS())
13721 if (E->isCompoundAssignmentOp())
13723 return getDerived().RebuildBinaryOperator(
13724 E->getOperatorLoc(), E->getOpcode(), LHS.get(), RHS.get());
13727 getSema().CurFPFeatures =
13728 NewOverrides.applyOverrides(getSema().getLangOpts());
13729 getSema().FpPragmaStack.CurrentValue = NewOverrides;
13730 return getDerived().RebuildBinaryOperator(E->getOperatorLoc(), E->getOpcode(),
13731 LHS.get(), RHS.get());
13734template <
typename Derived>
13739 ExprResult LHS = getDerived().TransformExpr(
const_cast<Expr*
>(Decomp.LHS));
13740 if (LHS.isInvalid())
13743 ExprResult RHS = getDerived().TransformExpr(
const_cast<Expr*
>(Decomp.RHS));
13744 if (RHS.isInvalid())
13750 bool ChangedAnyLookups =
false;
13751 Expr *PossibleBinOps[] = {E->getSemanticForm(),
13752 const_cast<Expr *
>(Decomp.InnerBinOp)};
13753 for (
Expr *PossibleBinOp : PossibleBinOps) {
13754 auto *Op = dyn_cast<CXXOperatorCallExpr>(PossibleBinOp->IgnoreImplicit());
13757 auto *
Callee = dyn_cast<DeclRefExpr>(Op->getCallee()->IgnoreImplicit());
13763 NamedDecl *
Found = cast_or_null<NamedDecl>(getDerived().TransformDecl(
13764 E->getOperatorLoc(),
Callee->getFoundDecl()));
13768 ChangedAnyLookups =
true;
13769 UnqualLookups.addDecl(
Found);
13772 if (!getDerived().AlwaysRebuild() && !ChangedAnyLookups &&
13773 LHS.get() == Decomp.LHS && RHS.get() == Decomp.RHS) {
13779 const Expr *StopAt[] = {Decomp.LHS, Decomp.RHS};
13784 return getDerived().RebuildCXXRewrittenBinaryOperator(
13785 E->getOperatorLoc(), Decomp.Opcode, UnqualLookups, LHS.get(), RHS.get());
13788template<
typename Derived>
13794 getSema().CurFPFeatures =
13795 NewOverrides.applyOverrides(getSema().getLangOpts());
13796 getSema().FpPragmaStack.CurrentValue = NewOverrides;
13797 return getDerived().TransformBinaryOperator(E);
13800template<
typename Derived>
13806 ExprResult commonExpr = getDerived().TransformExpr(e->getCommon());
13807 if (commonExpr.isInvalid())
13810 ExprResult rhs = getDerived().TransformExpr(e->getFalseExpr());
13811 if (rhs.isInvalid())
13814 if (!getDerived().AlwaysRebuild() &&
13815 commonExpr.get() == e->getCommon() &&
13816 rhs.get() == e->getFalseExpr())
13819 return getDerived().RebuildConditionalOperator(commonExpr.get(),
13820 e->getQuestionLoc(),
13826template<
typename Derived>
13830 if (
Cond.isInvalid())
13833 ExprResult LHS = getDerived().TransformExpr(E->getLHS());
13834 if (LHS.isInvalid())
13837 ExprResult RHS = getDerived().TransformExpr(E->getRHS());
13838 if (RHS.isInvalid())
13841 if (!getDerived().AlwaysRebuild() &&
13842 Cond.get() == E->getCond() &&
13843 LHS.get() == E->getLHS() &&
13844 RHS.get() == E->getRHS())
13847 return getDerived().RebuildConditionalOperator(
Cond.get(),
13848 E->getQuestionLoc(),
13854template<
typename Derived>
13859 return getDerived().
TransformExpr(E->getSubExprAsWritten());
13862template<
typename Derived>
13870 = getDerived().TransformExpr(E->getSubExprAsWritten());
13871 if (SubExpr.isInvalid())
13874 if (!getDerived().AlwaysRebuild() &&
13875 Type == E->getTypeInfoAsWritten() &&
13876 SubExpr.get() == E->getSubExpr())
13879 return getDerived().RebuildCStyleCastExpr(E->getLParenLoc(),
13885template<
typename Derived>
13893 ExprResult Init = getDerived().TransformExpr(E->getInitializer());
13894 if (
Init.isInvalid())
13897 if (!getDerived().AlwaysRebuild() &&
13899 Init.get() == E->getInitializer())
13906 return getDerived().RebuildCompoundLiteralExpr(
13907 E->getLParenLoc(), NewT,
13908 E->getInitializer()->getEndLoc(),
Init.get());
13911template<
typename Derived>
13915 if (
Base.isInvalid())
13918 if (!getDerived().AlwaysRebuild() &&
13919 Base.get() == E->getBase())
13925 return getDerived().RebuildExtVectorElementExpr(
13926 Base.get(), FakeOperatorLoc, E->isArrow(), E->getAccessorLoc(),
13930template<
typename Derived>
13936 bool InitChanged =
false;
13942 if (getDerived().TransformExprs(E->getInits(), E->getNumInits(),
false,
13943 Inits, &InitChanged))
13946 if (!getDerived().AlwaysRebuild() && !InitChanged) {
13953 return getDerived().RebuildInitList(E->getLBraceLoc(), Inits,
13954 E->getRBraceLoc());
13957template<
typename Derived>
13964 if (
Init.isInvalid())
13969 bool ExprChanged =
false;
13971 if (D.isFieldDesignator()) {
13972 if (D.getFieldDecl()) {
13974 getDerived().TransformDecl(D.getFieldLoc(), D.getFieldDecl()));
13975 if (Field != D.getFieldDecl())
13978 ExprChanged =
true;
13979 if (
Field->isAnonymousStructOrUnion())
13985 ExprChanged =
true;
13988 D.getFieldName(), D.getDotLoc(), D.getFieldLoc()));
13992 if (D.isArrayDesignator()) {
13993 ExprResult Index = getDerived().TransformExpr(E->getArrayIndex(D));
13994 if (Index.isInvalid())
13997 Desig.AddDesignator(
14000 ExprChanged = ExprChanged || Index.get() != E->getArrayIndex(D);
14001 ArrayExprs.push_back(Index.get());
14005 assert(D.isArrayRangeDesignator() &&
"New kind of designator?");
14007 = getDerived().TransformExpr(E->getArrayRangeStart(D));
14008 if (Start.isInvalid())
14011 ExprResult End = getDerived().TransformExpr(E->getArrayRangeEnd(D));
14012 if (End.isInvalid())
14016 Start.get(), End.get(), D.getLBracketLoc(), D.getEllipsisLoc()));
14018 ExprChanged = ExprChanged || Start.get() != E->getArrayRangeStart(D) ||
14019 End.get() != E->getArrayRangeEnd(D);
14021 ArrayExprs.push_back(Start.get());
14022 ArrayExprs.push_back(End.get());
14025 if (!getDerived().AlwaysRebuild() &&
14026 Init.get() == E->getInit() &&
14030 return getDerived().RebuildDesignatedInitExpr(Desig, ArrayExprs,
14031 E->getEqualOrColonLoc(),
14032 E->usesGNUSyntax(),
Init.get());
14037template<
typename Derived>
14041 llvm_unreachable(
"Unexpected DesignatedInitUpdateExpr in syntactic form of "
14046template<
typename Derived>
14050 llvm_unreachable(
"Unexpected NoInitExpr in syntactic form of initializer");
14054template<
typename Derived>
14057 llvm_unreachable(
"Unexpected ArrayInitLoopExpr outside of initializer");
14061template<
typename Derived>
14064 llvm_unreachable(
"Unexpected ArrayInitIndexExpr outside of initializer");
14068template<
typename Derived>
14076 QualType T = getDerived().TransformType(E->getType());
14080 if (!getDerived().AlwaysRebuild() &&
14084 return getDerived().RebuildImplicitValueInitExpr(
T);
14087template<
typename Derived>
14090 TypeSourceInfo *TInfo = getDerived().TransformType(E->getWrittenTypeInfo());
14094 ExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
14095 if (SubExpr.isInvalid())
14098 if (!getDerived().AlwaysRebuild() &&
14099 TInfo == E->getWrittenTypeInfo() &&
14100 SubExpr.get() == E->getSubExpr())
14103 return getDerived().RebuildVAArgExpr(E->getBuiltinLoc(), SubExpr.get(),
14104 TInfo, E->getRParenLoc());
14107template<
typename Derived>
14110 bool ArgumentChanged =
false;
14112 if (TransformExprs(E->getExprs(), E->getNumExprs(),
true, Inits,
14116 return getDerived().RebuildParenListExpr(E->getLParenLoc(),
14118 E->getRParenLoc());
14126template<
typename Derived>
14129 Decl *LD = getDerived().TransformDecl(E->getLabel()->getLocation(),
14134 return getDerived().RebuildAddrLabelExpr(E->getAmpAmpLoc(), E->getLabelLoc(),
14138template<
typename Derived>
14143 = getDerived().TransformCompoundStmt(E->getSubStmt(),
true);
14144 if (SubStmt.isInvalid()) {
14149 unsigned OldDepth = E->getTemplateDepth();
14150 unsigned NewDepth = getDerived().TransformTemplateDepth(OldDepth);
14152 if (!getDerived().AlwaysRebuild() && OldDepth == NewDepth &&
14153 SubStmt.get() == E->getSubStmt()) {
14159 return getDerived().RebuildStmtExpr(E->getLParenLoc(), SubStmt.get(),
14160 E->getRParenLoc(), NewDepth);
14163template<
typename Derived>
14167 if (
Cond.isInvalid())
14170 ExprResult LHS = getDerived().TransformExpr(E->getLHS());
14171 if (LHS.isInvalid())
14174 ExprResult RHS = getDerived().TransformExpr(E->getRHS());
14175 if (RHS.isInvalid())
14178 if (!getDerived().AlwaysRebuild() &&
14179 Cond.get() == E->getCond() &&
14180 LHS.get() == E->getLHS() &&
14181 RHS.get() == E->getRHS())
14184 return getDerived().RebuildChooseExpr(E->getBuiltinLoc(),
14185 Cond.get(), LHS.get(), RHS.get(),
14186 E->getRParenLoc());
14189template<
typename Derived>
14195template<
typename Derived>
14198 switch (E->getOperator()) {
14202 case OO_Array_Delete:
14203 llvm_unreachable(
"new and delete operators cannot use CXXOperatorCallExpr");
14208 assert(E->getNumArgs() >= 1 &&
"Object call is missing arguments");
14221 if (FakeLParenLoc.isInvalid() && EndLoc.isValid())
14222 FakeLParenLoc = EndLoc;
14226 if (getDerived().TransformExprs(E->getArgs() + 1, E->getNumArgs() - 1,
true,
14230 if (E->getOperator() == OO_Subscript)
14231 return getDerived().RebuildCxxSubscriptExpr(
Object.get(), FakeLParenLoc,
14232 Args, E->getEndLoc());
14234 return getDerived().RebuildCallExpr(
Object.get(), FakeLParenLoc, Args,
14238#define OVERLOADED_OPERATOR(Name, Spelling, Token, Unary, Binary, MemberOnly) \
14242#define OVERLOADED_OPERATOR_MULTI(Name,Spelling,Unary,Binary,MemberOnly)
14243#include "clang/Basic/OperatorKinds.def"
14245 case OO_Conditional:
14246 llvm_unreachable(
"conditional operator is not actually overloadable");
14250 llvm_unreachable(
"not an overloaded operator?");
14254 if (E->getNumArgs() == 1 && E->getOperator() == OO_Amp)
14255 First = getDerived().TransformAddressOfOperand(E->getArg(0));
14257 First = getDerived().TransformExpr(E->getArg(0));
14258 if (
First.isInvalid())
14262 if (E->getNumArgs() == 2) {
14264 getDerived().TransformInitializer(E->getArg(1),
false);
14265 if (Second.isInvalid())
14271 getSema().CurFPFeatures =
14272 NewOverrides.applyOverrides(getSema().getLangOpts());
14273 getSema().FpPragmaStack.CurrentValue = NewOverrides;
14277 LookupResult R(SemaRef, ULE->getName(), ULE->getNameLoc(),
14279 if (getDerived().TransformOverloadExprDecls(ULE, ULE->requiresADL(), R))
14282 return getDerived().RebuildCXXOperatorCallExpr(
14283 E->getOperator(), E->getOperatorLoc(),
Callee->getBeginLoc(),
14284 ULE->requiresADL(), R.asUnresolvedSet(),
First.get(), Second.get());
14289 Callee = ICE->getSubExprAsWritten();
14291 ValueDecl *VD = cast_or_null<ValueDecl>(
14292 getDerived().TransformDecl(DR->getLocation(), DR));
14297 Functions.addDecl(VD);
14299 return getDerived().RebuildCXXOperatorCallExpr(
14300 E->getOperator(), E->getOperatorLoc(),
Callee->getBeginLoc(),
14301 false, Functions,
First.get(), Second.get());
14304template<
typename Derived>
14307 return getDerived().TransformCallExpr(E);
14310template <
typename Derived>
14313 getSema().CurContext != E->getParentContext();
14315 if (!getDerived().AlwaysRebuild() && !NeedRebuildFunc)
14318 return getDerived().RebuildSourceLocExpr(E->getIdentKind(), E->getType(),
14319 E->getBeginLoc(), E->getEndLoc(),
14320 getSema().CurContext);
14323template <
typename Derived>
14328template<
typename Derived>
14337 ExprResult EC = getDerived().TransformCallExpr(E->getConfig());
14338 if (EC.isInvalid())
14342 bool ArgChanged =
false;
14344 if (getDerived().TransformExprs(E->getArgs(), E->getNumArgs(),
true, Args,
14348 if (!getDerived().AlwaysRebuild() &&
14349 Callee.get() == E->getCallee() &&
14355 = ((
Expr *)
Callee.get())->getSourceRange().getBegin();
14356 return getDerived().RebuildCallExpr(
Callee.get(), FakeLParenLoc,
14358 E->getRParenLoc(), EC.get());
14361template<
typename Derived>
14377 return getDerived().RebuildCXXNamedCastExpr(
14384template<
typename Derived>
14393 if (Sub.isInvalid())
14396 return getDerived().RebuildBuiltinBitCastExpr(BCE->
getBeginLoc(), TSI,
14400template<
typename Derived>
14402TreeTransform<Derived>::TransformCXXStaticCastExpr(CXXStaticCastExpr *E) {
14403 return getDerived().TransformCXXNamedCastExpr(E);
14406template<
typename Derived>
14412template<
typename Derived>
14419template<
typename Derived>
14425template<
typename Derived>
14431template<
typename Derived>
14436 getDerived().TransformTypeWithDeducedTST(E->getTypeInfoAsWritten());
14441 = getDerived().TransformExpr(E->getSubExprAsWritten());
14442 if (SubExpr.isInvalid())
14445 if (!getDerived().AlwaysRebuild() &&
14446 Type == E->getTypeInfoAsWritten() &&
14447 SubExpr.get() == E->getSubExpr())
14450 return getDerived().RebuildCXXFunctionalCastExpr(
Type,
14454 E->isListInitialization());
14457template<
typename Derived>
14460 if (E->isTypeOperand()) {
14462 = getDerived().TransformType(E->getTypeOperandSourceInfo());
14466 if (!getDerived().AlwaysRebuild() &&
14467 TInfo == E->getTypeOperandSourceInfo())
14470 return getDerived().RebuildCXXTypeidExpr(E->getType(), E->getBeginLoc(),
14471 TInfo, E->getEndLoc());
14477 Expr *Op = E->getExprOperand();
14479 if (E->isGLValue())
14480 if (
auto *RD = Op->getType()->getAsCXXRecordDecl();
14481 RD && RD->isPolymorphic())
14487 ExprResult SubExpr = getDerived().TransformExpr(Op);
14488 if (SubExpr.isInvalid())
14491 if (!getDerived().AlwaysRebuild() &&
14492 SubExpr.get() == E->getExprOperand())
14495 return getDerived().RebuildCXXTypeidExpr(E->getType(), E->getBeginLoc(),
14496 SubExpr.get(), E->getEndLoc());
14499template<
typename Derived>
14502 if (E->isTypeOperand()) {
14504 = getDerived().TransformType(E->getTypeOperandSourceInfo());
14508 if (!getDerived().AlwaysRebuild() &&
14509 TInfo == E->getTypeOperandSourceInfo())
14512 return getDerived().RebuildCXXUuidofExpr(E->getType(), E->getBeginLoc(),
14513 TInfo, E->getEndLoc());
14519 ExprResult SubExpr = getDerived().TransformExpr(E->getExprOperand());
14520 if (SubExpr.isInvalid())
14523 if (!getDerived().AlwaysRebuild() &&
14524 SubExpr.get() == E->getExprOperand())
14527 return getDerived().RebuildCXXUuidofExpr(E->getType(), E->getBeginLoc(),
14528 SubExpr.get(), E->getEndLoc());
14531template<
typename Derived>
14537template<
typename Derived>
14544template<
typename Derived>
14560 auto &S = getSema();
14561 if (E->isCapturedByCopyInLambdaWithExplicitObjectParameter())
14562 return S.getCurrentThisType();
14563 if (S.getCurLambda())
14564 return getDerived().TransformType(E->getType());
14565 return S.getCurrentThisType();
14568 if (!getDerived().AlwaysRebuild() &&
T == E->getType() &&
14569 !E->isCapturedByCopyInLambdaWithExplicitObjectParameter()) {
14572 getSema().MarkThisReferenced(E);
14576 return getDerived().RebuildCXXThisExpr(E->getBeginLoc(),
T, E->isImplicit());
14579template<
typename Derived>
14582 ExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
14583 if (SubExpr.isInvalid())
14586 getSema().DiagnoseExceptionUse(E->getThrowLoc(),
false);
14588 if (!getDerived().AlwaysRebuild() &&
14589 SubExpr.get() == E->getSubExpr())
14592 return getDerived().RebuildCXXThrowExpr(E->getThrowLoc(), SubExpr.get(),
14593 E->isThrownVariableInScope());
14596template<
typename Derived>
14600 getDerived().TransformDecl(E->getBeginLoc(), E->getParam()));
14605 if (E->hasRewrittenInit()) {
14606 InitRes = getDerived().TransformExpr(E->getRewrittenExpr());
14607 if (InitRes.isInvalid())
14611 if (!getDerived().AlwaysRebuild() && Param == E->getParam() &&
14612 E->getUsedContext() == SemaRef.
CurContext &&
14613 InitRes.get() == E->getRewrittenExpr())
14616 return getDerived().RebuildCXXDefaultArgExpr(E->getUsedLocation(), Param,
14620template<
typename Derived>
14624 getDerived().TransformDecl(E->getBeginLoc(), E->getField()));
14628 if (!getDerived().AlwaysRebuild() && Field == E->getField() &&
14632 return getDerived().RebuildCXXDefaultInitExpr(E->getExprLoc(), Field);
14635template<
typename Derived>
14639 TypeSourceInfo *
T = getDerived().TransformType(E->getTypeSourceInfo());
14643 if (!getDerived().AlwaysRebuild() &&
14644 T == E->getTypeSourceInfo())
14647 return getDerived().RebuildCXXScalarValueInitExpr(
T,
14648 T->getTypeLoc().getEndLoc(),
14649 E->getRParenLoc());
14652template<
typename Derived>
14657 getDerived().TransformTypeWithDeducedTST(E->getAllocatedTypeSourceInfo());
14658 if (!AllocTypeInfo)
14662 std::optional<Expr *> ArraySize;
14663 if (E->isArray()) {
14665 if (std::optional<Expr *> OldArraySize = E->getArraySize()) {
14666 NewArraySize = getDerived().TransformExpr(*OldArraySize);
14667 if (NewArraySize.isInvalid())
14670 ArraySize = NewArraySize.get();
14674 bool ArgumentChanged =
false;
14676 if (getDerived().TransformExprs(E->getPlacementArgs(),
14677 E->getNumPlacementArgs(),
true,
14678 PlacementArgs, &ArgumentChanged))
14682 Expr *OldInit = E->getInitializer();
14685 NewInit = getDerived().TransformInitializer(OldInit,
true);
14686 if (NewInit.isInvalid())
14691 if (E->getOperatorNew()) {
14692 OperatorNew = cast_or_null<FunctionDecl>(
14693 getDerived().TransformDecl(E->getBeginLoc(), E->getOperatorNew()));
14699 if (E->getOperatorDelete()) {
14700 OperatorDelete = cast_or_null<FunctionDecl>(
14701 getDerived().TransformDecl(E->getBeginLoc(), E->getOperatorDelete()));
14702 if (!OperatorDelete)
14706 if (!getDerived().AlwaysRebuild() &&
14707 AllocTypeInfo == E->getAllocatedTypeSourceInfo() &&
14708 ArraySize == E->getArraySize() &&
14709 NewInit.get() == OldInit &&
14710 OperatorNew == E->getOperatorNew() &&
14711 OperatorDelete == E->getOperatorDelete() &&
14712 !ArgumentChanged) {
14717 if (OperatorDelete)
14720 if (E->isArray() && !E->getAllocatedType()->isDependentType()) {
14732 QualType AllocType = AllocTypeInfo->getType();
14743 = dyn_cast<ConstantArrayType>(ArrayT)) {
14747 AllocType = ConsArrayT->getElementType();
14749 = dyn_cast<DependentSizedArrayType>(ArrayT)) {
14750 if (DepArrayT->getSizeExpr()) {
14751 ArraySize = DepArrayT->getSizeExpr();
14752 AllocType = DepArrayT->getElementType();
14757 return getDerived().RebuildCXXNewExpr(
14758 E->getBeginLoc(), E->isGlobalNew(),
14759 E->getBeginLoc(), PlacementArgs,
14760 E->getBeginLoc(), E->getTypeIdParens(), AllocType,
14761 AllocTypeInfo, ArraySize, E->getDirectInitRange(), NewInit.get());
14764template<
typename Derived>
14773 if (E->getOperatorDelete()) {
14774 OperatorDelete = cast_or_null<FunctionDecl>(
14775 getDerived().TransformDecl(E->getBeginLoc(), E->getOperatorDelete()));
14776 if (!OperatorDelete)
14780 if (!getDerived().AlwaysRebuild() &&
14781 Operand.get() == E->getArgument() &&
14782 OperatorDelete == E->getOperatorDelete()) {
14785 if (OperatorDelete)
14788 if (!E->getArgument()->isTypeDependent()) {
14790 E->getDestroyedType());
14791 if (
auto *
Record = Destroyed->getAsCXXRecordDecl())
14799 return getDerived().RebuildCXXDeleteExpr(
14800 E->getBeginLoc(), E->isGlobalDelete(), E->isArrayForm(),
Operand.get());
14803template<
typename Derived>
14808 if (
Base.isInvalid())
14812 bool MayBePseudoDestructor =
false;
14814 E->getOperatorLoc(),
14815 E->isArrow()? tok::arrow : tok::period,
14817 MayBePseudoDestructor);
14818 if (
Base.isInvalid())
14821 QualType ObjectType = ObjectTypePtr.get();
14823 if (QualifierLoc) {
14825 = getDerived().TransformNestedNameSpecifierLoc(QualifierLoc, ObjectType);
14830 SS.
Adopt(QualifierLoc);
14833 if (E->getDestroyedTypeInfo()) {
14834 TypeSourceInfo *DestroyedTypeInfo = getDerived().TransformTypeInObjectScope(
14835 E->getDestroyedTypeInfo(), ObjectType,
14837 if (!DestroyedTypeInfo)
14839 Destroyed = DestroyedTypeInfo;
14840 }
else if (!ObjectType.isNull() && ObjectType->isDependentType()) {
14844 E->getDestroyedTypeLoc());
14848 *E->getDestroyedTypeIdentifier(), E->getDestroyedTypeLoc(),
14849 nullptr, SS, ObjectTypePtr,
false);
14855 E->getDestroyedTypeLoc());
14859 if (E->getScopeTypeInfo()) {
14860 ScopeTypeInfo = getDerived().TransformTypeInObjectScope(
14861 E->getScopeTypeInfo(), ObjectType,
nullptr);
14862 if (!ScopeTypeInfo)
14866 return getDerived().RebuildCXXPseudoDestructorExpr(
Base.get(),
14867 E->getOperatorLoc(),
14871 E->getColonColonLoc(),
14876template <
typename Derived>
14881 bool AllEmptyPacks =
true;
14882 for (
auto *OldD : Old->
decls()) {
14898 if (
auto *UPD = dyn_cast<UsingPackDecl>(InstD))
14899 Decls = UPD->expansions();
14902 for (
auto *D : Decls) {
14903 if (
auto *UD = dyn_cast<UsingDecl>(D)) {
14904 for (
auto *SD : UD->shadows())
14911 AllEmptyPacks &= Decls.empty();
14920 if (AllEmptyPacks && !RequiresADL) {
14932 getSema().FilterAcceptableTemplateNames(R,
14939 diag::err_template_kw_refers_to_non_template)
14943 diag::note_template_kw_refers_to_non_template)
14952template <
typename Derived>
14958template <
typename Derived>
14961 bool IsAddressOfOperand) {
14966 if (TransformOverloadExprDecls(Old, Old->
requiresADL(), R))
14973 = getDerived().TransformNestedNameSpecifierLoc(Old->
getQualifierLoc());
14977 SS.
Adopt(QualifierLoc);
14981 CXXRecordDecl *NamingClass
14982 = cast_or_null<CXXRecordDecl>(getDerived().TransformDecl(
14985 if (!NamingClass) {
14990 R.setNamingClass(NamingClass);
15011 SS, TemplateKWLoc, R,
15018 return getDerived().RebuildDeclarationNameExpr(SS, R, Old->
requiresADL());
15021 return getDerived().RebuildTemplateIdExpr(SS, TemplateKWLoc, R,
15025template<
typename Derived>
15028 bool ArgChanged =
false;
15030 for (
unsigned I = 0, N = E->getNumArgs(); I != N; ++I) {
15032 TypeLoc FromTL = From->getTypeLoc();
15035 TLB.
reserve(FromTL.getFullDataSize());
15036 QualType To = getDerived().TransformType(TLB, FromTL);
15040 if (To == From->getType())
15041 Args.push_back(From);
15043 Args.push_back(TLB.getTypeSourceInfo(SemaRef.
Context, To));
15053 TypeLoc PatternTL = ExpansionTL.getPatternLoc();
15059 bool Expand =
true;
15060 bool RetainExpansion =
false;
15062 ExpansionTL.getTypePtr()->getNumExpansions();
15064 if (getDerived().TryExpandParameterPacks(
15065 ExpansionTL.getEllipsisLoc(), PatternTL.getSourceRange(),
15066 Unexpanded,
true, Expand,
15067 RetainExpansion, NumExpansions))
15077 TLB.
reserve(From->getTypeLoc().getFullDataSize());
15079 QualType To = getDerived().TransformType(TLB, PatternTL);
15083 To = getDerived().RebuildPackExpansionType(To,
15084 PatternTL.getSourceRange(),
15085 ExpansionTL.getEllipsisLoc(),
15093 Args.push_back(TLB.getTypeSourceInfo(SemaRef.
Context, To));
15099 for (
unsigned I = 0; I != *NumExpansions; ++I) {
15102 TLB.
reserve(PatternTL.getFullDataSize());
15103 QualType To = getDerived().TransformType(TLB, PatternTL);
15107 if (To->containsUnexpandedParameterPack()) {
15108 To = getDerived().RebuildPackExpansionType(To,
15109 PatternTL.getSourceRange(),
15110 ExpansionTL.getEllipsisLoc(),
15120 Args.push_back(TLB.getTypeSourceInfo(SemaRef.
Context, To));
15123 if (!RetainExpansion)
15128 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
15131 TLB.
reserve(From->getTypeLoc().getFullDataSize());
15133 QualType To = getDerived().TransformType(TLB, PatternTL);
15137 To = getDerived().RebuildPackExpansionType(To,
15138 PatternTL.getSourceRange(),
15139 ExpansionTL.getEllipsisLoc(),
15147 Args.push_back(TLB.getTypeSourceInfo(SemaRef.
Context, To));
15150 if (!getDerived().AlwaysRebuild() && !ArgChanged)
15153 return getDerived().RebuildTypeTrait(E->getTrait(), E->getBeginLoc(), Args,
15157template<
typename Derived>
15163 if (getDerived().TransformTemplateArguments(Old->getTemplateArgs(),
15164 Old->NumTemplateArgs, TransArgs))
15167 return getDerived().RebuildConceptSpecializationExpr(
15168 E->getNestedNameSpecifierLoc(), E->getTemplateKWLoc(),
15169 E->getConceptNameInfo(), E->getFoundDecl(), E->getNamedConcept(),
15173template<
typename Derived>
15187 getSema().Context, getSema().CurContext,
15188 E->getBody()->getBeginLoc());
15192 ExprResult TypeParamResult = getDerived().TransformRequiresTypeParams(
15193 E->getRequiresKWLoc(), E->getRBraceLoc(), E, Body,
15194 E->getLocalParameters(), TransParamTypes, TransParams, ExtParamInfos);
15198 Param->setDeclContext(Body);
15204 if (!TypeParamResult.isUnset())
15205 return TypeParamResult;
15208 if (getDerived().TransformRequiresExprRequirements(E->getRequirements(),
15213 if (
auto *ER = dyn_cast<concepts::ExprRequirement>(Req)) {
15214 if (ER->getReturnTypeRequirement().isTypeConstraint()) {
15215 ER->getReturnTypeRequirement()
15216 .getTypeConstraintTemplateParameterList()->getParam(0)
15217 ->setDeclContext(Body);
15222 return getDerived().RebuildRequiresExpr(
15223 E->getRequiresKWLoc(), Body, E->getLParenLoc(), TransParams,
15224 E->getRParenLoc(), TransReqs, E->getRBraceLoc());
15227template<
typename Derived>
15233 if (
auto *TypeReq = dyn_cast<concepts::TypeRequirement>(Req))
15234 TransReq =
getDerived().TransformTypeRequirement(TypeReq);
15235 else if (
auto *ExprReq = dyn_cast<concepts::ExprRequirement>(Req))
15236 TransReq =
getDerived().TransformExprRequirement(ExprReq);
15238 TransReq =
getDerived().TransformNestedRequirement(
15242 Transformed.push_back(TransReq);
15247template<
typename Derived>
15260 return getDerived().RebuildTypeRequirement(TransType);
15263template<
typename Derived>
15266 llvm::PointerUnion<Expr *, concepts::Requirement::SubstitutionDiagnostic *> TransExpr;
15272 TransExprRes =
SemaRef.CheckPlaceholderExpr(TransExprRes.
get());
15275 TransExpr = TransExprRes.
get();
15278 std::optional<concepts::ExprRequirement::ReturnTypeRequirement> TransRetReq;
15280 if (RetReq.isEmpty())
15281 TransRetReq.emplace();
15282 else if (RetReq.isSubstitutionFailure())
15283 TransRetReq.emplace(RetReq.getSubstitutionDiagnostic());
15284 else if (RetReq.isTypeConstraint()) {
15286 RetReq.getTypeConstraintTemplateParameterList();
15288 getDerived().TransformTemplateParameterList(OrigTPL);
15291 TransRetReq.emplace(TPL);
15293 assert(TransRetReq &&
"All code paths leading here must set TransRetReq");
15294 if (
Expr *E = dyn_cast<Expr *>(TransExpr))
15297 std::move(*TransRetReq));
15303template<
typename Derived>
15309 return getDerived().RebuildNestedRequirement(
15317 return getDerived().RebuildNestedRequirement(TransConstraint.
get());
15320template<
typename Derived>
15327 if (!getDerived().AlwaysRebuild() &&
15344template<
typename Derived>
15351 SubExpr = getDerived().TransformExpr(E->getQueriedExpression());
15352 if (SubExpr.isInvalid())
15355 if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getQueriedExpression())
15359 return getDerived().RebuildExpressionTrait(E->getTrait(), E->getBeginLoc(),
15360 SubExpr.get(), E->getEndLoc());
15363template <
typename Derived>
15368 DRE, AddrTaken, RecoveryTSI);
15381template <
typename Derived>
15388template <
typename Derived>
15404 getDerived().TransformDeclarationNameInfo(E->
getNameInfo());
15409 if (!getDerived().AlwaysRebuild() && QualifierLoc == E->
getQualifierLoc() &&
15415 return getDerived().RebuildDependentScopeDeclRefExpr(
15416 QualifierLoc, TemplateKWLoc, NameInfo,
nullptr,
15417 IsAddressOfOperand, RecoveryTSI);
15421 if (getDerived().TransformTemplateArguments(
15425 return getDerived().RebuildDependentScopeDeclRefExpr(
15426 QualifierLoc, TemplateKWLoc, NameInfo, &TransArgs, IsAddressOfOperand,
15430template<
typename Derived>
15436 if (getDerived().AllowSkippingCXXConstructExpr() &&
15437 ((E->getNumArgs() == 1 ||
15438 (E->getNumArgs() > 1 && getDerived().DropCallArgument(E->getArg(1)))) &&
15439 (!getDerived().DropCallArgument(E->getArg(0))) &&
15440 !E->isListInitialization()))
15446 QualType T = getDerived().TransformType(E->getType());
15451 getDerived().TransformDecl(E->getBeginLoc(), E->getConstructor()));
15455 bool ArgumentChanged =
false;
15460 E->isListInitialization());
15461 if (getDerived().TransformExprs(E->getArgs(), E->getNumArgs(),
true, Args,
15466 if (!getDerived().AlwaysRebuild() &&
15467 T == E->getType() &&
15469 !ArgumentChanged) {
15476 return getDerived().RebuildCXXConstructExpr(
15477 T, E->getBeginLoc(),
Constructor, E->isElidable(), Args,
15478 E->hadMultipleCandidates(), E->isListInitialization(),
15479 E->isStdInitListInitialization(), E->requiresZeroInitialization(),
15480 E->getConstructionKind(), E->getParenOrBraceRange());
15483template<
typename Derived>
15486 QualType T = getDerived().TransformType(E->getType());
15491 getDerived().TransformDecl(E->getBeginLoc(), E->getConstructor()));
15495 if (!getDerived().AlwaysRebuild() &&
15496 T == E->getType() &&
15504 return getDerived().RebuildCXXInheritedCtorInitExpr(
15506 E->constructsVBase(), E->inheritedFromVBase());
15513template<
typename Derived>
15516 if (
auto *Dtor = E->getTemporary()->getDestructor())
15519 return getDerived().TransformExpr(E->getSubExpr());
15527template<
typename Derived>
15533template<
typename Derived>
15538 getDerived().TransformTypeWithDeducedTST(E->getTypeSourceInfo());
15543 getDerived().TransformDecl(E->getBeginLoc(), E->getConstructor()));
15547 bool ArgumentChanged =
false;
15549 Args.reserve(E->getNumArgs());
15553 E->isListInitialization());
15554 if (TransformExprs(E->getArgs(), E->getNumArgs(),
true, Args,
15558 if (E->isListInitialization() && !E->isStdInitListInitialization()) {
15559 ExprResult Res = RebuildInitList(E->getBeginLoc(), Args, E->getEndLoc());
15560 if (Res.isInvalid())
15562 Args = {Res.get()};
15566 if (!getDerived().AlwaysRebuild() &&
15567 T == E->getTypeSourceInfo() &&
15569 !ArgumentChanged) {
15576 return getDerived().RebuildCXXTemporaryObjectExpr(
15577 T, LParenLoc, Args, E->getEndLoc(), E->isListInitialization());
15580template<
typename Derived>
15585 typedef std::pair<ExprResult, QualType> InitCaptureInfoTy;
15586 struct TransformedInitCapture {
15588 SourceLocation EllipsisLoc;
15590 SmallVector<InitCaptureInfoTy, 4> Expansions;
15593 InitCaptures.resize(E->explicit_capture_end() - E->explicit_capture_begin());
15595 CEnd = E->capture_end();
15597 if (!E->isInitCapture(
C))
15600 TransformedInitCapture &
Result = InitCaptures[
C - E->capture_begin()];
15605 ExprResult NewExprInitResult = getDerived().TransformInitializer(
15608 if (NewExprInitResult.isInvalid()) {
15612 Expr *NewExprInit = NewExprInitResult.get();
15615 getSema().buildLambdaInitCaptureInitialization(
15616 C->getLocation(),
C->getCaptureKind() ==
LCK_ByRef,
15617 EllipsisLoc, NumExpansions, OldVD->getIdentifier(),
15621 Result.Expansions.push_back(
15622 InitCaptureInfoTy(NewExprInit, NewInitCaptureType));
15626 if (OldVD->isParameterPack()) {
15635 bool Expand =
true;
15636 bool RetainExpansion =
false;
15638 ExpansionTL.getTypePtr()->getNumExpansions();
15640 if (getDerived().TryExpandParameterPacks(
15641 ExpansionTL.getEllipsisLoc(), OldVD->getInit()->getSourceRange(),
15642 Unexpanded,
true, Expand,
15643 RetainExpansion, NumExpansions))
15645 assert(!RetainExpansion &&
"Should not need to retain expansion after a "
15646 "capture since it cannot be extended");
15648 for (
unsigned I = 0; I != *NumExpansions; ++I) {
15653 SubstInitCapture(ExpansionTL.getEllipsisLoc(), NumExpansions);
15654 Result.EllipsisLoc = ExpansionTL.getEllipsisLoc();
15691 while (DC->isRequiresExprBody())
15693 if ((getSema().isUnevaluatedContext() ||
15694 getSema().isConstantEvaluatedContext()) &&
15695 !(dyn_cast_or_null<CXXRecordDecl>(DC->getParent()) &&
15697 (DC->isFileContext() || !DC->getParent()->isDependentContext()))
15702 E->getIntroducerRange(),
nullptr, DependencyKind,
15703 E->getCaptureDefault());
15704 getDerived().transformedLocalDecl(OldClass, {
Class});
15707 getSema().CreateLambdaCallOperator(E->getIntroducerRange(),
Class);
15710 getSema().buildLambdaScope(LSI, NewCallOperator, E->getIntroducerRange(),
15711 E->getCaptureDefault(), E->getCaptureDefaultLoc(),
15712 E->hasExplicitParameters(), E->isMutable());
15722 CEnd = E->capture_end();
15726 if (
C->isImplicit())
15730 if (
C->capturesThis()) {
15738 dyn_cast_if_present<CXXRecordDecl>(
15739 getSema().getFunctionLevelDeclContext()),
15741 getSema().CheckCXXThisCapture(
C->getLocation(),
C->isExplicit(),
15748 if (
C->capturesVLAType())
15752 if (E->isInitCapture(
C)) {
15753 TransformedInitCapture &NewC = InitCaptures[
C - E->capture_begin()];
15758 for (InitCaptureInfoTy &Info : NewC.Expansions) {
15760 QualType InitQualType = Info.second;
15761 if (
Init.isInvalid() || InitQualType.isNull()) {
15765 VarDecl *NewVD = getSema().createLambdaInitCaptureVarDecl(
15766 OldVD->getLocation(), InitQualType, NewC.EllipsisLoc,
15767 OldVD->getIdentifier(), OldVD->getInitStyle(),
Init.get(),
15768 getSema().CurContext);
15773 NewVDs.push_back(NewVD);
15774 getSema().addInitCapture(LSI, NewVD,
C->getCaptureKind() ==
LCK_ByRef);
15779 if (NewC.EllipsisLoc.isInvalid())
15780 LSI->ContainsUnexpandedParameterPack |=
15781 Init.get()->containsUnexpandedParameterPack();
15787 getDerived().transformedLocalDecl(OldVD, NewVDs);
15791 assert(
C->capturesVariable() &&
"unexpected kind of lambda capture");
15799 if (
C->isPackExpansion()) {
15801 bool ShouldExpand =
false;
15802 bool RetainExpansion =
false;
15804 if (getDerived().TryExpandParameterPacks(
15805 C->getEllipsisLoc(),
C->getLocation(), Unexpanded,
15806 true, ShouldExpand,
15807 RetainExpansion, NumExpansions)) {
15812 if (ShouldExpand) {
15817 for (
unsigned I = 0; I != *NumExpansions; ++I) {
15819 ValueDecl *CapturedVar = cast_if_present<ValueDecl>(
15820 getDerived().TransformDecl(
C->getLocation(), Pack));
15821 if (!CapturedVar) {
15827 getSema().tryCaptureVariable(CapturedVar,
C->getLocation(), Kind);
15835 EllipsisLoc =
C->getEllipsisLoc();
15839 auto *CapturedVar = cast_or_null<ValueDecl>(
15840 getDerived().TransformDecl(
C->getLocation(),
C->getCapturedVar()));
15841 if (!CapturedVar || CapturedVar->isInvalidDecl()) {
15848 if (
auto *VD = dyn_cast<VarDecl>(CapturedVar); VD && !
C->isPackExpansion())
15849 LSI->ContainsUnexpandedParameterPack |= VD->isParameterPack();
15852 getSema().tryCaptureVariable(CapturedVar,
C->getLocation(), Kind,
15855 getSema().finishLambdaExplicitCaptures(LSI);
15859 auto TPL = getDerived().TransformTemplateParameterList(
15860 E->getTemplateParameterList());
15861 LSI->GLTemplateParameterList = TPL;
15863 getSema().AddTemplateParametersToLambdaCallOperator(NewCallOperator,
Class,
15865 LSI->ContainsUnexpandedParameterPack |=
15866 TPL->containsUnexpandedParameterPack();
15871 E->getCallOperator()->getTypeSourceInfo()->getTypeLoc();
15873 getDerived().TransformType(NewCallOpTLBuilder, OldCallOpTypeLoc);
15874 if (NewCallOpType.isNull())
15876 LSI->ContainsUnexpandedParameterPack |=
15877 NewCallOpType->containsUnexpandedParameterPack();
15879 NewCallOpTLBuilder.getTypeSourceInfo(getSema().Context, NewCallOpType);
15884 assert(FPTL &&
"Not a FunctionProtoType?");
15887 if (!TRC.ArgPackSubstIndex)
15890 getSema().CompleteLambdaCallOperator(
15891 NewCallOperator, E->getCallOperator()->getLocation(),
15892 E->getCallOperator()->getInnerLocStart(), TRC, NewCallOpTSI,
15893 E->getCallOperator()->getConstexprKind(),
15894 E->getCallOperator()->getStorageClass(), FPTL.getParams(),
15895 E->hasExplicitResultType());
15897 getDerived().transformAttrs(E->getCallOperator(), NewCallOperator);
15898 getDerived().transformedLocalDecl(E->getCallOperator(), {NewCallOperator});
15904 std::optional<CXXRecordDecl::LambdaNumbering> Numbering;
15905 if (getDerived().ReplacingOriginal()) {
15906 Numbering = OldClass->getLambdaNumbering();
15909 getSema().handleLambdaNumbering(
Class, NewCallOperator, Numbering);
15914 getSema().PushExpressionEvaluationContextForFunction(
15916 E->getCallOperator());
15923 C.PointOfInstantiation = E->getBody()->getBeginLoc();
15924 getSema().pushCodeSynthesisContext(
C);
15928 : getDerived().TransformLambdaBody(E, E->getBody());
15930 getSema().popCodeSynthesisContext();
15934 FuncScopeCleanup.disable();
15936 if (Body.isInvalid()) {
15937 SavedContext.pop();
15938 getSema().ActOnLambdaError(E->getBeginLoc(),
nullptr,
15943 getSema().ActOnFinishFunctionBody(NewCallOperator, Body.get(),
15946 SavedContext.pop();
15981 DependencyKind = getDerived().ComputeLambdaDependency(LSI);
15982 Class->setLambdaDependencyKind(DependencyKind);
15984 return getDerived().RebuildLambdaExpr(E->getBeginLoc(),
15985 Body.get()->getEndLoc(), LSI);
15988template<
typename Derived>
15994template<
typename Derived>
16003 if (!
C->isImplicit())
16007 if (
C->capturesThis()) {
16008 getSema().CheckCXXThisCapture(
C->getLocation(),
C->isExplicit(),
16015 if (
C->capturesVLAType())
16018 assert(
C->capturesVariable() &&
"unexpected kind of lambda capture");
16022 VarDecl *CapturedVar = cast_or_null<VarDecl>(
16028 getSema().tryCaptureVariable(CapturedVar,
C->getLocation());
16034template<
typename Derived>
16043 bool ArgumentChanged =
false;
16055 if (!getDerived().AlwaysRebuild() &&
16061 return getDerived().RebuildCXXUnresolvedConstructExpr(
16065template<
typename Derived>
16074 if (!E->isImplicitAccess()) {
16075 OldBase = E->getBase();
16076 Base = getDerived().TransformExpr(OldBase);
16077 if (
Base.isInvalid())
16082 bool MayBePseudoDestructor =
false;
16084 E->getOperatorLoc(),
16085 E->isArrow()? tok::arrow : tok::period,
16087 MayBePseudoDestructor);
16088 if (
Base.isInvalid())
16091 ObjectType = ObjectTy.get();
16092 BaseType = ((
Expr*)
Base.get())->getType();
16095 BaseType = getDerived().TransformType(E->getBaseType());
16102 = getDerived().TransformFirstQualifierInScope(
16103 E->getFirstQualifierFoundInScope(),
16104 E->getQualifierLoc().getBeginLoc());
16107 if (E->getQualifier()) {
16109 = getDerived().TransformNestedNameSpecifierLoc(E->getQualifierLoc(),
16111 FirstQualifierInScope);
16123 = getDerived().TransformDeclarationNameInfo(E->getMemberNameInfo());
16124 if (!NameInfo.getName())
16127 if (!E->hasExplicitTemplateArgs()) {
16130 if (!getDerived().AlwaysRebuild() &&
16131 Base.get() == OldBase &&
16132 BaseType == E->getBaseType() &&
16133 QualifierLoc == E->getQualifierLoc() &&
16134 NameInfo.getName() == E->getMember() &&
16135 FirstQualifierInScope == E->getFirstQualifierFoundInScope())
16138 return getDerived().RebuildCXXDependentScopeMemberExpr(
Base.get(),
16141 E->getOperatorLoc(),
16144 FirstQualifierInScope,
16150 if (getDerived().TransformTemplateArguments(E->getTemplateArgs(),
16151 E->getNumTemplateArgs(),
16155 return getDerived().RebuildCXXDependentScopeMemberExpr(
Base.get(),
16158 E->getOperatorLoc(),
16161 FirstQualifierInScope,
16166template <
typename Derived>
16172 if (!Old->isImplicitAccess()) {
16173 Base = getDerived().TransformExpr(Old->getBase());
16174 if (
Base.isInvalid())
16177 getSema().PerformMemberExprBaseConversion(
Base.get(), Old->isArrow());
16178 if (
Base.isInvalid())
16180 BaseType =
Base.get()->getType();
16182 BaseType = getDerived().TransformType(Old->getBaseType());
16186 if (Old->getQualifierLoc()) {
16188 getDerived().TransformNestedNameSpecifierLoc(Old->getQualifierLoc());
16198 if (TransformOverloadExprDecls(Old,
false, R))
16202 if (Old->getNamingClass()) {
16204 getDerived().TransformDecl(Old->getMemberLoc(), Old->getNamingClass()));
16208 R.setNamingClass(NamingClass);
16212 if (Old->hasExplicitTemplateArgs()) {
16213 TransArgs.setLAngleLoc(Old->getLAngleLoc());
16214 TransArgs.setRAngleLoc(Old->getRAngleLoc());
16215 if (getDerived().TransformTemplateArguments(
16216 Old->getTemplateArgs(), Old->getNumTemplateArgs(), TransArgs))
16224 NamedDecl *FirstQualifierInScope =
nullptr;
16226 return getDerived().RebuildUnresolvedMemberExpr(
16227 Base.get(), BaseType, Old->getOperatorLoc(), Old->isArrow(), QualifierLoc,
16228 TemplateKWLoc, FirstQualifierInScope, R,
16229 (Old->hasExplicitTemplateArgs() ? &TransArgs :
nullptr));
16232template<
typename Derived>
16237 ExprResult SubExpr = getDerived().TransformExpr(E->getOperand());
16238 if (SubExpr.isInvalid())
16241 if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getOperand())
16244 return getDerived().RebuildCXXNoexceptExpr(E->getSourceRange(),SubExpr.get());
16247template<
typename Derived>
16250 ExprResult Pattern = getDerived().TransformExpr(E->getPattern());
16251 if (Pattern.isInvalid())
16254 if (!getDerived().AlwaysRebuild() && Pattern.get() == E->getPattern())
16257 return getDerived().RebuildPackExpansion(Pattern.get(), E->getEllipsisLoc(),
16258 E->getNumExpansions());
16261template <
typename Derived>
16266 if (!Arg.isPackExpansion()) {
16278 getSema().getTemplateArgumentPackExpansionPattern(ArgLoc, Ellipsis,
16279 OrigNumExpansions);
16291 if (!NumExpansions) {
16303template<
typename Derived>
16322 bool ShouldExpand =
false;
16323 bool RetainExpansion =
false;
16324 UnsignedOrNone NumExpansions = std::nullopt;
16325 if (getDerived().TryExpandParameterPacks(
16327 true, ShouldExpand,
16328 RetainExpansion, NumExpansions))
16333 if (ShouldExpand) {
16335 if (
auto *TTPD = dyn_cast<TemplateTypeParmDecl>(Pack)) {
16336 ArgStorage = getSema().Context.getPackExpansionType(
16337 getSema().Context.getTypeDeclType(TTPD), std::nullopt);
16338 }
else if (
auto *TTPD = dyn_cast<TemplateTemplateParmDecl>(Pack)) {
16342 ExprResult DRE = getSema().BuildDeclRefExpr(
16343 VD, VD->getType().getNonLValueExprType(getSema().Context),
16346 if (DRE.isInvalid())
16349 new (getSema().Context)
16353 PackArgs = ArgStorage;
16358 if (!PackArgs.size()) {
16359 auto *Pack = cast_or_null<NamedDecl>(
16363 return getDerived().RebuildSizeOfPackExpr(
16370 getDerived().ComputeSizeOfPackExprWithoutSubstitution(PackArgs);
16382 TemporaryBase Rebase(*
this, E->
getPackLoc(), getBaseEntity());
16385 if (TransformTemplateArguments(PackLocIterator(*
this, PackArgs.begin()),
16386 PackLocIterator(*
this, PackArgs.end()),
16387 TransformedPackArgs,
true))
16394 bool PartialSubstitution =
false;
16395 for (
auto &Loc : TransformedPackArgs.arguments()) {
16396 Args.push_back(Loc.getArgument());
16397 if (Loc.getArgument().isPackExpansion())
16398 PartialSubstitution =
true;
16401 if (PartialSubstitution)
16402 return getDerived().RebuildSizeOfPackExpr(
16404 std::nullopt, Args);
16406 return getDerived().RebuildSizeOfPackExpr(
16408 static_cast<unsigned>(Args.size()),
16412template <
typename Derived>
16415 if (!E->isValueDependent())
16423 IndexExpr = getDerived().TransformExpr(E->getIndexExpr());
16424 if (IndexExpr.isInvalid())
16429 bool FullySubstituted =
true;
16430 if (!E->expandsToEmptyPack() && E->getExpressions().empty()) {
16431 Expr *Pattern = E->getPackIdExpression();
16433 getSema().collectUnexpandedParameterPacks(E->getPackIdExpression(),
16435 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
16439 bool ShouldExpand =
true;
16440 bool RetainExpansion =
false;
16442 NumExpansions = std::nullopt;
16443 if (getDerived().TryExpandParameterPacks(
16444 E->getEllipsisLoc(), Pattern->getSourceRange(), Unexpanded,
16445 true, ShouldExpand,
16446 RetainExpansion, NumExpansions))
16448 if (!ShouldExpand) {
16450 ExprResult Pack = getDerived().TransformExpr(Pattern);
16451 if (Pack.isInvalid())
16453 return getDerived().RebuildPackIndexingExpr(
16454 E->getEllipsisLoc(), E->getRSquareLoc(), Pack.get(), IndexExpr.get(),
16457 for (
unsigned I = 0; I != *NumExpansions; ++I) {
16460 if (
Out.isInvalid())
16462 if (
Out.get()->containsUnexpandedParameterPack()) {
16463 Out = getDerived().RebuildPackExpansion(
Out.get(), E->getEllipsisLoc(),
16464 OrigNumExpansions);
16465 if (
Out.isInvalid())
16467 FullySubstituted =
false;
16469 ExpandedExprs.push_back(
Out.get());
16473 if (RetainExpansion) {
16474 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
16477 if (
Out.isInvalid())
16480 Out = getDerived().RebuildPackExpansion(
Out.get(), E->getEllipsisLoc(),
16481 OrigNumExpansions);
16482 if (
Out.isInvalid())
16484 FullySubstituted =
false;
16485 ExpandedExprs.push_back(
Out.get());
16487 }
else if (!E->expandsToEmptyPack()) {
16488 if (getDerived().TransformExprs(E->getExpressions().data(),
16489 E->getExpressions().size(),
false,
16494 return getDerived().RebuildPackIndexingExpr(
16495 E->getEllipsisLoc(), E->getRSquareLoc(), E->getPackIdExpression(),
16496 IndexExpr.get(), ExpandedExprs, FullySubstituted);
16499template <
typename Derived>
16502 if (!getSema().ArgPackSubstIndex)
16508 return getDerived().RebuildSubstNonTypeTemplateParmExpr(
16509 E->getAssociatedDecl(), E->getParameterPack(),
16510 E->getParameterPackLocation(), Arg, SemaRef.
getPackIndex(Pack),
16514template <
typename Derived>
16518 ExprResult Replacement = getDerived().TransformExpr(OrigReplacement);
16519 if (Replacement.isInvalid())
16522 Decl *AssociatedDecl =
16523 getDerived().TransformDecl(E->getNameLoc(), E->getAssociatedDecl());
16524 if (!AssociatedDecl)
16527 if (Replacement.get() == OrigReplacement &&
16528 AssociatedDecl == E->getAssociatedDecl())
16531 auto getParamAndType = [E](
Decl *AssociatedDecl)
16532 -> std::tuple<NonTypeTemplateParmDecl *, QualType> {
16533 auto [PDecl, Arg] =
16537 return {Param, Param->getType()};
16539 Arg = Arg.getPackAsArray()[*PackIndex];
16540 return {Param, Arg.getNonTypeTemplateArgumentType()};
16546 if (
auto [Param, ParamType] = getParamAndType(AssociatedDecl);
16548 ParamType, std::get<1>(getParamAndType(E->getAssociatedDecl()))) ||
16549 Replacement.get() != OrigReplacement) {
16556 Param, ParamType, Replacement.get(), SugaredConverted,
16557 CanonicalConverted,
16559 if (Replacement.isInvalid())
16563 Replacement = E->getReplacement();
16566 return getDerived().RebuildSubstNonTypeTemplateParmExpr(
16567 AssociatedDecl, E->getParameter(), E->getNameLoc(),
16569 E->getPackIndex(), E->getFinal());
16572template<
typename Derived>
16579template<
typename Derived>
16586template<
typename Derived>
16590 if (
Expr *OldCallee = E->getCallee()) {
16591 ExprResult CalleeResult = getDerived().TransformExpr(OldCallee);
16592 if (CalleeResult.isInvalid())
16597 Expr *Pattern = E->getPattern();
16600 getSema().collectUnexpandedParameterPacks(Pattern, Unexpanded);
16601 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
16605 bool Expand =
true;
16606 bool RetainExpansion =
false;
16608 NumExpansions = OrigNumExpansions;
16609 if (getDerived().TryExpandParameterPacks(
16610 E->getEllipsisLoc(), Pattern->getSourceRange(), Unexpanded,
16611 true, Expand, RetainExpansion,
16621 E->getLHS() ? getDerived().TransformExpr(E->getLHS()) :
ExprResult();
16622 if (LHS.isInvalid())
16626 E->getRHS() ? getDerived().TransformExpr(E->getRHS()) :
ExprResult();
16627 if (RHS.isInvalid())
16630 if (!getDerived().AlwaysRebuild() &&
16631 LHS.get() == E->getLHS() && RHS.get() == E->getRHS())
16634 return getDerived().RebuildCXXFoldExpr(
16635 Callee, E->getBeginLoc(), LHS.get(), E->getOperator(),
16636 E->getEllipsisLoc(), RHS.get(), E->getEndLoc(), NumExpansions);
16642 if (NumExpansions && SemaRef.
getLangOpts().BracketDepth < *NumExpansions) {
16643 SemaRef.
Diag(E->getEllipsisLoc(),
16644 clang::diag::err_fold_expression_limit_exceeded)
16645 << *NumExpansions << SemaRef.
getLangOpts().BracketDepth
16646 << E->getSourceRange();
16647 SemaRef.
Diag(E->getEllipsisLoc(), diag::note_bracket_depth);
16656 bool LeftFold = E->isLeftFold();
16660 if (!LeftFold && RetainExpansion) {
16661 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
16664 if (
Out.isInvalid())
16667 Result = getDerived().RebuildCXXFoldExpr(
16668 Callee, E->getBeginLoc(),
Out.get(), E->getOperator(),
16669 E->getEllipsisLoc(),
Result.get(), E->getEndLoc(), OrigNumExpansions);
16674 bool WarnedOnComparison =
false;
16675 for (
unsigned I = 0; I != *NumExpansions; ++I) {
16677 getSema(), LeftFold ? I : *NumExpansions - I - 1);
16679 if (
Out.isInvalid())
16682 if (
Out.get()->containsUnexpandedParameterPack()) {
16684 Result = getDerived().RebuildCXXFoldExpr(
16685 Callee, E->getBeginLoc(), LeftFold ?
Result.get() :
Out.get(),
16686 E->getOperator(), E->getEllipsisLoc(),
16687 LeftFold ?
Out.get() :
Result.get(), E->getEndLoc(),
16688 OrigNumExpansions);
16689 }
else if (
Result.isUsable()) {
16696 Result = getDerived().RebuildCXXOperatorCallExpr(
16698 E->getEllipsisLoc(),
Callee->getBeginLoc(),
Callee->requiresADL(),
16699 Functions, LHS, RHS);
16701 Result = getDerived().RebuildBinaryOperator(E->getEllipsisLoc(),
16702 E->getOperator(), LHS, RHS,
16704 if (!WarnedOnComparison &&
Result.isUsable()) {
16705 if (
auto *BO = dyn_cast<BinaryOperator>(
Result.get());
16706 BO && BO->isComparisonOp()) {
16707 WarnedOnComparison =
true;
16708 SemaRef.
Diag(BO->getBeginLoc(),
16709 diag::warn_comparison_in_fold_expression)
16710 << BO->getOpcodeStr();
16723 if (LeftFold && RetainExpansion) {
16724 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
16727 if (
Out.isInvalid())
16730 Result = getDerived().RebuildCXXFoldExpr(
16731 Callee, E->getBeginLoc(),
Result.get(), E->getOperator(),
16732 E->getEllipsisLoc(),
Out.get(), E->getEndLoc(), OrigNumExpansions);
16738 PE->setIsProducedByFoldExpansion();
16743 return getDerived().RebuildEmptyCXXFoldExpr(E->getEllipsisLoc(),
16748template <
typename Derived>
16754 QualType T = getDerived().TransformType(E->getType());
16756 bool ArgChanged =
false;
16758 if (getDerived().TransformExprs(InitExprs.data(), InitExprs.size(),
true,
16759 TransformedInits, &ArgChanged))
16762 if (!getDerived().AlwaysRebuild() && !ArgChanged &&
T == E->getType())
16765 return getDerived().RebuildCXXParenListInitExpr(
16766 TransformedInits,
T, E->getUserSpecifiedInitExprs().size(),
16767 E->getInitLoc(), E->getBeginLoc(), E->getEndLoc());
16770template<
typename Derived>
16777template<
typename Derived>
16783template<
typename Derived>
16789template<
typename Derived>
16792 ExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
16793 if (SubExpr.isInvalid())
16796 if (!getDerived().AlwaysRebuild() &&
16797 SubExpr.get() == E->getSubExpr())
16800 return getDerived().RebuildObjCBoxedExpr(E->getSourceRange(), SubExpr.get());
16803template<
typename Derived>
16808 bool ArgChanged =
false;
16809 if (getDerived().TransformExprs(E->getElements(), E->getNumElements(),
16810 false, Elements, &ArgChanged))
16813 if (!getDerived().AlwaysRebuild() && !ArgChanged)
16816 return getDerived().RebuildObjCArrayLiteral(E->getSourceRange(),
16821template<
typename Derived>
16827 bool ArgChanged =
false;
16828 for (
unsigned I = 0, N = E->getNumElements(); I != N; ++I) {
16831 if (OrigElement.isPackExpansion()) {
16834 getSema().collectUnexpandedParameterPacks(OrigElement.Key, Unexpanded);
16835 getSema().collectUnexpandedParameterPacks(OrigElement.Value, Unexpanded);
16836 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
16840 bool Expand =
true;
16841 bool RetainExpansion =
false;
16844 SourceRange PatternRange(OrigElement.Key->getBeginLoc(),
16845 OrigElement.Value->getEndLoc());
16846 if (getDerived().TryExpandParameterPacks(
16847 OrigElement.EllipsisLoc, PatternRange, Unexpanded,
16848 true, Expand, RetainExpansion,
16857 ExprResult Key = getDerived().TransformExpr(OrigElement.Key);
16858 if (Key.isInvalid())
16861 if (Key.get() != OrigElement.Key)
16865 if (
Value.isInvalid())
16872 Key.get(),
Value.get(), OrigElement.EllipsisLoc, NumExpansions
16874 Elements.push_back(Expansion);
16884 for (
unsigned I = 0; I != *NumExpansions; ++I) {
16886 ExprResult Key = getDerived().TransformExpr(OrigElement.Key);
16887 if (Key.isInvalid())
16891 if (
Value.isInvalid())
16901 if (Key.get()->containsUnexpandedParameterPack() ||
16902 Value.get()->containsUnexpandedParameterPack())
16903 Element.EllipsisLoc = OrigElement.EllipsisLoc;
16905 Elements.push_back(Element);
16915 ExprResult Key = getDerived().TransformExpr(OrigElement.Key);
16916 if (Key.isInvalid())
16919 if (Key.get() != OrigElement.Key)
16924 = getDerived().TransformExpr(OrigElement.Value);
16925 if (
Value.isInvalid())
16933 Elements.push_back(Element);
16936 if (!getDerived().AlwaysRebuild() && !ArgChanged)
16939 return getDerived().RebuildObjCDictionaryLiteral(E->getSourceRange(),
16943template<
typename Derived>
16947 = getDerived().TransformType(E->getEncodedTypeSourceInfo());
16948 if (!EncodedTypeInfo)
16951 if (!getDerived().AlwaysRebuild() &&
16952 EncodedTypeInfo == E->getEncodedTypeSourceInfo())
16955 return getDerived().RebuildObjCEncodeExpr(E->getAtLoc(),
16957 E->getRParenLoc());
16960template<
typename Derived>
16970template<
typename Derived>
16974 = getDerived().TransformType(E->getTypeInfoAsWritten());
16982 if (!getDerived().AlwaysRebuild() &&
16983 TSInfo == E->getTypeInfoAsWritten() &&
16984 Result.get() == E->getSubExpr())
16988 E->getLParenLoc(), E->getBridgeKind(), E->getBridgeKeywordLoc(), TSInfo,
16992template <
typename Derived>
16998template<
typename Derived>
17002 bool ArgChanged =
false;
17004 Args.reserve(E->getNumArgs());
17005 if (getDerived().TransformExprs(E->getArgs(), E->getNumArgs(),
false, Args,
17012 = getDerived().TransformType(E->getClassReceiverTypeInfo());
17013 if (!ReceiverTypeInfo)
17017 if (!getDerived().AlwaysRebuild() &&
17018 ReceiverTypeInfo == E->getClassReceiverTypeInfo() && !ArgChanged)
17023 E->getSelectorLocs(SelLocs);
17024 return getDerived().RebuildObjCMessageExpr(ReceiverTypeInfo,
17027 E->getMethodDecl(),
17034 if (!E->getMethodDecl())
17039 E->getSelectorLocs(SelLocs);
17040 return getDerived().RebuildObjCMessageExpr(E->getSuperLoc(),
17043 E->getReceiverType(),
17044 E->getMethodDecl(),
17052 "Only class and instance messages may be instantiated");
17054 = getDerived().TransformExpr(E->getInstanceReceiver());
17055 if (Receiver.isInvalid())
17059 if (!getDerived().AlwaysRebuild() &&
17060 Receiver.get() == E->getInstanceReceiver() && !ArgChanged)
17065 E->getSelectorLocs(SelLocs);
17066 return getDerived().RebuildObjCMessageExpr(Receiver.get(),
17069 E->getMethodDecl(),
17075template<
typename Derived>
17081template<
typename Derived>
17087template<
typename Derived>
17092 if (
Base.isInvalid())
17098 if (!getDerived().AlwaysRebuild() &&
17099 Base.get() == E->getBase())
17102 return getDerived().RebuildObjCIvarRefExpr(
Base.get(), E->getDecl(),
17104 E->isArrow(), E->isFreeIvar());
17107template<
typename Derived>
17112 if (!E->isObjectReceiver())
17117 if (
Base.isInvalid())
17123 if (!getDerived().AlwaysRebuild() &&
17124 Base.get() == E->getBase())
17127 if (E->isExplicitProperty())
17128 return getDerived().RebuildObjCPropertyRefExpr(
Base.get(),
17129 E->getExplicitProperty(),
17132 return getDerived().RebuildObjCPropertyRefExpr(
Base.get(),
17134 E->getImplicitPropertyGetter(),
17135 E->getImplicitPropertySetter(),
17139template<
typename Derived>
17144 if (
Base.isInvalid())
17148 ExprResult Key = getDerived().TransformExpr(E->getKeyExpr());
17149 if (Key.isInvalid())
17153 if (!getDerived().AlwaysRebuild() &&
17154 Key.get() == E->getKeyExpr() &&
Base.get() == E->getBaseExpr())
17157 return getDerived().RebuildObjCSubscriptRefExpr(E->getRBracket(),
17158 Base.get(), Key.get(),
17159 E->getAtIndexMethodDecl(),
17160 E->setAtIndexMethodDecl());
17163template<
typename Derived>
17168 if (
Base.isInvalid())
17172 if (!getDerived().AlwaysRebuild() &&
17173 Base.get() == E->getBase())
17176 return getDerived().RebuildObjCIsaExpr(
Base.get(), E->getIsaMemberLoc(),
17181template<
typename Derived>
17184 bool ArgumentChanged =
false;
17186 SubExprs.reserve(E->getNumSubExprs());
17187 if (getDerived().TransformExprs(E->getSubExprs(), E->getNumSubExprs(),
false,
17188 SubExprs, &ArgumentChanged))
17191 if (!getDerived().AlwaysRebuild() &&
17195 return getDerived().RebuildShuffleVectorExpr(E->getBuiltinLoc(),
17197 E->getRParenLoc());
17200template<
typename Derived>
17203 ExprResult SrcExpr = getDerived().TransformExpr(E->getSrcExpr());
17204 if (SrcExpr.isInvalid())
17211 if (!getDerived().AlwaysRebuild() &&
17212 Type == E->getTypeSourceInfo() &&
17213 SrcExpr.get() == E->getSrcExpr())
17216 return getDerived().RebuildConvertVectorExpr(E->getBuiltinLoc(),
17217 SrcExpr.get(),
Type,
17218 E->getRParenLoc());
17221template<
typename Derived>
17224 BlockDecl *oldBlock = E->getBlockDecl();
17230 blockScope->TheDecl->setBlockMissingReturnType(
17231 oldBlock->blockMissingReturnType());
17240 if (getDerived().TransformFunctionTypeParams(
17241 E->getCaretLocation(), oldBlock->parameters(),
nullptr,
17242 exprFunctionType->getExtParameterInfosOrNull(), paramTypes, ¶ms,
17244 getSema().ActOnBlockError(E->getCaretLocation(),
nullptr);
17249 getDerived().TransformType(exprFunctionType->getReturnType());
17251 auto epi = exprFunctionType->getExtProtoInfo();
17252 epi.ExtParameterInfos = extParamInfos.getPointerOrNull(paramTypes.size());
17255 getDerived().RebuildFunctionProtoType(exprResultType, paramTypes, epi);
17259 if (!params.empty())
17260 blockScope->TheDecl->setParams(params);
17262 if (!oldBlock->blockMissingReturnType()) {
17263 blockScope->HasImplicitReturnType =
false;
17264 blockScope->ReturnType = exprResultType;
17268 StmtResult body = getDerived().TransformStmt(E->getBody());
17269 if (body.isInvalid()) {
17270 getSema().ActOnBlockError(E->getCaretLocation(),
nullptr);
17278 for (
const auto &I : oldBlock->captures()) {
17279 VarDecl *oldCapture = I.getVariable();
17282 if (oldCapture->isParameterPack())
17286 cast<VarDecl>(getDerived().TransformDecl(E->getCaretLocation(),
17288 assert(blockScope->CaptureMap.count(newCapture));
17294 assert((!blockScope->isCXXThisCaptured() || oldBlock->capturesCXXThis()) &&
17295 "this pointer isn't captured in the old block");
17303template<
typename Derived>
17306 ExprResult SrcExpr = getDerived().TransformExpr(E->getSrcExpr());
17307 if (SrcExpr.isInvalid())
17310 QualType Type = getDerived().TransformType(E->getType());
17313 E->getRParenLoc());
17316template<
typename Derived>
17319 bool ArgumentChanged =
false;
17321 SubExprs.reserve(E->getNumSubExprs());
17322 if (getDerived().TransformExprs(E->getSubExprs(), E->getNumSubExprs(),
false,
17323 SubExprs, &ArgumentChanged))
17326 if (!getDerived().AlwaysRebuild() &&
17330 return getDerived().RebuildAtomicExpr(E->getBuiltinLoc(), SubExprs,
17331 E->getOp(), E->getRParenLoc());
17338template<
typename Derived>
17341 return SemaRef.BuildPointerType(PointeeType,
Star,
17345template<
typename Derived>
17348 return SemaRef.BuildBlockPointerType(PointeeType,
Star,
17352template<
typename Derived>
17355 bool WrittenAsLValue,
17357 return SemaRef.BuildReferenceType(ReferentType, WrittenAsLValue,
17361template <
typename Derived>
17365 return SemaRef.BuildMemberPointerType(PointeeType, SS, Cls, Sigil,
17369template<
typename Derived>
17376 return SemaRef.ObjC().BuildObjCTypeParamType(
17377 Decl, ProtocolLAngleLoc, Protocols, ProtocolLocs, ProtocolRAngleLoc,
17381template<
typename Derived>
17392 return SemaRef.ObjC().BuildObjCObjectType(
17393 BaseType, Loc, TypeArgsLAngleLoc, TypeArgs, TypeArgsRAngleLoc,
17394 ProtocolLAngleLoc, Protocols, ProtocolLocs, ProtocolRAngleLoc,
17399template<
typename Derived>
17403 return SemaRef.Context.getObjCObjectPointerType(PointeeType);
17406template <
typename Derived>
17409 Expr *SizeExpr,
unsigned IndexTypeQuals,
SourceRange BracketsRange) {
17410 if (SizeExpr || !Size)
17411 return SemaRef.BuildArrayType(ElementType, SizeMod, SizeExpr,
17412 IndexTypeQuals, BracketsRange,
17416 SemaRef.Context.UnsignedCharTy,
SemaRef.Context.UnsignedShortTy,
17418 SemaRef.Context.UnsignedLongLongTy,
SemaRef.Context.UnsignedInt128Ty
17421 for (
const auto &
T : Types)
17422 if (Size->getBitWidth() ==
SemaRef.Context.getIntWidth(
T)) {
17432 return SemaRef.BuildArrayType(ElementType, SizeMod, ArraySize,
17433 IndexTypeQuals, BracketsRange,
17437template <
typename Derived>
17440 Expr *SizeExpr,
unsigned IndexTypeQuals,
SourceRange BracketsRange) {
17441 return getDerived().RebuildArrayType(ElementType, SizeMod, &Size, SizeExpr,
17442 IndexTypeQuals, BracketsRange);
17445template <
typename Derived>
17449 return getDerived().RebuildArrayType(ElementType, SizeMod,
nullptr,
nullptr,
17450 IndexTypeQuals, BracketsRange);
17453template <
typename Derived>
17456 unsigned IndexTypeQuals,
SourceRange BracketsRange) {
17457 return getDerived().RebuildArrayType(ElementType, SizeMod,
nullptr,
17459 IndexTypeQuals, BracketsRange);
17462template <
typename Derived>
17465 unsigned IndexTypeQuals,
SourceRange BracketsRange) {
17466 return getDerived().RebuildArrayType(ElementType, SizeMod,
nullptr,
17468 IndexTypeQuals, BracketsRange);
17471template <
typename Derived>
17474 return SemaRef.BuildAddressSpaceAttr(PointeeType, AddrSpaceExpr,
17478template <
typename Derived>
17480 unsigned NumElements,
17483 return SemaRef.Context.getVectorType(ElementType, NumElements, VecKind);
17486template <
typename Derived>
17490 return SemaRef.BuildVectorType(ElementType, SizeExpr, AttributeLoc);
17493template<
typename Derived>
17495 unsigned NumElements,
17497 llvm::APInt numElements(
SemaRef.Context.getIntWidth(
SemaRef.Context.IntTy),
17498 NumElements,
true);
17502 return SemaRef.BuildExtVectorType(ElementType, VectorSize, AttributeLoc);
17505template<
typename Derived>
17510 return SemaRef.BuildExtVectorType(ElementType, SizeExpr, AttributeLoc);
17513template <
typename Derived>
17515 QualType ElementType,
unsigned NumRows,
unsigned NumColumns) {
17516 return SemaRef.Context.getConstantMatrixType(ElementType, NumRows,
17520template <
typename Derived>
17524 return SemaRef.BuildMatrixType(ElementType, RowExpr, ColumnExpr,
17528template <
typename Derived>
17532 return SemaRef.BuildFunctionType(
T, ParamTypes,
17538template<
typename Derived>
17540 return SemaRef.Context.getFunctionNoProtoType(
T);
17543template <
typename Derived>
17547 assert(D &&
"no decl found");
17551 if (
auto *UPD = dyn_cast<UsingPackDecl>(D)) {
17555 if (UPD->expansions().empty()) {
17556 getSema().Diag(NameLoc, diag::err_using_pack_expansion_empty)
17557 << UPD->isCXXClassMember() << UPD;
17566 for (
auto *E : UPD->expansions()) {
17573 else if (
T.isNull())
17576 assert(
getSema().Context.hasSameType(ThisT,
T) &&
17577 "mismatched resolved types in using pack expansion");
17579 return T.isNull() ? FallbackT :
T;
17581 if (
auto *Using = dyn_cast<UsingDecl>(D)) {
17582 assert(Using->hasTypename() &&
17583 "UnresolvedUsingTypenameDecl transformed to non-typename using");
17586 assert(++Using->shadow_begin() == Using->shadow_end());
17591 return SemaRef.Context.getUsingType(
Keyword, Qualifier, Shadow);
17594 "UnresolvedUsingTypenameDecl transformed to non-using decl");
17595 return SemaRef.Context.getUnresolvedUsingType(
17599template <
typename Derived>
17602 return SemaRef.BuildTypeofExprType(E, Kind);
17605template<
typename Derived>
17608 return SemaRef.Context.getTypeOfType(Underlying, Kind);
17611template <
typename Derived>
17613 return SemaRef.BuildDecltypeType(E);
17616template <
typename Derived>
17621 return SemaRef.BuildPackIndexingType(Pattern, IndexExpr, Loc, EllipsisLoc,
17622 FullySubstituted, Expansions);
17625template<
typename Derived>
17627 UnaryTransformType::UTTKind UKind,
17629 return SemaRef.BuildUnaryTransformType(BaseType, UKind, Loc);
17632template <
typename Derived>
17636 return SemaRef.CheckTemplateIdType(
17641template<
typename Derived>
17644 return SemaRef.BuildAtomicType(ValueType, KWLoc);
17647template<
typename Derived>
17651 return isReadPipe ?
SemaRef.BuildReadPipeType(ValueType, KWLoc)
17652 :
SemaRef.BuildWritePipeType(ValueType, KWLoc);
17655template <
typename Derived>
17659 llvm::APInt NumBitsAP(
SemaRef.Context.getIntWidth(
SemaRef.Context.IntTy),
17663 return SemaRef.BuildBitIntType(IsUnsigned, Bits, Loc);
17666template <
typename Derived>
17669 return SemaRef.BuildBitIntType(IsUnsigned, NumBitsExpr, Loc);
17672template <
typename Derived>
17680template <
typename Derived>
17687 getSema().ActOnTemplateName(
nullptr, SS, TemplateKWLoc,
17690 AllowInjectedClassName);
17694template<
typename Derived>
17701 bool AllowInjectedClassName) {
17704 SourceLocation SymbolLocations[3] = { NameLoc, NameLoc, NameLoc };
17709 false,
Template, AllowInjectedClassName);
17713template <
typename Derived>
17718 bool isPostIncDec = Second && (Op == OO_PlusPlus || Op == OO_MinusMinus);
17723 return SemaRef.PseudoObject().checkAssignment(
nullptr, OpLoc,
17724 Opc,
First, Second);
17739 if (Op == OO_Subscript) {
17740 if (!
First->getType()->isOverloadableType() &&
17742 return getSema().CreateBuiltinArraySubscriptExpr(
First, CalleeLoc, Second,
17744 }
else if (Op == OO_Arrow) {
17747 if (
First->getType()->isDependentType())
17750 return SemaRef.BuildOverloadedArrowExpr(
nullptr,
First, OpLoc);
17751 }
else if (Second ==
nullptr || isPostIncDec) {
17752 if (!
First->getType()->isOverloadableType() ||
17753 (Op == OO_Amp &&
getSema().isQualifiedMemberAccess(
First))) {
17760 return getSema().CreateBuiltinUnaryOp(OpLoc, Opc,
First);
17764 !
First->getType()->isOverloadableType() &&
17770 =
SemaRef.CreateBuiltinBinOp(OpLoc, Opc,
First, Second);
17779 if (!Second || isPostIncDec) {
17782 return SemaRef.CreateOverloadedUnaryOp(OpLoc, Opc, Functions,
First,
17789 First, Second, RequiresADL);
17796template<
typename Derived>
17806 QualType CanonicalBaseType =
Base->getType().getCanonicalType();
17812 ->getAsCanonical<RecordType>())) {
17814 return SemaRef.BuildPseudoDestructorExpr(
17815 Base, OperatorLoc, isArrow ? tok::arrow : tok::period, SS, ScopeType,
17816 CCLoc, TildeLoc, Destroyed);
17828 if (!
isa<TagType>(ScopeType->getType().getCanonicalType())) {
17829 getSema().Diag(ScopeType->getTypeLoc().getBeginLoc(),
17830 diag::err_expected_class_or_namespace)
17831 << ScopeType->getType() <<
getSema().getLangOpts().CPlusPlus;
17835 SS.
Make(
SemaRef.Context, ScopeType->getTypeLoc(), CCLoc);
17839 return getSema().BuildMemberReferenceExpr(
17840 Base,
Base->getType(), OperatorLoc, isArrow, SS, TemplateKWLoc,
17846template<
typename Derived>
17854 for (
unsigned I = 0; I < NumParams; ++I) {
17855 if (I != ContextParamPos) {
17861 Params.push_back(std::make_pair(StringRef(), QualType()));
17864 getSema().ActOnCapturedRegionStart(Loc,
nullptr,
17872 if (Body.isInvalid()) {
17873 getSema().ActOnCapturedRegionError();
17877 return getSema().ActOnCapturedRegionEnd(Body.get());
17880template <
typename Derived>
17886 llvm_unreachable(
"SYCL kernel call statement cannot appear in dependent "
17890template <
typename Derived>
static Decl::Kind getKind(const Decl *D)
Defines the C++ template declaration subclasses.
Defines the clang::Expr interface and subclasses for C++ expressions.
Defines Expressions and AST nodes for C++2a concepts.
llvm::MachO::Record Record
This file defines OpenMP AST classes for clauses.
Defines some OpenMP-specific enums and functions.
This file declares semantic analysis for Objective-C.
This file declares semantic analysis for OpenACC constructs and clauses.
This file declares semantic analysis for OpenMP constructs and clauses.
This file declares semantic analysis for expressions involving.
This file declares semantic analysis for SYCL constructs.
static bool PreparePackForExpansion(Sema &S, const CXXBaseSpecifier &Base, const MultiLevelTemplateArgumentList &TemplateArgs, TypeSourceInfo *&Out, UnexpandedInfo &Info)
Defines the Objective-C statement AST node classes.
This file defines OpenACC AST classes for statement-level contructs.
This file defines OpenMP AST classes for executable directives and clauses.
This file defines SYCL AST classes used to represent calls to SYCL kernels.
static QualType getPointeeType(const MemRegion *R)
QualType getAttributedType(attr::Kind attrKind, QualType modifiedType, QualType equivalentType, const Attr *attr=nullptr) const
QualType getArrayParameterType(QualType Ty) const
Return the uniqued reference to a specified array parameter type from the original array type.
QualType getSubstTemplateTypeParmType(QualType Replacement, Decl *AssociatedDecl, unsigned Index, UnsignedOrNone PackIndex, bool Final) const
Retrieve a substitution-result type.
QualType getDecayedType(QualType T) const
Return the uniqued reference to the decayed version of the given type.
QualType getBaseElementType(const ArrayType *VAT) const
Return the innermost element type of an array type.
TypeSourceInfo * getTrivialTypeSourceInfo(QualType T, SourceLocation Loc=SourceLocation()) const
Allocate a TypeSourceInfo where all locations have been initialized to a given location,...
CanQualType PseudoObjectTy
QualType getObjCObjectPointerType(QualType OIT) const
Return a ObjCObjectPointerType type for the given ObjCObjectType.
const ArrayType * getAsArrayType(QualType T) const
Type Query functions.
QualType getPackExpansionType(QualType Pattern, UnsignedOrNone NumExpansions, bool ExpectPackInType=true) const
Form a pack expansion type with the given pattern.
static bool hasSameType(QualType T1, QualType T2)
Determine whether the given types T1 and T2 are equivalent.
QualType getSizeType() const
Return the unique type for "size_t" (C99 7.17), defined in <stddef.h>.
TemplateName getSubstTemplateTemplateParmPack(const TemplateArgument &ArgPack, Decl *AssociatedDecl, unsigned Index, bool Final) const
QualType getHLSLAttributedResourceType(QualType Wrapped, QualType Contained, const HLSLAttributedResourceType::Attributes &Attrs)
AddrLabelExpr - The GNU address of label extension, representing &&label.
Represents the index of the current element of an array being initialized by an ArrayInitLoopExpr.
Represents a loop initializing the elements of an array.
Wrapper for source info for array parameter types.
This class represents BOTH the OpenMP Array Section and OpenACC 'subarray', with a boolean differenti...
ArraySubscriptExpr - [C99 6.5.2.1] Array Subscripting.
Wrapper for source info for arrays.
void setLBracketLoc(SourceLocation Loc)
An Embarcadero array type trait, as used in the implementation of __array_rank and __array_extent.
SourceLocation getEndLoc() const LLVM_READONLY
ArrayTypeTrait getTrait() const
Expr * getDimensionExpression() const
TypeSourceInfo * getQueriedTypeSourceInfo() const
SourceLocation getBeginLoc() const LLVM_READONLY
Represents an array type, per C99 6.7.5.2 - Array Declarators.
AsTypeExpr - Clang builtin function __builtin_astype [OpenCL 6.2.4.2] This AST node provides support ...
AtomicExpr - Variadic atomic builtins: __atomic_exchange, __atomic_fetch_*, __atomic_load,...
void setKWLoc(SourceLocation Loc)
Attr - This represents one attribute.
attr::Kind getKind() const
Represents an attribute applied to a statement.
SourceLocation getAttrLoc() const
ArrayRef< const Attr * > getAttrs() const
Type source information for an attributed type.
void setAttr(const Attr *A)
Type source information for an btf_tag attributed type.
BinaryConditionalOperator - The GNU extension to the conditional operator which allows the middle ope...
A builtin binary operation expression such as "x + y" or "x <= y".
static OverloadedOperatorKind getOverloadedOperator(Opcode Opc)
Retrieve the overloaded operator kind that corresponds to the given binary opcode.
static bool isAssignmentOp(Opcode Opc)
static Opcode getOverloadedOpcode(OverloadedOperatorKind OO)
Retrieve the binary opcode that corresponds to the given overloaded operator.
A fixed int type of a specified bitwidth.
Represents a block literal declaration, which is like an unnamed FunctionDecl.
void setIsVariadic(bool value)
BlockExpr - Adaptor class for mixing a BlockDecl with expressions.
Wrapper for source info for block pointers.
BreakStmt - This represents a break.
Represents a C++2a __builtin_bit_cast(T, v) expression.
SourceLocation getEndLoc() const LLVM_READONLY
SourceLocation getBeginLoc() const LLVM_READONLY
CStyleCastExpr - An explicit cast in C (C99 6.5.4) or a C-style cast in C++ (C++ [expr....
Represents a call to a CUDA kernel function.
A C++ addrspace_cast expression (currently only enabled for OpenCL).
Represents binding an expression to a temporary.
A boolean literal, per ([C++ lex.bool] Boolean literals).
CXXCatchStmt - This represents a C++ catch block.
A C++ const_cast expression (C++ [expr.const.cast]).
Represents a call to a C++ constructor.
SourceRange getParenOrBraceRange() const
Expr * getArg(unsigned Arg)
Return the specified argument.
bool isStdInitListInitialization() const
Whether this constructor call was written as list-initialization, but was interpreted as forming a st...
SourceLocation getEndLoc() const LLVM_READONLY
SourceLocation getBeginLoc() const LLVM_READONLY
bool isListInitialization() const
Whether this constructor call was written as list-initialization.
unsigned getNumArgs() const
Return the number of arguments to the constructor call.
Represents a C++ constructor within a class.
A default argument (C++ [dcl.fct.default]).
static CXXDefaultArgExpr * Create(const ASTContext &C, SourceLocation Loc, ParmVarDecl *Param, Expr *RewrittenExpr, DeclContext *UsedContext)
A use of a default initializer in a constructor or in aggregate initialization.
Represents a delete expression for memory deallocation and destructor calls, e.g.
Represents a C++ member access expression where the actual member referenced could not be resolved be...
Represents a C++ destructor within a class.
A C++ dynamic_cast expression (C++ [expr.dynamic.cast]).
Represents a folding of a pack over an operator.
CXXForRangeStmt - This represents C++0x [stmt.ranged]'s ranged for statement, represented as 'for (ra...
Represents an explicit C++ type conversion that uses "functional" notation (C++ [expr....
Represents a call to an inherited base class constructor from an inheriting constructor.
Represents a call to a member function that may be written either with member call syntax (e....
Represents a static or instance method of a struct/union/class.
Abstract class common to all of the C++ "named"/"keyword" casts.
SourceLocation getOperatorLoc() const
Retrieve the location of the cast operator keyword, e.g., static_cast.
SourceRange getAngleBrackets() const LLVM_READONLY
SourceLocation getRParenLoc() const
Retrieve the location of the closing parenthesis.
Represents a new-expression for memory allocation and constructor calls, e.g: "new CXXNewExpr(foo)".
Represents a C++11 noexcept expression (C++ [expr.unary.noexcept]).
The null pointer literal (C++11 [lex.nullptr])
A call to an overloaded operator written using operator syntax.
Represents a list-initialization with parenthesis.
Represents a C++ pseudo-destructor (C++ [expr.pseudo]).
Represents a C++ struct/union/class.
unsigned getLambdaDependencyKind() const
A C++ reinterpret_cast expression (C++ [expr.reinterpret.cast]).
A rewritten comparison expression that was originally written using operator syntax.
An expression "T()" which creates an rvalue of a non-class type T.
Represents a C++ nested-name-specifier or a global scope specifier.
void Make(ASTContext &Context, TypeLoc TL, SourceLocation ColonColonLoc)
Make a nested-name-specifier of the form 'type::'.
char * location_data() const
Retrieve the data associated with the source-location information.
SourceRange getRange() const
void MakeGlobal(ASTContext &Context, SourceLocation ColonColonLoc)
Turn this (empty) nested-name-specifier into the global nested-name-specifier '::'.
NestedNameSpecifier getScopeRep() const
Retrieve the representation of the nested-name-specifier.
NestedNameSpecifierLoc getWithLocInContext(ASTContext &Context) const
Retrieve a nested-name-specifier with location information, copied into the given AST context.
unsigned location_size() const
Retrieve the size of the data associated with source-location information.
void Extend(ASTContext &Context, NamespaceBaseDecl *Namespace, SourceLocation NamespaceLoc, SourceLocation ColonColonLoc)
Extend the current nested-name-specifier by another nested-name-specifier component of the form 'name...
void MakeMicrosoftSuper(ASTContext &Context, CXXRecordDecl *RD, SourceLocation SuperLoc, SourceLocation ColonColonLoc)
Turns this (empty) nested-name-specifier into '__super' nested-name-specifier.
bool isEmpty() const
No scope specifier.
void Adopt(NestedNameSpecifierLoc Other)
Adopt an existing nested-name-specifier (with source-range information).
Implicit construction of a std::initializer_list<T> object from an array temporary within list-initia...
Represents a C++ functional cast expression that builds a temporary object.
Represents the this expression in C++.
A C++ throw-expression (C++ [except.throw]).
CXXTryStmt - A C++ try block, including all handlers.
A C++ typeid expression (C++ [expr.typeid]), which gets the type_info that corresponds to the supplie...
Describes an explicit type conversion that uses functional notion but could not be resolved because o...
SourceLocation getLParenLoc() const
Retrieve the location of the left parentheses ('(') that precedes the argument list.
bool isListInitialization() const
Determine whether this expression models list-initialization.
TypeSourceInfo * getTypeSourceInfo() const
Retrieve the type source information for the type being constructed.
SourceLocation getRParenLoc() const
Retrieve the location of the right parentheses (')') that follows the argument list.
unsigned getNumArgs() const
Retrieve the number of arguments.
A Microsoft C++ __uuidof expression, which gets the _GUID that corresponds to the supplied type or ex...
CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).
static CallExpr * Create(const ASTContext &Ctx, Expr *Fn, ArrayRef< Expr * > Args, QualType Ty, ExprValueKind VK, SourceLocation RParenLoc, FPOptionsOverride FPFeatures, unsigned MinNumArgs=0, ADLCallKind UsesADL=NotADL)
Create a call expression.
Represents the body of a CapturedStmt, and serves as its DeclContext.
unsigned getNumParams() const
unsigned getContextParamPosition() const
ImplicitParamDecl * getParam(unsigned i) const
This captures a statement into a function.
CapturedDecl * getCapturedDecl()
Retrieve the outlined function declaration.
Stmt * getCapturedStmt()
Retrieve the statement being captured.
SourceLocation getBeginLoc() const LLVM_READONLY
CapturedRegionKind getCapturedRegionKind() const
Retrieve the captured region kind.
CaseStmt - Represent a case statement.
Expr * getSubExprAsWritten()
Retrieve the cast subexpression as it was written in the source code, looking through any implicit ca...
ChooseExpr - GNU builtin-in function __builtin_choose_expr.
Represents a 'co_await' expression.
CompoundAssignOperator - For compound assignments (e.g.
CompoundLiteralExpr - [C99 6.5.2.5].
CompoundStmt - This represents a group of statements like { stmt stmt }.
FPOptionsOverride getStoredFPFeatures() const
Get FPOptionsOverride from trailing storage.
SourceLocation getLBracLoc() const
bool hasStoredFPFeatures() const
SourceLocation getRBracLoc() const
Declaration of a C++20 concept.
static ConceptReference * Create(const ASTContext &C, NestedNameSpecifierLoc NNS, SourceLocation TemplateKWLoc, DeclarationNameInfo ConceptNameInfo, NamedDecl *FoundDecl, TemplateDecl *NamedConcept, const ASTTemplateArgumentListInfo *ArgsAsWritten)
Represents the specialization of a concept - evaluates to a prvalue of type bool.
const TypeClass * getTypePtr() const
ConditionalOperator - The ?
Represents the canonical version of C arrays with a specified constant size.
ConstantExpr - An expression that occurs in a constant context and optionally the result of evaluatin...
Represents a concrete matrix type with constant number of rows and columns.
ContinueStmt - This represents a continue.
ConvertVectorExpr - Clang builtin function __builtin_convertvector This AST node provides support for...
Represents a 'co_return' statement in the C++ Coroutines TS.
Represents the body of a coroutine.
Represents a sugar type with __counted_by or __sized_by annotations, including their _or_null variant...
Represents a 'co_yield' expression.
Wrapper for source info for pointers decayed from arrays and functions.
static DeclAccessPair make(NamedDecl *D, AccessSpecifier AS)
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
DeclContext * getParent()
getParent - Returns the containing DeclContext.
DeclContextLookupResult lookup_result
lookup_result lookup(DeclarationName Name) const
lookup - Find the declarations (if any) with the given Name in this context.
void addDecl(Decl *D)
Add the declaration D into this context.
A reference to a declared variable, function, enum, etc.
DeclStmt - Adaptor class for mixing declarations with statements and expressions.
Decl - This represents one declaration (or definition), e.g.
bool isInvalidDecl() const
SourceLocation getLocation() const
DeclContext * getDeclContext()
AccessSpecifier getAccess() const
The name of a declaration.
TemplateDecl * getCXXDeductionGuideTemplate() const
If this name is the name of a C++ deduction guide, return the template associated with that name.
@ CXXConversionFunctionName
QualType getCXXNameType() const
If this name is one of the C++ names (of a constructor, destructor, or conversion function),...
NameKind getNameKind() const
Determine what kind of name this is.
SourceLocation getInnerLocStart() const
Return start of source range ignoring outer template declarations.
TypeSourceInfo * getTypeSourceInfo() const
Information about one declarator, including the parsed type information and the identifier.
void setDecltypeLoc(SourceLocation Loc)
void setElaboratedKeywordLoc(SourceLocation Loc)
DeferStmt - This represents a deferred statement.
static DeferStmt * Create(ASTContext &Context, SourceLocation DeferLoc, Stmt *Body)
void setAttrOperandParensRange(SourceRange range)
Represents an extended address space qualifier where the input address space value is dependent.
Represents a 'co_await' expression while the type of the promise is dependent.
void setElaboratedKeywordLoc(SourceLocation Loc)
A qualified reference to a name whose declaration cannot yet be resolved.
SourceLocation getRAngleLoc() const
Retrieve the location of the right angle bracket ending the explicit template argument list following...
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies the name, with source location information.
SourceLocation getLAngleLoc() const
Retrieve the location of the left angle bracket starting the explicit template argument list followin...
bool hasExplicitTemplateArgs() const
Determines whether this lookup had explicit template arguments.
SourceLocation getTemplateKeywordLoc() const
Retrieve the location of the template keyword preceding this name, if any.
unsigned getNumTemplateArgs() const
DeclarationName getDeclName() const
Retrieve the name that this expression refers to.
TemplateArgumentLoc const * getTemplateArgs() const
const DeclarationNameInfo & getNameInfo() const
Retrieve the name that this expression refers to.
Represents an array type in C++ whose size is a value-dependent expression.
void setNameLoc(SourceLocation Loc)
Represents an extended vector type where either the type or size is dependent.
Represents a matrix type where the type and the number of rows and columns is dependent on a template...
void setNameLoc(SourceLocation Loc)
Represents a vector type where either the type or size is dependent.
Represents a single C99 designator.
Represents a C99 designated initializer expression.
Designation - Represent a full designation, which is a sequence of designators.
static Designator CreateArrayRangeDesignator(Expr *Start, Expr *End, SourceLocation LBracketLoc, SourceLocation EllipsisLoc)
Creates a GNU array-range designator.
static Designator CreateArrayDesignator(Expr *Index, SourceLocation LBracketLoc)
Creates an array designator.
static Designator CreateFieldDesignator(const IdentifierInfo *FieldName, SourceLocation DotLoc, SourceLocation FieldLoc)
Creates a field designator.
bool hasErrorOccurred() const
DoStmt - This represents a 'do/while' stmt.
Wrap a function effect's condition expression in another struct so that FunctionProtoType's TrailingO...
Expr * getCondition() const
void set(SourceLocation ElaboratedKeywordLoc, NestedNameSpecifierLoc QualifierLoc, SourceLocation NameLoc)
Represents a reference to emded data.
RAII object that enters a new expression evaluation context.
Wrapper for source info for enum types.
TypeSourceInfo * getTypeInfoAsWritten() const
getTypeInfoAsWritten - Returns the type source info for the type that this expression is casting to.
Represents an expression – generally a full-expression – that introduces cleanups to be run at the en...
This represents one expression.
bool isValueDependent() const
Determines whether the value of this expression depends on.
bool isTypeDependent() const
Determines whether the type of this expression depends on.
ExprObjectKind getObjectKind() const
getObjectKind - The object kind that this expression produces.
Expr * IgnoreImplicitAsWritten() LLVM_READONLY
Skip past any implicit AST nodes which might surround this expression until reaching a fixed point.
bool isDefaultArgument() const
Determine whether this expression is a default function argument.
bool hasPlaceholderType() const
Returns whether this expression has a placeholder type.
static ExprValueKind getValueKindForType(QualType T)
getValueKindForType - Given a formal return or parameter type, give its value kind.
An expression trait intrinsic.
ExtVectorElementExpr - This represents access to specific elements of a vector, and may occur on the ...
Represents difference between two FPOptions values.
FPOptions applyOverrides(FPOptions Base)
Represents a member of a struct/union/class.
ForStmt - This represents a 'for (init;cond;inc)' stmt.
Represents a function declaration or definition.
ArrayRef< ParmVarDecl * > parameters() const
SmallVector< Conflict > Conflicts
Represents an abstract function effect, using just an enumeration describing its kind.
StringRef name() const
The description printed in diagnostics, e.g. 'nonblocking'.
Kind oppositeKind() const
Return the opposite kind, for effects which have opposites.
ArrayRef< EffectConditionExpr > conditions() const
Represents a K&R-style 'int foo()' function, which has no information available about its arguments.
Represents a reference to a function parameter pack, init-capture pack, or binding pack that has been...
Represents a prototype with parameter type info, e.g.
param_type_iterator param_type_begin() const
unsigned getNumParams() const
SourceLocation getLocalRangeEnd() const
void setLocalRangeBegin(SourceLocation L)
void setLParenLoc(SourceLocation Loc)
SourceRange getExceptionSpecRange() const
void setParam(unsigned i, ParmVarDecl *VD)
ArrayRef< ParmVarDecl * > getParams() const
void setRParenLoc(SourceLocation Loc)
void setLocalRangeEnd(SourceLocation L)
void setExceptionSpecRange(SourceRange R)
TypeLoc getReturnLoc() const
SourceLocation getLocalRangeBegin() const
SourceLocation getLParenLoc() const
SourceLocation getRParenLoc() const
Interesting information about a specific parameter that can't simply be reflected in parameter's type...
This represents a GCC inline-assembly statement extension.
GNUNullExpr - Implements the GNU __null extension, which is a name for a null pointer constant that h...
Represents a C11 generic selection.
AssociationTy< false > Association
GotoStmt - This represents a direct goto.
Type source information for HLSL attributed resource type.
This class represents temporary values used to represent inout and out arguments in HLSL.
One of these records is kept for each identifier that is lexed.
IfStmt - This represents an if/then/else.
ImaginaryLiteral - We support imaginary integer and floating point literals, like "1....
ImplicitCastExpr - Allows us to explicitly represent implicit type conversions, which have no direct ...
Represents an implicitly-generated value initialization of an object of a given type.
Represents a C array with an unspecified size.
IndirectGotoStmt - This represents an indirect goto.
const TypeClass * getTypePtr() const
Describes an C or C++ initializer list.
InitListExpr * getSyntacticForm() const
Wrapper for source info for injected class names of class templates.
static IntegerLiteral * Create(const ASTContext &C, const llvm::APInt &V, QualType type, SourceLocation l)
Returns a new integer literal with value 'V' and type 'type'.
Represents the declaration of a label.
LabelStmt - Represents a label, which has a substatement.
A C++ lambda expression, which produces a function object (of unspecified type) that can be invoked l...
capture_iterator capture_begin() const
Retrieve an iterator pointing to the first lambda capture.
bool isInitCapture(const LambdaCapture *Capture) const
Determine whether one of this lambda's captures is an init-capture.
capture_iterator capture_end() const
Retrieve an iterator pointing past the end of the sequence of lambda captures.
const LambdaCapture * capture_iterator
An iterator that walks over the captures of the lambda, both implicit and explicit.
Represents the results of name lookup.
LLVM_ATTRIBUTE_REINITIALIZES void clear()
Clears out any current state.
void addDecl(NamedDecl *D)
Add a declaration to these results with its natural access.
bool empty() const
Return true if no decls were found.
void resolveKind()
Resolves the result kind of the lookup, possibly hiding decls.
SourceLocation getNameLoc() const
Gets the location of the identifier.
NamedDecl * getRepresentativeDecl() const
Fetches a representative decl. Useful for lazy diagnostics.
DeclarationName getLookupName() const
Gets the name to look up.
This represents a Microsoft inline-assembly statement extension.
Representation of a Microsoft __if_exists or __if_not_exists statement with a dependent name.
An instance of this class represents the declaration of a property member.
A member reference to an MSPropertyDecl.
MS property subscript expression.
void setExpansionLoc(SourceLocation Loc)
Represents a prvalue temporary that is written into memory so that a reference can bind to it.
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.
NamedDecl * getUnderlyingDecl()
Looks through UsingDecls and ObjCCompatibleAliasDecls for the underlying named decl.
IdentifierInfo * getIdentifier() const
Get the identifier that names this declaration, if there is one.
StringRef getName() const
Get the name of identifier for this declaration as a StringRef.
DeclarationName getDeclName() const
Get the actual, stored name of the declaration, which may be a special name.
Represents C++ namespaces and their aliases.
Class that aids in the construction of nested-name-specifiers along with source-location information ...
void MakeTrivial(ASTContext &Context, NestedNameSpecifier Qualifier, SourceRange R)
Make a new nested-name-specifier from incomplete source-location information.
A C++ nested-name-specifier augmented with source location information.
NestedNameSpecifier getNestedNameSpecifier() const
Retrieve the nested-name-specifier to which this instance refers.
SourceLocation getLocalEndLoc() const
Retrieve the location of the end of this component of the nested-name-specifier.
SourceRange getSourceRange() const LLVM_READONLY
Retrieve the source range covering the entirety of this nested-name-specifier.
SourceLocation getEndLoc() const
Retrieve the location of the end of this nested-name-specifier.
SourceLocation getBeginLoc() const
Retrieve the location of the beginning of this nested-name-specifier.
TypeLoc castAsTypeLoc() const
For a nested-name-specifier that refers to a type, retrieve the type with source-location information...
void * getOpaqueData() const
Retrieve the opaque pointer that refers to source-location data.
SourceLocation getLocalBeginLoc() const
Retrieve the location of the beginning of this component of the nested-name-specifier.
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
NamespaceAndPrefix getAsNamespaceAndPrefix() const
CXXRecordDecl * getAsRecordDecl() const
Retrieve the record declaration stored in this nested name specifier, or null.
bool isDependent() const
Whether this nested name specifier refers to a dependent type or not.
@ MicrosoftSuper
Microsoft's '__super' specifier, stored as a CXXRecordDecl* of the class it appeared in.
@ Global
The global specifier '::'. There is no stored value.
@ Type
A type, stored as a Type*.
@ Namespace
A namespace-like entity, stored as a NamespaceBaseDecl*.
Represents a place-holder for an object not to be initialized by anything.
NonTypeTemplateParmDecl - Declares a non-type template parameter, e.g., "Size" in.
NullStmt - This is the null statement ";": C99 6.8.3p3.
This represents the 'absent' clause in the 'pragma omp assume' directive.
This represents 'acq_rel' clause in the 'pragma omp atomic|flush' directives.
This represents 'acquire' clause in the 'pragma omp atomic|flush' directives.
This represents clause 'affinity' in the 'pragma omp task'-based directives.
This represents the 'align' clause in the 'pragma omp allocate' directive.
This represents clause 'aligned' in the 'pragma omp ...' directives.
This represents clause 'allocate' in the 'pragma omp ...' directives.
This represents 'allocator' clause in the 'pragma omp ...' directive.
An explicit cast in C or a C-style cast in C++, which uses the syntax ([s1][s2]......
This represents 'at' clause in the 'pragma omp error' directive.
This represents 'atomic_default_mem_order' clause in the 'pragma omp requires' directive.
This represents 'bind' clause in the 'pragma omp ...' directives.
This represents 'capture' clause in the 'pragma omp atomic' directive.
This is a basic class for representing single OpenMP clause.
OpenMPClauseKind getClauseKind() const
Returns kind of OpenMP clause (private, shared, reduction, etc.).
This represents 'collapse' clause in the 'pragma omp ...' directive.
This represents 'compare' clause in the 'pragma omp atomic' directive.
This represents the 'contains' clause in the 'pragma omp assume' directive.
This represents clause 'copyin' in the 'pragma omp ...' directives.
This represents clause 'copyprivate' in the 'pragma omp ...' directives.
This represents 'default' clause in the 'pragma omp ...' directive.
This represents 'defaultmap' clause in the 'pragma omp ...' directive.
This represents implicit clause 'depend' for the 'pragma omp task' directive.
This represents implicit clause 'depobj' for the 'pragma omp depobj' directive.
This represents 'destroy' clause in the 'pragma omp depobj' directive or the 'pragma omp interop' dir...
This represents 'detach' clause in the 'pragma omp task' directive.
This represents 'device' clause in the 'pragma omp ...' directive.
This represents 'dist_schedule' clause in the 'pragma omp ...' directive.
This represents the 'doacross' clause for the 'pragma omp ordered' directive.
This represents 'dyn_groupprivate' clause in 'pragma omp target ...' and 'pragma omp teams ....
This represents 'dynamic_allocators' clause in the 'pragma omp requires' directive.
This represents clause 'exclusive' in the 'pragma omp scan' directive.
This represents 'fail' clause in the 'pragma omp atomic' directive.
This represents 'filter' clause in the 'pragma omp ...' directive.
This represents 'final' clause in the 'pragma omp ...' directive.
This represents clause 'firstprivate' in the 'pragma omp ...' directives.
This represents implicit clause 'flush' for the 'pragma omp flush' directive.
This represents clause 'from' in the 'pragma omp ...' directives.
Representation of the 'full' clause of the 'pragma omp unroll' directive.
This represents 'grainsize' clause in the 'pragma omp ...' directive.
This represents clause 'has_device_ptr' in the 'pragma omp ...' directives.
This represents 'hint' clause in the 'pragma omp ...' directive.
This represents the 'holds' clause in the 'pragma omp assume' directive.
This represents 'if' clause in the 'pragma omp ...' directive.
This represents clause 'in_reduction' in the 'pragma omp task' directives.
This represents clause 'inclusive' in the 'pragma omp scan' directive.
This represents the 'init' clause in 'pragma omp ...' directives.
This represents clause 'is_device_ptr' in the 'pragma omp ...' directives.
OpenMP 5.0 [2.1.6 Iterators] Iterators are identifiers that expand to multiple values in the clause o...
This represents clause 'lastprivate' in the 'pragma omp ...' directives.
This represents clause 'linear' in the 'pragma omp ...' directives.
This class represents the 'looprange' clause in the 'pragma omp fuse' directive.
This represents clauses with a list of expressions that are mappable.
This represents 'mergeable' clause in the 'pragma omp ...' directive.
This represents the 'message' clause in the 'pragma omp error' and the 'pragma omp parallel' directiv...
This represents the 'no_openmp' clause in the 'pragma omp assume' directive.
This represents the 'no_openmp_constructs' clause in the.
This represents the 'no_openmp_routines' clause in the 'pragma omp assume' directive.
This represents the 'no_parallelism' clause in the 'pragma omp assume' directive.
This represents 'nocontext' clause in the 'pragma omp ...' directive.
This represents 'nogroup' clause in the 'pragma omp ...' directive.
This represents clause 'nontemporal' in the 'pragma omp ...' directives.
This represents 'novariants' clause in the 'pragma omp ...' directive.
This represents 'nowait' clause in the 'pragma omp ...' directive.
This represents 'num_tasks' clause in the 'pragma omp ...' directive.
This represents 'num_teams' clause in the 'pragma omp ...' directive.
This represents 'num_threads' clause in the 'pragma omp ...' directive.
This represents 'order' clause in the 'pragma omp ...' directive.
This represents 'ordered' clause in the 'pragma omp ...' directive.
Representation of the 'partial' clause of the 'pragma omp unroll' directive.
This class represents the 'permutation' clause in the 'pragma omp interchange' directive.
This represents 'priority' clause in the 'pragma omp ...' directive.
This represents clause 'private' in the 'pragma omp ...' directives.
This represents 'proc_bind' clause in the 'pragma omp ...' directive.
This represents 'read' clause in the 'pragma omp atomic' directive.
This represents clause 'reduction' in the 'pragma omp ...' directives.
This represents 'relaxed' clause in the 'pragma omp atomic' directives.
This represents 'release' clause in the 'pragma omp atomic|flush' directives.
This represents 'reverse_offload' clause in the 'pragma omp requires' directive.
This represents 'simd' clause in the 'pragma omp ...' directive.
This represents 'safelen' clause in the 'pragma omp ...' directive.
This represents 'schedule' clause in the 'pragma omp ...' directive.
This represents 'self_maps' clause in the 'pragma omp requires' directive.
This represents 'seq_cst' clause in the 'pragma omp atomic|flush' directives.
This represents the 'severity' clause in the 'pragma omp error' and the 'pragma omp parallel' directi...
This represents clause 'shared' in the 'pragma omp ...' directives.
This represents 'simdlen' clause in the 'pragma omp ...' directive.
This represents the 'sizes' clause in the 'pragma omp tile' directive.
This represents clause 'task_reduction' in the 'pragma omp taskgroup' directives.
This represents 'thread_limit' clause in the 'pragma omp ...' directive.
This represents 'threads' clause in the 'pragma omp ...' directive.
This represents 'threadset' clause in the 'pragma omp task ...' directive.
This represents clause 'to' in the 'pragma omp ...' directives.
This represents 'unified_address' clause in the 'pragma omp requires' directive.
This represents 'unified_shared_memory' clause in the 'pragma omp requires' directive.
This represents 'untied' clause in the 'pragma omp ...' directive.
This represents 'update' clause in the 'pragma omp atomic' directive.
This represents the 'use' clause in 'pragma omp ...' directives.
This represents clause 'use_device_addr' in the 'pragma omp ...' directives.
This represents clause 'use_device_ptr' in the 'pragma omp ...' directives.
This represents clause 'uses_allocators' in the 'pragma omp target'-based directives.
This represents 'weak' clause in the 'pragma omp atomic' directives.
This represents 'write' clause in the 'pragma omp atomic' directive.
This represents 'ompx_attribute' clause in a directive that might generate an outlined function.
This represents 'ompx_bare' clause in the 'pragma omp target teams ...' directive.
This represents 'ompx_dyn_cgroup_mem' clause in the 'pragma omp target ...' directive.
ObjCArrayLiteral - used for objective-c array containers; as in: @["Hello", NSApp,...
Represents Objective-C's @catch statement.
Represents Objective-C's @finally statement.
Represents Objective-C's @synchronized statement.
Represents Objective-C's @throw statement.
Represents Objective-C's @try ... @catch ... @finally statement.
Represents Objective-C's @autoreleasepool Statement.
A runtime availability query.
ObjCBoolLiteralExpr - Objective-C Boolean Literal.
ObjCBoxedExpr - used for generalized expression boxing.
An Objective-C "bridged" cast expression, which casts between Objective-C pointers and C pointers,...
ObjCDictionaryLiteral - AST node to represent objective-c dictionary literals; as in:"name" : NSUserN...
ObjCEncodeExpr, used for @encode in Objective-C.
Represents Objective-C's collection statement.
ObjCIndirectCopyRestoreExpr - Represents the passing of a function argument by indirect copy-restore ...
Wrapper for source info for ObjC interfaces.
ObjCIsaExpr - Represent X->isa and X.isa when X is an ObjC 'id' type.
ObjCIvarDecl - Represents an ObjC instance variable.
ObjCIvarRefExpr - A reference to an ObjC instance variable.
An expression that sends a message to the given Objective-C object or class.
@ SuperInstance
The receiver is the instance of the superclass object.
@ Instance
The receiver is an object instance.
@ SuperClass
The receiver is a superclass.
@ Class
The receiver is a class.
ObjCMethodDecl - Represents an instance or class method declaration.
Wraps an ObjCPointerType with source location information.
void setStarLoc(SourceLocation Loc)
void setHasBaseTypeAsWritten(bool HasBaseType)
Represents one property declaration in an Objective-C interface.
ObjCPropertyRefExpr - A dot-syntax expression to access an ObjC property.
ObjCProtocolExpr used for protocol expression in Objective-C.
ObjCSelectorExpr used for @selector in Objective-C.
ObjCStringLiteral, used for Objective-C string literals i.e.
ObjCSubscriptRefExpr - used for array and dictionary subscripting.
Represents the declaration of an Objective-C type parameter.
ProtocolLAngleLoc, ProtocolRAngleLoc, and the source locations for protocol qualifiers are stored aft...
@ Array
An index into an array.
@ Identifier
A field in a dependent type, known only by its name.
@ Base
An implicit indirection through a C++ base class, when the field found is in a base class.
static OpaquePtr make(QualType P)
OpaqueValueExpr - An expression referring to an opaque object of a fixed type and value class.
Expr * getSourceExpr() const
The source expression of an opaque value expression is the expression which originally generated the ...
This expression type represents an asterisk in an OpenACC Size-Expr, used in the 'tile' and 'gang' cl...
static OpenACCAsyncClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *IntExpr, SourceLocation EndLoc)
static OpenACCAttachClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCAutoClause * Create(const ASTContext &Ctx, SourceLocation BeginLoc, SourceLocation EndLoc)
This is the base type for all OpenACC Clauses.
Represents a 'collapse' clause on a 'loop' construct.
static OpenACCCollapseClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, bool HasForce, Expr *LoopCount, SourceLocation EndLoc)
static OpenACCCopyClause * Create(const ASTContext &C, OpenACCClauseKind Spelling, SourceLocation BeginLoc, SourceLocation LParenLoc, OpenACCModifierKind Mods, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCCopyInClause * Create(const ASTContext &C, OpenACCClauseKind Spelling, SourceLocation BeginLoc, SourceLocation LParenLoc, OpenACCModifierKind Mods, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCCopyOutClause * Create(const ASTContext &C, OpenACCClauseKind Spelling, SourceLocation BeginLoc, SourceLocation LParenLoc, OpenACCModifierKind Mods, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCCreateClause * Create(const ASTContext &C, OpenACCClauseKind Spelling, SourceLocation BeginLoc, SourceLocation LParenLoc, OpenACCModifierKind Mods, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCDefaultAsyncClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *IntExpr, SourceLocation EndLoc)
A 'default' clause, has the optional 'none' or 'present' argument.
static OpenACCDefaultClause * Create(const ASTContext &C, OpenACCDefaultClauseKind K, SourceLocation BeginLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
static OpenACCDeleteClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCDetachClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCDeviceClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCDeviceNumClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *IntExpr, SourceLocation EndLoc)
static OpenACCDevicePtrClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
A 'device_type' or 'dtype' clause, takes a list of either an 'asterisk' or an identifier.
static OpenACCDeviceTypeClause * Create(const ASTContext &C, OpenACCClauseKind K, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< DeviceTypeArgument > Archs, SourceLocation EndLoc)
static OpenACCFinalizeClause * Create(const ASTContext &Ctx, SourceLocation BeginLoc, SourceLocation EndLoc)
static OpenACCFirstPrivateClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, ArrayRef< OpenACCFirstPrivateRecipe > InitRecipes, SourceLocation EndLoc)
static OpenACCHostClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
An 'if' clause, which has a required condition expression.
static OpenACCIfClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *ConditionExpr, SourceLocation EndLoc)
static OpenACCIfPresentClause * Create(const ASTContext &Ctx, SourceLocation BeginLoc, SourceLocation EndLoc)
static OpenACCIndependentClause * Create(const ASTContext &Ctx, SourceLocation BeginLoc, SourceLocation EndLoc)
static OpenACCNoCreateClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCNumGangsClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > IntExprs, SourceLocation EndLoc)
static OpenACCNumWorkersClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *IntExpr, SourceLocation EndLoc)
static OpenACCPresentClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCPrivateClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, ArrayRef< OpenACCPrivateRecipe > InitRecipes, SourceLocation EndLoc)
A 'self' clause, which has an optional condition expression, or, in the event of an 'update' directiv...
static OpenACCSelfClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *ConditionExpr, SourceLocation EndLoc)
static OpenACCSeqClause * Create(const ASTContext &Ctx, SourceLocation BeginLoc, SourceLocation EndLoc)
static OpenACCTileClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > SizeExprs, SourceLocation EndLoc)
static OpenACCUseDeviceClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCVectorClause * Create(const ASTContext &Ctx, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *IntExpr, SourceLocation EndLoc)
static OpenACCVectorLengthClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *IntExpr, SourceLocation EndLoc)
static OpenACCWaitClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *DevNumExpr, SourceLocation QueuesLoc, ArrayRef< Expr * > QueueIdExprs, SourceLocation EndLoc)
static OpenACCWorkerClause * Create(const ASTContext &Ctx, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *IntExpr, SourceLocation EndLoc)
A reference to an overloaded function set, either an UnresolvedLookupExpr or an UnresolvedMemberExpr.
bool hasExplicitTemplateArgs() const
Determines whether this expression had explicit template arguments.
SourceLocation getLAngleLoc() const
Retrieve the location of the left angle bracket starting the explicit template argument list followin...
SourceLocation getNameLoc() const
Gets the location of the name.
SourceLocation getTemplateKeywordLoc() const
Retrieve the location of the template keyword preceding this name, if any.
NestedNameSpecifierLoc getQualifierLoc() const
Fetches the nested-name qualifier with source-location information, if one was given.
TemplateArgumentLoc const * getTemplateArgs() const
llvm::iterator_range< decls_iterator > decls() const
unsigned getNumTemplateArgs() const
DeclarationName getName() const
Gets the name looked up.
SourceLocation getRAngleLoc() const
Retrieve the location of the right angle bracket ending the explicit template argument list following...
bool hasTemplateKeyword() const
Determines whether the name was preceded by the template keyword.
Represents a C++11 pack expansion that produces a sequence of expressions.
void setEllipsisLoc(SourceLocation Loc)
SourceLocation getEllipsisLoc() const
TypeLoc getPatternLoc() const
void setEllipsisLoc(SourceLocation Loc)
ParenExpr - This represents a parenthesized expression, e.g.
SourceLocation getLParen() const
Get the location of the left parentheses '('.
SourceLocation getRParen() const
Get the location of the right parentheses ')'.
void setLParenLoc(SourceLocation Loc)
Represents a parameter to a function.
unsigned getFunctionScopeIndex() const
Returns the index of this parameter in its prototype or method scope.
void setScopeInfo(unsigned scopeDepth, unsigned parameterIndex)
static ParmVarDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, const IdentifierInfo *Id, QualType T, TypeSourceInfo *TInfo, StorageClass S, Expr *DefArg)
unsigned getFunctionScopeDepth() const
void setKWLoc(SourceLocation Loc)
Pointer-authentication qualifiers.
void setSigilLoc(SourceLocation Loc)
TypeLoc getPointeeLoc() const
SourceLocation getSigilLoc() const
Wrapper for source info for pointers.
PointerType - C99 6.7.5.1 - Pointer Declarators.
[C99 6.4.2.2] - A predefined identifier such as func.
Stores the type being destroyed by a pseudo-destructor expression.
const IdentifierInfo * getIdentifier() const
SourceLocation getLocation() const
TypeSourceInfo * getTypeSourceInfo() const
PseudoObjectExpr - An expression which accesses a pseudo-object l-value.
A (possibly-)qualified type.
bool isNull() const
Return true if this QualType doesn't point to a type yet.
const Type * getTypePtr() const
Retrieves a pointer to the underlying (unqualified) type.
Qualifiers getQualifiers() const
Retrieve the set of qualifiers applied to this type.
QualType getUnqualifiedType() const
Retrieve the unqualified variant of the given type, removing as little sugar as possible.
Qualifiers getLocalQualifiers() const
Retrieve the set of qualifiers local to this particular QualType instance, not including any qualifie...
Represents a template name as written in source code.
Wrapper of type source information for a type with non-trivial direct qualifiers.
The collection of all-type qualifiers we support.
void removeObjCLifetime()
static Qualifiers fromCVRMask(unsigned CVR)
PointerAuthQualifier getPointerAuth() const
bool hasObjCLifetime() const
LangAS getAddressSpace() const
Frontend produces RecoveryExprs on semantic errors that prevent creating other well-formed expression...
Base for LValueReferenceType and RValueReferenceType.
QualType getPointeeTypeAsWritten() const
Represents the body of a requires-expression.
static RequiresExprBodyDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc)
C++2a [expr.prim.req]: A requires-expression provides a concise way to express requirements on templa...
static RequiresExpr * Create(ASTContext &C, SourceLocation RequiresKWLoc, RequiresExprBodyDecl *Body, SourceLocation LParenLoc, ArrayRef< ParmVarDecl * > LocalParameters, SourceLocation RParenLoc, ArrayRef< concepts::Requirement * > Requirements, SourceLocation RBraceLoc)
ReturnStmt - This represents a return, optionally of an expression: return; return 4;.
static SEHFinallyStmt * Create(const ASTContext &C, SourceLocation FinallyLoc, Stmt *Block)
Represents a __leave statement.
SYCLKernelCallStmt represents the transformation that is applied to the body of a function declared w...
Smart pointer class that efficiently represents Objective-C method names.
SemaDiagnosticBuilder Diag(SourceLocation Loc, unsigned DiagID)
Emit a diagnostic.
VarDecl * BuildObjCExceptionDecl(TypeSourceInfo *TInfo, QualType ExceptionType, SourceLocation StartLoc, SourceLocation IdLoc, const IdentifierInfo *Id, bool Invalid=false)
Build a type-check a new Objective-C exception variable declaration.
StmtResult ActOnObjCForCollectionStmt(SourceLocation ForColLoc, Stmt *First, Expr *collection, SourceLocation RParenLoc)
StmtResult FinishObjCForCollectionStmt(Stmt *ForCollection, Stmt *Body)
FinishObjCForCollectionStmt - Attach the body to a objective-C foreach statement.
ExprResult BuildObjCDictionaryLiteral(SourceRange SR, MutableArrayRef< ObjCDictionaryElement > Elements)
StmtResult ActOnObjCAtSynchronizedStmt(SourceLocation AtLoc, Expr *SynchExpr, Stmt *SynchBody)
ExprResult BuildObjCArrayLiteral(SourceRange SR, MultiExprArg Elements)
ExprResult BuildObjCBoxedExpr(SourceRange SR, Expr *ValueExpr)
BuildObjCBoxedExpr - builds an ObjCBoxedExpr AST node for the '@' prefixed parenthesized expression.
StmtResult ActOnObjCAtTryStmt(SourceLocation AtLoc, Stmt *Try, MultiStmtArg Catch, Stmt *Finally)
StmtResult ActOnObjCAtFinallyStmt(SourceLocation AtLoc, Stmt *Body)
StmtResult BuildObjCAtThrowStmt(SourceLocation AtLoc, Expr *Throw)
ExprResult ActOnObjCAtSynchronizedOperand(SourceLocation atLoc, Expr *operand)
ExprResult BuildObjCBridgedCast(SourceLocation LParenLoc, ObjCBridgeCastKind Kind, SourceLocation BridgeKeywordLoc, TypeSourceInfo *TSInfo, Expr *SubExpr)
StmtResult ActOnObjCAtCatchStmt(SourceLocation AtLoc, SourceLocation RParen, Decl *Parm, Stmt *Body)
StmtResult ActOnObjCAutoreleasePoolStmt(SourceLocation AtLoc, Stmt *Body)
ExprResult BuildObjCSubscriptExpression(SourceLocation RB, Expr *BaseExpr, Expr *IndexExpr, ObjCMethodDecl *getterMethod, ObjCMethodDecl *setterMethod)
Build an ObjC subscript pseudo-object expression, given that that's supported by the runtime.
Helper type for the registration/assignment of constructs that need to 'know' about their parent cons...
Helper type to restore the state of various 'loop' constructs when we run into a loop (for,...
A type to represent all the data for an OpenACC Clause that has been parsed, but not yet created/sema...
void ActOnWhileStmt(SourceLocation WhileLoc)
ExprResult ActOnOpenACCAsteriskSizeExpr(SourceLocation AsteriskLoc)
void ActOnDoStmt(SourceLocation DoLoc)
void ActOnRangeForStmtBegin(SourceLocation ForLoc, const Stmt *OldRangeFor, const Stmt *RangeFor)
StmtResult ActOnEndStmtDirective(OpenACCDirectiveKind K, SourceLocation StartLoc, SourceLocation DirLoc, SourceLocation LParenLoc, SourceLocation MiscLoc, ArrayRef< Expr * > Exprs, OpenACCAtomicKind AK, SourceLocation RParenLoc, SourceLocation EndLoc, ArrayRef< OpenACCClause * > Clauses, StmtResult AssocStmt)
Called after the directive has been completely parsed, including the declaration group or associated ...
void ActOnForStmtEnd(SourceLocation ForLoc, StmtResult Body)
void ActOnForStmtBegin(SourceLocation ForLoc, const Stmt *First, const Stmt *Second, const Stmt *Third)
ExprResult ActOnArraySectionExpr(Expr *Base, SourceLocation LBLoc, Expr *LowerBound, SourceLocation ColonLocFirst, Expr *Length, SourceLocation RBLoc)
Checks and creates an Array Section used in an OpenACC construct/clause.
OMPClause * ActOnOpenMPNocontextClause(Expr *Condition, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'nocontext' clause.
OMPClause * ActOnOpenMPXDynCGroupMemClause(Expr *Size, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on a well-formed 'ompx_dyn_cgroup_mem' clause.
OMPClause * ActOnOpenMPSafelenClause(Expr *Length, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'safelen' clause.
OMPClause * ActOnOpenMPHoldsClause(Expr *E, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'holds' clause.
OMPClause * ActOnOpenMPFilterClause(Expr *ThreadID, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'filter' clause.
OMPClause * ActOnOpenMPFullClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-form 'full' clauses.
OMPClause * ActOnOpenMPDetachClause(Expr *Evt, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'detach' clause.
OMPClause * ActOnOpenMPUseClause(Expr *InteropVar, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation VarLoc, SourceLocation EndLoc)
Called on well-formed 'use' clause.
OMPClause * ActOnOpenMPPrivateClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'private' clause.
OMPClause * ActOnOpenMPOrderedClause(SourceLocation StartLoc, SourceLocation EndLoc, SourceLocation LParenLoc=SourceLocation(), Expr *NumForLoops=nullptr)
Called on well-formed 'ordered' clause.
OMPClause * ActOnOpenMPIsDevicePtrClause(ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs)
Called on well-formed 'is_device_ptr' clause.
OMPClause * ActOnOpenMPHasDeviceAddrClause(ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs)
Called on well-formed 'has_device_addr' clause.
OMPClause * ActOnOpenMPPartialClause(Expr *FactorExpr, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-form 'partial' clauses.
OMPClause * ActOnOpenMPLastprivateClause(ArrayRef< Expr * > VarList, OpenMPLastprivateModifier LPKind, SourceLocation LPKindLoc, SourceLocation ColonLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'lastprivate' clause.
OMPClause * ActOnOpenMPFirstprivateClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'firstprivate' clause.
OMPClause * ActOnOpenMPPriorityClause(Expr *Priority, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'priority' clause.
OMPClause * ActOnOpenMPDistScheduleClause(OpenMPDistScheduleClauseKind Kind, Expr *ChunkSize, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation KindLoc, SourceLocation CommaLoc, SourceLocation EndLoc)
Called on well-formed 'dist_schedule' clause.
OMPClause * ActOnOpenMPLoopRangeClause(Expr *First, Expr *Count, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation FirstLoc, SourceLocation CountLoc, SourceLocation EndLoc)
Called on well-form 'looprange' clause after parsing its arguments.
OMPClause * ActOnOpenMPPermutationClause(ArrayRef< Expr * > PermExprs, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-form 'permutation' clause after parsing its arguments.
OMPClause * ActOnOpenMPNontemporalClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'nontemporal' clause.
OMPClause * ActOnOpenMPBindClause(OpenMPBindClauseKind Kind, SourceLocation KindLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on a well-formed 'bind' clause.
OMPClause * ActOnOpenMPThreadLimitClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'thread_limit' clause.
OMPClause * ActOnOpenMPSharedClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'shared' clause.
OMPClause * ActOnOpenMPCopyinClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'copyin' clause.
OMPClause * ActOnOpenMPDestroyClause(Expr *InteropVar, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation VarLoc, SourceLocation EndLoc)
Called on well-formed 'destroy' clause.
OMPClause * ActOnOpenMPAffinityClause(SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc, Expr *Modifier, ArrayRef< Expr * > Locators)
Called on well-formed 'affinity' clause.
OMPClause * ActOnOpenMPNumTeamsClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'num_teams' clause.
OMPClause * ActOnOpenMPDependClause(const OMPDependClause::DependDataTy &Data, Expr *DepModifier, ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'depend' clause.
OMPClause * ActOnOpenMPDoacrossClause(OpenMPDoacrossClauseModifier DepType, SourceLocation DepLoc, SourceLocation ColonLoc, ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'doacross' clause.
OMPClause * ActOnOpenMPGrainsizeClause(OpenMPGrainsizeClauseModifier Modifier, Expr *Size, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ModifierLoc, SourceLocation EndLoc)
Called on well-formed 'grainsize' clause.
ExprResult ActOnOMPArraySectionExpr(Expr *Base, SourceLocation LBLoc, Expr *LowerBound, SourceLocation ColonLocFirst, SourceLocation ColonLocSecond, Expr *Length, Expr *Stride, SourceLocation RBLoc)
ExprResult ActOnOMPIteratorExpr(Scope *S, SourceLocation IteratorKwLoc, SourceLocation LLoc, SourceLocation RLoc, ArrayRef< OMPIteratorData > Data)
OMPClause * ActOnOpenMPUsesAllocatorClause(SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc, ArrayRef< UsesAllocatorsData > Data)
Called on well-formed 'uses_allocators' clause.
OMPClause * ActOnOpenMPAllocatorClause(Expr *Allocator, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'allocator' clause.
OMPClause * ActOnOpenMPInclusiveClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'inclusive' clause.
OMPClause * ActOnOpenMPTaskReductionClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc, CXXScopeSpec &ReductionIdScopeSpec, const DeclarationNameInfo &ReductionId, ArrayRef< Expr * > UnresolvedReductions={})
Called on well-formed 'task_reduction' clause.
OMPClause * ActOnOpenMPNowaitClause(SourceLocation StartLoc, SourceLocation EndLoc, SourceLocation LParenLoc, Expr *Condition)
Called on well-formed 'nowait' clause.
OMPClause * ActOnOpenMPOrderClause(OpenMPOrderClauseModifier Modifier, OpenMPOrderClauseKind Kind, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation MLoc, SourceLocation KindLoc, SourceLocation EndLoc)
Called on well-formed 'order' clause.
OMPClause * ActOnOpenMPSizesClause(ArrayRef< Expr * > SizeExprs, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-form 'sizes' clause.
OMPClause * ActOnOpenMPDeviceClause(OpenMPDeviceClauseModifier Modifier, Expr *Device, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ModifierLoc, SourceLocation EndLoc)
Called on well-formed 'device' clause.
OMPClause * ActOnOpenMPInReductionClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc, CXXScopeSpec &ReductionIdScopeSpec, const DeclarationNameInfo &ReductionId, ArrayRef< Expr * > UnresolvedReductions={})
Called on well-formed 'in_reduction' clause.
OMPClause * ActOnOpenMPFlushClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'flush' pseudo clause.
StmtResult ActOnOpenMPExecutableDirective(OpenMPDirectiveKind Kind, const DeclarationNameInfo &DirName, OpenMPDirectiveKind CancelRegion, ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
OMPClause * ActOnOpenMPMessageClause(Expr *MS, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'message' clause.
OMPClause * ActOnOpenMPScheduleClause(OpenMPScheduleClauseModifier M1, OpenMPScheduleClauseModifier M2, OpenMPScheduleClauseKind Kind, Expr *ChunkSize, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation M1Loc, SourceLocation M2Loc, SourceLocation KindLoc, SourceLocation CommaLoc, SourceLocation EndLoc)
Called on well-formed 'schedule' clause.
OMPClause * ActOnOpenMPSimdlenClause(Expr *Length, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'simdlen' clause.
OMPClause * ActOnOpenMPUseDevicePtrClause(ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs)
Called on well-formed 'use_device_ptr' clause.
OMPClause * ActOnOpenMPProcBindClause(llvm::omp::ProcBindKind Kind, SourceLocation KindLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'proc_bind' clause.
OMPClause * ActOnOpenMPXBareClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on a well-formed 'ompx_bare' clause.
StmtResult ActOnOpenMPInformationalDirective(OpenMPDirectiveKind Kind, const DeclarationNameInfo &DirName, ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Process an OpenMP informational directive.
StmtResult ActOnOpenMPCanonicalLoop(Stmt *AStmt)
Called for syntactical loops (ForStmt or CXXForRangeStmt) associated to an OpenMP loop directive.
OMPClause * ActOnOpenMPHintClause(Expr *Hint, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'hint' clause.
ExprResult ActOnOMPArrayShapingExpr(Expr *Base, SourceLocation LParenLoc, SourceLocation RParenLoc, ArrayRef< Expr * > Dims, ArrayRef< SourceRange > Brackets)
OMPClause * ActOnOpenMPNumThreadsClause(OpenMPNumThreadsClauseModifier Modifier, Expr *NumThreads, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ModifierLoc, SourceLocation EndLoc)
Called on well-formed 'num_threads' clause.
OMPClause * ActOnOpenMPAtClause(OpenMPAtClauseKind Kind, SourceLocation KindLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'at' clause.
OMPClause * ActOnOpenMPInitClause(Expr *InteropVar, OMPInteropInfo &InteropInfo, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation VarLoc, SourceLocation EndLoc)
Called on well-formed 'init' clause.
OMPClause * ActOnOpenMPUseDeviceAddrClause(ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs)
Called on well-formed 'use_device_addr' clause.
OMPClause * ActOnOpenMPAllocateClause(Expr *Allocator, Expr *Alignment, OpenMPAllocateClauseModifier FirstModifier, SourceLocation FirstModifierLoc, OpenMPAllocateClauseModifier SecondModifier, SourceLocation SecondModifierLoc, ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation ColonLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'allocate' clause.
OMPClause * ActOnOpenMPFinalClause(Expr *Condition, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'final' clause.
OMPClause * ActOnOpenMPMapClause(Expr *IteratorModifier, ArrayRef< OpenMPMapModifierKind > MapTypeModifiers, ArrayRef< SourceLocation > MapTypeModifiersLoc, CXXScopeSpec &MapperIdScopeSpec, DeclarationNameInfo &MapperId, OpenMPMapClauseKind MapType, bool IsMapTypeImplicit, SourceLocation MapLoc, SourceLocation ColonLoc, ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs, bool NoDiagnose=false, ArrayRef< Expr * > UnresolvedMappers={})
Called on well-formed 'map' clause.
OMPClause * ActOnOpenMPNumTasksClause(OpenMPNumTasksClauseModifier Modifier, Expr *NumTasks, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ModifierLoc, SourceLocation EndLoc)
Called on well-formed 'num_tasks' clause.
OMPClause * ActOnOpenMPFromClause(ArrayRef< OpenMPMotionModifierKind > MotionModifiers, ArrayRef< SourceLocation > MotionModifiersLoc, Expr *IteratorModifier, CXXScopeSpec &MapperIdScopeSpec, DeclarationNameInfo &MapperId, SourceLocation ColonLoc, ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs, ArrayRef< Expr * > UnresolvedMappers={})
Called on well-formed 'from' clause.
OMPClause * ActOnOpenMPDynGroupprivateClause(OpenMPDynGroupprivateClauseModifier M1, OpenMPDynGroupprivateClauseFallbackModifier M2, Expr *Size, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation M1Loc, SourceLocation M2Loc, SourceLocation EndLoc)
Called on a well-formed 'dyn_groupprivate' clause.
void StartOpenMPDSABlock(OpenMPDirectiveKind K, const DeclarationNameInfo &DirName, Scope *CurScope, SourceLocation Loc)
Called on start of new data sharing attribute block.
OMPClause * ActOnOpenMPSeverityClause(OpenMPSeverityClauseKind Kind, SourceLocation KindLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'severity' clause.
OMPClause * ActOnOpenMPToClause(ArrayRef< OpenMPMotionModifierKind > MotionModifiers, ArrayRef< SourceLocation > MotionModifiersLoc, Expr *IteratorModifier, CXXScopeSpec &MapperIdScopeSpec, DeclarationNameInfo &MapperId, SourceLocation ColonLoc, ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs, ArrayRef< Expr * > UnresolvedMappers={})
Called on well-formed 'to' clause.
OMPClause * ActOnOpenMPLinearClause(ArrayRef< Expr * > VarList, Expr *Step, SourceLocation StartLoc, SourceLocation LParenLoc, OpenMPLinearClauseKind LinKind, SourceLocation LinLoc, SourceLocation ColonLoc, SourceLocation StepModifierLoc, SourceLocation EndLoc)
Called on well-formed 'linear' clause.
OMPClause * ActOnOpenMPDefaultmapClause(OpenMPDefaultmapClauseModifier M, OpenMPDefaultmapClauseKind Kind, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation MLoc, SourceLocation KindLoc, SourceLocation EndLoc)
Called on well-formed 'defaultmap' clause.
OMPClause * ActOnOpenMPReductionClause(ArrayRef< Expr * > VarList, OpenMPVarListDataTy::OpenMPReductionClauseModifiers Modifiers, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ModifierLoc, SourceLocation ColonLoc, SourceLocation EndLoc, CXXScopeSpec &ReductionIdScopeSpec, const DeclarationNameInfo &ReductionId, ArrayRef< Expr * > UnresolvedReductions={})
Called on well-formed 'reduction' clause.
OMPClause * ActOnOpenMPAlignedClause(ArrayRef< Expr * > VarList, Expr *Alignment, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc)
Called on well-formed 'aligned' clause.
OMPClause * ActOnOpenMPDepobjClause(Expr *Depobj, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'depobj' pseudo clause.
OMPClause * ActOnOpenMPNovariantsClause(Expr *Condition, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'novariants' clause.
OMPClause * ActOnOpenMPCopyprivateClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'copyprivate' clause.
OMPClause * ActOnOpenMPCollapseClause(Expr *NumForLoops, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'collapse' clause.
OMPClause * ActOnOpenMPDefaultClause(llvm::omp::DefaultKind M, SourceLocation MLoc, OpenMPDefaultClauseVariableCategory VCKind, SourceLocation VCKindLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'default' clause.
OMPClause * ActOnOpenMPAlignClause(Expr *Alignment, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'align' clause.
OMPClause * ActOnOpenMPXAttributeClause(ArrayRef< const Attr * > Attrs, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on a well-formed 'ompx_attribute' clause.
OMPClause * ActOnOpenMPExclusiveClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'exclusive' clause.
OMPClause * ActOnOpenMPIfClause(OpenMPDirectiveKind NameModifier, Expr *Condition, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation NameModifierLoc, SourceLocation ColonLoc, SourceLocation EndLoc)
Called on well-formed 'if' clause.
Expr * recreateSyntacticForm(PseudoObjectExpr *E)
Given a pseudo-object expression, recreate what it looks like syntactically without the attendant Opa...
ExprResult checkRValue(Expr *E)
ExprResult BuildUniqueStableNameExpr(SourceLocation OpLoc, SourceLocation LParen, SourceLocation RParen, TypeSourceInfo *TSI)
RAII object used to change the argument pack substitution index within a Sema object.
RAII object used to temporarily allow the C++ 'this' expression to be used, with the given qualifiers...
A RAII object to enter scope of a compound statement.
A helper class for building up ExtParameterInfos.
const FunctionProtoType::ExtParameterInfo * getPointerOrNull(unsigned numParams)
Return a pointer (suitable for setting in an ExtProtoInfo) to the ExtParameterInfo array we've built ...
void set(unsigned index, FunctionProtoType::ExtParameterInfo info)
Set the ExtParameterInfo for the parameter at the given index,.
Records and restores the CurFPFeatures state on entry/exit of compound statements.
Sema - This implements semantic analysis and AST building for C.
ParsedType CreateParsedType(QualType T, TypeSourceInfo *TInfo)
Package the given type and TSI into a ParsedType.
ExprResult ActOnCXXParenListInitExpr(ArrayRef< Expr * > Args, QualType T, unsigned NumUserSpecifiedExprs, SourceLocation InitLoc, SourceLocation LParenLoc, SourceLocation RParenLoc)
ExprResult BuildOperatorCoawaitCall(SourceLocation Loc, Expr *E, UnresolvedLookupExpr *Lookup)
Build a call to 'operator co_await' if there is a suitable operator for the given expression.
ExprResult BuildMemberReferenceExpr(Expr *Base, QualType BaseType, SourceLocation OpLoc, bool IsArrow, CXXScopeSpec &SS, SourceLocation TemplateKWLoc, NamedDecl *FirstQualifierInScope, const DeclarationNameInfo &NameInfo, const TemplateArgumentListInfo *TemplateArgs, const Scope *S, ActOnMemberAccessExtraArgs *ExtraArgs=nullptr)
StmtResult BuildMSDependentExistsStmt(SourceLocation KeywordLoc, bool IsIfExists, NestedNameSpecifierLoc QualifierLoc, DeclarationNameInfo NameInfo, Stmt *Nested)
@ LookupOrdinaryName
Ordinary name lookup, which finds ordinary names (functions, variables, typedefs, etc....
@ LookupMemberName
Member name lookup, which finds the names of class/struct/union members.
@ LookupTagName
Tag name lookup, which finds the names of enums, classes, structs, and unions.
bool checkFinalSuspendNoThrow(const Stmt *FinalSuspend)
Check that the expression co_await promise.final_suspend() shall not be potentially-throwing.
ExprResult 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)
ExprResult PerformObjectMemberConversion(Expr *From, NestedNameSpecifier Qualifier, NamedDecl *FoundDecl, NamedDecl *Member)
Cast a base object to a member's actual type.
Expr * MaybeCreateExprWithCleanups(Expr *SubExpr)
MaybeCreateExprWithCleanups - If the current full-expression requires any cleanups,...
SmallVector< ExpressionEvaluationContextRecord, 8 > ExprEvalContexts
A stack of expression evaluation contexts.
ExprResult BuildEmptyCXXFoldExpr(SourceLocation EllipsisLoc, BinaryOperatorKind Operator)
ExprResult BuildCXXThrow(SourceLocation OpLoc, Expr *Ex, bool IsThrownVarInScope)
ExprResult BuildBinOp(Scope *S, SourceLocation OpLoc, BinaryOperatorKind Opc, Expr *LHSExpr, Expr *RHSExpr, bool ForFoldExpression=false)
ExprResult BuildCXXDefaultInitExpr(SourceLocation Loc, FieldDecl *Field)
ExprResult BuildLambdaExpr(SourceLocation StartLoc, SourceLocation EndLoc)
Complete a lambda-expression having processed and attached the lambda body.
@ BFRK_Rebuild
Instantiation or recovery rebuild of a for-range statement.
void ActOnCaseStmtBody(Stmt *CaseStmt, Stmt *SubStmt)
ActOnCaseStmtBody - This installs a statement as the body of a case.
ExprResult ActOnBlockStmtExpr(SourceLocation CaretLoc, Stmt *Body, Scope *CurScope)
ActOnBlockStmtExpr - This is called when the body of a block statement literal was successfully compl...
ExprResult BuildArrayTypeTrait(ArrayTypeTrait ATT, SourceLocation KWLoc, TypeSourceInfo *TSInfo, Expr *DimExpr, SourceLocation RParen)
void MarkMemberReferenced(MemberExpr *E)
Perform reference-marking and odr-use handling for a MemberExpr.
ExprResult BuildCXXNamedCast(SourceLocation OpLoc, tok::TokenKind Kind, TypeSourceInfo *Ty, Expr *E, SourceRange AngleBrackets, SourceRange Parens)
void MarkFunctionReferenced(SourceLocation Loc, FunctionDecl *Func, bool MightBeOdrUse=true)
Mark a function referenced, and check whether it is odr-used (C++ [basic.def.odr]p2,...
ExprResult CreateRecoveryExpr(SourceLocation Begin, SourceLocation End, ArrayRef< Expr * > SubExprs, QualType T=QualType())
Attempts to produce a RecoveryExpr after some AST node cannot be created.
ExprResult ActOnGCCAsmStmtString(Expr *Stm, bool ForAsmLabel)
StmtResult ActOnIfStmt(SourceLocation IfLoc, IfStatementKind StatementKind, SourceLocation LParenLoc, Stmt *InitStmt, ConditionResult Cond, SourceLocation RParenLoc, Stmt *ThenVal, SourceLocation ElseLoc, Stmt *ElseVal)
void ActOnBlockStart(SourceLocation CaretLoc, Scope *CurScope)
ActOnBlockStart - This callback is invoked when a block literal is started.
ExprResult ActOnArraySubscriptExpr(Scope *S, Expr *Base, SourceLocation LLoc, MultiExprArg ArgExprs, SourceLocation RLoc)
ExprResult BuildAtomicExpr(SourceRange CallRange, SourceRange ExprRange, SourceLocation RParenLoc, MultiExprArg Args, AtomicExpr::AtomicOp Op, AtomicArgumentOrder ArgOrder=AtomicArgumentOrder::API)
ExprResult ActOnCallExpr(Scope *S, Expr *Fn, SourceLocation LParenLoc, MultiExprArg ArgExprs, SourceLocation RParenLoc, Expr *ExecConfig=nullptr)
ActOnCallExpr - Handle a call to Fn with the specified array of arguments.
OpaquePtr< TemplateName > TemplateTy
static QualType GetTypeFromParser(ParsedType Ty, TypeSourceInfo **TInfo=nullptr)
static ConditionResult ConditionError()
StmtResult ActOnCompoundStmt(SourceLocation L, SourceLocation R, ArrayRef< Stmt * > Elts, bool isStmtExpr)
SemaPseudoObject & PseudoObject()
StmtResult ActOnCXXTryBlock(SourceLocation TryLoc, Stmt *TryBlock, ArrayRef< Stmt * > Handlers)
ActOnCXXTryBlock - Takes a try compound-statement and a number of handlers and creates a try statemen...
OpaquePtr< DeclGroupRef > DeclGroupPtrTy
StmtResult ActOnDefaultStmt(SourceLocation DefaultLoc, SourceLocation ColonLoc, Stmt *SubStmt, Scope *CurScope)
ExprResult HandleExprEvaluationContextForTypeof(Expr *E)
StmtResult ActOnCaseStmt(SourceLocation CaseLoc, ExprResult LHS, SourceLocation DotDotDotLoc, ExprResult RHS, SourceLocation ColonLoc)
TypeSourceInfo * CheckPackExpansion(TypeSourceInfo *Pattern, SourceLocation EllipsisLoc, UnsignedOrNone NumExpansions)
Construct a pack expansion type from the pattern of the pack expansion.
StmtResult FinishCXXForRangeStmt(Stmt *ForRange, Stmt *Body)
FinishCXXForRangeStmt - Attach the body to a C++0x for-range statement.
ExprResult ActOnFinishFullExpr(Expr *Expr, bool DiscardedValue)
ExprResult CreateBuiltinMatrixSubscriptExpr(Expr *Base, Expr *RowIdx, Expr *ColumnIdx, SourceLocation RBLoc)
StmtResult ActOnGCCAsmStmt(SourceLocation AsmLoc, bool IsSimple, bool IsVolatile, unsigned NumOutputs, unsigned NumInputs, IdentifierInfo **Names, MultiExprArg Constraints, MultiExprArg Exprs, Expr *AsmString, MultiExprArg Clobbers, unsigned NumLabels, SourceLocation RParenLoc)
ShuffleVectorExpr - clang-specific builtin-in function __builtin_shufflevector.
Represents an expression that computes the length of a parameter pack.
SourceLocation getPackLoc() const
Determine the location of the parameter pack.
bool isPartiallySubstituted() const
Determine whether this represents a partially-substituted sizeof... expression, such as is produced f...
static SizeOfPackExpr * Create(ASTContext &Context, SourceLocation OperatorLoc, NamedDecl *Pack, SourceLocation PackLoc, SourceLocation RParenLoc, UnsignedOrNone Length=std::nullopt, ArrayRef< TemplateArgument > PartialArgs={})
ArrayRef< TemplateArgument > getPartialArguments() const
Get.
SourceLocation getOperatorLoc() const
Determine the location of the 'sizeof' keyword.
SourceLocation getRParenLoc() const
Determine the location of the right parenthesis.
NamedDecl * getPack() const
Retrieve the parameter pack.
Represents a function call to one of __builtin_LINE(), __builtin_COLUMN(), __builtin_FUNCTION(),...
static bool MayBeDependent(SourceLocIdentKind Kind)
Encodes a location in the source.
bool isValid() const
Return true if this is a valid SourceLocation object.
A trivial tuple used to represent a source range.
SourceLocation getEnd() const
SourceLocation getBegin() const
StmtExpr - This is the GNU Statement Expression extension: ({int X=4; X;}).
Stmt - This represents one statement.
SourceLocation getEndLoc() const LLVM_READONLY
StmtClass getStmtClass() const
SourceRange getSourceRange() const LLVM_READONLY
SourceLocation tokens are not useful in isolation - they are low level value objects created/interpre...
StringLiteral - This represents a string literal expression, e.g.
Wrapper for substituted template type parameters.
Represents a reference to a non-type template parameter that has been substituted with a template arg...
Represents a reference to a non-type template parameter pack that has been substituted with a non-tem...
A structure for storing an already-substituted template template parameter pack.
A structure for storing the information associated with a substituted template template parameter.
Wrapper for substituted template type parameters.
SwitchStmt - This represents a 'switch' stmt.
Represents the declaration of a struct/union/class/enum.
SourceLocation getNameLoc() const
SourceLocation getElaboratedKeywordLoc() const
NestedNameSpecifierLoc getQualifierLoc() const
void setQualifierLoc(NestedNameSpecifierLoc QualifierLoc)
void setNameLoc(SourceLocation Loc)
void setElaboratedKeywordLoc(SourceLocation Loc)
A convenient class for passing around template argument information.
void setLAngleLoc(SourceLocation Loc)
void setRAngleLoc(SourceLocation Loc)
void addArgument(const TemplateArgumentLoc &Loc)
const TemplateArgumentLoc * operator->() const
pointer(TemplateArgumentLoc Arg)
Simple iterator that traverses the template arguments in a container that provides a getArgLoc() memb...
TemplateArgumentLoc operator*() const
TemplateArgumentLocContainerIterator operator++(int)
friend bool operator!=(const TemplateArgumentLocContainerIterator &X, const TemplateArgumentLocContainerIterator &Y)
TemplateArgumentLocContainerIterator()
TemplateArgumentLoc value_type
TemplateArgumentLocContainerIterator(ArgLocContainer &Container, unsigned Index)
friend bool operator==(const TemplateArgumentLocContainerIterator &X, const TemplateArgumentLocContainerIterator &Y)
TemplateArgumentLocContainerIterator & operator++()
std::input_iterator_tag iterator_category
TemplateArgumentLoc reference
pointer operator->() const
const TemplateArgumentLoc * operator->() const
pointer(TemplateArgumentLoc Arg)
Iterator adaptor that invents template argument location information for each of the template argumen...
TemplateArgumentLocInventIterator & operator++()
pointer operator->() const
std::iterator_traits< InputIterator >::difference_type difference_type
reference operator*() const
TemplateArgumentLocInventIterator operator++(int)
friend bool operator==(const TemplateArgumentLocInventIterator &X, const TemplateArgumentLocInventIterator &Y)
TemplateArgumentLocInventIterator(TreeTransform< Derived > &Self, InputIterator Iter)
friend bool operator!=(const TemplateArgumentLocInventIterator &X, const TemplateArgumentLocInventIterator &Y)
std::input_iterator_tag iterator_category
TemplateArgumentLoc reference
TemplateArgumentLoc value_type
Location wrapper for a TemplateArgument.
const TemplateArgument & getArgument() const
SourceLocation getTemplateNameLoc() const
SourceLocation getTemplateKWLoc() const
TypeSourceInfo * getTypeSourceInfo() const
Expr * getSourceExpression() const
NestedNameSpecifierLoc getTemplateQualifierLoc() const
Represents a template argument.
Expr * getAsExpr() const
Retrieve the template argument as an expression.
const TemplateArgument * pack_iterator
Iterator that traverses the elements of a template argument pack.
QualType getNonTypeTemplateArgumentType() const
If this is a non-type template argument, get its type.
QualType getAsType() const
Retrieve the type for a type template argument.
llvm::APSInt getAsIntegral() const
Retrieve the template argument as an integral value.
TemplateName getAsTemplate() const
Retrieve the template name for a template name argument.
bool containsUnexpandedParameterPack() const
Whether this template argument contains an unexpanded parameter pack.
ValueDecl * getAsDecl() const
Retrieve the declaration for a declaration non-type template argument.
@ Declaration
The template argument is a declaration that was provided for a pointer, reference,...
@ Template
The template argument is a template name that was provided for a template template parameter.
@ StructuralValue
The template argument is a non-type template argument that can't be represented by the special-case D...
@ Pack
The template argument is actually a parameter pack.
@ TemplateExpansion
The template argument is a pack expansion of a template name that was provided for a template templat...
@ NullPtr
The template argument is a null pointer or null pointer to member that was provided for a non-type te...
@ Type
The template argument is a type.
@ Null
Represents an empty template argument, e.g., one that has not been deduced.
@ Integral
The template argument is an integral value stored in an llvm::APSInt that was provided for an integra...
@ Expression
The template argument is an expression, and we've not resolved it to one of the other forms yet,...
ArgKind getKind() const
Return the kind of stored template argument.
bool isPackExpansion() const
Determine whether this template argument is a pack expansion.
const APValue & getAsStructuralValue() const
Get the value of a StructuralValue.
The base class of all kinds of template declarations (e.g., class, function, etc.).
Represents a C++ template name within the type system.
TemplateDecl * getAsTemplateDecl(bool IgnoreDeduced=false) const
Retrieve the underlying template declaration that this template name refers to, if known.
DeducedTemplateStorage * getAsDeducedTemplateName() const
Retrieve the deduced template info, if any.
bool isNull() const
Determine whether this template name is NULL.
DependentTemplateName * getAsDependentTemplateName() const
Retrieve the underlying dependent template name structure, if any.
QualifiedTemplateName * getAsQualifiedTemplateName() const
Retrieve the underlying qualified template name structure, if any.
NestedNameSpecifier getQualifier() const
SubstTemplateTemplateParmPackStorage * getAsSubstTemplateTemplateParmPack() const
Retrieve the substituted template template parameter pack, if known.
SubstTemplateTemplateParmStorage * getAsSubstTemplateTemplateParm() const
Retrieve the substituted template template parameter, if known.
Stores a list of template parameters for a TemplateDecl and its derived classes.
unsigned getNumArgs() const
SourceLocation getLAngleLoc() const
SourceLocation getRAngleLoc() const
SourceLocation getTemplateNameLoc() const
SourceLocation getTemplateKeywordLoc() const
NestedNameSpecifierLoc getQualifierLoc() const
SourceLocation getElaboratedKeywordLoc() const
Wrapper for template type parameters.
The top declaration context.
TypeLoc getTypeLocInContext(ASTContext &Context, QualType T)
Copies the type-location information to the given AST context and returns a TypeLoc referring into th...
TyLocType push(QualType T)
Pushes space for a new TypeLoc of the given type.
void reserve(size_t Requested)
Ensures that this buffer has at least as much capacity as described.
void TypeWasModifiedSafely(QualType T)
Tell the TypeLocBuilder that the type it is storing has been modified in some safe way that doesn't a...
TypeSourceInfo * getTypeSourceInfo(ASTContext &Context, QualType T)
Creates a TypeSourceInfo for the given type.
Base wrapper for a particular "section" of type source info.
UnqualTypeLoc getUnqualifiedLoc() const
Skips past any qualifiers, if this is qualified.
QualType getType() const
Get the type for which this source info wrapper provides information.
T getAs() const
Convert to the specified TypeLoc type, returning a null TypeLoc if this TypeLoc is not of the desired...
T castAs() const
Convert to the specified TypeLoc type, asserting that this TypeLoc is of the desired type.
SourceRange getSourceRange() const LLVM_READONLY
Get the full source range.
unsigned getFullDataSize() const
Returns the size of the type source info data block.
TypeLocClass getTypeLocClass() const
T getAsAdjusted() const
Convert to the specified TypeLoc type, returning a null TypeLoc if this TypeLoc is not of the desired...
SourceLocation getBeginLoc() const
Get the begin source location.
Represents a typeof (or typeof) expression (a C23 feature and GCC extension) or a typeof_unqual expre...
A container of type source information.
TypeLoc getTypeLoc() const
Return the TypeLoc wrapper for the type source info.
QualType getType() const
Return the type wrapped by this type source info.
void setNameLoc(SourceLocation Loc)
A type trait used in the implementation of various C++11 and Library TR1 trait templates.
The base class of the type hierarchy.
bool isDependentType() const
Whether this type is a dependent type, meaning that its definition somehow depends on a template para...
bool containsUnexpandedParameterPack() const
Whether this type is or contains an unexpanded parameter pack, used to support C++0x variadic templat...
bool isOverloadableType() const
Determines whether this is a type for which one can define an overloaded operator.
bool isObjCObjectPointerType() const
const T * getAs() const
Member-template getAs<specific type>'.
Base class for declarations which introduce a typedef-name.
Wrapper for source info for typedefs.
void setTypeofLoc(SourceLocation Loc)
UnaryExprOrTypeTraitExpr - expression with either a type or (unevaluated) expression operand.
UnaryOperator - This represents the unary-expression's (except sizeof and alignof),...
SourceLocation getOperatorLoc() const
getOperatorLoc - Return the location of the operator.
Expr * getSubExpr() const
static Opcode getOverloadedOpcode(OverloadedOperatorKind OO, bool Postfix)
Retrieve the unary opcode that corresponds to the given overloaded operator.
Represents a C++ unqualified-id that has been parsed.
void setOperatorFunctionId(SourceLocation OperatorLoc, OverloadedOperatorKind Op, SourceLocation SymbolLocations[3])
Specify that this unqualified-id was parsed as an operator-function-id.
A reference to a name which we were able to look up during parsing but could not resolve to a specifi...
CXXRecordDecl * getNamingClass()
Gets the 'naming class' (in the sense of C++0x [class.access.base]p5) of the lookup.
bool requiresADL() const
True if this declaration should be extended by argument-dependent lookup.
static UnresolvedLookupExpr * Create(const ASTContext &Context, CXXRecordDecl *NamingClass, NestedNameSpecifierLoc QualifierLoc, const DeclarationNameInfo &NameInfo, bool RequiresADL, UnresolvedSetIterator Begin, UnresolvedSetIterator End, bool KnownDependent, bool KnownInstantiationDependent)
Represents a C++ member access expression for which lookup produced a set of overloaded functions.
A set of unresolved declarations.
void append(iterator I, iterator E)
A set of unresolved declarations.
Wrapper for source info for unresolved typename using decls.
Represents the dependent type named by a dependently-scoped typename using declaration,...
A call to a literal operator (C++11 [over.literal]) written as a user-defined literal (C++11 [lit....
Represents a shadow declaration implicitly introduced into a scope by a (resolved) using-declaration ...
NamedDecl * getTargetDecl() const
Gets the underlying declaration which has been brought into the local scope.
Wrapper for source info for types used via transparent aliases.
Represents a call to the builtin function __builtin_va_arg.
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
bool isParameterPack() const
Determine whether this value is actually a function parameter pack, init-capture pack,...
Represents a variable declaration or definition.
@ CInit
C-style initialization with assignment.
@ CallInit
Call-style initialization (C++98)
StorageClass getStorageClass() const
Returns the storage class as written in the source.
Represents a C array with a specified size that is not an integer-constant-expression.
void setNameLoc(SourceLocation Loc)
Represents a GCC generic vector type.
WhileStmt - This represents a 'while' stmt.
A requires-expression requirement which queries the validity and properties of an expression ('simple...
SubstitutionDiagnostic * getExprSubstitutionDiagnostic() const
bool isExprSubstitutionFailure() const
const ReturnTypeRequirement & getReturnTypeRequirement() const
SourceLocation getNoexceptLoc() const
A requires-expression requirement which is satisfied when a general constraint expression is satisfie...
const ASTConstraintSatisfaction & getConstraintSatisfaction() const
bool hasInvalidConstraint() const
Expr * getConstraintExpr() const
StringRef getInvalidConstraintEntity()
A static requirement that can be used in a requires-expression to check properties of types and expre...
A requires-expression requirement which queries the existence of a type name or type template special...
bool isSubstitutionFailure() const
SubstitutionDiagnostic * getSubstitutionDiagnostic() const
TypeSourceInfo * getType() const
Retains information about a block that is currently being parsed.
bool ContainsUnexpandedParameterPack
Whether this contains an unexpanded parameter pack.
CXXRecordDecl * Lambda
The class that describes the lambda.
CXXMethodDecl * CallOperator
The lambda's compiler-generated operator().
@ AttributedType
The l-value was considered opaque, so the alignment was determined from a type, but that type was an ...
const AstTypeMatcher< FunctionType > functionType
llvm::PointerUnion< const Decl *, const Expr * > DeclTy
bool Comp(InterpState &S, CodePtr OpPC)
1) Pops the value from the stack.
bool Inc(InterpState &S, CodePtr OpPC, bool CanOverflow)
1) Pops a pointer from the stack 2) Load the value from the pointer 3) Writes the value increased by ...
The JSON file list parser is used to communicate input to InstallAPI.
CanQual< Type > CanQualType
Represents a canonical, potentially-qualified type.
OpenMPOriginalSharingModifier
OpenMP 6.0 original sharing modifiers.
OverloadedOperatorKind
Enumeration specifying the different kinds of C++ overloaded operators.
@ OO_None
Not an overloaded operator.
@ NUM_OVERLOADED_OPERATORS
bool isa(CodeGen::Address addr)
ArrayTypeTrait
Names for the array type traits.
OpenMPDefaultClauseVariableCategory
OpenMP variable-category for 'default' clause.
AutoTypeKeyword
Which keyword(s) were used to create an AutoType.
OpenMPDefaultmapClauseModifier
OpenMP modifiers for 'defaultmap' clause.
OpenMPOrderClauseModifier
OpenMP modifiers for 'order' clause.
@ Ambiguous
Name lookup results in an ambiguity; use getAmbiguityKind to figure out what kind of ambiguity we hav...
@ NotFound
No entity found met the criteria.
@ FoundOverloaded
Name lookup found a set of overloaded functions that met the criteria.
@ Found
Name lookup found a single declaration that met the criteria.
@ FoundUnresolvedValue
Name lookup found an unresolvable value declaration and cannot yet complete.
@ NotFoundInCurrentInstantiation
No entity found met the criteria within the current instantiation,, but there were dependent base cla...
IfStatementKind
In an if statement, this denotes whether the statement is a constexpr or consteval if statement.
@ TemplateName
The identifier is a template name. FIXME: Add an annotation for that.
@ OK_ObjCProperty
An Objective-C property is a logical field of an Objective-C object which is read and written via Obj...
OpenMPAtClauseKind
OpenMP attributes for 'at' clause.
@ LCK_ByCopy
Capturing by copy (a.k.a., by value)
@ LCK_ByRef
Capturing by reference.
@ LCK_StarThis
Capturing the *this object by copy.
NonTagKind
Common ways to introduce type names without a tag for use in diagnostics.
OpenMPReductionClauseModifier
OpenMP modifiers for 'reduction' clause.
std::pair< llvm::PointerUnion< const TemplateTypeParmType *, NamedDecl *, const TemplateSpecializationType *, const SubstBuiltinTemplatePackType * >, SourceLocation > UnexpandedParameterPack
@ DevicePtr
'deviceptr' clause, allowed on Compute and Combined Constructs, plus 'data' and 'declare'.
@ Invalid
Represents an invalid clause, for the purposes of parsing.
@ Attach
'attach' clause, allowed on Compute and Combined constructs, plus 'data' and 'enter data'.
@ Self
'self' clause, allowed on Compute and Combined Constructs, plus 'update'.
@ Detach
'detach' clause, allowed on the 'exit data' construct.
TypeOfKind
The kind of 'typeof' expression we're after.
OpenMPScheduleClauseModifier
OpenMP modifiers for 'schedule' clause.
OpenACCComputeConstruct(OpenACCDirectiveKind K, SourceLocation Start, SourceLocation DirectiveLoc, SourceLocation End, ArrayRef< const OpenACCClause * > Clauses, Stmt *StructuredBlock)
OpenMPDistScheduleClauseKind
OpenMP attributes for 'dist_schedule' clause.
OpenMPDoacrossClauseModifier
OpenMP dependence types for 'doacross' clause.
@ Dependent
Parse the block as a dependent block, which may be used in some template instantiations but not other...
UnaryExprOrTypeTrait
Names for the "expression or type" traits.
std::pair< NullabilityKind, bool > DiagNullabilityKind
A nullability kind paired with a bit indicating whether it used a context-sensitive keyword.
OpenMPDynGroupprivateClauseFallbackModifier
MutableArrayRef< Expr * > MultiExprArg
@ Property
The type of a property.
@ Result
The result type of a method or function.
OpenMPBindClauseKind
OpenMP bindings for the 'bind' clause.
ArraySizeModifier
Capture whether this is a normal array (e.g.
const FunctionProtoType * T
bool isComputedNoexcept(ExceptionSpecificationType ESpecType)
OpenMPLastprivateModifier
OpenMP 'lastprivate' clause modifier.
@ Template
We are parsing a template declaration.
ActionResult< CXXBaseSpecifier * > BaseResult
OpenMPGrainsizeClauseModifier
OpenMPNumTasksClauseModifier
TagTypeKind
The kind of a tag type.
bool transformOMPMappableExprListClause(TreeTransform< Derived > &TT, OMPMappableExprListClause< T > *C, llvm::SmallVectorImpl< Expr * > &Vars, CXXScopeSpec &MapperIdScopeSpec, DeclarationNameInfo &MapperIdInfo, llvm::SmallVectorImpl< Expr * > &UnresolvedMappers)
@ Keyword
The name has been typo-corrected to a keyword.
bool isOpenMPLoopDirective(OpenMPDirectiveKind DKind)
Checks if the specified directive is a directive with an associated loop construct.
OpenMPSeverityClauseKind
OpenMP attributes for 'severity' clause.
std::tuple< NamedDecl *, TemplateArgument > getReplacedTemplateParameter(Decl *D, unsigned Index)
Internal helper used by Subst* nodes to retrieve a parameter from the AssociatedDecl,...
OpenMPDefaultmapClauseKind
OpenMP attributes for 'defaultmap' clause.
OpenMPAllocateClauseModifier
OpenMP modifiers for 'allocate' clause.
OpenMPLinearClauseKind
OpenMP attributes for 'linear' clause.
llvm::omp::Directive OpenMPDirectiveKind
OpenMP directives.
OpenMPDynGroupprivateClauseModifier
@ VK_PRValue
A pr-value expression (in the C++11 taxonomy) produces a temporary value.
@ VK_LValue
An l-value expression is a reference to an object with independent storage.
@ Dependent
The name is a dependent name, so the results will differ from one instantiation to the next.
@ Exists
The symbol exists.
@ Error
An error occurred.
@ DoesNotExist
The symbol does not exist.
MutableArrayRef< Stmt * > MultiStmtArg
OpenMPNumThreadsClauseModifier
U cast(CodeGen::Address addr)
OpenMPDeviceClauseModifier
OpenMP modifiers for 'device' clause.
OpaquePtr< QualType > ParsedType
An opaque type for threading parsed type information through the parser.
ElaboratedTypeKeyword
The elaboration keyword that precedes a qualified type name or introduces an elaborated-type-specifie...
@ None
No keyword precedes the qualified type name.
@ Class
The "class" keyword introduces the elaborated-type-specifier.
@ Typename
The "typename" keyword precedes the qualified type name, e.g., typename T::type.
ActionResult< Expr * > ExprResult
OpenMPOrderClauseKind
OpenMP attributes for 'order' clause.
TypeTrait
Names for traits that operate specifically on types.
@ Parens
New-expression has a C++98 paren-delimited initializer.
ExceptionSpecificationType
The various types of exception specifications that exist in C++11.
@ EST_Uninstantiated
not instantiated yet
@ EST_Unevaluated
not evaluated yet, for special member function
@ EST_Dynamic
throw(T1, T2)
OpenMPScheduleClauseKind
OpenMP attributes for 'schedule' clause.
static QualType TransformTypeSpecType(TypeLocBuilder &TLB, TyLoc T)
ActionResult< Stmt * > StmtResult
OpenMPMapClauseKind
OpenMP mapping kind for 'map' clause.
The result of a constraint satisfaction check, containing the necessary information to diagnose an un...
Represents an explicit template argument list in C++, e.g., the "<int>" in "sort<int>".
static const ASTTemplateArgumentListInfo * Create(const ASTContext &C, const TemplateArgumentListInfo &List)
UnsignedOrNone ArgPackSubstIndex
DeclarationNameInfo - A collector data type for bundling together a DeclarationName and the correspon...
SourceLocation getLoc() const
getLoc - Returns the main location of the declaration name.
DeclarationName getName() const
getName - Returns the embedded declaration name.
void setNamedTypeInfo(TypeSourceInfo *TInfo)
setNamedTypeInfo - Sets the source type info associated to the name.
void setName(DeclarationName N)
setName - Sets the embedded declaration name.
TypeSourceInfo * getNamedTypeInfo() const
getNamedTypeInfo - Returns the source type info associated to the name.
A FunctionEffect plus a potential boolean expression determining whether the effect is declared (e....
Holds information about the various types of exception specification.
FunctionDecl * SourceTemplate
The function template whose exception specification this is instantiated from, for EST_Uninstantiated...
ExceptionSpecificationType Type
The kind of exception specification this is.
ArrayRef< QualType > Exceptions
Explicitly-specified list of exception types.
Expr * NoexceptExpr
Noexcept expression, if this is a computed noexcept specification.
Extra information about a function prototype.
ExceptionSpecInfo ExceptionSpec
FunctionEffectsRef FunctionEffects
const ExtParameterInfo * ExtParameterInfos
const IdentifierInfo * getIdentifier() const
Returns the identifier to which this template name refers.
OverloadedOperatorKind getOperator() const
Return the overloaded operator to which this template name refers.
static TagTypeKind getTagTypeKindForKeyword(ElaboratedTypeKeyword Keyword)
Converts an elaborated type keyword into a TagTypeKind.
const NamespaceBaseDecl * Namespace
Iterator range representation begin:end[:step].
Data for list of allocators.
This structure contains most locations needed for by an OMPVarListClause.
An element in an Objective-C dictionary literal.
Data for list of allocators.
A context in which code is being synthesized (where a source location alone is not sufficient to iden...
@ LambdaExpressionSubstitution
We are substituting into a lambda expression.
An RAII helper that pops function a function scope on exit.
Keeps information about an identifier in a nested-name-spec.
Location information for a TemplateArgument.
UnsignedOrNone OrigNumExpansions
bool ExpandUnderForgetSubstitions
UnsignedOrNone NumExpansions