13#ifndef LLVM_CLANG_LIB_SEMA_TREETRANSFORM_H
14#define LLVM_CLANG_LIB_SEMA_TREETRANSFORM_H
49#include "llvm/ADT/ArrayRef.h"
50#include "llvm/Support/ErrorHandling.h"
54using namespace llvm::omp;
121template<
typename Derived>
126 class ForgetPartiallySubstitutedPackRAII {
134 ForgetPartiallySubstitutedPackRAII(Derived &
Self)
135 :
Self(
Self), ResetPackSubstIndex(
Self.getSema(), std::nullopt) {
136 Old =
Self.ForgetPartiallySubstitutedPack();
139 ~ForgetPartiallySubstitutedPackRAII() {
140 Self.RememberPartiallySubstitutedPack(Old);
157 Derived &
getDerived() {
return static_cast<Derived&
>(*this); }
161 return static_cast<const Derived&
>(*this);
229 if (Location.isValid())
230 Self.getDerived().setBase(Location, Entity);
234 Self.getDerived().setBase(OldLocation, OldEntity);
307 bool FailOnPackProducingTemplates,
308 bool &ShouldExpand,
bool &RetainExpansion,
310 ShouldExpand =
false;
338 struct ForgetSubstitutionRAII {
344 Old =
Self.ForgetSubstitution();
347 ~ForgetSubstitutionRAII() {
Self.RememberSubstitution(std::move(Old)); }
447 const X##Attr *Transform##X##Attr(const X##Attr *R) { return R; }
448#include "clang/Basic/AttrList.inc"
458 const X##Attr *TransformStmt##X##Attr(const Stmt *, const Stmt *, \
459 const X##Attr *A) { \
460 return getDerived().Transform##X##Attr(A); \
462#include "clang/Basic/AttrList.inc"
508 bool *ArgChanged =
nullptr);
517 llvm::DenseMap<Decl *, Decl *>::iterator Known
520 return Known->second;
548 assert(
New.size() == 1 &&
549 "must override transformedLocalDecl if performing pack expansion");
587 NamedDecl *FirstQualifierInScope =
nullptr);
632 NamedDecl *FirstQualifierInScope =
nullptr,
633 bool AllowInjectedClassName =
false);
645 bool Uneval =
false);
672 bool Uneval =
false) {
691 template<
typename InputIterator>
695 bool Uneval =
false);
697 template <
typename InputIterator>
701 bool Uneval =
false);
722 return SemaRef.Context.getTrivialTypeSourceInfo(
T,
726#define ABSTRACT_TYPELOC(CLASS, PARENT)
727#define TYPELOC(CLASS, PARENT) \
728 QualType Transform##CLASS##Type(TypeLocBuilder &TLB, CLASS##TypeLoc T);
729#include "clang/AST/TypeLocNodes.def"
733 bool SuppressObjCLifetime);
737 bool SuppressObjCLifetime);
739 template<
typename Fn>
757 bool AllowInjectedClassName);
785 return getDerived().TransformFunctionTypeParams(
786 Loc, Params, ParamTypes, ParamInfos, PTypes, PVars, PInfos,
nullptr);
804 KWLoc, Params,
nullptr,
805 nullptr, PTypes, &TransParams, PInfos))
819 bool ExpectParameterPack);
846 bool IsAddressOfOperand,
854 bool IsAddressOfOperand);
862#define STMT(Node, Parent) \
863 LLVM_ATTRIBUTE_NOINLINE \
864 StmtResult Transform##Node(Node *S);
865#define VALUESTMT(Node, Parent) \
866 LLVM_ATTRIBUTE_NOINLINE \
867 StmtResult Transform##Node(Node *S, StmtDiscardKind SDK);
868#define EXPR(Node, Parent) \
869 LLVM_ATTRIBUTE_NOINLINE \
870 ExprResult Transform##Node(Node *E);
871#define ABSTRACT_STMT(Stmt)
872#include "clang/AST/StmtNodes.inc"
874#define GEN_CLANG_CLAUSE_CLASS
875#define CLAUSE_CLASS(Enum, Str, Class) \
876 LLVM_ATTRIBUTE_NOINLINE \
877 OMPClause *Transform##Class(Class *S);
878#include "llvm/Frontend/OpenMP/OMP.inc"
956 const llvm::APInt *Size,
Expr *SizeExpr,
957 unsigned IndexTypeQuals,
SourceRange BracketsRange);
966 const llvm::APInt &Size,
Expr *SizeExpr,
967 unsigned IndexTypeQuals,
977 unsigned IndexTypeQuals,
987 unsigned IndexTypeQuals,
998 unsigned IndexTypeQuals,
1036 unsigned NumColumns);
1053 Expr *AddrSpaceExpr,
1077 return SemaRef.Context.getUsingType(
Keyword, Qualifier, D, UnderlyingType);
1090 return SemaRef.Context.getMacroQualifiedType(
T, MacroII);
1100 return SemaRef.Context.getCanonicalTagType(Tag);
1117 UnaryTransformType::UTTKind UKind,
1129 bool FullySubstituted,
1143 TypeConstraintConcept,
1144 TypeConstraintArgs);
1151 return SemaRef.Context.getDeducedTemplateSpecializationType(
1170 return SemaRef.BuildParenType(InnerType);
1183 bool DeducedTSTContext) {
1185 SS.
Adopt(QualifierLoc);
1189 if (!
SemaRef.computeDeclContext(SS))
1197 return SemaRef.CheckTypenameType(
Keyword, KeywordLoc, QualifierLoc,
1198 *Id, IdLoc, DeducedTSTContext);
1211 if (
SemaRef.RequireCompleteDeclContext(SS, DC))
1216 switch (
Result.getResultKind()) {
1227 llvm_unreachable(
"Tag lookup cannot find non-tags");
1239 switch (
Result.getResultKind()) {
1245 SemaRef.Diag(IdLoc, diag::err_tag_reference_non_tag)
1246 << SomeDecl << NTK << Kind;
1251 SemaRef.Diag(IdLoc, diag::err_not_tag_in_scope)
1257 if (!
SemaRef.isAcceptableTagRedeclaration(Tag, Kind,
false,
1259 SemaRef.Diag(KeywordLoc, diag::err_use_with_wrong_tag) << Id;
1260 SemaRef.Diag(Tag->getLocation(), diag::note_previous_use);
1316 bool AllowInjectedClassName);
1329 bool AllowInjectedClassName);
1335 bool AllowInjectedClassName);
1345 Decl *AssociatedDecl,
unsigned Index,
1348 ArgPack, AssociatedDecl, Index, Final);
1402 return SemaRef.ActOnLabelStmt(IdentLoc, L, ColonLoc, SubStmt);
1412 if (
SemaRef.CheckRebuiltStmtAttributes(Attrs))
1414 return SemaRef.BuildAttributedStmt(AttrLoc, Attrs, SubStmt);
1426 Then, ElseLoc, Else);
1480 Inc, RParenLoc, Body);
1525 bool IsVolatile,
unsigned NumOutputs,
1532 NumInputs, Names, Constraints, Exprs,
1533 AsmString, Clobbers, NumLabels, RParenLoc);
1542 StringRef AsmString,
1543 unsigned NumOutputs,
unsigned NumInputs,
1549 NumOutputs, NumInputs,
1550 Constraints, Clobbers, Exprs, EndLoc);
1579 CoawaitLoc, Operand, OpCoawaitLookup);
1583 Suspend.
get(),
true);
1684 Kind, DirName, CancelRegion, Clauses, AStmt, StartLoc, EndLoc);
1696 Kind, DirName, Clauses, AStmt, StartLoc, EndLoc);
1710 NameModifier,
Condition, StartLoc, LParenLoc, NameModifierLoc, ColonLoc,
1736 Modifier, NumThreads, StartLoc, LParenLoc, ModifierLoc, EndLoc);
1797 First, Count, StartLoc, LParenLoc, FirstLoc, CountLoc, EndLoc);
1833 Kind, KindKwLoc, VCKind, VCLoc, StartLoc, LParenLoc, EndLoc);
1846 Kind, KindKwLoc, StartLoc, LParenLoc, EndLoc);
1859 M1, M2, Kind, ChunkSize, StartLoc, LParenLoc, M1Loc, M2Loc, KindLoc,
1921 VarList, LPKind, LPKindLoc, ColonLoc, StartLoc, LParenLoc, EndLoc);
1949 VarList, {Modifier, OriginalSharingModifier}, StartLoc, LParenLoc,
1950 ModifierLoc, ColonLoc, EndLoc, ReductionIdScopeSpec, ReductionId,
1951 UnresolvedReductions);
1965 VarList, StartLoc, LParenLoc, ColonLoc, EndLoc, ReductionIdScopeSpec,
1966 ReductionId, UnresolvedReductions);
1981 VarList, StartLoc, LParenLoc, ColonLoc, EndLoc, ReductionIdScopeSpec,
1982 ReductionId, UnresolvedReductions);
1995 VarList, Step, StartLoc, LParenLoc, Modifier, ModifierLoc, ColonLoc,
1996 StepModifierLoc, EndLoc);
2009 VarList, Alignment, StartLoc, LParenLoc, ColonLoc, EndLoc);
2069 Data, DepModifier, VarList, StartLoc, LParenLoc, EndLoc);
2082 Modifier,
Device, StartLoc, LParenLoc, ModifierLoc, EndLoc);
2097 IteratorModifier, MapTypeModifiers, MapTypeModifiersLoc,
2098 MapperIdScopeSpec, MapperId, MapType, IsMapTypeImplicit, MapLoc,
2099 ColonLoc, VarList, Locs,
2100 false, UnresolvedMappers);
2117 Allocate, Alignment, FirstModifier, FirstModifierLoc, SecondModifier,
2118 SecondModifierLoc, VarList, StartLoc, LParenLoc, ColonLoc, EndLoc);
2166 Modifier,
Device, StartLoc, LParenLoc, ModifierLoc, EndLoc);
2179 Modifier, NumTasks, StartLoc, LParenLoc, ModifierLoc, EndLoc);
2214 Kind, ChunkSize, StartLoc, LParenLoc, KindLoc, CommaLoc, EndLoc);
2229 MotionModifiers, MotionModifiersLoc, IteratorModifier,
2230 MapperIdScopeSpec, MapperId, ColonLoc, VarList, Locs,
2246 MotionModifiers, MotionModifiersLoc, IteratorModifier,
2247 MapperIdScopeSpec, MapperId, ColonLoc, VarList, Locs,
2299 M, Kind, StartLoc, LParenLoc, MLoc, KindLoc, EndLoc);
2346 StartLoc, LParenLoc, EndLoc,
Data);
2359 StartLoc, LParenLoc, ColonLoc, EndLoc, Modifier, Locators);
2371 Modifier, Kind, StartLoc, LParenLoc, ModifierKwLoc, KindKwLoc, EndLoc);
2384 InteropVar, InteropInfo, StartLoc, LParenLoc, VarLoc, EndLoc);
2395 LParenLoc, VarLoc, EndLoc);
2407 InteropVar, StartLoc, LParenLoc, VarLoc, EndLoc);
2478 M1, M2, Size, StartLoc, LParenLoc, M1Loc, M2Loc, EndLoc);
2559 DepType, DepLoc, ColonLoc, VarList, StartLoc, LParenLoc, EndLoc);
2607 ForLoc, Element, Collection, RParenLoc);
2625 StartLoc, IdLoc, Id);
2662 if (
DeclStmt *RangeStmt = dyn_cast<DeclStmt>(Range)) {
2663 if (RangeStmt->isSingleDecl()) {
2664 if (
VarDecl *RangeVar = dyn_cast<VarDecl>(RangeStmt->getSingleDecl())) {
2665 if (RangeVar->isInvalidDecl())
2668 Expr *RangeExpr = RangeVar->getInit();
2675 diag::err_objc_for_range_init_stmt)
2676 <<
Init->getSourceRange();
2679 ForLoc, LoopVar, RangeExpr, RParenLoc);
2686 ForLoc, CoawaitLoc,
Init, ColonLoc, Range, Begin, End,
Cond, Inc,
2700 QualifierLoc, NameInfo, Nested);
2762 SS.
Adopt(QualifierLoc);
2874 if (IsOMPArraySection)
2876 Base, LBracketLoc, LowerBound, ColonLocFirst, ColonLocSecond, Length,
2877 Stride, RBracketLoc);
2879 assert(Stride ==
nullptr && !ColonLocSecond.
isValid() &&
2880 "Stride/second colon not allowed for OpenACC");
2883 Base, LBracketLoc, LowerBound, ColonLocFirst, Length, RBracketLoc);
2895 Base, LParenLoc, RParenLoc, Dims, BracketsRanges);
2907 nullptr, IteratorKwLoc, LLoc, RLoc,
Data);
2917 Expr *ExecConfig =
nullptr) {
2919 nullptr, Callee, LParenLoc, Args, RParenLoc, ExecConfig);
2926 nullptr, Callee, LParenLoc, Args, RParenLoc);
2944 if (!
Member->getDeclName()) {
2948 assert(
Member->getType()->isRecordType() &&
2949 "unnamed member not of record type?");
2962 if (!isArrow &&
Base->isPRValue()) {
2977 SS.
Adopt(QualifierLoc);
2980 if (
Base->containsErrors())
2985 if (isArrow && !BaseType->isPointerType())
2994 if (
getSema().isUnevaluatedContext() &&
Base->isImplicitCXXThis() &&
2999 ->getAsCXXRecordDecl()) {
3003 if (!ThisClass->Equals(
Class) && !ThisClass->isDerivedFrom(
Class))
3011 FirstQualifierInScope,
3012 R, ExplicitTemplateArgs,
3022 bool ForFoldExpression =
false) {
3100 return SemaRef.BuildInitList(LBraceLoc, Inits, RBraceLoc);
3113 =
SemaRef.ActOnDesignatedInitializer(Desig, EqualOrColonLoc, GNUSyntax,
3153 unsigned NumUserSpecifiedExprs,
3158 InitLoc, LParenLoc, RParenLoc);
3188 return SemaRef.ActOnChooseExpr(BuiltinLoc,
3200 Expr *ControllingExpr,
3205 ControllingExpr, Types, Exprs);
3220 ControllingType, Types, Exprs);
3253 case Stmt::CXXStaticCastExprClass:
3254 return getDerived().RebuildCXXStaticCastExpr(OpLoc, LAngleLoc, TInfo,
3255 RAngleLoc, LParenLoc,
3256 SubExpr, RParenLoc);
3258 case Stmt::CXXDynamicCastExprClass:
3259 return getDerived().RebuildCXXDynamicCastExpr(OpLoc, LAngleLoc, TInfo,
3260 RAngleLoc, LParenLoc,
3261 SubExpr, RParenLoc);
3263 case Stmt::CXXReinterpretCastExprClass:
3264 return getDerived().RebuildCXXReinterpretCastExpr(OpLoc, LAngleLoc, TInfo,
3265 RAngleLoc, LParenLoc,
3269 case Stmt::CXXConstCastExprClass:
3270 return getDerived().RebuildCXXConstCastExpr(OpLoc, LAngleLoc, TInfo,
3271 RAngleLoc, LParenLoc,
3272 SubExpr, RParenLoc);
3274 case Stmt::CXXAddrspaceCastExprClass:
3275 return getDerived().RebuildCXXAddrspaceCastExpr(
3276 OpLoc, LAngleLoc, TInfo, RAngleLoc, LParenLoc, SubExpr, RParenLoc);
3279 llvm_unreachable(
"Invalid C++ named cast");
3357 OpLoc, tok::kw_addrspace_cast, TInfo, SubExpr,
3369 bool ListInitialization) {
3373 if (
auto *PLE = dyn_cast<ParenListExpr>(Sub))
3375 TInfo, LParenLoc,
MultiExprArg(PLE->getExprs(), PLE->getNumExprs()),
3376 RParenLoc, ListInitialization);
3378 if (
auto *PLE = dyn_cast<CXXParenListInitExpr>(Sub))
3380 TInfo, LParenLoc, PLE->getInitExprs(), RParenLoc, ListInitialization);
3384 ListInitialization);
3448 if (
getSema().CheckCXXThisType(ThisLoc, ThisType))
3458 bool IsThrownVariableInScope) {
3468 Expr *RewrittenExpr) {
3470 RewrittenExpr,
getSema().CurContext);
3504 std::optional<Expr *> ArraySize,
3523 bool IsGlobalDelete,
3574 bool IsAddressOfOperand,
3577 SS.
Adopt(QualifierLoc);
3579 if (TemplateArgs || TemplateKWLoc.
isValid())
3581 SS, TemplateKWLoc, NameInfo, TemplateArgs, IsAddressOfOperand);
3584 SS, NameInfo, IsAddressOfOperand, RecoveryTSI);
3606 bool IsElidable,
MultiExprArg Args,
bool HadMultipleCandidates,
3607 bool ListInitialization,
bool StdInitListInitialization,
3614 FoundCtor =
Constructor->getInheritedConstructor().getConstructor();
3617 if (
getSema().CompleteConstructorCall(FoundCtor,
T, Args, Loc,
3624 HadMultipleCandidates,
3626 StdInitListInitialization,
3627 RequiresZeroInit, ConstructKind,
3635 bool ConstructsVBase,
3636 bool InheritedFromVBase) {
3638 Loc,
T,
Constructor, ConstructsVBase, InheritedFromVBase);
3649 bool ListInitialization) {
3651 TSInfo, LParenOrBraceLoc, Args, RParenOrBraceLoc, ListInitialization);
3662 bool ListInitialization) {
3664 RParenLoc, ListInitialization);
3681 SS.
Adopt(QualifierLoc);
3683 return SemaRef.BuildMemberReferenceExpr(BaseE, BaseType,
3684 OperatorLoc, IsArrow,
3686 FirstQualifierInScope,
3688 TemplateArgs,
nullptr);
3704 SS.
Adopt(QualifierLoc);
3706 return SemaRef.BuildMemberReferenceExpr(BaseE, BaseType,
3707 OperatorLoc, IsArrow,
3709 FirstQualifierInScope,
3710 R, TemplateArgs,
nullptr);
3718 return SemaRef.BuildCXXNoexceptExpr(Range.getBegin(), Arg, Range.getEnd());
3731 RParenLoc, Length, PartialArgs);
3736 Expr *PackIdExpression,
Expr *IndexExpr,
3738 bool FullySubstituted =
false) {
3740 IndexExpr, RSquareLoc, ExpandedExprs,
3766 NamedConcept, TALI);
3784 LocalParameters, RParenLoc, Requirements,
3791 return SemaRef.BuildTypeRequirement(SubstDiag);
3795 return SemaRef.BuildTypeRequirement(
T);
3803 return SemaRef.BuildExprRequirement(SubstDiag, IsSimple, NoexceptLoc,
3810 return SemaRef.BuildExprRequirement(E, IsSimple, NoexceptLoc,
3817 return SemaRef.BuildNestedRequirement(InvalidConstraintEntity,
3822 return SemaRef.BuildNestedRequirement(Constraint);
3838 Expr **Elements,
unsigned NumElements) {
3848 RB,
Base, Key, getterMethod, setterMethod);
3867 return SemaRef.ObjC().BuildObjCEncodeExpression(AtLoc, EncodeTypeInfo,
3879 return SemaRef.ObjC().BuildClassMessage(
3880 ReceiverTypeInfo, ReceiverTypeInfo->
getType(),
3893 return SemaRef.ObjC().BuildInstanceMessage(Receiver, Receiver->
getType(),
3896 SelectorLocs, RBracLoc, Args);
3908 return Method->isInstanceMethod()
3909 ?
SemaRef.ObjC().BuildInstanceMessage(
3910 nullptr, SuperType, SuperLoc, Sel,
Method, LBracLoc,
3911 SelectorLocs, RBracLoc, Args)
3912 :
SemaRef.ObjC().BuildClassMessage(
nullptr, SuperType, SuperLoc,
3914 SelectorLocs, RBracLoc, Args);
3923 bool IsArrow,
bool IsFreeIvar) {
3932 if (IsFreeIvar &&
Result.isUsable())
3969 PropertyLoc,
Base));
3998 =
SemaRef.Context.Idents.get(
"__builtin_shufflevector");
4001 assert(!Lookup.
empty() &&
"No __builtin_shufflevector?");
4009 Callee =
SemaRef.ImpCastExprToType(Callee, CalleePtrTy,
4010 CK_BuiltinFnToFnPtr).get();
4026 return SemaRef.ConvertVectorExpr(SrcExpr, DstTInfo, BuiltinLoc, RParenLoc);
4041 EllipsisLoc, NumExpansions);
4065 llvm_unreachable(
"Pack expansion pattern has no parameter packs");
4101 EllipsisLoc, RHS, RParenLoc,
4110 Init->containsUnexpandedParameterPack();
4111 else if (PVD->hasUninstantiatedDefaultArg())
4113 PVD->getUninstantiatedDefaultArg()
4114 ->containsUnexpandedParameterPack();
4268 Exprs.push_back(DevNumExpr);
4269 llvm::append_range(Exprs, QueueIdExprs);
4313 ObjectType, FirstQualifierInScope);
4319 QualType TransformDependentNameType(TypeLocBuilder &TLB,
4320 DependentNameTypeLoc TL,
4321 bool DeducibleTSTContext,
4322 QualType ObjectType = QualType(),
4323 NamedDecl *UnqualLookup =
nullptr);
4326 TransformOpenACCClauseList(OpenACCDirectiveKind DirKind,
4331 OpenACCDirectiveKind DirKind,
4332 const OpenACCClause *OldClause);
4335template <
typename Derived>
4345#define STMT(Node, Parent) \
4346 case Stmt::Node##Class: return getDerived().Transform##Node(cast<Node>(S));
4347#define VALUESTMT(Node, Parent) \
4348 case Stmt::Node##Class: \
4349 return getDerived().Transform##Node(cast<Node>(S), SDK);
4350#define ABSTRACT_STMT(Node)
4351#define EXPR(Node, Parent)
4352#include "clang/AST/StmtNodes.inc"
4355#define STMT(Node, Parent)
4356#define ABSTRACT_STMT(Stmt)
4357#define EXPR(Node, Parent) case Stmt::Node##Class:
4358#include "clang/AST/StmtNodes.inc"
4363 E =
getSema().ActOnStmtExprResult(E);
4371template<
typename Derived>
4379#define GEN_CLANG_CLAUSE_CLASS
4380#define CLAUSE_CLASS(Enum, Str, Class) \
4382 return getDerived().Transform##Class(cast<Class>(S));
4383#include "llvm/Frontend/OpenMP/OMP.inc"
4390template<
typename Derived>
4397#define STMT(Node, Parent) case Stmt::Node##Class: break;
4398#define ABSTRACT_STMT(Stmt)
4399#define EXPR(Node, Parent) \
4400 case Stmt::Node##Class: return getDerived().Transform##Node(cast<Node>(E));
4401#include "clang/AST/StmtNodes.inc"
4407template<
typename Derived>
4415 if (
auto *FE = dyn_cast<FullExpr>(
Init))
4416 Init = FE->getSubExpr();
4418 if (
auto *AIL = dyn_cast<ArrayInitLoopExpr>(
Init)) {
4424 Init = MTE->getSubExpr();
4427 Init = Binder->getSubExpr();
4430 Init = ICE->getSubExprAsWritten();
4433 dyn_cast<CXXStdInitializerListExpr>(
Init))
4470 getSema().currentEvaluationContext().InLifetimeExtendingContext =
4471 getSema().parentEvaluationContext().InLifetimeExtendingContext;
4472 getSema().currentEvaluationContext().RebuildDefaultArgOrDefaultInit =
4473 getSema().parentEvaluationContext().RebuildDefaultArgOrDefaultInit;
4475 bool ArgChanged =
false;
4477 true, NewArgs, &ArgChanged))
4487 if (
Parens.isInvalid()) {
4490 assert(NewArgs.empty() &&
4491 "no parens or braces but have direct init with arguments?");
4498template<
typename Derived>
4504 for (
unsigned I = 0; I != NumInputs; ++I) {
4514 Expr *Pattern = Expansion->getPattern();
4517 getSema().collectUnexpandedParameterPacks(Pattern, Unexpanded);
4518 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
4523 bool RetainExpansion =
false;
4524 UnsignedOrNone OrigNumExpansions = Expansion->getNumExpansions();
4528 Unexpanded,
true, Expand,
4529 RetainExpansion, NumExpansions))
4542 Expansion->getEllipsisLoc(),
4544 if (Out.isInvalid())
4549 Outputs.push_back(Out.get());
4555 if (ArgChanged) *ArgChanged =
true;
4559 for (
unsigned I = 0; I != *NumExpansions; ++I) {
4562 if (Out.isInvalid())
4565 if (Out.get()->containsUnexpandedParameterPack()) {
4567 Out.get(), Expansion->getEllipsisLoc(), OrigNumExpansions);
4568 if (Out.isInvalid())
4572 Outputs.push_back(Out.get());
4577 if (RetainExpansion) {
4578 ForgetPartiallySubstitutedPackRAII Forget(
getDerived());
4581 if (Out.isInvalid())
4585 Out.get(), Expansion->getEllipsisLoc(), OrigNumExpansions);
4586 if (Out.isInvalid())
4589 Outputs.push_back(Out.get());
4596 IsCall ?
getDerived().TransformInitializer(Inputs[I],
false)
4601 if (
Result.get() != Inputs[I] && ArgChanged)
4604 Outputs.push_back(
Result.get());
4610template <
typename Derived>
4621 VarDecl *ConditionVar = cast_or_null<VarDecl>(
4627 return getSema().ActOnConditionVariable(ConditionVar, Loc, Kind);
4636 return getSema().ActOnCondition(
nullptr, Loc, CondExpr.
get(), Kind,
4643template <
typename Derived>
4651 Qualifier = Qualifier.getAsNamespaceAndPrefix().Prefix)
4663 llvm_unreachable(
"unexpected null nested name specifier");
4694 QualifierLoc =
getDerived().TransformNestedNameSpecifierLoc(
4695 QualifierLoc, ObjectType, FirstQualifierInScope);
4699 FirstQualifierInScope =
nullptr;
4701 SS.
Adopt(QualifierLoc);
4705 if (
SemaRef.BuildCXXNestedNameSpecifier(
nullptr, IdInfo,
4707 FirstQualifierInScope,
false))
4715 T = TransformTypeInObjectScope(TLB, TL, ObjectType,
4716 FirstQualifierInScope);
4722 if (
T->isDependentType() ||
T->isRecordType() ||
4723 (
SemaRef.getLangOpts().CPlusPlus11 &&
T->isEnumeralType())) {
4724 if (
T->isEnumeralType())
4726 diag::warn_cxx98_compat_enum_nested_name_spec);
4733 if (!TTL || !TTL.
getDecl()->isInvalidDecl()) {
4757template<
typename Derived>
4777 TemplateDecl *NewTemplate = cast_or_null<TemplateDecl>(
4784 SemaRef.Context.DeclarationNames.getCXXDeductionGuideName(NewTemplate));
4794 NewTInfo =
getDerived().TransformType(OldTInfo);
4797 NewCanTy =
SemaRef.Context.getCanonicalType(NewTInfo->
getType());
4805 NewCanTy =
SemaRef.Context.getCanonicalType(NewT);
4818 llvm_unreachable(
"Unknown name kind.");
4821template <
typename Derived>
4825 QualType ObjectType,
bool AllowInjectedClassName) {
4827 return getDerived().RebuildTemplateName(SS, TemplateKWLoc, *II, NameLoc,
4828 ObjectType, AllowInjectedClassName);
4830 NameLoc, ObjectType,
4831 AllowInjectedClassName);
4834template <
typename Derived>
4838 NamedDecl *FirstQualifierInScope,
bool AllowInjectedClassName) {
4840 TemplateName UnderlyingName = QTN->getUnderlyingTemplate();
4843 QualifierLoc =
getDerived().TransformNestedNameSpecifierLoc(
4844 QualifierLoc, ObjectType, FirstQualifierInScope);
4851 UnderlyingQualifier, TemplateKWLoc, UnderlyingName, NameLoc, ObjectType,
4852 FirstQualifierInScope, AllowInjectedClassName);
4853 if (NewUnderlyingName.
isNull())
4855 assert(!UnderlyingQualifier &&
"unexpected qualifier");
4859 NewUnderlyingName == UnderlyingName)
4862 SS.
Adopt(QualifierLoc);
4863 return getDerived().RebuildTemplateName(SS, QTN->hasTemplateKeyword(),
4869 QualifierLoc =
getDerived().TransformNestedNameSpecifierLoc(
4870 QualifierLoc, ObjectType, FirstQualifierInScope);
4884 SS.
Adopt(QualifierLoc);
4885 return getDerived().RebuildTemplateName(SS, TemplateKWLoc, DTN->getName(),
4886 NameLoc, ObjectType,
4887 AllowInjectedClassName);
4892 assert(!QualifierLoc &&
"Unexpected qualified SubstTemplateTemplateParm");
4899 ReplacementQualifierLoc = Builder.getWithLocInContext(
SemaRef.Context);
4903 ReplacementQualifierLoc, TemplateKWLoc, ReplacementName, NameLoc,
4904 ObjectType, FirstQualifierInScope, AllowInjectedClassName);
4907 Decl *AssociatedDecl =
4908 getDerived().TransformDecl(NameLoc, S->getAssociatedDecl());
4910 AssociatedDecl == S->getAssociatedDecl())
4912 return SemaRef.Context.getSubstTemplateTemplateParm(
4913 NewName, AssociatedDecl, S->getIndex(), S->getPackIndex(),
4918 "DeducedTemplateName should not escape partial ordering");
4922 assert(!QualifierLoc &&
"Unexpected qualifier");
4929 assert(!QualifierLoc &&
4930 "Unexpected qualified SubstTemplateTemplateParmPack");
4932 SubstPack->getArgumentPack(), SubstPack->getAssociatedDecl(),
4933 SubstPack->getIndex(), SubstPack->getFinal());
4937 llvm_unreachable(
"overloaded function decl survived to here");
4940template <
typename Derived>
4945 QualifierLoc, TemplateKeywordLoc, Name, NameLoc);
4951template<
typename Derived>
4955 Output =
getSema().getTrivialTemplateArgumentLoc(
4959template <
typename Derived>
4967 llvm_unreachable(
"Unexpected TemplateArgument");
4990 if (NewT ==
T && D == NewD)
5007 llvm_unreachable(
"unexpected template argument kind");
5039 llvm_unreachable(
"Caller should expand pack expansions");
5055 E =
SemaRef.ActOnConstantExpression(E);
5070template<
typename Derived,
typename InputIterator>
5078 typedef typename std::iterator_traits<InputIterator>::difference_type
5093 : Self(Self), Iter(Iter) { }
5108 Self.InventTemplateArgumentLoc(*Iter,
Result);
5116 return X.Iter == Y.Iter;
5121 return X.Iter != Y.Iter;
5125template<
typename Derived>
5126template<
typename InputIterator>
5146 PackLocIterator(*
this, In.getArgument().pack_begin()),
5147 PackLocIterator(*
this, In.getArgument().pack_end()), *PackOutput,
5154 if (In.getArgument().isPackExpansion()) {
5166 std::optional<ForgetSubstitutionRAII> ForgetSubst;
5176 if (Out.getArgument().containsUnexpandedParameterPack()) {
5179 if (Out.getArgument().isNull())
5189 ForgetPartiallySubstitutedPackRAII Forget(
getDerived());
5197 if (Out.getArgument().isNull())
5216template <
typename Derived>
5217template <
typename InputIterator>
5226 return !Arg.isDependent() && Arg.isConceptOrConceptTemplateParameter();
5238 PackLocIterator(*
this, In.getArgument().pack_begin()),
5239 PackLocIterator(*
this, In.getArgument().pack_end()), Outputs,
5245 if (!isNonDependentConceptArgument(In.getArgument())) {
5260template <
typename Derived>
5271 Pattern =
getSema().getTemplateArgumentPackExpansionPattern(
5274 getSema().collectUnexpandedParameterPacks(Pattern, Unexpanded);
5275 if (IsLateExpansionAttempt) {
5280 return P.first.dyn_cast<
const SubstBuiltinTemplatePackType *>();
5282 if (!SawPackTypes) {
5287 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
5295 Info.
Ellipsis, Pattern.getSourceRange(), Unexpanded,
5301 if (ComputeInfo(In,
false, Info, Pattern))
5313 std::optional<Sema::ArgPackSubstIndexRAII> SubstIndex(
5314 std::in_place,
getSema(), std::nullopt);
5320 if (Out.getArgument().isNull())
5357 ForgetSubstitutionRAII ForgetSubst(
getDerived());
5358 if (ComputeInfo(Out,
true, Info, OutPattern))
5371template<
typename Derived>
5389template <
typename Derived>
5409template<
typename Derived>
5412 switch (
T.getTypeLocClass()) {
5413#define ABSTRACT_TYPELOC(CLASS, PARENT)
5414#define TYPELOC(CLASS, PARENT) \
5415 case TypeLoc::CLASS: \
5416 return getDerived().Transform##CLASS##Type(TLB, \
5417 T.castAs<CLASS##TypeLoc>());
5418#include "clang/AST/TypeLocNodes.def"
5421 llvm_unreachable(
"unhandled type loc!");
5424template<
typename Derived>
5437template <
typename Derived>
5475template<
typename Derived>
5480 TypeLoc UnqualTL =
T.getUnqualifiedLoc();
5481 auto SuppressObjCLifetime =
5482 T.getType().getLocalQualifiers().hasObjCLifetime();
5484 Result = getDerived().TransformTemplateTypeParmType(TLB, TTP,
5485 SuppressObjCLifetime);
5486 }
else if (
auto STTP = UnqualTL.
getAs<SubstTemplateTypeParmPackTypeLoc>()) {
5487 Result = getDerived().TransformSubstTemplateTypeParmPackType(
5488 TLB, STTP, SuppressObjCLifetime);
5490 Result = getDerived().TransformType(TLB, UnqualTL);
5509template <
typename Derived>
5519 SemaRef.Diag(Loc, diag::err_address_space_mismatch_templ_inst)
5526 if (
T.getPointerAuth().isPresent()) {
5527 SemaRef.Diag(Loc, diag::err_ptrauth_qualifier_redundant) << TL.
getType();
5530 if (!
T->isDependentType()) {
5531 if (!
T->isSignableType(
SemaRef.getASTContext())) {
5532 SemaRef.Diag(Loc, diag::err_ptrauth_qualifier_invalid_target) <<
T;
5540 if (
T->isFunctionType()) {
5541 T =
SemaRef.getASTContext().getAddrSpaceQualType(
T,
5551 if (
T->isReferenceType()) {
5561 if (!
T->isObjCLifetimeType() && !
T->isDependentType())
5563 else if (
T.getObjCLifetime()) {
5567 const AutoType *AutoTy;
5568 if ((AutoTy = dyn_cast<AutoType>(
T)) && AutoTy->isDeduced()) {
5570 QualType Deduced = AutoTy->getDeducedType();
5575 T =
SemaRef.Context.getAutoType(Deduced, AutoTy->getKeyword(),
5578 AutoTy->getTypeConstraintConcept(),
5579 AutoTy->getTypeConstraintArguments());
5584 SemaRef.Diag(Loc, diag::err_attr_objc_ownership_redundant) <<
T;
5590 return SemaRef.BuildQualifiedType(
T, Loc, Quals);
5593template <
typename Derived>
5594QualType TreeTransform<Derived>::TransformTypeInObjectScope(
5597 assert(!getDerived().AlreadyTransformed(TL.
getType()));
5600 case TypeLoc::TemplateSpecialization:
5601 return getDerived().TransformTemplateSpecializationType(
5603 FirstQualifierInScope,
true);
5604 case TypeLoc::DependentName:
5605 return getDerived().TransformDependentNameType(
5607 ObjectType, FirstQualifierInScope);
5611 return getDerived().TransformType(TLB, TL);
5615template <
class TyLoc>
static inline
5617 TyLoc NewT = TLB.
push<TyLoc>(
T.getType());
5618 NewT.setNameLoc(
T.getNameLoc());
5622template<
typename Derived>
5623QualType TreeTransform<Derived>::TransformBuiltinType(TypeLocBuilder &TLB,
5625 BuiltinTypeLoc NewT = TLB.push<BuiltinTypeLoc>(T.getType());
5626 NewT.setBuiltinLoc(T.getBuiltinLoc());
5627 if (T.needsExtraLocalData())
5628 NewT.getWrittenBuiltinSpecs() = T.getWrittenBuiltinSpecs();
5632template<
typename Derived>
5639template <
typename Derived>
5643 return getDerived().
TransformType(TLB, TL.getOriginalLoc());
5646template<
typename Derived>
5649 QualType OriginalType = getDerived().TransformType(TLB, TL.getOriginalLoc());
5650 if (OriginalType.isNull())
5654 if (getDerived().AlwaysRebuild() ||
5655 OriginalType != TL.getOriginalLoc().getType())
5662template <
typename Derived>
5666 QualType OriginalType = getDerived().TransformType(TLB, TL.getElementLoc());
5667 if (OriginalType.isNull())
5671 if (getDerived().AlwaysRebuild() ||
5672 OriginalType != TL.getElementLoc().getType())
5679template<
typename Derived>
5683 = getDerived().TransformType(TLB, TL.getPointeeLoc());
5684 if (PointeeType.isNull())
5688 if (PointeeType->getAs<ObjCObjectType>()) {
5700 if (getDerived().AlwaysRebuild() ||
5701 PointeeType != TL.getPointeeLoc().getType()) {
5702 Result = getDerived().RebuildPointerType(PointeeType, TL.getSigilLoc());
5709 TLB.TypeWasModifiedSafely(
Result->getPointeeType());
5716template<
typename Derived>
5721 = getDerived().TransformType(TLB, TL.getPointeeLoc());
5722 if (PointeeType.isNull())
5726 if (getDerived().AlwaysRebuild() ||
5727 PointeeType != TL.getPointeeLoc().getType()) {
5728 Result = getDerived().RebuildBlockPointerType(PointeeType,
5743template<
typename Derived>
5751 if (PointeeType.
isNull())
5756 PointeeType !=
T->getPointeeTypeAsWritten()) {
5758 T->isSpelledAsLValue(),
5780template<
typename Derived>
5784 return TransformReferenceType(TLB, TL);
5787template<
typename Derived>
5789TreeTransform<Derived>::TransformRValueReferenceType(TypeLocBuilder &TLB,
5790 RValueReferenceTypeLoc TL) {
5791 return TransformReferenceType(TLB, TL);
5794template<
typename Derived>
5798 QualType PointeeType = getDerived().TransformType(TLB, TL.getPointeeLoc());
5799 if (PointeeType.isNull())
5806 getDerived().TransformNestedNameSpecifierLoc(OldQualifierLoc);
5807 if (!NewQualifierLoc)
5810 CXXRecordDecl *OldCls =
T->getMostRecentCXXRecordDecl(), *NewCls =
nullptr;
5812 NewCls = cast_or_null<CXXRecordDecl>(
5813 getDerived().TransformDecl(TL.getStarLoc(), OldCls));
5819 if (getDerived().AlwaysRebuild() || PointeeType !=
T->getPointeeType() ||
5820 NewQualifierLoc.getNestedNameSpecifier() !=
5821 OldQualifierLoc.getNestedNameSpecifier() ||
5824 SS.
Adopt(NewQualifierLoc);
5825 Result = getDerived().RebuildMemberPointerType(PointeeType, SS, NewCls,
5834 if (MPT && PointeeType != MPT->getPointeeType()) {
5841 NewTL.setQualifierLoc(NewQualifierLoc);
5846template<
typename Derived>
5851 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
5852 if (ElementType.isNull())
5856 Expr *OldSize = TL.getSizeExpr();
5858 OldSize =
const_cast<Expr*
>(
T->getSizeExpr());
5859 Expr *NewSize =
nullptr;
5863 NewSize = getDerived().TransformExpr(OldSize).template getAs<Expr>();
5868 if (getDerived().AlwaysRebuild() ||
5869 ElementType !=
T->getElementType() ||
5870 (
T->getSizeExpr() && NewSize != OldSize)) {
5871 Result = getDerived().RebuildConstantArrayType(ElementType,
5872 T->getSizeModifier(),
5873 T->getSize(), NewSize,
5874 T->getIndexTypeCVRQualifiers(),
5875 TL.getBracketsRange());
5886 NewTL.setRBracketLoc(TL.getRBracketLoc());
5887 NewTL.setSizeExpr(NewSize);
5892template<
typename Derived>
5897 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
5898 if (ElementType.isNull())
5902 if (getDerived().AlwaysRebuild() ||
5903 ElementType !=
T->getElementType()) {
5904 Result = getDerived().RebuildIncompleteArrayType(ElementType,
5905 T->getSizeModifier(),
5906 T->getIndexTypeCVRQualifiers(),
5907 TL.getBracketsRange());
5914 NewTL.setRBracketLoc(TL.getRBracketLoc());
5915 NewTL.setSizeExpr(
nullptr);
5920template<
typename Derived>
5925 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
5926 if (ElementType.isNull())
5933 SizeResult = getDerived().TransformExpr(
T->getSizeExpr());
5935 if (SizeResult.isInvalid())
5939 if (SizeResult.isInvalid())
5945 if (getDerived().AlwaysRebuild() ||
5946 ElementType !=
T->getElementType() ||
5947 Size !=
T->getSizeExpr()) {
5948 Result = getDerived().RebuildVariableArrayType(ElementType,
5949 T->getSizeModifier(),
5951 T->getIndexTypeCVRQualifiers(),
5952 TL.getBracketsRange());
5961 NewTL.setRBracketLoc(TL.getRBracketLoc());
5962 NewTL.setSizeExpr(Size);
5967template<
typename Derived>
5972 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
5973 if (ElementType.isNull())
5981 SemaRef.
ExprEvalContexts.back().InConditionallyConstantEvaluateContext =
true;
5984 Expr *origSize = TL.getSizeExpr();
5985 if (!origSize) origSize =
T->getSizeExpr();
5988 = getDerived().TransformExpr(origSize);
5990 if (sizeResult.isInvalid())
5993 Expr *size = sizeResult.get();
5996 if (getDerived().AlwaysRebuild() ||
5997 ElementType !=
T->getElementType() ||
5999 Result = getDerived().RebuildDependentSizedArrayType(ElementType,
6000 T->getSizeModifier(),
6002 T->getIndexTypeCVRQualifiers(),
6003 TL.getBracketsRange());
6012 NewTL.setRBracketLoc(TL.getRBracketLoc());
6013 NewTL.setSizeExpr(size);
6018template <
typename Derived>
6022 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
6023 if (ElementType.isNull())
6031 if (
Size.isInvalid())
6035 if (getDerived().AlwaysRebuild() || ElementType !=
T->getElementType() ||
6036 Size.get() !=
T->getSizeExpr()) {
6037 Result = getDerived().RebuildDependentVectorType(
6038 ElementType,
Size.get(),
T->getAttributeLoc(),
T->getVectorKind());
6056template<
typename Derived>
6063 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
6064 if (ElementType.isNull())
6073 if (
Size.isInvalid())
6077 if (getDerived().AlwaysRebuild() ||
6078 ElementType !=
T->getElementType() ||
6079 Size.get() !=
T->getSizeExpr()) {
6080 Result = getDerived().RebuildDependentSizedExtVectorType(ElementType,
6082 T->getAttributeLoc());
6100template <
typename Derived>
6105 QualType ElementType = getDerived().TransformType(
T->getElementType());
6106 if (ElementType.isNull())
6110 if (getDerived().AlwaysRebuild() || ElementType !=
T->getElementType()) {
6111 Result = getDerived().RebuildConstantMatrixType(
6112 ElementType,
T->getNumRows(),
T->getNumColumns());
6119 NewTL.setAttrOperandParensRange(TL.getAttrOperandParensRange());
6120 NewTL.setAttrRowOperand(TL.getAttrRowOperand());
6121 NewTL.setAttrColumnOperand(TL.getAttrColumnOperand());
6126template <
typename Derived>
6131 QualType ElementType = getDerived().TransformType(
T->getElementType());
6132 if (ElementType.isNull()) {
6140 Expr *origRows = TL.getAttrRowOperand();
6142 origRows =
T->getRowExpr();
6143 Expr *origColumns = TL.getAttrColumnOperand();
6145 origColumns =
T->getColumnExpr();
6147 ExprResult rowResult = getDerived().TransformExpr(origRows);
6149 if (rowResult.isInvalid())
6152 ExprResult columnResult = getDerived().TransformExpr(origColumns);
6154 if (columnResult.isInvalid())
6157 Expr *rows = rowResult.get();
6158 Expr *columns = columnResult.get();
6161 if (getDerived().AlwaysRebuild() || ElementType !=
T->getElementType() ||
6162 rows != origRows || columns != origColumns) {
6163 Result = getDerived().RebuildDependentSizedMatrixType(
6164 ElementType, rows, columns,
T->getAttributeLoc());
6174 NewTL.setAttrOperandParensRange(TL.getAttrOperandParensRange());
6175 NewTL.setAttrRowOperand(rows);
6176 NewTL.setAttrColumnOperand(columns);
6180template <
typename Derived>
6186 getDerived().TransformType(TLB, TL.getPointeeTypeLoc());
6188 if (pointeeType.isNull())
6195 ExprResult AddrSpace = getDerived().TransformExpr(
T->getAddrSpaceExpr());
6197 if (AddrSpace.isInvalid())
6201 if (getDerived().AlwaysRebuild() || pointeeType !=
T->getPointeeType() ||
6202 AddrSpace.get() !=
T->getAddrSpaceExpr()) {
6203 Result = getDerived().RebuildDependentAddressSpaceType(
6204 pointeeType, AddrSpace.get(),
T->getAttributeLoc());
6215 NewTL.setAttrExprOperand(TL.getAttrExprOperand());
6216 NewTL.setAttrNameLoc(TL.getAttrNameLoc());
6219 TLB.TypeWasModifiedSafely(
Result);
6225template <
typename Derived>
6229 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
6230 if (ElementType.isNull())
6234 if (getDerived().AlwaysRebuild() ||
6235 ElementType !=
T->getElementType()) {
6236 Result = getDerived().RebuildVectorType(ElementType,
T->getNumElements(),
6237 T->getVectorKind());
6248template<
typename Derived>
6252 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
6253 if (ElementType.isNull())
6257 if (getDerived().AlwaysRebuild() ||
6258 ElementType !=
T->getElementType()) {
6259 Result = getDerived().RebuildExtVectorType(ElementType,
6260 T->getNumElements(),
6272template <
typename Derived>
6275 bool ExpectParameterPack) {
6310 if (NewTSI == OldTSI && indexAdjustment == 0)
6320 getDerived().transformedLocalDecl(OldParm, {newParm});
6324template <
typename Derived>
6332 unsigned *LastParamTransformed) {
6333 int indexAdjustment = 0;
6335 unsigned NumParams = Params.size();
6336 for (
unsigned i = 0; i != NumParams; ++i) {
6337 if (LastParamTransformed)
6338 *LastParamTransformed = i;
6340 assert(OldParm->getFunctionScopeIndex() == i);
6344 if (OldParm->isParameterPack()) {
6349 TypeLoc TL = OldParm->getTypeSourceInfo()->getTypeLoc();
6352 SemaRef.collectUnexpandedParameterPacks(Pattern, Unexpanded);
6355 bool ShouldExpand =
false;
6356 bool RetainExpansion =
false;
6358 if (Unexpanded.size() > 0) {
6359 OrigNumExpansions = ExpansionTL.
getTypePtr()->getNumExpansions();
6360 NumExpansions = OrigNumExpansions;
6364 ShouldExpand, RetainExpansion, NumExpansions)) {
6369 const AutoType *AT =
6370 Pattern.getType().getTypePtr()->getContainedAutoType();
6371 assert((AT && (!AT->isDeduced() || AT->getDeducedType().isNull())) &&
6372 "Could not find parameter packs or undeduced auto type!");
6379 getDerived().ExpandingFunctionParameterPack(OldParm);
6380 for (
unsigned I = 0; I != *NumExpansions; ++I) {
6383 =
getDerived().TransformFunctionTypeParam(OldParm,
6391 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6392 OutParamTypes.push_back(NewParm->
getType());
6394 PVars->push_back(NewParm);
6399 if (RetainExpansion) {
6400 ForgetPartiallySubstitutedPackRAII Forget(
getDerived());
6402 =
getDerived().TransformFunctionTypeParam(OldParm,
6410 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6411 OutParamTypes.push_back(NewParm->
getType());
6413 PVars->push_back(NewParm);
6429 NewParm =
getDerived().TransformFunctionTypeParam(OldParm,
6434 "Parameter pack no longer a parameter pack after "
6437 NewParm =
getDerived().TransformFunctionTypeParam(
6438 OldParm, indexAdjustment, std::nullopt,
6446 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6447 OutParamTypes.push_back(NewParm->
getType());
6449 PVars->push_back(NewParm);
6457 bool IsPackExpansion =
false;
6460 if (
const PackExpansionType *Expansion
6461 = dyn_cast<PackExpansionType>(OldType)) {
6463 QualType Pattern = Expansion->getPattern();
6465 getSema().collectUnexpandedParameterPacks(Pattern, Unexpanded);
6468 bool ShouldExpand =
false;
6469 bool RetainExpansion =
false;
6473 RetainExpansion, NumExpansions)) {
6480 for (
unsigned I = 0; I != *NumExpansions; ++I) {
6487 NewType =
getSema().getASTContext().getPackExpansionType(
6488 NewType, std::nullopt);
6495 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6496 OutParamTypes.push_back(NewType);
6498 PVars->push_back(
nullptr);
6507 if (RetainExpansion) {
6508 ForgetPartiallySubstitutedPackRAII Forget(
getDerived());
6514 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6515 OutParamTypes.push_back(NewType);
6517 PVars->push_back(
nullptr);
6522 OldType = Expansion->getPattern();
6523 IsPackExpansion =
true;
6525 NewType =
getDerived().TransformType(OldType);
6527 NewType =
getDerived().TransformType(OldType);
6533 if (IsPackExpansion)
6534 NewType =
getSema().Context.getPackExpansionType(NewType,
6538 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6539 OutParamTypes.push_back(NewType);
6541 PVars->push_back(
nullptr);
6546 for (
unsigned i = 0, e = PVars->size(); i != e; ++i)
6548 assert(parm->getFunctionScopeIndex() == i);
6555template<
typename Derived>
6560 return getDerived().TransformFunctionProtoType(
6564 ExceptionStorage, Changed);
6568template<
typename Derived>
template<
typename Fn>
6587 if (
T->hasTrailingReturn()) {
6591 T->getExtParameterInfosOrNull(),
6592 ParamTypes, &ParamDecls, ExtParamInfos))
6602 auto *RD = dyn_cast<CXXRecordDecl>(
SemaRef.getCurLexicalContext());
6604 SemaRef, !ThisContext && RD ? RD : ThisContext, ThisTypeQuals);
6619 T->getExtParameterInfosOrNull(),
6620 ParamTypes, &ParamDecls, ExtParamInfos))
6626 bool EPIChanged =
false;
6631 if (
auto NewExtParamInfos =
6647 std::optional<FunctionEffectSet> NewFX;
6659 std::optional<FunctionEffectMode> Mode =
6679 "FunctionEffectMode::None shouldn't be possible here");
6682 if (!
SemaRef.diagnoseConflictingFunctionEffect(*NewFX, NewEC,
6685 NewFX->insert(NewEC, Errs);
6686 assert(Errs.empty());
6696 Result =
getDerived().RebuildFunctionProtoType(ResultType, ParamTypes, EPI);
6707 for (
unsigned i = 0, e = NewTL.
getNumParams(); i != e; ++i)
6713template<
typename Derived>
6736 getSema().ActOnNoexceptSpec(NoexceptExpr.
get(), EST);
6751 if (
const PackExpansionType *PackExpansion =
6752 T->getAs<PackExpansionType>()) {
6757 SemaRef.collectUnexpandedParameterPacks(PackExpansion->getPattern(),
6759 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
6764 bool Expand =
false;
6765 bool RetainExpansion =
false;
6766 UnsignedOrNone NumExpansions = PackExpansion->getNumExpansions();
6771 true, Expand, RetainExpansion,
6784 U =
SemaRef.Context.getPackExpansionType(
U, NumExpansions);
6785 Exceptions.push_back(
U);
6791 for (
unsigned ArgIdx = 0; ArgIdx != *NumExpansions; ++ArgIdx) {
6795 if (
U.isNull() ||
SemaRef.CheckSpecifiedExceptionType(
U, Loc))
6798 Exceptions.push_back(
U);
6802 if (
U.isNull() ||
SemaRef.CheckSpecifiedExceptionType(
U, Loc))
6807 Exceptions.push_back(
U);
6817template<
typename Derived>
6827 if (getDerived().AlwaysRebuild() || ResultType !=
T->getReturnType())
6828 Result = getDerived().RebuildFunctionNoProtoType(ResultType);
6839template <
typename Derived>
6840QualType TreeTransform<Derived>::TransformUnresolvedUsingType(
6841 TypeLocBuilder &TLB, UnresolvedUsingTypeLoc TL) {
6843 const UnresolvedUsingType *T = TL.getTypePtr();
6844 bool Changed =
false;
6846 NestedNameSpecifierLoc QualifierLoc = TL.getQualifierLoc();
6847 if (NestedNameSpecifierLoc OldQualifierLoc = QualifierLoc) {
6848 QualifierLoc = getDerived().TransformNestedNameSpecifierLoc(QualifierLoc);
6851 Changed |= QualifierLoc != OldQualifierLoc;
6854 auto *D = getDerived().TransformDecl(TL.getNameLoc(),
T->getDecl());
6860 if (getDerived().AlwaysRebuild() || Changed) {
6861 Result = getDerived().RebuildUnresolvedUsingType(
6862 T->getKeyword(), QualifierLoc.getNestedNameSpecifier(), TL.getNameLoc(),
6870 QualifierLoc, TL.getNameLoc());
6873 QualifierLoc, TL.getNameLoc());
6877template <
typename Derived>
6885 QualifierLoc = getDerived().TransformNestedNameSpecifierLoc(QualifierLoc);
6888 Changed |= QualifierLoc != OldQualifierLoc;
6891 auto *D = cast_or_null<UsingShadowDecl>(
6892 getDerived().TransformDecl(TL.getNameLoc(),
T->getDecl()));
6897 QualType UnderlyingType = getDerived().TransformType(
T->desugar());
6898 if (UnderlyingType.isNull())
6900 Changed |= UnderlyingType !=
T->desugar();
6903 if (getDerived().AlwaysRebuild() || Changed) {
6904 Result = getDerived().RebuildUsingType(
6905 T->getKeyword(), QualifierLoc.getNestedNameSpecifier(), D,
6915template<
typename Derived>
6923 QualifierLoc = getDerived().TransformNestedNameSpecifierLoc(QualifierLoc);
6926 Changed |= QualifierLoc != OldQualifierLoc;
6929 auto *
Typedef = cast_or_null<TypedefNameDecl>(
6930 getDerived().TransformDecl(TL.getNameLoc(),
T->getDecl()));
6938 if (getDerived().AlwaysRebuild() || Changed) {
6939 Result = getDerived().RebuildTypedefType(
6940 T->getKeyword(), QualifierLoc.getNestedNameSpecifier(),
Typedef);
6946 QualifierLoc, TL.getNameLoc());
6950template<
typename Derived>
6958 ExprResult E = getDerived().TransformExpr(TL.getUnderlyingExpr());
6968 if (getDerived().AlwaysRebuild() || E.get() != TL.getUnderlyingExpr()) {
6970 getDerived().RebuildTypeOfExprType(E.get(), TL.getTypeofLoc(), Kind);
6977 NewTL.setLParenLoc(TL.getLParenLoc());
6978 NewTL.setRParenLoc(TL.getRParenLoc());
6983template<
typename Derived>
6987 TypeSourceInfo* New_Under_TI = getDerived().TransformType(Old_Under_TI);
6993 if (getDerived().AlwaysRebuild() || New_Under_TI != Old_Under_TI) {
6994 Result = getDerived().RebuildTypeOfType(New_Under_TI->getType(), Kind);
7001 NewTL.setLParenLoc(TL.getLParenLoc());
7002 NewTL.setRParenLoc(TL.getRParenLoc());
7003 NewTL.setUnmodifiedTInfo(New_Under_TI);
7008template<
typename Derived>
7011 const DecltypeType *
T = TL.getTypePtr();
7018 ExprResult E = getDerived().TransformExpr(
T->getUnderlyingExpr());
7022 E = getSema().ActOnDecltypeExpression(E.get());
7027 if (getDerived().AlwaysRebuild() ||
7028 E.get() !=
T->getUnderlyingExpr()) {
7029 Result = getDerived().RebuildDecltypeType(E.get(), TL.getDecltypeLoc());
7037 NewTL.setRParenLoc(TL.getRParenLoc());
7041template <
typename Derived>
7051 IndexExpr = getDerived().TransformExpr(TL.getIndexExpr());
7052 if (IndexExpr.isInvalid())
7055 QualType Pattern = TL.getPattern();
7057 const PackIndexingType *PIT = TL.
getTypePtr();
7061 bool NotYetExpanded = Types.empty();
7062 bool FullySubstituted =
true;
7064 if (Types.empty() && !PIT->expandsToEmptyPack())
7068 if (!
T->containsUnexpandedParameterPack()) {
7069 QualType Transformed = getDerived().TransformType(
T);
7070 if (Transformed.isNull())
7072 SubtitutedTypes.push_back(Transformed);
7077 getSema().collectUnexpandedParameterPacks(
T, Unexpanded);
7078 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
7081 bool ShouldExpand =
true;
7082 bool RetainExpansion =
false;
7084 if (getDerived().TryExpandParameterPacks(
7087 RetainExpansion, NumExpansions))
7089 if (!ShouldExpand) {
7095 QualType Pack = getDerived().TransformType(TLB, TI->getTypeLoc());
7098 if (NotYetExpanded) {
7099 FullySubstituted =
false;
7100 QualType Out = getDerived().RebuildPackIndexingType(
7110 SubtitutedTypes.push_back(Pack);
7113 for (
unsigned I = 0; I != *NumExpansions; ++I) {
7118 SubtitutedTypes.push_back(Out);
7119 FullySubstituted &= !
Out->containsUnexpandedParameterPack();
7123 if (RetainExpansion) {
7124 FullySubstituted =
false;
7125 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
7129 SubtitutedTypes.push_back(Out);
7137 QualType Result = getDerived().TransformType(TLB, TL.getPatternLoc());
7139 QualType Out = getDerived().RebuildPackIndexingType(
7141 FullySubstituted, SubtitutedTypes);
7150template<
typename Derived>
7156 if (
Result->isDependentType()) {
7157 const UnaryTransformType *
T = TL.getTypePtr();
7159 NewBaseTSI = getDerived().TransformType(TL.getUnderlyingTInfo());
7162 QualType NewBase = NewBaseTSI->getType();
7164 Result = getDerived().RebuildUnaryTransformType(NewBase,
7173 NewTL.setParensRange(TL.getParensRange());
7174 NewTL.setUnderlyingTInfo(NewBaseTSI);
7178template<
typename Derived>
7181 const DeducedTemplateSpecializationType *
T = TL.getTypePtr();
7186 TL.getTemplateNameLoc());
7190 QualType OldDeduced =
T->getDeducedType();
7192 if (!OldDeduced.isNull()) {
7193 NewDeduced = getDerived().TransformType(OldDeduced);
7194 if (NewDeduced.isNull())
7198 QualType Result = getDerived().RebuildDeducedTemplateSpecializationType(
7205 NewTL.setTemplateNameLoc(TL.getTemplateNameLoc());
7206 NewTL.setQualifierLoc(QualifierLoc);
7210template <
typename Derived>
7217 QualifierLoc =
getDerived().TransformNestedNameSpecifierLoc(QualifierLoc);
7222 auto *TD = cast_or_null<TagDecl>(
7229 TD !=
T->getDecl()) {
7230 if (
T->isCanonicalUnqualified())
7247template <
typename Derived>
7253template <
typename Derived>
7254QualType TreeTransform<Derived>::TransformRecordType(TypeLocBuilder &TLB,
7256 return getDerived().TransformTagType(TLB, TL);
7259template<
typename Derived>
7266template<
typename Derived>
7270 return getDerived().TransformTemplateTypeParmType(
7275template <
typename Derived>
7281template<
typename Derived>
7282QualType TreeTransform<Derived>::TransformSubstTemplateTypeParmType(
7283 TypeLocBuilder &TLB,
7284 SubstTemplateTypeParmTypeLoc TL) {
7285 const SubstTemplateTypeParmType *T = TL.getTypePtr();
7288 getDerived().TransformDecl(TL.getNameLoc(), T->getAssociatedDecl());
7293 TemporaryBase Rebase(*
this, TL.getNameLoc(), DeclarationName());
7294 QualType Replacement = getDerived().TransformType(T->getReplacementType());
7295 if (Replacement.isNull())
7299 Replacement, NewReplaced, T->getIndex(), T->getPackIndex(),
7303 SubstTemplateTypeParmTypeLoc NewTL
7304 = TLB.push<SubstTemplateTypeParmTypeLoc>(Result);
7305 NewTL.setNameLoc(TL.getNameLoc());
7309template <
typename Derived>
7315template<
typename Derived>
7319 return getDerived().TransformSubstTemplateTypeParmPackType(
7323template <
typename Derived>
7329template<
typename Derived>
7330QualType TreeTransform<Derived>::TransformAtomicType(TypeLocBuilder &TLB,
7332 QualType ValueType = getDerived().TransformType(TLB, TL.getValueLoc());
7333 if (ValueType.isNull())
7336 QualType Result = TL.getType();
7337 if (getDerived().AlwaysRebuild() ||
7338 ValueType != TL.getValueLoc().getType()) {
7339 Result = getDerived().RebuildAtomicType(ValueType, TL.getKWLoc());
7340 if (Result.isNull())
7346 NewTL.setLParenLoc(TL.getLParenLoc());
7347 NewTL.setRParenLoc(TL.getRParenLoc());
7352template <
typename Derived>
7355 QualType ValueType = getDerived().TransformType(TLB, TL.getValueLoc());
7356 if (ValueType.isNull())
7360 if (getDerived().AlwaysRebuild() || ValueType != TL.getValueLoc().getType()) {
7363 Result = getDerived().RebuildPipeType(ValueType, TL.getKWLoc(), isReadPipe);
7374template <
typename Derived>
7380 if (getDerived().AlwaysRebuild()) {
7381 Result = getDerived().RebuildBitIntType(EIT->isUnsigned(),
7382 EIT->getNumBits(), TL.getNameLoc());
7392template <
typename Derived>
7399 ExprResult BitsExpr = getDerived().TransformExpr(EIT->getNumBitsExpr());
7402 if (BitsExpr.isInvalid())
7407 if (getDerived().AlwaysRebuild() || BitsExpr.get() != EIT->getNumBitsExpr()) {
7408 Result = getDerived().RebuildDependentBitIntType(
7409 EIT->isUnsigned(), BitsExpr.get(), TL.getNameLoc());
7425template <
typename Derived>
7428 llvm_unreachable(
"This type does not need to be transformed.");
7436 template<
typename ArgLocContainer>
7438 ArgLocContainer *Container;
7463 : Container(&Container), Index(Index) { }
7477 return Container->getArgLoc(Index);
7481 return pointer(Container->getArgLoc(Index));
7486 return X.Container == Y.Container &&
X.Index == Y.Index;
7495template<
typename Derived>
7496QualType TreeTransform<Derived>::TransformAutoType(TypeLocBuilder &TLB,
7498 const AutoType *T = TL.getTypePtr();
7499 QualType OldDeduced = T->getDeducedType();
7500 QualType NewDeduced;
7501 if (!OldDeduced.isNull()) {
7502 NewDeduced = getDerived().TransformType(OldDeduced);
7503 if (NewDeduced.isNull())
7510 if (
T->isConstrained()) {
7511 assert(TL.getConceptReference());
7512 NewCD = cast_or_null<ConceptDecl>(getDerived().TransformDecl(
7513 TL.getConceptNameLoc(),
T->getTypeConstraintConcept()));
7515 NewTemplateArgs.setLAngleLoc(TL.getLAngleLoc());
7516 NewTemplateArgs.setRAngleLoc(TL.getRAngleLoc());
7518 if (getDerived().TransformTemplateArguments(
7519 ArgIterator(TL, 0), ArgIterator(TL, TL.getNumArgs()),
7523 if (TL.getNestedNameSpecifierLoc()) {
7525 = getDerived().TransformNestedNameSpecifierLoc(
7526 TL.getNestedNameSpecifierLoc());
7527 if (!NewNestedNameSpec)
7533 if (getDerived().AlwaysRebuild() || NewDeduced != OldDeduced ||
7534 T->isDependentType() ||
T->isConstrained()) {
7537 NewArgList.reserve(NewTemplateArgs.size());
7538 for (
const auto &ArgLoc : NewTemplateArgs.arguments())
7539 NewArgList.push_back(ArgLoc.getArgument());
7540 Result = getDerived().RebuildAutoType(NewDeduced,
T->getKeyword(), NewCD,
7548 NewTL.setRParenLoc(TL.getRParenLoc());
7549 NewTL.setConceptReference(
nullptr);
7551 if (
T->isConstrained()) {
7553 TL.getTypePtr()->getTypeConstraintConcept()->getDeclName(),
7554 TL.getConceptNameLoc(),
7555 TL.getTypePtr()->getTypeConstraintConcept()->getDeclName());
7557 SemaRef.
Context, NewNestedNameSpec, TL.getTemplateKWLoc(), DNI,
7558 TL.getFoundDecl(), TL.getTypePtr()->getTypeConstraintConcept(),
7560 NewTL.setConceptReference(CR);
7566template <
typename Derived>
7569 return getDerived().TransformTemplateSpecializationType(
7574template <
typename Derived>
7577 NamedDecl *FirstQualifierInScope,
bool AllowInjectedClassName) {
7578 const TemplateSpecializationType *
T = TL.
getTypePtr();
7584 AllowInjectedClassName);
7593 if (getDerived().TransformTemplateArguments(ArgIterator(TL, 0),
7602 QualType Result = getDerived().RebuildTemplateSpecializationType(
7615template <
typename Derived>
7619 QualType modifiedType = getDerived().TransformType(TLB, TL.getModifiedLoc());
7620 if (modifiedType.isNull())
7624 const Attr *oldAttr = TL.getAttr();
7625 const Attr *newAttr = oldAttr ? getDerived().TransformAttr(oldAttr) :
nullptr;
7626 if (oldAttr && !newAttr)
7632 if (getDerived().AlwaysRebuild() ||
7633 modifiedType != oldType->getModifiedType()) {
7646 QualType equivalentType = modifiedType;
7647 if (TL.getModifiedLoc().getType() != TL.getEquivalentTypeLoc().getType()) {
7649 AuxiliaryTLB.
reserve(TL.getFullDataSize());
7651 getDerived().TransformType(AuxiliaryTLB, TL.getEquivalentTypeLoc());
7652 if (equivalentType.isNull())
7658 if (
auto nullability = oldType->getImmediateNullability()) {
7659 if (!modifiedType->canHaveNullability()) {
7660 SemaRef.
Diag((TL.getAttr() ? TL.getAttr()->getLocation()
7661 : TL.getModifiedLoc().getBeginLoc()),
7662 diag::err_nullability_nonpointer)
7679template <
typename Derived>
7683 QualType InnerTy = getDerived().TransformType(TLB, TL.getInnerLoc());
7684 if (InnerTy.isNull())
7687 Expr *OldCount = TL.getCountExpr();
7688 Expr *NewCount =
nullptr;
7690 ExprResult CountResult = getDerived().TransformExpr(OldCount);
7691 if (CountResult.isInvalid())
7693 NewCount = CountResult.get();
7697 if (getDerived().AlwaysRebuild() || InnerTy != OldTy->desugar() ||
7698 OldCount != NewCount) {
7701 InnerTy, NewCount, OldTy->isCountInBytes(), OldTy->isOrNull());
7708template <
typename Derived>
7712 llvm_unreachable(
"Unexpected TreeTransform for BTFTagAttributedType");
7715template <
typename Derived>
7719 const HLSLAttributedResourceType *oldType = TL.getTypePtr();
7721 QualType WrappedTy = getDerived().TransformType(TLB, TL.getWrappedLoc());
7722 if (WrappedTy.isNull())
7726 QualType OldContainedTy = oldType->getContainedType();
7727 if (!OldContainedTy.isNull()) {
7728 TypeSourceInfo *oldContainedTSI = TL.getContainedTypeSourceInfo();
7729 if (!oldContainedTSI)
7730 oldContainedTSI = getSema().getASTContext().getTrivialTypeSourceInfo(
7732 TypeSourceInfo *ContainedTSI = getDerived().TransformType(oldContainedTSI);
7735 ContainedTy = ContainedTSI->getType();
7739 if (getDerived().AlwaysRebuild() || WrappedTy != oldType->getWrappedType() ||
7740 ContainedTy != oldType->getContainedType()) {
7742 WrappedTy, ContainedTy, oldType->getAttrs());
7749template <
typename Derived>
7753 return TL.getType();
7756template<
typename Derived>
7760 QualType Inner = getDerived().TransformType(TLB, TL.getInnerLoc());
7765 if (getDerived().AlwaysRebuild() ||
7766 Inner != TL.getInnerLoc().getType()) {
7767 Result = getDerived().RebuildParenType(Inner);
7774 NewTL.setRParenLoc(TL.getRParenLoc());
7778template <
typename Derived>
7782 QualType Inner = getDerived().TransformType(TLB, TL.getInnerLoc());
7787 if (getDerived().AlwaysRebuild() || Inner != TL.getInnerLoc().getType()) {
7789 getDerived().RebuildMacroQualifiedType(Inner, TL.getMacroIdentifier());
7799template<
typename Derived>
7800QualType TreeTransform<Derived>::TransformDependentNameType(
7802 return TransformDependentNameType(TLB, TL,
false);
7805template <
typename Derived>
7806QualType TreeTransform<Derived>::TransformDependentNameType(
7809 const DependentNameType *
T = TL.getTypePtr();
7813 QualifierLoc = getDerived().TransformNestedNameSpecifierLoc(
7814 QualifierLoc, ObjectType, UnqualLookup);
7818 assert((ObjectType.isNull() && !UnqualLookup) &&
7819 "must be transformed by TransformNestedNameSpecifierLoc");
7823 = getDerived().RebuildDependentNameType(
T->getKeyword(),
7824 TL.getElaboratedKeywordLoc(),
7835 NewTL.setQualifierLoc(QualifierLoc);
7836 NewTL.setNameLoc(TL.getNameLoc());
7840 NewTL.setTemplateNameLoc(TL.getNameLoc());
7841 NewTL.setQualifierLoc(QualifierLoc);
7844 QualifierLoc, TL.getNameLoc());
7847 NewTL.
set(TL.getElaboratedKeywordLoc(), QualifierLoc, TL.getNameLoc());
7851 NewTL.setQualifierLoc(QualifierLoc);
7852 NewTL.setNameLoc(TL.getNameLoc());
7857template<
typename Derived>
7861 = getDerived().TransformType(TLB, TL.getPatternLoc());
7862 if (Pattern.isNull())
7866 if (getDerived().AlwaysRebuild() ||
7867 Pattern != TL.getPatternLoc().getType()) {
7868 Result = getDerived().RebuildPackExpansionType(Pattern,
7869 TL.getPatternLoc().getSourceRange(),
7870 TL.getEllipsisLoc(),
7871 TL.getTypePtr()->getNumExpansions());
7881template<
typename Derived>
7886 TLB.pushFullCopy(TL);
7887 return TL.getType();
7890template<
typename Derived>
7894 const ObjCTypeParamType *
T = TL.getTypePtr();
7896 getDerived().TransformDecl(
T->getDecl()->getLocation(),
T->getDecl()));
7901 if (getDerived().AlwaysRebuild() ||
7902 OTP !=
T->getDecl()) {
7903 Result = getDerived().RebuildObjCTypeParamType(
7904 OTP, TL.getProtocolLAngleLoc(),
7905 llvm::ArrayRef(TL.getTypePtr()->qual_begin(), TL.getNumProtocols()),
7906 TL.getProtocolLocs(), TL.getProtocolRAngleLoc());
7912 if (TL.getNumProtocols()) {
7913 NewTL.setProtocolLAngleLoc(TL.getProtocolLAngleLoc());
7914 for (
unsigned i = 0, n = TL.getNumProtocols(); i != n; ++i)
7915 NewTL.setProtocolLoc(i, TL.getProtocolLoc(i));
7916 NewTL.setProtocolRAngleLoc(TL.getProtocolRAngleLoc());
7921template<
typename Derived>
7926 QualType BaseType = getDerived().TransformType(TLB, TL.getBaseLoc());
7927 if (BaseType.isNull())
7930 bool AnyChanged = BaseType != TL.getBaseLoc().getType();
7934 for (
unsigned i = 0, n = TL.getNumTypeArgs(); i != n; ++i) {
7936 TypeLoc TypeArgLoc = TypeArgInfo->getTypeLoc();
7937 QualType TypeArg = TypeArgInfo->getType();
7942 const auto *PackExpansion = PackExpansionLoc.getType()
7943 ->castAs<PackExpansionType>();
7947 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
7951 TypeLoc PatternLoc = PackExpansionLoc.getPatternLoc();
7952 bool Expand =
false;
7953 bool RetainExpansion =
false;
7954 UnsignedOrNone NumExpansions = PackExpansion->getNumExpansions();
7955 if (getDerived().TryExpandParameterPacks(
7956 PackExpansionLoc.getEllipsisLoc(), PatternLoc.getSourceRange(),
7957 Unexpanded,
true, Expand,
7958 RetainExpansion, NumExpansions))
7968 TypeArgBuilder.
reserve(PatternLoc.getFullDataSize());
7969 QualType NewPatternType = getDerived().TransformType(TypeArgBuilder,
7971 if (NewPatternType.isNull())
7975 NewPatternType, NumExpansions);
7977 NewExpansionLoc.
setEllipsisLoc(PackExpansionLoc.getEllipsisLoc());
7978 NewTypeArgInfos.push_back(
7979 TypeArgBuilder.getTypeSourceInfo(SemaRef.
Context, NewExpansionType));
7985 for (
unsigned ArgIdx = 0; ArgIdx != *NumExpansions; ++ArgIdx) {
7989 TypeArgBuilder.
reserve(PatternLoc.getFullDataSize());
7991 QualType NewTypeArg = getDerived().TransformType(TypeArgBuilder,
7993 if (NewTypeArg.isNull())
7996 NewTypeArgInfos.push_back(
7997 TypeArgBuilder.getTypeSourceInfo(SemaRef.
Context, NewTypeArg));
8004 TypeArgBuilder.
reserve(TypeArgLoc.getFullDataSize());
8006 getDerived().TransformType(TypeArgBuilder, TypeArgLoc);
8007 if (NewTypeArg.isNull())
8011 if (NewTypeArg == TypeArg) {
8012 NewTypeArgInfos.push_back(TypeArgInfo);
8016 NewTypeArgInfos.push_back(
8017 TypeArgBuilder.getTypeSourceInfo(SemaRef.
Context, NewTypeArg));
8022 if (getDerived().AlwaysRebuild() || AnyChanged) {
8024 Result = getDerived().RebuildObjCObjectType(
8025 BaseType, TL.getBeginLoc(), TL.getTypeArgsLAngleLoc(), NewTypeArgInfos,
8026 TL.getTypeArgsRAngleLoc(), TL.getProtocolLAngleLoc(),
8027 llvm::ArrayRef(TL.getTypePtr()->qual_begin(), TL.getNumProtocols()),
8028 TL.getProtocolLocs(), TL.getProtocolRAngleLoc());
8036 NewT.setTypeArgsLAngleLoc(TL.getTypeArgsLAngleLoc());
8037 for (
unsigned i = 0, n = TL.getNumTypeArgs(); i != n; ++i)
8038 NewT.setTypeArgTInfo(i, NewTypeArgInfos[i]);
8039 NewT.setTypeArgsRAngleLoc(TL.getTypeArgsRAngleLoc());
8040 NewT.setProtocolLAngleLoc(TL.getProtocolLAngleLoc());
8041 for (
unsigned i = 0, n = TL.getNumProtocols(); i != n; ++i)
8042 NewT.setProtocolLoc(i, TL.getProtocolLoc(i));
8043 NewT.setProtocolRAngleLoc(TL.getProtocolRAngleLoc());
8047template<
typename Derived>
8051 QualType PointeeType = getDerived().TransformType(TLB, TL.getPointeeLoc());
8052 if (PointeeType.isNull())
8056 if (getDerived().AlwaysRebuild() ||
8057 PointeeType != TL.getPointeeLoc().getType()) {
8058 Result = getDerived().RebuildObjCObjectPointerType(PointeeType,
8072template<
typename Derived>
8078template<
typename Derived>
8081 return getDerived().TransformCompoundStmt(S,
false);
8084template<
typename Derived>
8091 getSema().resetFPOptions(
8094 bool SubStmtInvalid =
false;
8095 bool SubStmtChanged =
false;
8097 for (
auto *B : S->
body()) {
8099 B, IsStmtExpr && B == S->
body_back() ? StmtDiscardKind::StmtExprResult
8100 : StmtDiscardKind::Discarded);
8102 if (
Result.isInvalid()) {
8109 SubStmtInvalid =
true;
8113 SubStmtChanged = SubStmtChanged || Result.get() != B;
8114 Statements.push_back(Result.getAs<Stmt>());
8120 if (!getDerived().AlwaysRebuild() &&
8124 return getDerived().RebuildCompoundStmt(S->
getLBracLoc(),
8130template<
typename Derived>
8139 LHS = getDerived().TransformExpr(S->getLHS());
8141 if (LHS.isInvalid())
8145 RHS = getDerived().TransformExpr(S->getRHS());
8147 if (RHS.isInvalid())
8154 StmtResult Case = getDerived().RebuildCaseStmt(S->getCaseLoc(),
8156 S->getEllipsisLoc(),
8159 if (Case.isInvalid())
8164 getDerived().TransformStmt(S->getSubStmt());
8165 if (SubStmt.isInvalid())
8169 return getDerived().RebuildCaseStmtBody(Case.get(), SubStmt.get());
8172template <
typename Derived>
8176 getDerived().TransformStmt(S->getSubStmt());
8177 if (SubStmt.isInvalid())
8181 return getDerived().RebuildDefaultStmt(S->getDefaultLoc(), S->getColonLoc(),
8185template<
typename Derived>
8188 StmtResult SubStmt = getDerived().TransformStmt(S->getSubStmt(), SDK);
8189 if (SubStmt.isInvalid())
8192 Decl *LD = getDerived().TransformDecl(S->getDecl()->getLocation(),
8200 if (LD == S->getDecl())
8201 S->getDecl()->setStmt(
nullptr);
8204 return getDerived().RebuildLabelStmt(S->getIdentLoc(),
8209template <
typename Derived>
8218 return getDerived().Transform##X##Attr(cast<X##Attr>(R));
8219#include "clang/Basic/AttrList.inc"
8224template <
typename Derived>
8235 return getDerived().TransformStmt##X##Attr(OrigS, InstS, cast<X##Attr>(R));
8236#include "clang/Basic/AttrList.inc"
8241template <
typename Derived>
8244 StmtDiscardKind SDK) {
8249 bool AttrsChanged =
false;
8253 for (
const auto *I : S->
getAttrs()) {
8255 getDerived().TransformStmtAttr(S->
getSubStmt(), SubStmt.
get(), I);
8256 AttrsChanged |= (I != R);
8269 return getDerived().RebuildAttributedStmt(S->
getAttrLoc(), Attrs,
8273template<
typename Derived>
8278 if (
Init.isInvalid())
8282 if (!S->isConsteval()) {
8284 Cond = getDerived().TransformCondition(
8285 S->getIfLoc(), S->getConditionVariable(), S->getCond(),
8288 if (
Cond.isInvalid())
8293 std::optional<bool> ConstexprConditionValue;
8294 if (S->isConstexpr())
8295 ConstexprConditionValue =
Cond.getKnownValue();
8299 if (!ConstexprConditionValue || *ConstexprConditionValue) {
8303 S->isNonNegatedConsteval());
8305 Then = getDerived().TransformStmt(S->getThen());
8306 if (Then.isInvalid())
8312 Then =
new (getSema().Context)
8313 CompoundStmt(S->getThen()->getBeginLoc(), S->getThen()->getEndLoc());
8318 if (!ConstexprConditionValue || !*ConstexprConditionValue) {
8322 S->isNegatedConsteval());
8324 Else = getDerived().TransformStmt(S->getElse());
8325 if (Else.isInvalid())
8327 }
else if (S->getElse() && ConstexprConditionValue &&
8328 *ConstexprConditionValue) {
8332 Else =
new (getSema().Context)
8333 CompoundStmt(S->getElse()->getBeginLoc(), S->getElse()->getEndLoc());
8336 if (!getDerived().AlwaysRebuild() &&
8337 Init.get() == S->getInit() &&
8338 Cond.get() == std::make_pair(S->getConditionVariable(), S->getCond()) &&
8339 Then.get() == S->getThen() &&
8340 Else.get() == S->getElse())
8343 return getDerived().RebuildIfStmt(
8344 S->getIfLoc(), S->getStatementKind(), S->getLParenLoc(),
Cond,
8345 S->getRParenLoc(),
Init.get(), Then.get(), S->getElseLoc(), Else.get());
8348template<
typename Derived>
8353 if (
Init.isInvalid())
8358 S->getSwitchLoc(), S->getConditionVariable(), S->getCond(),
8360 if (
Cond.isInvalid())
8365 getDerived().RebuildSwitchStmtStart(S->getSwitchLoc(), S->getLParenLoc(),
8366 Init.get(),
Cond, S->getRParenLoc());
8371 StmtResult Body = getDerived().TransformStmt(S->getBody());
8372 if (Body.isInvalid())
8376 return getDerived().RebuildSwitchStmtBody(S->getSwitchLoc(),
Switch.get(),
8380template<
typename Derived>
8385 S->getWhileLoc(), S->getConditionVariable(), S->getCond(),
8387 if (
Cond.isInvalid())
8396 StmtResult Body = getDerived().TransformStmt(S->getBody());
8397 if (Body.isInvalid())
8400 if (!getDerived().AlwaysRebuild() &&
8401 Cond.get() == std::make_pair(S->getConditionVariable(), S->getCond()) &&
8402 Body.get() == S->getBody())
8405 return getDerived().RebuildWhileStmt(S->getWhileLoc(), S->getLParenLoc(),
8406 Cond, S->getRParenLoc(), Body.get());
8409template<
typename Derived>
8418 StmtResult Body = getDerived().TransformStmt(S->getBody());
8419 if (Body.isInvalid())
8424 if (
Cond.isInvalid())
8427 if (!getDerived().AlwaysRebuild() &&
8428 Cond.get() == S->getCond() &&
8429 Body.get() == S->getBody())
8432 return getDerived().RebuildDoStmt(S->getDoLoc(), Body.get(), S->getWhileLoc(),
8433 S->getWhileLoc(),
Cond.get(),
8437template<
typename Derived>
8440 if (getSema().getLangOpts().OpenMP)
8441 getSema().OpenMP().startOpenMPLoop();
8445 if (
Init.isInvalid())
8450 if (getSema().getLangOpts().OpenMP &&
Init.isUsable())
8451 getSema().OpenMP().ActOnOpenMPLoopInitialization(S->getForLoc(),
8456 S->getForLoc(), S->getConditionVariable(), S->getCond(),
8458 if (
Cond.isInvalid())
8463 if (
Inc.isInvalid())
8467 if (S->getInc() && !FullInc.get())
8474 S->getBeginLoc(), S->getInit(),
Init.get(), S->getCond(),
8475 Cond.get().second, S->getInc(),
Inc.get());
8478 StmtResult Body = getDerived().TransformStmt(S->getBody());
8479 if (Body.isInvalid())
8484 if (!getDerived().AlwaysRebuild() &&
8485 Init.get() == S->getInit() &&
8486 Cond.get() == std::make_pair(S->getConditionVariable(), S->getCond()) &&
8487 Inc.get() == S->getInc() &&
8488 Body.get() == S->getBody())
8491 return getDerived().RebuildForStmt(S->getForLoc(), S->getLParenLoc(),
8493 S->getRParenLoc(), Body.get());
8496template<
typename Derived>
8499 Decl *LD = getDerived().TransformDecl(S->getLabel()->getLocation(),
8505 return getDerived().RebuildGotoStmt(S->getGotoLoc(), S->getLabelLoc(),
8509template<
typename Derived>
8517 if (!getDerived().AlwaysRebuild() &&
8518 Target.get() == S->getTarget())
8521 return getDerived().RebuildIndirectGotoStmt(S->getGotoLoc(), S->getStarLoc(),
8525template<
typename Derived>
8528 if (!S->hasLabelTarget())
8531 Decl *LD = getDerived().TransformDecl(S->getLabelDecl()->getLocation(),
8540template<
typename Derived>
8543 if (!S->hasLabelTarget())
8546 Decl *LD = getDerived().TransformDecl(S->getLabelDecl()->getLocation(),
8555template<
typename Derived>
8565 return getDerived().RebuildReturnStmt(S->getReturnLoc(),
Result.get());
8568template<
typename Derived>
8571 bool DeclChanged =
false;
8574 for (
auto *D : S->decls()) {
8575 Decl *Transformed = getDerived().TransformDefinition(D->getLocation(), D);
8579 if (Transformed != D)
8583 if (
auto *TD = dyn_cast<TypeDecl>(Transformed)) {
8584 if (
auto *TN = dyn_cast<TypedefNameDecl>(TD)) {
8585 LSI->ContainsUnexpandedParameterPack |=
8586 TN->getUnderlyingType()->containsUnexpandedParameterPack();
8588 LSI->ContainsUnexpandedParameterPack |=
8591 .getTypeDeclType(TD)
8592 ->containsUnexpandedParameterPack();
8595 if (
auto *VD = dyn_cast<VarDecl>(Transformed))
8596 LSI->ContainsUnexpandedParameterPack |=
8597 VD->getType()->containsUnexpandedParameterPack();
8600 Decls.push_back(Transformed);
8603 if (!getDerived().AlwaysRebuild() && !DeclChanged)
8606 return getDerived().RebuildDeclStmt(Decls, S->getBeginLoc(), S->getEndLoc());
8609template<
typename Derived>
8619 bool ExprsChanged =
false;
8621 auto RebuildString = [&](
Expr *E) {
8626 ExprsChanged =
true;
8633 for (
unsigned I = 0, E = S->getNumOutputs(); I != E; ++I) {
8634 Names.push_back(S->getOutputIdentifier(I));
8640 Constraints.push_back(
Result.get());
8643 Expr *OutputExpr = S->getOutputExpr(I);
8644 Result = getDerived().TransformExpr(OutputExpr);
8648 ExprsChanged |=
Result.get() != OutputExpr;
8650 Exprs.push_back(
Result.get());
8654 for (
unsigned I = 0, E = S->getNumInputs(); I != E; ++I) {
8655 Names.push_back(S->getInputIdentifier(I));
8661 Constraints.push_back(
Result.get());
8664 Expr *InputExpr = S->getInputExpr(I);
8665 Result = getDerived().TransformExpr(InputExpr);
8669 ExprsChanged |=
Result.get() != InputExpr;
8671 Exprs.push_back(
Result.get());
8675 for (
unsigned I = 0, E = S->getNumLabels(); I != E; ++I) {
8676 Names.push_back(S->getLabelIdentifier(I));
8681 ExprsChanged |=
Result.get() != S->getLabelExpr(I);
8682 Exprs.push_back(
Result.get());
8686 for (
unsigned I = 0, E = S->getNumClobbers(); I != E; ++I) {
8690 Clobbers.push_back(
Result.get());
8693 ExprResult AsmString = RebuildString(S->getAsmStringExpr());
8694 if (AsmString.isInvalid())
8697 if (!getDerived().AlwaysRebuild() && !ExprsChanged)
8700 return getDerived().RebuildGCCAsmStmt(S->getAsmLoc(), S->isSimple(),
8701 S->isVolatile(), S->getNumOutputs(),
8702 S->getNumInputs(), Names.data(),
8703 Constraints, Exprs, AsmString.get(),
8704 Clobbers, S->getNumLabels(),
8708template<
typename Derived>
8713 bool HadError =
false, HadChange =
false;
8717 TransformedExprs.reserve(SrcExprs.size());
8718 for (
unsigned i = 0, e = SrcExprs.size(); i != e; ++i) {
8720 if (!
Result.isUsable()) {
8723 HadChange |= (
Result.get() != SrcExprs[i]);
8724 TransformedExprs.push_back(
Result.get());
8729 if (!HadChange && !getDerived().AlwaysRebuild())
8732 return getDerived().RebuildMSAsmStmt(S->getAsmLoc(), S->getLBraceLoc(),
8733 AsmToks, S->getAsmString(),
8734 S->getNumOutputs(), S->getNumInputs(),
8735 S->getAllConstraints(), S->getClobbers(),
8736 TransformedExprs, S->getEndLoc());
8740template<
typename Derived>
8745 assert(FD && ScopeInfo && !ScopeInfo->CoroutinePromise &&
8746 ScopeInfo->NeedsCoroutineSuspends &&
8747 ScopeInfo->CoroutineSuspends.first ==
nullptr &&
8748 ScopeInfo->CoroutineSuspends.second ==
nullptr &&
8749 "expected clean scope info");
8753 ScopeInfo->setNeedsCoroutineSuspends(
false);
8766 getDerived().transformedLocalDecl(S->getPromiseDecl(), {Promise});
8767 ScopeInfo->CoroutinePromise = Promise;
8772 StmtResult InitSuspend = getDerived().TransformStmt(S->getInitSuspendStmt());
8773 if (InitSuspend.isInvalid())
8776 getDerived().TransformStmt(S->getFinalSuspendStmt());
8777 if (FinalSuspend.isInvalid() ||
8780 ScopeInfo->setCoroutineSuspends(InitSuspend.get(), FinalSuspend.get());
8783 StmtResult BodyRes = getDerived().TransformStmt(S->getBody());
8784 if (BodyRes.isInvalid())
8788 if (Builder.isInvalid())
8791 Expr *ReturnObject = S->getReturnValueInit();
8792 assert(ReturnObject &&
"the return object is expected to be valid");
8793 ExprResult Res = getDerived().TransformInitializer(ReturnObject,
8795 if (Res.isInvalid())
8797 Builder.ReturnValue = Res.get();
8802 if (S->hasDependentPromiseType()) {
8805 if (!Promise->getType()->isDependentType()) {
8806 assert(!S->getFallthroughHandler() && !S->getExceptionHandler() &&
8807 !S->getReturnStmtOnAllocFailure() && !S->getDeallocate() &&
8808 "these nodes should not have been built yet");
8809 if (!Builder.buildDependentStatements())
8813 if (
auto *OnFallthrough = S->getFallthroughHandler()) {
8814 StmtResult Res = getDerived().TransformStmt(OnFallthrough);
8815 if (Res.isInvalid())
8817 Builder.OnFallthrough = Res.get();
8820 if (
auto *OnException = S->getExceptionHandler()) {
8821 StmtResult Res = getDerived().TransformStmt(OnException);
8822 if (Res.isInvalid())
8824 Builder.OnException = Res.get();
8827 if (
auto *OnAllocFailure = S->getReturnStmtOnAllocFailure()) {
8828 StmtResult Res = getDerived().TransformStmt(OnAllocFailure);
8829 if (Res.isInvalid())
8831 Builder.ReturnStmtOnAllocFailure = Res.get();
8835 assert(S->getAllocate() && S->getDeallocate() &&
8836 "allocation and deallocation calls must already be built");
8837 ExprResult AllocRes = getDerived().TransformExpr(S->getAllocate());
8838 if (AllocRes.isInvalid())
8840 Builder.Allocate = AllocRes.get();
8842 ExprResult DeallocRes = getDerived().TransformExpr(S->getDeallocate());
8843 if (DeallocRes.isInvalid())
8845 Builder.Deallocate = DeallocRes.get();
8847 if (
auto *ResultDecl = S->getResultDecl()) {
8848 StmtResult Res = getDerived().TransformStmt(ResultDecl);
8849 if (Res.isInvalid())
8851 Builder.ResultDecl = Res.get();
8856 if (Res.isInvalid())
8858 Builder.ReturnStmt = Res.get();
8862 return getDerived().RebuildCoroutineBodyStmt(Builder);
8865template<
typename Derived>
8875 return getDerived().RebuildCoreturnStmt(S->getKeywordLoc(),
Result.get(),
8879template <
typename Derived>
8892 ExprResult Lookup = getSema().BuildOperatorCoawaitLookupExpr(
8893 getSema().getCurScope(), E->getKeywordLoc());
8897 return getDerived().RebuildCoawaitExpr(
8898 E->getKeywordLoc(),
Operand.get(),
8902template <
typename Derived>
8905 ExprResult OperandResult = getDerived().TransformInitializer(E->getOperand(),
8907 if (OperandResult.isInvalid())
8911 E->getOperatorCoawaitLookup());
8918 return getDerived().RebuildDependentCoawaitExpr(
8919 E->getKeywordLoc(), OperandResult.get(),
8923template<
typename Derived>
8933 return getDerived().RebuildCoyieldExpr(E->getKeywordLoc(),
Result.get());
8938template<
typename Derived>
8942 StmtResult TryBody = getDerived().TransformStmt(S->getTryBody());
8943 if (TryBody.isInvalid())
8947 bool AnyCatchChanged =
false;
8949 for (
unsigned I = 0, N = S->getNumCatchStmts(); I != N; ++I) {
8950 StmtResult Catch = getDerived().TransformStmt(S->getCatchStmt(I));
8951 if (Catch.isInvalid())
8953 if (Catch.get() != S->getCatchStmt(I))
8954 AnyCatchChanged =
true;
8955 CatchStmts.push_back(Catch.get());
8960 if (S->getFinallyStmt()) {
8961 Finally = getDerived().TransformStmt(S->getFinallyStmt());
8962 if (Finally.isInvalid())
8967 if (!getDerived().AlwaysRebuild() &&
8968 TryBody.get() == S->getTryBody() &&
8970 Finally.get() == S->getFinallyStmt())
8974 return getDerived().RebuildObjCAtTryStmt(S->getAtTryLoc(), TryBody.get(),
8975 CatchStmts, Finally.get());
8978template<
typename Derived>
8983 if (
VarDecl *FromVar = S->getCatchParamDecl()) {
8985 if (FromVar->getTypeSourceInfo()) {
8986 TSInfo = getDerived().TransformType(FromVar->getTypeSourceInfo());
8993 T = TSInfo->getType();
8995 T = getDerived().TransformType(FromVar->getType());
9000 Var = getDerived().RebuildObjCExceptionDecl(FromVar, TSInfo,
T);
9005 StmtResult Body = getDerived().TransformStmt(S->getCatchBody());
9006 if (Body.isInvalid())
9009 return getDerived().RebuildObjCAtCatchStmt(S->getAtCatchLoc(),
9014template<
typename Derived>
9018 StmtResult Body = getDerived().TransformStmt(S->getFinallyBody());
9019 if (Body.isInvalid())
9023 if (!getDerived().AlwaysRebuild() &&
9024 Body.get() == S->getFinallyBody())
9028 return getDerived().RebuildObjCAtFinallyStmt(S->getAtFinallyLoc(),
9032template<
typename Derived>
9036 if (S->getThrowExpr()) {
9037 Operand = getDerived().TransformExpr(S->getThrowExpr());
9042 if (!getDerived().AlwaysRebuild() &&
9043 Operand.get() == S->getThrowExpr())
9046 return getDerived().RebuildObjCAtThrowStmt(S->getThrowLoc(),
Operand.get());
9049template<
typename Derived>
9058 getDerived().RebuildObjCAtSynchronizedOperand(S->getAtSynchronizedLoc(),
9064 StmtResult Body = getDerived().TransformStmt(S->getSynchBody());
9065 if (Body.isInvalid())
9069 if (!getDerived().AlwaysRebuild() &&
9070 Object.get() == S->getSynchExpr() &&
9071 Body.get() == S->getSynchBody())
9075 return getDerived().RebuildObjCAtSynchronizedStmt(S->getAtSynchronizedLoc(),
9076 Object.get(), Body.get());
9079template<
typename Derived>
9084 StmtResult Body = getDerived().TransformStmt(S->getSubStmt());
9085 if (Body.isInvalid())
9089 if (!getDerived().AlwaysRebuild() &&
9090 Body.get() == S->getSubStmt())
9094 return getDerived().RebuildObjCAutoreleasePoolStmt(
9095 S->getAtLoc(), Body.get());
9098template<
typename Derived>
9103 StmtResult Element = getDerived().TransformStmt(
9104 S->getElement(), StmtDiscardKind::NotDiscarded);
9105 if (Element.isInvalid())
9109 ExprResult Collection = getDerived().TransformExpr(S->getCollection());
9110 if (Collection.isInvalid())
9114 StmtResult Body = getDerived().TransformStmt(S->getBody());
9115 if (Body.isInvalid())
9119 if (!getDerived().AlwaysRebuild() &&
9120 Element.get() == S->getElement() &&
9121 Collection.get() == S->getCollection() &&
9122 Body.get() == S->getBody())
9126 return getDerived().RebuildObjCForCollectionStmt(S->getForLoc(),
9133template <
typename Derived>
9137 if (
VarDecl *ExceptionDecl = S->getExceptionDecl()) {
9139 getDerived().TransformType(ExceptionDecl->getTypeSourceInfo());
9143 Var = getDerived().RebuildExceptionDecl(
9144 ExceptionDecl,
T, ExceptionDecl->getInnerLocStart(),
9145 ExceptionDecl->getLocation(), ExceptionDecl->getIdentifier());
9146 if (!Var || Var->isInvalidDecl())
9151 StmtResult Handler = getDerived().TransformStmt(S->getHandlerBlock());
9152 if (Handler.isInvalid())
9155 if (!getDerived().AlwaysRebuild() && !Var &&
9156 Handler.get() == S->getHandlerBlock())
9159 return getDerived().RebuildCXXCatchStmt(S->getCatchLoc(), Var, Handler.get());
9162template <
typename Derived>
9165 StmtResult TryBlock = getDerived().TransformCompoundStmt(S->getTryBlock());
9166 if (TryBlock.isInvalid())
9170 bool HandlerChanged =
false;
9172 for (
unsigned I = 0, N = S->getNumHandlers(); I != N; ++I) {
9173 StmtResult Handler = getDerived().TransformCXXCatchStmt(S->getHandler(I));
9174 if (Handler.isInvalid())
9177 HandlerChanged = HandlerChanged || Handler.get() != S->getHandler(I);
9178 Handlers.push_back(Handler.getAs<
Stmt>());
9181 getSema().DiagnoseExceptionUse(S->getTryLoc(),
true);
9183 if (!getDerived().AlwaysRebuild() && TryBlock.get() == S->getTryBlock() &&
9187 return getDerived().RebuildCXXTryStmt(S->getTryLoc(), TryBlock.get(),
9191template<
typename Derived>
9202 auto &LastRecord = getSema().currentEvaluationContext();
9203 LastRecord.InLifetimeExtendingContext =
true;
9204 LastRecord.RebuildDefaultArgOrDefaultInit =
true;
9207 S->getInit() ? getDerived().TransformStmt(S->getInit()) :
StmtResult();
9208 if (
Init.isInvalid())
9212 if (
Range.isInvalid())
9217 getSema().ExprEvalContexts.back().ForRangeLifetimeExtendTemps.empty());
9218 auto ForRangeLifetimeExtendTemps =
9219 getSema().ExprEvalContexts.back().ForRangeLifetimeExtendTemps;
9221 StmtResult Begin = getDerived().TransformStmt(S->getBeginStmt());
9222 if (Begin.isInvalid())
9224 StmtResult End = getDerived().TransformStmt(S->getEndStmt());
9225 if (End.isInvalid())
9229 if (
Cond.isInvalid())
9233 if (
Cond.isInvalid())
9239 if (
Inc.isInvalid())
9244 StmtResult LoopVar = getDerived().TransformStmt(S->getLoopVarStmt());
9245 if (LoopVar.isInvalid())
9249 if (getDerived().AlwaysRebuild() ||
9250 Init.get() != S->getInit() ||
9251 Range.get() != S->getRangeStmt() ||
9252 Begin.get() != S->getBeginStmt() ||
9253 End.get() != S->getEndStmt() ||
9254 Cond.get() != S->getCond() ||
9255 Inc.get() != S->getInc() ||
9256 LoopVar.get() != S->getLoopVarStmt()) {
9257 NewStmt = getDerived().RebuildCXXForRangeStmt(
9258 S->getForLoc(), S->getCoawaitLoc(),
Init.get(), S->getColonLoc(),
9259 Range.get(), Begin.get(), End.get(),
Cond.get(),
Inc.get(),
9260 LoopVar.get(), S->getRParenLoc(), ForRangeLifetimeExtendTemps);
9261 if (NewStmt.isInvalid() && LoopVar.get() != S->getLoopVarStmt()) {
9263 getSema().ActOnInitializerError(
9274 StmtResult Body = getDerived().TransformStmt(S->getBody());
9275 if (Body.isInvalid())
9282 if (Body.get() != S->getBody() && NewStmt.get() == S) {
9283 NewStmt = getDerived().RebuildCXXForRangeStmt(
9284 S->getForLoc(), S->getCoawaitLoc(),
Init.get(), S->getColonLoc(),
9285 Range.get(), Begin.get(), End.get(),
Cond.get(),
Inc.get(),
9286 LoopVar.get(), S->getRParenLoc(), ForRangeLifetimeExtendTemps);
9287 if (NewStmt.isInvalid())
9291 if (NewStmt.get() == S)
9294 return FinishCXXForRangeStmt(NewStmt.get(), Body.get());
9297template<
typename Derived>
9303 if (S->getQualifierLoc()) {
9305 = getDerived().TransformNestedNameSpecifierLoc(S->getQualifierLoc());
9312 if (NameInfo.getName()) {
9313 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
9314 if (!NameInfo.getName())
9319 if (!getDerived().AlwaysRebuild() &&
9320 QualifierLoc == S->getQualifierLoc() &&
9321 NameInfo.getName() == S->getNameInfo().getName())
9326 SS.
Adopt(QualifierLoc);
9328 switch (getSema().CheckMicrosoftIfExistsSymbol(
nullptr, SS, NameInfo)) {
9330 if (S->isIfExists())
9333 return new (getSema().Context)
NullStmt(S->getKeywordLoc());
9336 if (S->isIfNotExists())
9339 return new (getSema().Context)
NullStmt(S->getKeywordLoc());
9350 StmtResult SubStmt = getDerived().TransformCompoundStmt(S->getSubStmt());
9351 if (SubStmt.isInvalid())
9359 return getDerived().RebuildMSDependentExistsStmt(S->getKeywordLoc(),
9366template<
typename Derived>
9370 if (E->getQualifierLoc()) {
9372 = getDerived().TransformNestedNameSpecifierLoc(E->getQualifierLoc());
9378 getDerived().TransformDecl(E->getMemberLoc(), E->getPropertyDecl()));
9383 if (
Base.isInvalid())
9389 QualifierLoc, E->getMemberLoc());
9392template <
typename Derived>
9396 if (BaseRes.isInvalid())
9398 auto IdxRes = getDerived().TransformExpr(E->getIdx());
9399 if (IdxRes.isInvalid())
9402 if (!getDerived().AlwaysRebuild() &&
9403 BaseRes.get() == E->getBase() &&
9404 IdxRes.get() == E->getIdx())
9407 return getDerived().RebuildArraySubscriptExpr(
9408 BaseRes.get(),
SourceLocation(), IdxRes.get(), E->getRBracketLoc());
9411template <
typename Derived>
9413 StmtResult TryBlock = getDerived().TransformCompoundStmt(S->getTryBlock());
9414 if (TryBlock.isInvalid())
9417 StmtResult Handler = getDerived().TransformSEHHandler(S->getHandler());
9418 if (Handler.isInvalid())
9421 if (!getDerived().AlwaysRebuild() && TryBlock.get() == S->getTryBlock() &&
9422 Handler.get() == S->getHandler())
9425 return getDerived().RebuildSEHTryStmt(S->getIsCXXTry(), S->getTryLoc(),
9426 TryBlock.get(), Handler.get());
9429template <
typename Derived>
9432 if (
Block.isInvalid())
9435 return getDerived().RebuildSEHFinallyStmt(S->getFinallyLoc(),
Block.get());
9438template <
typename Derived>
9440 ExprResult FilterExpr = getDerived().TransformExpr(S->getFilterExpr());
9441 if (FilterExpr.isInvalid())
9445 if (
Block.isInvalid())
9448 return getDerived().RebuildSEHExceptStmt(S->getExceptLoc(), FilterExpr.get(),
9452template <
typename Derived>
9460template<
typename Derived>
9470template <
typename Derived>
9472TreeTransform<Derived>::TransformOMPCanonicalLoop(OMPCanonicalLoop *L) {
9476 return getDerived().TransformStmt(L->getLoopStmt());
9479template <
typename Derived>
9486 TClauses.reserve(Clauses.size());
9490 getDerived().getSema().OpenMP().StartOpenMPClause((*I)->getClauseKind());
9492 getDerived().getSema().OpenMP().EndOpenMPClause();
9494 TClauses.push_back(Clause);
9496 TClauses.push_back(
nullptr);
9500 if (D->hasAssociatedStmt() && D->getAssociatedStmt()) {
9501 getDerived().getSema().OpenMP().ActOnOpenMPRegionStart(
9502 D->getDirectiveKind(),
9508 if (D->getDirectiveKind() == OMPD_atomic ||
9509 D->getDirectiveKind() == OMPD_critical ||
9510 D->getDirectiveKind() == OMPD_section ||
9511 D->getDirectiveKind() == OMPD_master)
9512 CS = D->getAssociatedStmt();
9514 CS = D->getRawStmt();
9517 getSema().getLangOpts().OpenMPIRBuilder)
9521 getDerived().getSema().OpenMP().ActOnOpenMPRegionEnd(Body, TClauses);
9526 if (TClauses.size() != Clauses.size()) {
9532 if (D->getDirectiveKind() == OMPD_critical) {
9534 DirName =
getDerived().TransformDeclarationNameInfo(DirName);
9537 if (D->getDirectiveKind() == OMPD_cancellation_point) {
9539 }
else if (D->getDirectiveKind() == OMPD_cancel) {
9543 return getDerived().RebuildOMPExecutableDirective(
9544 D->getDirectiveKind(), DirName, CancelRegion, TClauses,
9545 AssociatedStmt.
get(), D->getBeginLoc(), D->getEndLoc());
9553template <
typename Derived>
9560 TClauses.reserve(Clauses.size());
9563 getDerived().getSema().OpenMP().StartOpenMPClause(
C->getClauseKind());
9565 getDerived().getSema().OpenMP().EndOpenMPClause();
9567 TClauses.push_back(Clause);
9569 TClauses.push_back(
nullptr);
9573 if (D->hasAssociatedStmt() && D->getAssociatedStmt()) {
9574 getDerived().getSema().OpenMP().ActOnOpenMPRegionStart(
9575 D->getDirectiveKind(),
9580 assert(D->getDirectiveKind() == OMPD_assume &&
9581 "Unexpected informational directive");
9582 Stmt *CS = D->getAssociatedStmt();
9586 getDerived().getSema().OpenMP().ActOnOpenMPRegionEnd(Body, TClauses);
9590 if (TClauses.size() != Clauses.size())
9595 return getDerived().RebuildOMPInformationalDirective(
9596 D->getDirectiveKind(), DirName, TClauses, AssociatedStmt.
get(),
9597 D->getBeginLoc(), D->getEndLoc());
9600template <
typename Derived>
9605 SemaRef.
Diag(D->getBeginLoc(), diag::err_omp_instantiation_not_supported)
9606 << getOpenMPDirectiveName(D->getDirectiveKind(), OMPVersion);
9610template <
typename Derived>
9612TreeTransform<Derived>::TransformOMPParallelDirective(OMPParallelDirective *D) {
9613 DeclarationNameInfo DirName;
9614 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9615 OMPD_parallel, DirName,
nullptr, D->getBeginLoc());
9616 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9617 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9621template <
typename Derived>
9625 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9626 OMPD_simd, DirName,
nullptr, D->getBeginLoc());
9627 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9628 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9632template <
typename Derived>
9636 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9637 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
9638 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9639 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9643template <
typename Derived>
9647 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9648 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
9649 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9650 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9654template <
typename Derived>
9658 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9659 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
9660 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9661 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9665template <
typename Derived>
9669 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9670 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
9671 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9672 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9676template <
typename Derived>
9678 OMPInterchangeDirective *D) {
9680 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9681 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
9682 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9683 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9687template <
typename Derived>
9691 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9692 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
9693 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9694 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9698template <
typename Derived>
9702 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9703 OMPD_for, DirName,
nullptr, D->getBeginLoc());
9704 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9705 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9709template <
typename Derived>
9713 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9714 OMPD_for_simd, DirName,
nullptr, D->getBeginLoc());
9715 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9716 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9720template <
typename Derived>
9724 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9725 OMPD_sections, DirName,
nullptr, D->getBeginLoc());
9726 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9727 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9731template <
typename Derived>
9735 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9736 OMPD_section, DirName,
nullptr, D->getBeginLoc());
9737 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9738 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9742template <
typename Derived>
9746 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9747 OMPD_scope, DirName,
nullptr, D->getBeginLoc());
9748 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9749 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9753template <
typename Derived>
9757 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9758 OMPD_single, DirName,
nullptr, D->getBeginLoc());
9759 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9760 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9764template <
typename Derived>
9768 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9769 OMPD_master, DirName,
nullptr, D->getBeginLoc());
9770 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9771 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9775template <
typename Derived>
9779 OMPD_critical, D->getDirectiveName(),
nullptr, D->getBeginLoc());
9780 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9781 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9785template <
typename Derived>
9787 OMPParallelForDirective *D) {
9789 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9790 OMPD_parallel_for, DirName,
nullptr, D->getBeginLoc());
9791 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9792 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9796template <
typename Derived>
9798 OMPParallelForSimdDirective *D) {
9800 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9801 OMPD_parallel_for_simd, DirName,
nullptr, D->getBeginLoc());
9802 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9803 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9807template <
typename Derived>
9809 OMPParallelMasterDirective *D) {
9811 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9812 OMPD_parallel_master, DirName,
nullptr, D->getBeginLoc());
9813 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9814 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9818template <
typename Derived>
9820 OMPParallelMaskedDirective *D) {
9822 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9823 OMPD_parallel_masked, DirName,
nullptr, D->getBeginLoc());
9824 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9825 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9829template <
typename Derived>
9831 OMPParallelSectionsDirective *D) {
9833 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9834 OMPD_parallel_sections, DirName,
nullptr, D->getBeginLoc());
9835 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9836 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9840template <
typename Derived>
9844 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9845 OMPD_task, DirName,
nullptr, D->getBeginLoc());
9846 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9847 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9851template <
typename Derived>
9853 OMPTaskyieldDirective *D) {
9855 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9856 OMPD_taskyield, DirName,
nullptr, D->getBeginLoc());
9857 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9858 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9862template <
typename Derived>
9866 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9867 OMPD_barrier, DirName,
nullptr, D->getBeginLoc());
9868 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9869 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9873template <
typename Derived>
9877 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9878 OMPD_taskwait, DirName,
nullptr, D->getBeginLoc());
9879 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9880 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9884template <
typename Derived>
9888 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9889 OMPD_assume, DirName,
nullptr, D->getBeginLoc());
9890 StmtResult Res = getDerived().TransformOMPInformationalDirective(D);
9891 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9895template <
typename Derived>
9899 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9900 OMPD_error, DirName,
nullptr, D->getBeginLoc());
9901 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9902 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9906template <
typename Derived>
9908 OMPTaskgroupDirective *D) {
9910 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9911 OMPD_taskgroup, DirName,
nullptr, D->getBeginLoc());
9912 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9913 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9917template <
typename Derived>
9921 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9922 OMPD_flush, DirName,
nullptr, D->getBeginLoc());
9923 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9924 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9928template <
typename Derived>
9932 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9933 OMPD_depobj, DirName,
nullptr, D->getBeginLoc());
9934 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9935 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9939template <
typename Derived>
9943 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9944 OMPD_scan, DirName,
nullptr, D->getBeginLoc());
9945 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9946 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9950template <
typename Derived>
9954 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9955 OMPD_ordered, DirName,
nullptr, D->getBeginLoc());
9956 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9957 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9961template <
typename Derived>
9965 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9966 OMPD_atomic, DirName,
nullptr, D->getBeginLoc());
9967 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9968 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9972template <
typename Derived>
9976 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9977 OMPD_target, DirName,
nullptr, D->getBeginLoc());
9978 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9979 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9983template <
typename Derived>
9985 OMPTargetDataDirective *D) {
9987 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9988 OMPD_target_data, DirName,
nullptr, D->getBeginLoc());
9989 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9990 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9994template <
typename Derived>
9996 OMPTargetEnterDataDirective *D) {
9998 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9999 OMPD_target_enter_data, DirName,
nullptr, D->getBeginLoc());
10000 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10001 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10005template <
typename Derived>
10007 OMPTargetExitDataDirective *D) {
10009 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10010 OMPD_target_exit_data, DirName,
nullptr, D->getBeginLoc());
10011 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10012 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10016template <
typename Derived>
10018 OMPTargetParallelDirective *D) {
10020 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10021 OMPD_target_parallel, DirName,
nullptr, D->getBeginLoc());
10022 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10023 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10027template <
typename Derived>
10029 OMPTargetParallelForDirective *D) {
10031 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10032 OMPD_target_parallel_for, DirName,
nullptr, D->getBeginLoc());
10033 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10034 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10038template <
typename Derived>
10040 OMPTargetUpdateDirective *D) {
10042 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10043 OMPD_target_update, DirName,
nullptr, D->getBeginLoc());
10044 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10045 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10049template <
typename Derived>
10053 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10054 OMPD_teams, DirName,
nullptr, D->getBeginLoc());
10055 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10056 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10060template <
typename Derived>
10062 OMPCancellationPointDirective *D) {
10064 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10065 OMPD_cancellation_point, DirName,
nullptr, D->getBeginLoc());
10066 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10067 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10071template <
typename Derived>
10075 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10076 OMPD_cancel, DirName,
nullptr, D->getBeginLoc());
10077 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10078 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10082template <
typename Derived>
10086 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10087 OMPD_taskloop, DirName,
nullptr, D->getBeginLoc());
10088 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10089 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10093template <
typename Derived>
10095 OMPTaskLoopSimdDirective *D) {
10097 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10098 OMPD_taskloop_simd, DirName,
nullptr, D->getBeginLoc());
10099 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10100 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10104template <
typename Derived>
10106 OMPMasterTaskLoopDirective *D) {
10108 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10109 OMPD_master_taskloop, DirName,
nullptr, D->getBeginLoc());
10110 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10111 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10115template <
typename Derived>
10117 OMPMaskedTaskLoopDirective *D) {
10119 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10120 OMPD_masked_taskloop, DirName,
nullptr, D->getBeginLoc());
10121 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10122 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10126template <
typename Derived>
10128 OMPMasterTaskLoopSimdDirective *D) {
10130 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10131 OMPD_master_taskloop_simd, DirName,
nullptr, D->getBeginLoc());
10132 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10133 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10137template <
typename Derived>
10139 OMPMaskedTaskLoopSimdDirective *D) {
10141 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10142 OMPD_masked_taskloop_simd, DirName,
nullptr, D->getBeginLoc());
10143 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10144 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10148template <
typename Derived>
10150 OMPParallelMasterTaskLoopDirective *D) {
10152 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10153 OMPD_parallel_master_taskloop, DirName,
nullptr, D->getBeginLoc());
10154 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10155 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10159template <
typename Derived>
10161 OMPParallelMaskedTaskLoopDirective *D) {
10163 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10164 OMPD_parallel_masked_taskloop, DirName,
nullptr, D->getBeginLoc());
10165 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10166 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10170template <
typename Derived>
10173 OMPParallelMasterTaskLoopSimdDirective *D) {
10175 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10176 OMPD_parallel_master_taskloop_simd, DirName,
nullptr, D->getBeginLoc());
10177 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10178 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10182template <
typename Derived>
10185 OMPParallelMaskedTaskLoopSimdDirective *D) {
10187 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10188 OMPD_parallel_masked_taskloop_simd, DirName,
nullptr, D->getBeginLoc());
10189 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10190 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10194template <
typename Derived>
10196 OMPDistributeDirective *D) {
10198 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10199 OMPD_distribute, DirName,
nullptr, D->getBeginLoc());
10200 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10201 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10205template <
typename Derived>
10207 OMPDistributeParallelForDirective *D) {
10209 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10210 OMPD_distribute_parallel_for, DirName,
nullptr, D->getBeginLoc());
10211 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10212 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10216template <
typename Derived>
10219 OMPDistributeParallelForSimdDirective *D) {
10221 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10222 OMPD_distribute_parallel_for_simd, DirName,
nullptr, D->getBeginLoc());
10223 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10224 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10228template <
typename Derived>
10230 OMPDistributeSimdDirective *D) {
10232 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10233 OMPD_distribute_simd, DirName,
nullptr, D->getBeginLoc());
10234 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10235 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10239template <
typename Derived>
10241 OMPTargetParallelForSimdDirective *D) {
10243 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10244 OMPD_target_parallel_for_simd, DirName,
nullptr, D->getBeginLoc());
10245 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10246 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10250template <
typename Derived>
10252 OMPTargetSimdDirective *D) {
10254 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10255 OMPD_target_simd, DirName,
nullptr, D->getBeginLoc());
10256 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10257 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10261template <
typename Derived>
10263 OMPTeamsDistributeDirective *D) {
10265 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10266 OMPD_teams_distribute, DirName,
nullptr, D->getBeginLoc());
10267 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10268 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10272template <
typename Derived>
10274 OMPTeamsDistributeSimdDirective *D) {
10276 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10277 OMPD_teams_distribute_simd, DirName,
nullptr, D->getBeginLoc());
10278 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10279 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10283template <
typename Derived>
10285 OMPTeamsDistributeParallelForSimdDirective *D) {
10287 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10288 OMPD_teams_distribute_parallel_for_simd, DirName,
nullptr,
10290 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10291 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10295template <
typename Derived>
10297 OMPTeamsDistributeParallelForDirective *D) {
10299 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10300 OMPD_teams_distribute_parallel_for, DirName,
nullptr, D->getBeginLoc());
10301 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10302 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10306template <
typename Derived>
10308 OMPTargetTeamsDirective *D) {
10310 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10311 OMPD_target_teams, DirName,
nullptr, D->getBeginLoc());
10312 auto Res = getDerived().TransformOMPExecutableDirective(D);
10313 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10317template <
typename Derived>
10319 OMPTargetTeamsDistributeDirective *D) {
10321 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10322 OMPD_target_teams_distribute, DirName,
nullptr, D->getBeginLoc());
10323 auto Res = getDerived().TransformOMPExecutableDirective(D);
10324 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10328template <
typename Derived>
10331 OMPTargetTeamsDistributeParallelForDirective *D) {
10333 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10334 OMPD_target_teams_distribute_parallel_for, DirName,
nullptr,
10336 auto Res = getDerived().TransformOMPExecutableDirective(D);
10337 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10341template <
typename Derived>
10344 OMPTargetTeamsDistributeParallelForSimdDirective *D) {
10346 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10347 OMPD_target_teams_distribute_parallel_for_simd, DirName,
nullptr,
10349 auto Res = getDerived().TransformOMPExecutableDirective(D);
10350 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10354template <
typename Derived>
10357 OMPTargetTeamsDistributeSimdDirective *D) {
10359 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10360 OMPD_target_teams_distribute_simd, DirName,
nullptr, D->getBeginLoc());
10361 auto Res = getDerived().TransformOMPExecutableDirective(D);
10362 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10366template <
typename Derived>
10370 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10371 OMPD_interop, DirName,
nullptr, D->getBeginLoc());
10372 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10373 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10377template <
typename Derived>
10381 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10382 OMPD_dispatch, DirName,
nullptr, D->getBeginLoc());
10383 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10384 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10388template <
typename Derived>
10392 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10393 OMPD_masked, DirName,
nullptr, D->getBeginLoc());
10394 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10395 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10399template <
typename Derived>
10401 OMPGenericLoopDirective *D) {
10403 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10404 OMPD_loop, DirName,
nullptr, D->getBeginLoc());
10405 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10406 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10410template <
typename Derived>
10412 OMPTeamsGenericLoopDirective *D) {
10414 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10415 OMPD_teams_loop, DirName,
nullptr, D->getBeginLoc());
10416 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10417 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10421template <
typename Derived>
10423 OMPTargetTeamsGenericLoopDirective *D) {
10425 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10426 OMPD_target_teams_loop, DirName,
nullptr, D->getBeginLoc());
10427 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10428 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10432template <
typename Derived>
10434 OMPParallelGenericLoopDirective *D) {
10436 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10437 OMPD_parallel_loop, DirName,
nullptr, D->getBeginLoc());
10438 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10439 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10443template <
typename Derived>
10446 OMPTargetParallelGenericLoopDirective *D) {
10448 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10449 OMPD_target_parallel_loop, DirName,
nullptr, D->getBeginLoc());
10450 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10451 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10458template <
typename Derived>
10461 if (
Cond.isInvalid())
10463 return getDerived().RebuildOMPIfClause(
10464 C->getNameModifier(),
Cond.get(),
C->getBeginLoc(),
C->getLParenLoc(),
10465 C->getNameModifierLoc(),
C->getColonLoc(),
C->getEndLoc());
10468template <
typename Derived>
10471 if (
Cond.isInvalid())
10473 return getDerived().RebuildOMPFinalClause(
Cond.get(),
C->getBeginLoc(),
10474 C->getLParenLoc(),
C->getEndLoc());
10477template <
typename Derived>
10480 ExprResult NumThreads = getDerived().TransformExpr(
C->getNumThreads());
10481 if (NumThreads.isInvalid())
10483 return getDerived().RebuildOMPNumThreadsClause(
10484 C->getModifier(), NumThreads.get(),
C->getBeginLoc(),
C->getLParenLoc(),
10485 C->getModifierLoc(),
C->getEndLoc());
10488template <
typename Derived>
10491 ExprResult E = getDerived().TransformExpr(
C->getSafelen());
10494 return getDerived().RebuildOMPSafelenClause(
10495 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10498template <
typename Derived>
10501 ExprResult E = getDerived().TransformExpr(
C->getAllocator());
10504 return getDerived().RebuildOMPAllocatorClause(
10505 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10508template <
typename Derived>
10511 ExprResult E = getDerived().TransformExpr(
C->getSimdlen());
10514 return getDerived().RebuildOMPSimdlenClause(
10515 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10518template <
typename Derived>
10521 TransformedSizes.reserve(
C->getNumSizes());
10523 for (
Expr *E :
C->getSizesRefs()) {
10525 TransformedSizes.push_back(
nullptr);
10534 TransformedSizes.push_back(
T.get());
10537 if (!Changed && !getDerived().AlwaysRebuild())
10539 return RebuildOMPSizesClause(TransformedSizes,
C->getBeginLoc(),
10540 C->getLParenLoc(),
C->getEndLoc());
10543template <
typename Derived>
10547 TransformedArgs.reserve(
C->getNumLoops());
10549 for (
Expr *E :
C->getArgsRefs()) {
10551 TransformedArgs.push_back(
nullptr);
10560 TransformedArgs.push_back(
T.get());
10563 if (!Changed && !getDerived().AlwaysRebuild())
10565 return RebuildOMPPermutationClause(TransformedArgs,
C->getBeginLoc(),
10566 C->getLParenLoc(),
C->getEndLoc());
10569template <
typename Derived>
10571 if (!getDerived().AlwaysRebuild())
10573 return RebuildOMPFullClause(
C->getBeginLoc(),
C->getEndLoc());
10576template <
typename Derived>
10579 ExprResult T = getDerived().TransformExpr(
C->getFactor());
10582 Expr *Factor =
T.get();
10583 bool Changed = Factor !=
C->getFactor();
10585 if (!Changed && !getDerived().AlwaysRebuild())
10587 return RebuildOMPPartialClause(Factor,
C->getBeginLoc(),
C->getLParenLoc(),
10591template <
typename Derived>
10594 ExprResult F = getDerived().TransformExpr(
C->getFirst());
10598 ExprResult Cn = getDerived().TransformExpr(
C->getCount());
10599 if (Cn.isInvalid())
10603 Expr *Count = Cn.get();
10605 bool Changed = (
First !=
C->getFirst()) || (Count !=
C->getCount());
10608 if (!Changed && !getDerived().AlwaysRebuild())
10611 return RebuildOMPLoopRangeClause(
First, Count,
C->getBeginLoc(),
10612 C->getLParenLoc(),
C->getFirstLoc(),
10613 C->getCountLoc(),
C->getEndLoc());
10616template <
typename Derived>
10619 ExprResult E = getDerived().TransformExpr(
C->getNumForLoops());
10622 return getDerived().RebuildOMPCollapseClause(
10623 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10626template <
typename Derived>
10630 C->getDefaultKind(),
C->getDefaultKindKwLoc(),
C->getDefaultVC(),
10631 C->getDefaultVCLoc(),
C->getBeginLoc(),
C->getLParenLoc(),
10635template <
typename Derived>
10642template <
typename Derived>
10646 C->getProcBindKind(),
C->getProcBindKindKwLoc(),
C->getBeginLoc(),
10647 C->getLParenLoc(),
C->getEndLoc());
10650template <
typename Derived>
10653 ExprResult E = getDerived().TransformExpr(
C->getChunkSize());
10656 return getDerived().RebuildOMPScheduleClause(
10657 C->getFirstScheduleModifier(),
C->getSecondScheduleModifier(),
10658 C->getScheduleKind(), E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
10659 C->getFirstScheduleModifierLoc(),
C->getSecondScheduleModifierLoc(),
10660 C->getScheduleKindLoc(),
C->getCommaLoc(),
C->getEndLoc());
10663template <
typename Derived>
10667 if (
auto *
Num =
C->getNumForLoops()) {
10668 E = getDerived().TransformExpr(
Num);
10672 return getDerived().RebuildOMPOrderedClause(
C->getBeginLoc(),
C->getEndLoc(),
10673 C->getLParenLoc(), E.get());
10676template <
typename Derived>
10680 if (
Expr *Evt =
C->getEventHandler()) {
10681 E = getDerived().TransformExpr(Evt);
10685 return getDerived().RebuildOMPDetachClause(E.get(),
C->getBeginLoc(),
10686 C->getLParenLoc(),
C->getEndLoc());
10689template <
typename Derived>
10695 if (
Cond.isInvalid())
10698 return getDerived().RebuildOMPNowaitClause(
Cond.get(),
C->getBeginLoc(),
10699 C->getLParenLoc(),
C->getEndLoc());
10702template <
typename Derived>
10709template <
typename Derived>
10716template <
typename Derived>
10722template <
typename Derived>
10728template <
typename Derived>
10735template <
typename Derived>
10742template <
typename Derived>
10749template <
typename Derived>
10755template <
typename Derived>
10761template <
typename Derived>
10763 ExprResult E = getDerived().TransformExpr(
C->getExpr());
10766 return getDerived().RebuildOMPHoldsClause(E.get(),
C->getBeginLoc(),
10767 C->getLParenLoc(),
C->getEndLoc());
10770template <
typename Derived>
10776template <
typename Derived>
10781template <
typename Derived>
10786template <
typename Derived>
10791template <
typename Derived>
10797template <
typename Derived>
10804template <
typename Derived>
10811template <
typename Derived>
10818template <
typename Derived>
10825template <
typename Derived>
10832template <
typename Derived>
10838template <
typename Derived>
10845template <
typename Derived>
10851template <
typename Derived>
10858template <
typename Derived>
10860 ExprResult IVR = getDerived().TransformExpr(
C->getInteropVar());
10861 if (IVR.isInvalid())
10865 InteropInfo.PreferTypes.reserve(
C->varlist_size() - 1);
10866 for (
Expr *E : llvm::drop_begin(
C->varlist())) {
10868 if (ER.isInvalid())
10870 InteropInfo.PreferTypes.push_back(ER.get());
10872 return getDerived().RebuildOMPInitClause(IVR.get(), InteropInfo,
10873 C->getBeginLoc(),
C->getLParenLoc(),
10874 C->getVarLoc(),
C->getEndLoc());
10877template <
typename Derived>
10879 ExprResult ER = getDerived().TransformExpr(
C->getInteropVar());
10880 if (ER.isInvalid())
10882 return getDerived().RebuildOMPUseClause(ER.get(),
C->getBeginLoc(),
10883 C->getLParenLoc(),
C->getVarLoc(),
10887template <
typename Derived>
10891 if (
Expr *IV =
C->getInteropVar()) {
10892 ER = getDerived().TransformExpr(IV);
10893 if (ER.isInvalid())
10896 return getDerived().RebuildOMPDestroyClause(ER.get(),
C->getBeginLoc(),
10897 C->getLParenLoc(),
C->getVarLoc(),
10901template <
typename Derived>
10905 if (
Cond.isInvalid())
10907 return getDerived().RebuildOMPNovariantsClause(
10908 Cond.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10911template <
typename Derived>
10915 if (
Cond.isInvalid())
10917 return getDerived().RebuildOMPNocontextClause(
10918 Cond.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10921template <
typename Derived>
10924 ExprResult ThreadID = getDerived().TransformExpr(
C->getThreadID());
10925 if (ThreadID.isInvalid())
10927 return getDerived().RebuildOMPFilterClause(ThreadID.get(),
C->getBeginLoc(),
10928 C->getLParenLoc(),
C->getEndLoc());
10931template <
typename Derived>
10933 ExprResult E = getDerived().TransformExpr(
C->getAlignment());
10936 return getDerived().RebuildOMPAlignClause(E.get(),
C->getBeginLoc(),
10937 C->getLParenLoc(),
C->getEndLoc());
10940template <
typename Derived>
10943 llvm_unreachable(
"unified_address clause cannot appear in dependent context");
10946template <
typename Derived>
10950 "unified_shared_memory clause cannot appear in dependent context");
10953template <
typename Derived>
10956 llvm_unreachable(
"reverse_offload clause cannot appear in dependent context");
10959template <
typename Derived>
10963 "dynamic_allocators clause cannot appear in dependent context");
10966template <
typename Derived>
10970 "atomic_default_mem_order clause cannot appear in dependent context");
10973template <
typename Derived>
10976 llvm_unreachable(
"self_maps clause cannot appear in dependent context");
10979template <
typename Derived>
10982 C->getBeginLoc(),
C->getLParenLoc(),
10986template <
typename Derived>
10990 C->getSeverityKind(),
C->getSeverityKindKwLoc(),
C->getBeginLoc(),
10991 C->getLParenLoc(),
C->getEndLoc());
10994template <
typename Derived>
10997 ExprResult E = getDerived().TransformExpr(
C->getMessageString());
11000 return getDerived().RebuildOMPMessageClause(
11001 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11004template <
typename Derived>
11008 Vars.reserve(
C->varlist_size());
11009 for (
auto *
VE :
C->varlist()) {
11011 if (EVar.isInvalid())
11013 Vars.push_back(EVar.get());
11015 return getDerived().RebuildOMPPrivateClause(
11016 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11019template <
typename Derived>
11023 Vars.reserve(
C->varlist_size());
11024 for (
auto *
VE :
C->varlist()) {
11026 if (EVar.isInvalid())
11028 Vars.push_back(EVar.get());
11030 return getDerived().RebuildOMPFirstprivateClause(
11031 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11034template <
typename Derived>
11038 Vars.reserve(
C->varlist_size());
11039 for (
auto *
VE :
C->varlist()) {
11041 if (EVar.isInvalid())
11043 Vars.push_back(EVar.get());
11045 return getDerived().RebuildOMPLastprivateClause(
11046 Vars,
C->getKind(),
C->getKindLoc(),
C->getColonLoc(),
C->getBeginLoc(),
11047 C->getLParenLoc(),
C->getEndLoc());
11050template <
typename Derived>
11054 Vars.reserve(
C->varlist_size());
11055 for (
auto *
VE :
C->varlist()) {
11057 if (EVar.isInvalid())
11059 Vars.push_back(EVar.get());
11061 return getDerived().RebuildOMPSharedClause(Vars,
C->getBeginLoc(),
11062 C->getLParenLoc(),
C->getEndLoc());
11065template <
typename Derived>
11069 Vars.reserve(
C->varlist_size());
11070 for (
auto *
VE :
C->varlist()) {
11072 if (EVar.isInvalid())
11074 Vars.push_back(EVar.get());
11077 ReductionIdScopeSpec.
Adopt(
C->getQualifierLoc());
11080 if (NameInfo.getName()) {
11081 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
11082 if (!NameInfo.getName())
11088 for (
auto *E :
C->reduction_ops()) {
11093 for (
auto *D : ULE->decls()) {
11096 Decls.addDecl(InstD, InstD->getAccess());
11100 ReductionIdScopeSpec.getWithLocInContext(SemaRef.
Context), NameInfo,
11101 true, Decls.begin(), Decls.end(),
11104 UnresolvedReductions.push_back(
nullptr);
11106 return getDerived().RebuildOMPReductionClause(
11107 Vars,
C->getModifier(),
C->getOriginalSharingModifier(),
C->getBeginLoc(),
11108 C->getLParenLoc(),
C->getModifierLoc(),
C->getColonLoc(),
C->getEndLoc(),
11109 ReductionIdScopeSpec, NameInfo, UnresolvedReductions);
11112template <
typename Derived>
11116 Vars.reserve(
C->varlist_size());
11117 for (
auto *
VE :
C->varlist()) {
11119 if (EVar.isInvalid())
11121 Vars.push_back(EVar.get());
11124 ReductionIdScopeSpec.
Adopt(
C->getQualifierLoc());
11127 if (NameInfo.getName()) {
11128 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
11129 if (!NameInfo.getName())
11135 for (
auto *E :
C->reduction_ops()) {
11140 for (
auto *D : ULE->decls()) {
11143 Decls.addDecl(InstD, InstD->getAccess());
11147 ReductionIdScopeSpec.getWithLocInContext(SemaRef.
Context), NameInfo,
11148 true, Decls.begin(), Decls.end(),
11151 UnresolvedReductions.push_back(
nullptr);
11153 return getDerived().RebuildOMPTaskReductionClause(
11154 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getColonLoc(),
11155 C->getEndLoc(), ReductionIdScopeSpec, NameInfo, UnresolvedReductions);
11158template <
typename Derived>
11162 Vars.reserve(
C->varlist_size());
11163 for (
auto *
VE :
C->varlist()) {
11165 if (EVar.isInvalid())
11167 Vars.push_back(EVar.get());
11170 ReductionIdScopeSpec.
Adopt(
C->getQualifierLoc());
11173 if (NameInfo.getName()) {
11174 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
11175 if (!NameInfo.getName())
11181 for (
auto *E :
C->reduction_ops()) {
11186 for (
auto *D : ULE->decls()) {
11189 Decls.addDecl(InstD, InstD->getAccess());
11193 ReductionIdScopeSpec.getWithLocInContext(SemaRef.
Context), NameInfo,
11194 true, Decls.begin(), Decls.end(),
11197 UnresolvedReductions.push_back(
nullptr);
11199 return getDerived().RebuildOMPInReductionClause(
11200 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getColonLoc(),
11201 C->getEndLoc(), ReductionIdScopeSpec, NameInfo, UnresolvedReductions);
11204template <
typename Derived>
11208 Vars.reserve(
C->varlist_size());
11209 for (
auto *
VE :
C->varlist()) {
11211 if (EVar.isInvalid())
11213 Vars.push_back(EVar.get());
11215 ExprResult Step = getDerived().TransformExpr(
C->getStep());
11216 if (Step.isInvalid())
11218 return getDerived().RebuildOMPLinearClause(
11219 Vars, Step.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getModifier(),
11220 C->getModifierLoc(),
C->getColonLoc(),
C->getStepModifierLoc(),
11224template <
typename Derived>
11228 Vars.reserve(
C->varlist_size());
11229 for (
auto *
VE :
C->varlist()) {
11231 if (EVar.isInvalid())
11233 Vars.push_back(EVar.get());
11235 ExprResult Alignment = getDerived().TransformExpr(
C->getAlignment());
11236 if (Alignment.isInvalid())
11238 return getDerived().RebuildOMPAlignedClause(
11239 Vars, Alignment.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11240 C->getColonLoc(),
C->getEndLoc());
11243template <
typename Derived>
11247 Vars.reserve(
C->varlist_size());
11248 for (
auto *
VE :
C->varlist()) {
11250 if (EVar.isInvalid())
11252 Vars.push_back(EVar.get());
11254 return getDerived().RebuildOMPCopyinClause(Vars,
C->getBeginLoc(),
11255 C->getLParenLoc(),
C->getEndLoc());
11258template <
typename Derived>
11262 Vars.reserve(
C->varlist_size());
11263 for (
auto *
VE :
C->varlist()) {
11265 if (EVar.isInvalid())
11267 Vars.push_back(EVar.get());
11269 return getDerived().RebuildOMPCopyprivateClause(
11270 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11273template <
typename Derived>
11276 Vars.reserve(
C->varlist_size());
11277 for (
auto *
VE :
C->varlist()) {
11279 if (EVar.isInvalid())
11281 Vars.push_back(EVar.get());
11283 return getDerived().RebuildOMPFlushClause(Vars,
C->getBeginLoc(),
11284 C->getLParenLoc(),
C->getEndLoc());
11287template <
typename Derived>
11290 ExprResult E = getDerived().TransformExpr(
C->getDepobj());
11293 return getDerived().RebuildOMPDepobjClause(E.get(),
C->getBeginLoc(),
11294 C->getLParenLoc(),
C->getEndLoc());
11297template <
typename Derived>
11301 Expr *DepModifier =
C->getModifier();
11303 ExprResult DepModRes = getDerived().TransformExpr(DepModifier);
11304 if (DepModRes.isInvalid())
11306 DepModifier = DepModRes.get();
11308 Vars.reserve(
C->varlist_size());
11309 for (
auto *
VE :
C->varlist()) {
11311 if (EVar.isInvalid())
11313 Vars.push_back(EVar.get());
11315 return getDerived().RebuildOMPDependClause(
11316 {
C->getDependencyKind(),
C->getDependencyLoc(),
C->getColonLoc(),
11317 C->getOmpAllMemoryLoc()},
11318 DepModifier, Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11321template <
typename Derived>
11324 ExprResult E = getDerived().TransformExpr(
C->getDevice());
11327 return getDerived().RebuildOMPDeviceClause(
11328 C->getModifier(), E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11329 C->getModifierLoc(),
C->getEndLoc());
11332template <
typename Derived,
class T>
11339 Vars.reserve(
C->varlist_size());
11340 for (
auto *
VE :
C->varlist()) {
11344 Vars.push_back(EVar.
get());
11348 if (
C->getMapperQualifierLoc()) {
11349 QualifierLoc = TT.
getDerived().TransformNestedNameSpecifierLoc(
11350 C->getMapperQualifierLoc());
11354 MapperIdScopeSpec.
Adopt(QualifierLoc);
11355 MapperIdInfo =
C->getMapperIdInfo();
11356 if (MapperIdInfo.
getName()) {
11357 MapperIdInfo = TT.
getDerived().TransformDeclarationNameInfo(MapperIdInfo);
11363 for (
auto *E :
C->mapperlists()) {
11368 for (
auto *D : ULE->decls()) {
11371 Decls.addDecl(InstD, InstD->
getAccess());
11376 MapperIdInfo,
true, Decls.begin(), Decls.end(),
11379 UnresolvedMappers.push_back(
nullptr);
11385template <
typename Derived>
11386OMPClause *TreeTransform<Derived>::TransformOMPMapClause(OMPMapClause *
C) {
11387 OMPVarListLocTy Locs(
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11389 Expr *IteratorModifier =
C->getIteratorModifier();
11390 if (IteratorModifier) {
11391 ExprResult MapModRes = getDerived().TransformExpr(IteratorModifier);
11392 if (MapModRes.isInvalid())
11394 IteratorModifier = MapModRes.
get();
11400 *
this,
C, Vars, MapperIdScopeSpec, MapperIdInfo, UnresolvedMappers))
11402 return getDerived().RebuildOMPMapClause(
11403 IteratorModifier,
C->getMapTypeModifiers(),
C->getMapTypeModifiersLoc(),
11404 MapperIdScopeSpec, MapperIdInfo,
C->getMapType(),
C->isImplicitMapType(),
11405 C->getMapLoc(),
C->getColonLoc(), Vars, Locs, UnresolvedMappers);
11408template <
typename Derived>
11411 Expr *Allocator =
C->getAllocator();
11413 ExprResult AllocatorRes = getDerived().TransformExpr(Allocator);
11414 if (AllocatorRes.isInvalid())
11416 Allocator = AllocatorRes.get();
11418 Expr *Alignment =
C->getAlignment();
11420 ExprResult AlignmentRes = getDerived().TransformExpr(Alignment);
11421 if (AlignmentRes.isInvalid())
11423 Alignment = AlignmentRes.get();
11426 Vars.reserve(
C->varlist_size());
11427 for (
auto *
VE :
C->varlist()) {
11429 if (EVar.isInvalid())
11431 Vars.push_back(EVar.get());
11433 return getDerived().RebuildOMPAllocateClause(
11434 Allocator, Alignment,
C->getFirstAllocateModifier(),
11435 C->getFirstAllocateModifierLoc(),
C->getSecondAllocateModifier(),
11436 C->getSecondAllocateModifierLoc(), Vars,
C->getBeginLoc(),
11437 C->getLParenLoc(),
C->getColonLoc(),
C->getEndLoc());
11440template <
typename Derived>
11444 Vars.reserve(
C->varlist_size());
11445 for (
auto *
VE :
C->varlist()) {
11447 if (EVar.isInvalid())
11449 Vars.push_back(EVar.get());
11451 return getDerived().RebuildOMPNumTeamsClause(
11452 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11455template <
typename Derived>
11459 Vars.reserve(
C->varlist_size());
11460 for (
auto *
VE :
C->varlist()) {
11462 if (EVar.isInvalid())
11464 Vars.push_back(EVar.get());
11466 return getDerived().RebuildOMPThreadLimitClause(
11467 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11470template <
typename Derived>
11473 ExprResult E = getDerived().TransformExpr(
C->getPriority());
11476 return getDerived().RebuildOMPPriorityClause(
11477 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11480template <
typename Derived>
11483 ExprResult E = getDerived().TransformExpr(
C->getGrainsize());
11486 return getDerived().RebuildOMPGrainsizeClause(
11487 C->getModifier(), E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11488 C->getModifierLoc(),
C->getEndLoc());
11491template <
typename Derived>
11494 ExprResult E = getDerived().TransformExpr(
C->getNumTasks());
11497 return getDerived().RebuildOMPNumTasksClause(
11498 C->getModifier(), E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11499 C->getModifierLoc(),
C->getEndLoc());
11502template <
typename Derived>
11504 ExprResult E = getDerived().TransformExpr(
C->getHint());
11507 return getDerived().RebuildOMPHintClause(E.get(),
C->getBeginLoc(),
11508 C->getLParenLoc(),
C->getEndLoc());
11511template <
typename Derived>
11514 ExprResult E = getDerived().TransformExpr(
C->getChunkSize());
11517 return getDerived().RebuildOMPDistScheduleClause(
11518 C->getDistScheduleKind(), E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11519 C->getDistScheduleKindLoc(),
C->getCommaLoc(),
C->getEndLoc());
11522template <
typename Derived>
11528 C->getDefaultmapKind(),
11531 C->getDefaultmapModifierLoc(),
11532 C->getDefaultmapKindLoc(),
11536template <
typename Derived>
11540 Expr *IteratorModifier =
C->getIteratorModifier();
11541 if (IteratorModifier) {
11542 ExprResult MapModRes = getDerived().TransformExpr(IteratorModifier);
11543 if (MapModRes.isInvalid())
11545 IteratorModifier = MapModRes.get();
11551 *
this,
C, Vars, MapperIdScopeSpec, MapperIdInfo, UnresolvedMappers))
11553 return getDerived().RebuildOMPToClause(
11554 C->getMotionModifiers(),
C->getMotionModifiersLoc(), IteratorModifier,
11555 MapperIdScopeSpec, MapperIdInfo,
C->getColonLoc(), Vars, Locs,
11556 UnresolvedMappers);
11559template <
typename Derived>
11563 Expr *IteratorModifier =
C->getIteratorModifier();
11564 if (IteratorModifier) {
11565 ExprResult MapModRes = getDerived().TransformExpr(IteratorModifier);
11566 if (MapModRes.isInvalid())
11568 IteratorModifier = MapModRes.get();
11574 *
this,
C, Vars, MapperIdScopeSpec, MapperIdInfo, UnresolvedMappers))
11576 return getDerived().RebuildOMPFromClause(
11577 C->getMotionModifiers(),
C->getMotionModifiersLoc(), IteratorModifier,
11578 MapperIdScopeSpec, MapperIdInfo,
C->getColonLoc(), Vars, Locs,
11579 UnresolvedMappers);
11582template <
typename Derived>
11586 Vars.reserve(
C->varlist_size());
11587 for (
auto *
VE :
C->varlist()) {
11589 if (EVar.isInvalid())
11591 Vars.push_back(EVar.get());
11594 return getDerived().RebuildOMPUseDevicePtrClause(Vars, Locs);
11597template <
typename Derived>
11601 Vars.reserve(
C->varlist_size());
11602 for (
auto *
VE :
C->varlist()) {
11604 if (EVar.isInvalid())
11606 Vars.push_back(EVar.get());
11609 return getDerived().RebuildOMPUseDeviceAddrClause(Vars, Locs);
11612template <
typename Derived>
11616 Vars.reserve(
C->varlist_size());
11617 for (
auto *
VE :
C->varlist()) {
11619 if (EVar.isInvalid())
11621 Vars.push_back(EVar.get());
11624 return getDerived().RebuildOMPIsDevicePtrClause(Vars, Locs);
11627template <
typename Derived>
11631 Vars.reserve(
C->varlist_size());
11632 for (
auto *
VE :
C->varlist()) {
11634 if (EVar.isInvalid())
11636 Vars.push_back(EVar.get());
11639 return getDerived().RebuildOMPHasDeviceAddrClause(Vars, Locs);
11642template <
typename Derived>
11646 Vars.reserve(
C->varlist_size());
11647 for (
auto *
VE :
C->varlist()) {
11649 if (EVar.isInvalid())
11651 Vars.push_back(EVar.get());
11653 return getDerived().RebuildOMPNontemporalClause(
11654 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11657template <
typename Derived>
11661 Vars.reserve(
C->varlist_size());
11662 for (
auto *
VE :
C->varlist()) {
11664 if (EVar.isInvalid())
11666 Vars.push_back(EVar.get());
11668 return getDerived().RebuildOMPInclusiveClause(
11669 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11672template <
typename Derived>
11676 Vars.reserve(
C->varlist_size());
11677 for (
auto *
VE :
C->varlist()) {
11679 if (EVar.isInvalid())
11681 Vars.push_back(EVar.get());
11683 return getDerived().RebuildOMPExclusiveClause(
11684 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11687template <
typename Derived>
11691 Data.reserve(
C->getNumberOfAllocators());
11692 for (
unsigned I = 0, E =
C->getNumberOfAllocators(); I < E; ++I) {
11694 ExprResult Allocator = getDerived().TransformExpr(D.Allocator);
11695 if (Allocator.isInvalid())
11698 if (
Expr *AT = D.AllocatorTraits) {
11699 AllocatorTraits = getDerived().TransformExpr(AT);
11700 if (AllocatorTraits.isInvalid())
11704 NewD.Allocator = Allocator.get();
11705 NewD.AllocatorTraits = AllocatorTraits.get();
11706 NewD.LParenLoc = D.LParenLoc;
11707 NewD.RParenLoc = D.RParenLoc;
11709 return getDerived().RebuildOMPUsesAllocatorsClause(
11710 Data,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11713template <
typename Derived>
11717 Locators.reserve(
C->varlist_size());
11719 if (
Expr *Modifier =
C->getModifier()) {
11720 ModifierRes = getDerived().TransformExpr(Modifier);
11721 if (ModifierRes.isInvalid())
11724 for (
Expr *E :
C->varlist()) {
11725 ExprResult Locator = getDerived().TransformExpr(E);
11726 if (Locator.isInvalid())
11728 Locators.push_back(Locator.get());
11730 return getDerived().RebuildOMPAffinityClause(
11731 C->getBeginLoc(),
C->getLParenLoc(),
C->getColonLoc(),
C->getEndLoc(),
11732 ModifierRes.get(), Locators);
11735template <
typename Derived>
11738 C->getKind(),
C->getKindKwLoc(),
C->getBeginLoc(),
C->getLParenLoc(),
11739 C->getEndLoc(),
C->getModifier(),
C->getModifierKwLoc());
11742template <
typename Derived>
11745 C->getBindKind(),
C->getBindKindLoc(),
C->getBeginLoc(),
11746 C->getLParenLoc(),
C->getEndLoc());
11749template <
typename Derived>
11753 if (
Size.isInvalid())
11755 return getDerived().RebuildOMPXDynCGroupMemClause(
11756 Size.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11759template <
typename Derived>
11763 if (
Size.isInvalid())
11765 return getDerived().RebuildOMPDynGroupprivateClause(
11766 C->getDynGroupprivateModifier(),
C->getDynGroupprivateFallbackModifier(),
11767 Size.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11768 C->getDynGroupprivateModifierLoc(),
11769 C->getDynGroupprivateFallbackModifierLoc(),
C->getEndLoc());
11772template <
typename Derived>
11776 Vars.reserve(
C->varlist_size());
11777 for (
auto *
VE :
C->varlist()) {
11779 if (EVar.isInvalid())
11781 Vars.push_back(EVar.get());
11783 return getDerived().RebuildOMPDoacrossClause(
11784 C->getDependenceType(),
C->getDependenceLoc(),
C->getColonLoc(), Vars,
11785 C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11788template <
typename Derived>
11792 for (
auto *A :
C->getAttrs())
11793 NewAttrs.push_back(getDerived().TransformAttr(A));
11794 return getDerived().RebuildOMPXAttributeClause(
11795 NewAttrs,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11798template <
typename Derived>
11807template <
typename Derived>
11808class OpenACCClauseTransform final
11810 TreeTransform<Derived> &Self;
11811 ArrayRef<const OpenACCClause *> ExistingClauses;
11812 SemaOpenACC::OpenACCParsedClause &ParsedClause;
11813 OpenACCClause *NewClause =
nullptr;
11816 ExprResult Res = Self.TransformExpr(VarRef);
11818 if (!Res.isUsable())
11821 Res = Self.getSema().OpenACC().ActOnVar(ParsedClause.getDirectiveKind(),
11822 ParsedClause.getClauseKind(),
11828 llvm::SmallVector<Expr *> VisitVarList(ArrayRef<Expr *> VarList) {
11829 llvm::SmallVector<Expr *> InstantiatedVarList;
11830 for (Expr *CurVar : VarList) {
11833 if (VarRef.isUsable())
11834 InstantiatedVarList.push_back(VarRef.get());
11837 return InstantiatedVarList;
11841 OpenACCClauseTransform(TreeTransform<Derived> &Self,
11842 ArrayRef<const OpenACCClause *> ExistingClauses,
11843 SemaOpenACC::OpenACCParsedClause &PC)
11844 : Self(Self), ExistingClauses(ExistingClauses), ParsedClause(PC) {}
11846 OpenACCClause *CreatedClause()
const {
return NewClause; }
11848#define VISIT_CLAUSE(CLAUSE_NAME) \
11849 void Visit##CLAUSE_NAME##Clause(const OpenACC##CLAUSE_NAME##Clause &Clause);
11850#include "clang/Basic/OpenACCClauses.def"
11853template <
typename Derived>
11854void OpenACCClauseTransform<Derived>::VisitDefaultClause(
11856 ParsedClause.setDefaultDetails(
C.getDefaultClauseKind());
11859 Self.getSema().getASTContext(), ParsedClause.getDefaultClauseKind(),
11860 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
11861 ParsedClause.getEndLoc());
11864template <
typename Derived>
11865void OpenACCClauseTransform<Derived>::VisitIfClause(
const OpenACCIfClause &
C) {
11867 assert(
Cond &&
"If constructed with invalid Condition");
11871 if (Res.isInvalid() || !Res.get().second)
11874 ParsedClause.setConditionDetails(Res.get().second);
11877 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
11878 ParsedClause.getLParenLoc(), ParsedClause.getConditionExpr(),
11879 ParsedClause.getEndLoc());
11882template <
typename Derived>
11883void OpenACCClauseTransform<Derived>::VisitSelfClause(
11889 for (
Expr *CurVar :
C.getVarList()) {
11892 if (!Res.isUsable())
11895 Res =
Self.getSema().OpenACC().ActOnVar(ParsedClause.getDirectiveKind(),
11896 ParsedClause.getClauseKind(),
11899 if (Res.isUsable())
11900 InstantiatedVarList.push_back(Res.get());
11903 ParsedClause.setVarListDetails(InstantiatedVarList,
11907 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
11908 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
11909 ParsedClause.getEndLoc());
11912 if (
C.hasConditionExpr()) {
11915 Self.TransformCondition(
Cond->getExprLoc(),
nullptr,
Cond,
11918 if (Res.isInvalid() || !Res.get().second)
11921 ParsedClause.setConditionDetails(Res.get().second);
11925 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
11926 ParsedClause.getLParenLoc(), ParsedClause.getConditionExpr(),
11927 ParsedClause.getEndLoc());
11931template <
typename Derived>
11932void OpenACCClauseTransform<Derived>::VisitNumGangsClause(
11936 for (
Expr *CurIntExpr :
C.getIntExprs()) {
11939 if (!Res.isUsable())
11944 C.getBeginLoc(), Res.get());
11945 if (!Res.isUsable())
11948 InstantiatedIntExprs.push_back(Res.get());
11951 ParsedClause.setIntExprDetails(InstantiatedIntExprs);
11953 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
11954 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs(),
11955 ParsedClause.getEndLoc());
11958template <
typename Derived>
11959void OpenACCClauseTransform<Derived>::VisitPrivateClause(
11964 for (
const auto [RefExpr, InitRecipe] :
11965 llvm::zip(
C.getVarList(),
C.getInitRecipes())) {
11968 if (VarRef.isUsable()) {
11969 InstantiatedVarList.push_back(VarRef.get());
11973 if (InitRecipe.isSet())
11974 InitRecipes.push_back(InitRecipe);
11976 InitRecipes.push_back(
11977 Self.getSema().OpenACC().CreatePrivateInitRecipe(VarRef.get()));
11980 ParsedClause.setVarListDetails(InstantiatedVarList,
11984 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
11985 ParsedClause.getLParenLoc(), ParsedClause.getVarList(), InitRecipes,
11986 ParsedClause.getEndLoc());
11989template <
typename Derived>
11990void OpenACCClauseTransform<Derived>::VisitHostClause(
11992 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
11996 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
11997 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
11998 ParsedClause.getEndLoc());
12001template <
typename Derived>
12002void OpenACCClauseTransform<Derived>::VisitDeviceClause(
12004 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12008 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12009 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12010 ParsedClause.getEndLoc());
12013template <
typename Derived>
12014void OpenACCClauseTransform<Derived>::VisitFirstPrivateClause(
12019 for (
const auto [RefExpr, InitRecipe] :
12020 llvm::zip(
C.getVarList(),
C.getInitRecipes())) {
12023 if (VarRef.isUsable()) {
12024 InstantiatedVarList.push_back(VarRef.get());
12028 if (InitRecipe.isSet())
12029 InitRecipes.push_back(InitRecipe);
12031 InitRecipes.push_back(
12032 Self.getSema().OpenACC().CreateFirstPrivateInitRecipe(
12036 ParsedClause.setVarListDetails(InstantiatedVarList,
12040 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12041 ParsedClause.getLParenLoc(), ParsedClause.getVarList(), InitRecipes,
12042 ParsedClause.getEndLoc());
12045template <
typename Derived>
12046void OpenACCClauseTransform<Derived>::VisitNoCreateClause(
12048 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12052 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12053 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12054 ParsedClause.getEndLoc());
12057template <
typename Derived>
12058void OpenACCClauseTransform<Derived>::VisitPresentClause(
12060 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12064 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12065 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12066 ParsedClause.getEndLoc());
12069template <
typename Derived>
12070void OpenACCClauseTransform<Derived>::VisitCopyClause(
12072 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12073 C.getModifierList());
12076 Self.getSema().getASTContext(), ParsedClause.getClauseKind(),
12077 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12078 ParsedClause.getModifierList(), ParsedClause.getVarList(),
12079 ParsedClause.getEndLoc());
12082template <
typename Derived>
12083void OpenACCClauseTransform<Derived>::VisitLinkClause(
12085 llvm_unreachable(
"link clause not valid unless a decl transform");
12088template <
typename Derived>
12089void OpenACCClauseTransform<Derived>::VisitDeviceResidentClause(
12091 llvm_unreachable(
"device_resident clause not valid unless a decl transform");
12093template <
typename Derived>
12094void OpenACCClauseTransform<Derived>::VisitNoHostClause(
12096 llvm_unreachable(
"nohost clause not valid unless a decl transform");
12098template <
typename Derived>
12099void OpenACCClauseTransform<Derived>::VisitBindClause(
12101 llvm_unreachable(
"bind clause not valid unless a decl transform");
12104template <
typename Derived>
12105void OpenACCClauseTransform<Derived>::VisitCopyInClause(
12107 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12108 C.getModifierList());
12111 Self.getSema().getASTContext(), ParsedClause.getClauseKind(),
12112 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12113 ParsedClause.getModifierList(), ParsedClause.getVarList(),
12114 ParsedClause.getEndLoc());
12117template <
typename Derived>
12118void OpenACCClauseTransform<Derived>::VisitCopyOutClause(
12120 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12121 C.getModifierList());
12124 Self.getSema().getASTContext(), ParsedClause.getClauseKind(),
12125 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12126 ParsedClause.getModifierList(), ParsedClause.getVarList(),
12127 ParsedClause.getEndLoc());
12130template <
typename Derived>
12131void OpenACCClauseTransform<Derived>::VisitCreateClause(
12133 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12134 C.getModifierList());
12137 Self.getSema().getASTContext(), ParsedClause.getClauseKind(),
12138 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12139 ParsedClause.getModifierList(), ParsedClause.getVarList(),
12140 ParsedClause.getEndLoc());
12142template <
typename Derived>
12143void OpenACCClauseTransform<Derived>::VisitAttachClause(
12148 llvm::erase_if(VarList, [&](
Expr *E) {
12149 return Self.getSema().OpenACC().CheckVarIsPointerType(
12155 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12156 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12157 ParsedClause.getEndLoc());
12160template <
typename Derived>
12161void OpenACCClauseTransform<Derived>::VisitDetachClause(
12166 llvm::erase_if(VarList, [&](
Expr *E) {
12167 return Self.getSema().OpenACC().CheckVarIsPointerType(
12173 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12174 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12175 ParsedClause.getEndLoc());
12178template <
typename Derived>
12179void OpenACCClauseTransform<Derived>::VisitDeleteClause(
12181 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12184 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12185 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12186 ParsedClause.getEndLoc());
12189template <
typename Derived>
12190void OpenACCClauseTransform<Derived>::VisitUseDeviceClause(
12192 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12195 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12196 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12197 ParsedClause.getEndLoc());
12200template <
typename Derived>
12201void OpenACCClauseTransform<Derived>::VisitDevicePtrClause(
12206 llvm::erase_if(VarList, [&](
Expr *E) {
12207 return Self.getSema().OpenACC().CheckVarIsPointerType(
12213 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12214 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12215 ParsedClause.getEndLoc());
12218template <
typename Derived>
12219void OpenACCClauseTransform<Derived>::VisitNumWorkersClause(
12221 Expr *IntExpr =
const_cast<Expr *
>(
C.getIntExpr());
12222 assert(IntExpr &&
"num_workers clause constructed with invalid int expr");
12225 if (!Res.isUsable())
12230 C.getBeginLoc(), Res.get());
12231 if (!Res.isUsable())
12234 ParsedClause.setIntExprDetails(Res.get());
12236 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12237 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs()[0],
12238 ParsedClause.getEndLoc());
12241template <
typename Derived>
12242void OpenACCClauseTransform<Derived>::VisitDeviceNumClause (
12244 Expr *IntExpr =
const_cast<Expr *
>(
C.getIntExpr());
12245 assert(IntExpr &&
"device_num clause constructed with invalid int expr");
12248 if (!Res.isUsable())
12253 C.getBeginLoc(), Res.get());
12254 if (!Res.isUsable())
12257 ParsedClause.setIntExprDetails(Res.get());
12259 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12260 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs()[0],
12261 ParsedClause.getEndLoc());
12264template <
typename Derived>
12265void OpenACCClauseTransform<Derived>::VisitDefaultAsyncClause(
12267 Expr *IntExpr =
const_cast<Expr *
>(
C.getIntExpr());
12268 assert(IntExpr &&
"default_async clause constructed with invalid int expr");
12271 if (!Res.isUsable())
12276 C.getBeginLoc(), Res.get());
12277 if (!Res.isUsable())
12280 ParsedClause.setIntExprDetails(Res.get());
12282 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12283 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs()[0],
12284 ParsedClause.getEndLoc());
12287template <
typename Derived>
12288void OpenACCClauseTransform<Derived>::VisitVectorLengthClause(
12290 Expr *IntExpr =
const_cast<Expr *
>(
C.getIntExpr());
12291 assert(IntExpr &&
"vector_length clause constructed with invalid int expr");
12294 if (!Res.isUsable())
12299 C.getBeginLoc(), Res.get());
12300 if (!Res.isUsable())
12303 ParsedClause.setIntExprDetails(Res.get());
12305 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12306 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs()[0],
12307 ParsedClause.getEndLoc());
12310template <
typename Derived>
12311void OpenACCClauseTransform<Derived>::VisitAsyncClause(
12313 if (
C.hasIntExpr()) {
12315 if (!Res.isUsable())
12320 C.getBeginLoc(), Res.get());
12321 if (!Res.isUsable())
12323 ParsedClause.setIntExprDetails(Res.get());
12327 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12328 ParsedClause.getLParenLoc(),
12329 ParsedClause.getNumIntExprs() != 0 ? ParsedClause.getIntExprs()[0]
12331 ParsedClause.getEndLoc());
12334template <
typename Derived>
12335void OpenACCClauseTransform<Derived>::VisitWorkerClause(
12337 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>::VisitVectorClause(
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>::VisitWaitClause(
12391 if (
C.hasExprs()) {
12392 Expr *DevNumExpr =
nullptr;
12396 if (
C.getDevNumExpr()) {
12398 if (!Res.isUsable())
12402 C.getBeginLoc(), Res.get());
12403 if (!Res.isUsable())
12406 DevNumExpr = Res.get();
12410 for (
Expr *CurQueueIdExpr :
C.getQueueIdExprs()) {
12412 if (!Res.isUsable())
12416 C.getBeginLoc(), Res.get());
12417 if (!Res.isUsable())
12420 InstantiatedQueueIdExprs.push_back(Res.get());
12423 ParsedClause.setWaitDetails(DevNumExpr,
C.getQueuesLoc(),
12424 std::move(InstantiatedQueueIdExprs));
12428 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12429 ParsedClause.getLParenLoc(), ParsedClause.getDevNumExpr(),
12430 ParsedClause.getQueuesLoc(), ParsedClause.getQueueIdExprs(),
12431 ParsedClause.getEndLoc());
12434template <
typename Derived>
12435void OpenACCClauseTransform<Derived>::VisitDeviceTypeClause(
12439 Self.getSema().getASTContext(),
C.getClauseKind(),
12440 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12441 C.getArchitectures(), ParsedClause.getEndLoc());
12444template <
typename Derived>
12445void OpenACCClauseTransform<Derived>::VisitAutoClause(
12449 ParsedClause.getBeginLoc(),
12450 ParsedClause.getEndLoc());
12453template <
typename Derived>
12454void OpenACCClauseTransform<Derived>::VisitIndependentClause(
12457 ParsedClause.getBeginLoc(),
12458 ParsedClause.getEndLoc());
12461template <
typename Derived>
12462void OpenACCClauseTransform<Derived>::VisitSeqClause(
12465 ParsedClause.getBeginLoc(),
12466 ParsedClause.getEndLoc());
12468template <
typename Derived>
12469void OpenACCClauseTransform<Derived>::VisitFinalizeClause(
12472 ParsedClause.getBeginLoc(),
12473 ParsedClause.getEndLoc());
12476template <
typename Derived>
12477void OpenACCClauseTransform<Derived>::VisitIfPresentClause(
12480 ParsedClause.getBeginLoc(),
12481 ParsedClause.getEndLoc());
12484template <
typename Derived>
12485void OpenACCClauseTransform<Derived>::VisitReductionClause(
12491 for (
const auto [Var, OrigRecipe] :
12492 llvm::zip(TransformedVars,
C.getRecipes())) {
12494 ParsedClause.getDirectiveKind(),
C.getReductionOp(), Var);
12495 if (Res.isUsable()) {
12496 ValidVars.push_back(Res.get());
12498 if (OrigRecipe.isSet())
12499 Recipes.emplace_back(OrigRecipe.AllocaDecl, OrigRecipe.CombinerRecipes);
12501 Recipes.push_back(
Self.getSema().OpenACC().CreateReductionInitRecipe(
12502 C.getReductionOp(), Res.get()));
12506 NewClause =
Self.getSema().OpenACC().CheckReductionClause(
12507 ExistingClauses, ParsedClause.getDirectiveKind(),
12508 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12509 C.getReductionOp(), ValidVars, Recipes, ParsedClause.getEndLoc());
12512template <
typename Derived>
12513void OpenACCClauseTransform<Derived>::VisitCollapseClause(
12515 Expr *LoopCount =
const_cast<Expr *
>(
C.getLoopCount());
12516 assert(LoopCount &&
"collapse clause constructed with invalid loop count");
12520 NewLoopCount =
Self.getSema().OpenACC().ActOnIntExpr(
12522 NewLoopCount.get()->getBeginLoc(), NewLoopCount.get());
12525 Self.getSema().OpenACC().CheckCollapseLoopCount(NewLoopCount.get());
12527 ParsedClause.setCollapseDetails(
C.hasForce(), NewLoopCount.get());
12529 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12530 ParsedClause.getLParenLoc(), ParsedClause.isForce(),
12531 ParsedClause.getLoopCount(), ParsedClause.getEndLoc());
12534template <
typename Derived>
12535void OpenACCClauseTransform<Derived>::VisitTileClause(
12540 for (
Expr *E :
C.getSizeExprs()) {
12543 if (!NewSizeExpr.isUsable())
12546 NewSizeExpr =
Self.getSema().OpenACC().ActOnIntExpr(
12548 NewSizeExpr.get()->getBeginLoc(), NewSizeExpr.get());
12550 NewSizeExpr =
Self.getSema().OpenACC().CheckTileSizeExpr(NewSizeExpr.get());
12552 if (!NewSizeExpr.isUsable())
12554 TransformedExprs.push_back(NewSizeExpr.get());
12557 ParsedClause.setIntExprDetails(TransformedExprs);
12559 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12560 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs(),
12561 ParsedClause.getEndLoc());
12563template <
typename Derived>
12564void OpenACCClauseTransform<Derived>::VisitGangClause(
12569 for (
unsigned I = 0; I <
C.getNumExprs(); ++I) {
12571 if (!ER.isUsable())
12574 ER =
Self.getSema().OpenACC().CheckGangExpr(ExistingClauses,
12575 ParsedClause.getDirectiveKind(),
12576 C.getExpr(I).first, ER.get());
12577 if (!ER.isUsable())
12579 TransformedGangKinds.push_back(
C.getExpr(I).first);
12580 TransformedIntExprs.push_back(ER.get());
12583 NewClause =
Self.getSema().OpenACC().CheckGangClause(
12584 ParsedClause.getDirectiveKind(), ExistingClauses,
12585 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12586 TransformedGangKinds, TransformedIntExprs, ParsedClause.getEndLoc());
12589template <
typename Derived>
12590OpenACCClause *TreeTransform<Derived>::TransformOpenACCClause(
12595 DirKind, OldClause->getClauseKind(), OldClause->getBeginLoc());
12596 ParsedClause.setEndLoc(OldClause->getEndLoc());
12598 if (
const auto *WithParms = dyn_cast<OpenACCClauseWithParams>(OldClause))
12599 ParsedClause.setLParenLoc(WithParms->getLParenLoc());
12601 OpenACCClauseTransform<Derived> Transform{*
this, ExistingClauses,
12603 Transform.Visit(OldClause);
12605 return Transform.CreatedClause();
12608template <
typename Derived>
12610TreeTransform<Derived>::TransformOpenACCClauseList(
12613 for (
const auto *Clause : OldClauses) {
12614 if (
OpenACCClause *TransformedClause = getDerived().TransformOpenACCClause(
12615 TransformedClauses, DirKind, Clause))
12616 TransformedClauses.push_back(TransformedClause);
12618 return TransformedClauses;
12621template <
typename Derived>
12624 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12627 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12630 if (getSema().OpenACC().ActOnStartStmtDirective(
12631 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12636 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
12637 C->clauses(), TransformedClauses);
12638 StmtResult StrBlock = getDerived().TransformStmt(
C->getStructuredBlock());
12639 StrBlock = getSema().OpenACC().ActOnAssociatedStmt(
12640 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses, StrBlock);
12642 return getDerived().RebuildOpenACCComputeConstruct(
12643 C->getDirectiveKind(),
C->getBeginLoc(),
C->getDirectiveLoc(),
12644 C->getEndLoc(), TransformedClauses, StrBlock);
12647template <
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);
12666 Loop = getSema().OpenACC().ActOnAssociatedStmt(
12667 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses,
Loop);
12669 return getDerived().RebuildOpenACCLoopConstruct(
12670 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12671 TransformedClauses,
Loop);
12674template <
typename Derived>
12676 OpenACCCombinedConstruct *
C) {
12677 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12680 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12683 if (getSema().OpenACC().ActOnStartStmtDirective(
12684 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12689 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
12690 C->clauses(), TransformedClauses);
12692 Loop = getSema().OpenACC().ActOnAssociatedStmt(
12693 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses,
Loop);
12695 return getDerived().RebuildOpenACCCombinedConstruct(
12696 C->getDirectiveKind(),
C->getBeginLoc(),
C->getDirectiveLoc(),
12697 C->getEndLoc(), TransformedClauses,
Loop);
12700template <
typename Derived>
12703 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12706 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12708 if (getSema().OpenACC().ActOnStartStmtDirective(
12709 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12713 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
12714 C->clauses(), TransformedClauses);
12715 StmtResult StrBlock = getDerived().TransformStmt(
C->getStructuredBlock());
12716 StrBlock = getSema().OpenACC().ActOnAssociatedStmt(
12717 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses, StrBlock);
12719 return getDerived().RebuildOpenACCDataConstruct(
12720 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12721 TransformedClauses, StrBlock);
12724template <
typename Derived>
12726 OpenACCEnterDataConstruct *
C) {
12727 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12730 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12732 if (getSema().OpenACC().ActOnStartStmtDirective(
12733 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12736 return getDerived().RebuildOpenACCEnterDataConstruct(
12737 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12738 TransformedClauses);
12741template <
typename Derived>
12743 OpenACCExitDataConstruct *
C) {
12744 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12747 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12749 if (getSema().OpenACC().ActOnStartStmtDirective(
12750 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12753 return getDerived().RebuildOpenACCExitDataConstruct(
12754 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12755 TransformedClauses);
12758template <
typename Derived>
12760 OpenACCHostDataConstruct *
C) {
12761 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12764 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12766 if (getSema().OpenACC().ActOnStartStmtDirective(
12767 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12771 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
12772 C->clauses(), TransformedClauses);
12773 StmtResult StrBlock = getDerived().TransformStmt(
C->getStructuredBlock());
12774 StrBlock = getSema().OpenACC().ActOnAssociatedStmt(
12775 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses, StrBlock);
12777 return getDerived().RebuildOpenACCHostDataConstruct(
12778 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12779 TransformedClauses, StrBlock);
12782template <
typename Derived>
12785 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12788 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12790 if (getSema().OpenACC().ActOnStartStmtDirective(
12791 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12794 return getDerived().RebuildOpenACCInitConstruct(
12795 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12796 TransformedClauses);
12799template <
typename Derived>
12801 OpenACCShutdownConstruct *
C) {
12802 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12805 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12807 if (getSema().OpenACC().ActOnStartStmtDirective(
12808 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12811 return getDerived().RebuildOpenACCShutdownConstruct(
12812 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12813 TransformedClauses);
12815template <
typename Derived>
12818 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12821 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12823 if (getSema().OpenACC().ActOnStartStmtDirective(
12824 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12827 return getDerived().RebuildOpenACCSetConstruct(
12828 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12829 TransformedClauses);
12832template <
typename Derived>
12834 OpenACCUpdateConstruct *
C) {
12835 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12838 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12840 if (getSema().OpenACC().ActOnStartStmtDirective(
12841 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12844 return getDerived().RebuildOpenACCUpdateConstruct(
12845 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12846 TransformedClauses);
12849template <
typename Derived>
12852 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12855 if (
C->hasDevNumExpr()) {
12856 DevNumExpr = getDerived().TransformExpr(
C->getDevNumExpr());
12858 if (DevNumExpr.isUsable())
12859 DevNumExpr = getSema().OpenACC().ActOnIntExpr(
12861 C->getBeginLoc(), DevNumExpr.get());
12866 for (
Expr *QE :
C->getQueueIdExprs()) {
12867 assert(QE &&
"Null queue id expr?");
12868 ExprResult NewEQ = getDerived().TransformExpr(QE);
12870 if (!NewEQ.isUsable())
12874 C->getBeginLoc(), NewEQ.get());
12875 if (NewEQ.isUsable())
12876 QueueIdExprs.push_back(NewEQ.get());
12880 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12883 if (getSema().OpenACC().ActOnStartStmtDirective(
12884 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12887 return getDerived().RebuildOpenACCWaitConstruct(
12888 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getLParenLoc(),
12889 DevNumExpr.isUsable() ? DevNumExpr.get() :
nullptr,
C->getQueuesLoc(),
12890 QueueIdExprs,
C->getRParenLoc(),
C->getEndLoc(), TransformedClauses);
12892template <
typename Derived>
12894 OpenACCCacheConstruct *
C) {
12895 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12898 for (
Expr *Var :
C->getVarList()) {
12899 assert(Var &&
"Null var listexpr?");
12901 ExprResult NewVar = getDerived().TransformExpr(Var);
12903 if (!NewVar.isUsable())
12906 NewVar = getSema().OpenACC().ActOnVar(
12908 if (!NewVar.isUsable())
12911 TransformedVarList.push_back(NewVar.get());
12914 if (getSema().OpenACC().ActOnStartStmtDirective(
C->getDirectiveKind(),
12915 C->getBeginLoc(), {}))
12918 return getDerived().RebuildOpenACCCacheConstruct(
12919 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getLParenLoc(),
12920 C->getReadOnlyLoc(), TransformedVarList,
C->getRParenLoc(),
12924template <
typename Derived>
12926 OpenACCAtomicConstruct *
C) {
12927 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12930 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12933 if (getSema().OpenACC().ActOnStartStmtDirective(
C->getDirectiveKind(),
12934 C->getBeginLoc(), {}))
12939 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(), {}, {});
12941 StmtResult AssocStmt = getDerived().TransformStmt(
C->getAssociatedStmt());
12942 AssocStmt = getSema().OpenACC().ActOnAssociatedStmt(
12943 C->getBeginLoc(),
C->getDirectiveKind(),
C->getAtomicKind(), {},
12946 return getDerived().RebuildOpenACCAtomicConstruct(
12947 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getAtomicKind(),
12948 C->getEndLoc(), TransformedClauses, AssocStmt);
12951template <
typename Derived>
12954 if (getDerived().AlwaysRebuild())
12963template<
typename Derived>
12966 return TransformExpr(E->getSubExpr());
12969template <
typename Derived>
12972 if (!E->isTypeDependent())
12975 TypeSourceInfo *NewT = getDerived().TransformType(E->getTypeSourceInfo());
12980 if (!getDerived().AlwaysRebuild() && E->getTypeSourceInfo() == NewT)
12983 return getDerived().RebuildSYCLUniqueStableNameExpr(
12984 E->getLocation(), E->getLParenLocation(), E->getRParenLocation(), NewT);
12987template<
typename Derived>
12990 if (!E->isTypeDependent())
12994 E->getIdentKind());
12997template<
typename Derived>
13001 if (E->getQualifierLoc()) {
13003 = getDerived().TransformNestedNameSpecifierLoc(E->getQualifierLoc());
13009 = cast_or_null<ValueDecl>(getDerived().TransformDecl(E->getLocation(),
13011 if (!ND || ND->isInvalidDecl())
13015 if (E->getFoundDecl() != E->getDecl()) {
13016 Found = cast_or_null<NamedDecl>(
13017 getDerived().TransformDecl(E->getLocation(), E->getFoundDecl()));
13023 if (NameInfo.getName()) {
13024 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
13025 if (!NameInfo.getName())
13029 if (!getDerived().AlwaysRebuild() &&
13030 !E->isCapturedByCopyInLambdaWithExplicitObjectParameter() &&
13031 QualifierLoc == E->getQualifierLoc() && ND == E->getDecl() &&
13032 Found == E->getFoundDecl() &&
13033 NameInfo.getName() == E->getDecl()->getDeclName() &&
13034 !E->hasExplicitTemplateArgs()) {
13044 if (E->hasExplicitTemplateArgs()) {
13045 TemplateArgs = &TransArgs;
13046 TransArgs.setLAngleLoc(E->getLAngleLoc());
13047 TransArgs.setRAngleLoc(E->getRAngleLoc());
13048 if (getDerived().TransformTemplateArguments(E->getTemplateArgs(),
13049 E->getNumTemplateArgs(),
13054 return getDerived().RebuildDeclRefExpr(QualifierLoc, ND, NameInfo,
13055 Found, TemplateArgs);
13058template<
typename Derived>
13064template <
typename Derived>
13070template<
typename Derived>
13076template<
typename Derived>
13082template<
typename Derived>
13088template<
typename Derived>
13094template<
typename Derived>
13097 return getDerived().TransformCallExpr(E);
13100template<
typename Derived>
13105 if (E->isExprPredicate())
13106 ControllingExpr = getDerived().TransformExpr(E->getControllingExpr());
13108 ControllingType = getDerived().TransformType(E->getControllingType());
13110 if (ControllingExpr.isInvalid() && !ControllingType)
13121 AssocTypes.push_back(AssocType);
13123 AssocTypes.push_back(
nullptr);
13127 getDerived().TransformExpr(Assoc.getAssociationExpr());
13128 if (AssocExpr.isInvalid())
13130 AssocExprs.push_back(AssocExpr.get());
13133 if (!ControllingType)
13134 return getDerived().RebuildGenericSelectionExpr(E->getGenericLoc(),
13135 E->getDefaultLoc(),
13137 ControllingExpr.get(),
13140 return getDerived().RebuildGenericSelectionExpr(
13141 E->getGenericLoc(), E->getDefaultLoc(), E->getRParenLoc(),
13142 ControllingType, AssocTypes, AssocExprs);
13145template<
typename Derived>
13148 ExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
13149 if (SubExpr.isInvalid())
13152 if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getSubExpr())
13155 return getDerived().RebuildParenExpr(SubExpr.get(), E->getLParen(),
13162template<
typename Derived>
13166 return getDerived().TransformDependentScopeDeclRefExpr(
13167 DRE,
true,
nullptr);
13169 return getDerived().TransformUnresolvedLookupExpr(
13175template<
typename Derived>
13180 SubExpr = TransformAddressOfOperand(E->
getSubExpr());
13186 if (!getDerived().AlwaysRebuild() && SubExpr.
get() == E->
getSubExpr())
13194template<
typename Derived>
13196TreeTransform<Derived>::TransformOffsetOfExpr(OffsetOfExpr *E) {
13198 TypeSourceInfo *Type = getDerived().TransformType(E->getTypeSourceInfo());
13208 bool ExprChanged =
false;
13209 typedef Sema::OffsetOfComponent Component;
13211 for (
unsigned I = 0, N = E->getNumComponents(); I != N; ++I) {
13212 const OffsetOfNode &ON = E->getComponent(I);
13214 Comp.isBrackets =
true;
13215 Comp.LocStart = ON.getSourceRange().getBegin();
13216 Comp.LocEnd = ON.getSourceRange().getEnd();
13217 switch (ON.getKind()) {
13219 Expr *FromIndex = E->getIndexExpr(ON.getArrayExprIndex());
13220 ExprResult Index = getDerived().TransformExpr(FromIndex);
13221 if (Index.isInvalid())
13224 ExprChanged = ExprChanged || Index.get() != FromIndex;
13225 Comp.isBrackets =
true;
13226 Comp.U.E = Index.get();
13232 Comp.isBrackets =
false;
13233 Comp.U.IdentInfo = ON.getFieldName();
13234 if (!
Comp.U.IdentInfo)
13244 Components.push_back(Comp);
13248 if (!getDerived().AlwaysRebuild() &&
13249 Type == E->getTypeSourceInfo() &&
13254 return getDerived().RebuildOffsetOfExpr(E->getOperatorLoc(),
Type,
13255 Components, E->getRParenLoc());
13258template<
typename Derived>
13261 assert((!E->getSourceExpr() || getDerived().AlreadyTransformed(E->getType())) &&
13262 "opaque value expression requires transformation");
13266template <
typename Derived>
13270 for (
Expr *
C : E->subExpressions()) {
13272 if (NewC.isInvalid())
13278 if (!getDerived().AlwaysRebuild() && !Changed)
13280 return getDerived().RebuildRecoveryExpr(E->getBeginLoc(), E->getEndLoc(),
13284template<
typename Derived>
13294 ExprResult result = getDerived().TransformExpr(newSyntacticForm);
13295 if (result.isInvalid())
return ExprError();
13300 if (result.get()->hasPlaceholderType(BuiltinType::PseudoObject))
13306template<
typename Derived>
13310 if (E->isArgumentType()) {
13317 if (!getDerived().AlwaysRebuild() && OldT == NewT)
13320 return getDerived().RebuildUnaryExprOrTypeTrait(NewT, E->getOperatorLoc(),
13322 E->getSourceRange());
13336 auto *PE = dyn_cast<ParenExpr>(E->getArgumentExpr());
13338 PE ? dyn_cast<DependentScopeDeclRefExpr>(PE->getSubExpr()) :
nullptr)
13339 SubExpr = getDerived().TransformParenDependentScopeDeclRefExpr(
13340 PE, DRE,
false, &RecoveryTSI);
13342 SubExpr = getDerived().TransformExpr(E->getArgumentExpr());
13345 return getDerived().RebuildUnaryExprOrTypeTrait(
13346 RecoveryTSI, E->getOperatorLoc(), E->getKind(), E->getSourceRange());
13347 }
else if (SubExpr.isInvalid())
13350 if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getArgumentExpr())
13353 return getDerived().RebuildUnaryExprOrTypeTrait(SubExpr.get(),
13354 E->getOperatorLoc(),
13356 E->getSourceRange());
13359template<
typename Derived>
13362 ExprResult LHS = getDerived().TransformExpr(E->getLHS());
13363 if (LHS.isInvalid())
13366 ExprResult RHS = getDerived().TransformExpr(E->getRHS());
13367 if (RHS.isInvalid())
13371 if (!getDerived().AlwaysRebuild() &&
13372 LHS.get() == E->getLHS() &&
13373 RHS.get() == E->getRHS())
13376 return getDerived().RebuildArraySubscriptExpr(
13378 E->getLHS()->getBeginLoc(), RHS.get(), E->getRBracketLoc());
13381template <
typename Derived>
13385 if (
Base.isInvalid())
13388 ExprResult RowIdx = getDerived().TransformExpr(E->getRowIdx());
13389 if (RowIdx.isInvalid())
13392 ExprResult ColumnIdx = getDerived().TransformExpr(E->getColumnIdx());
13393 if (ColumnIdx.isInvalid())
13396 if (!getDerived().AlwaysRebuild() &&
Base.get() == E->getBase() &&
13397 RowIdx.get() == E->getRowIdx() && ColumnIdx.get() == E->getColumnIdx())
13400 return getDerived().RebuildMatrixSubscriptExpr(
13401 Base.get(), RowIdx.get(), ColumnIdx.get(), E->getRBracketLoc());
13404template <
typename Derived>
13408 if (
Base.isInvalid())
13412 if (E->getLowerBound()) {
13413 LowerBound = getDerived().TransformExpr(E->getLowerBound());
13414 if (LowerBound.isInvalid())
13419 if (E->getLength()) {
13420 Length = getDerived().TransformExpr(E->getLength());
13421 if (Length.isInvalid())
13426 if (E->isOMPArraySection()) {
13427 if (
Expr *Str = E->getStride()) {
13428 Stride = getDerived().TransformExpr(Str);
13429 if (Stride.isInvalid())
13434 if (!getDerived().AlwaysRebuild() &&
Base.get() == E->getBase() &&
13435 LowerBound.get() == E->getLowerBound() &&
13436 Length.get() == E->getLength() &&
13437 (E->isOpenACCArraySection() || Stride.get() == E->getStride()))
13440 return getDerived().RebuildArraySectionExpr(
13441 E->isOMPArraySection(),
Base.get(), E->getBase()->getEndLoc(),
13442 LowerBound.get(), E->getColonLocFirst(),
13443 E->isOMPArraySection() ? E->getColonLocSecond() :
SourceLocation{},
13444 Length.get(), Stride.get(), E->getRBracketLoc());
13447template <
typename Derived>
13451 if (
Base.isInvalid())
13455 bool ErrorFound =
false;
13456 for (
Expr *
Dim : E->getDimensions()) {
13458 if (DimRes.isInvalid()) {
13462 Dims.push_back(DimRes.get());
13467 return getDerived().RebuildOMPArrayShapingExpr(
Base.get(), E->getLParenLoc(),
13468 E->getRParenLoc(), Dims,
13469 E->getBracketsRanges());
13472template <
typename Derived>
13475 unsigned NumIterators = E->numOfIterators();
13478 bool ErrorFound =
false;
13479 bool NeedToRebuild = getDerived().AlwaysRebuild();
13480 for (
unsigned I = 0; I < NumIterators; ++I) {
13482 Data[I].DeclIdent = D->getIdentifier();
13483 Data[I].DeclIdentLoc = D->getLocation();
13484 if (D->getLocation() == D->getBeginLoc()) {
13486 "Implicit type must be int.");
13488 TypeSourceInfo *TSI = getDerived().TransformType(D->getTypeSourceInfo());
13496 ErrorFound = ErrorFound ||
13497 !(!D->getTypeSourceInfo() || (
Data[I].
Type.getAsOpaquePtr() &&
13498 !
Data[I].Type.get().isNull())) ||
13499 Begin.isInvalid() || End.isInvalid() || Step.isInvalid();
13502 Data[I].Range.Begin = Begin.get();
13503 Data[I].Range.End = End.get();
13504 Data[I].Range.Step = Step.get();
13505 Data[I].AssignLoc = E->getAssignLoc(I);
13506 Data[I].ColonLoc = E->getColonLoc(I);
13507 Data[I].SecColonLoc = E->getSecondColonLoc(I);
13510 (D->getTypeSourceInfo() &&
Data[I].
Type.get().getTypePtrOrNull() !=
13511 D->getType().getTypePtrOrNull()) ||
13517 if (!NeedToRebuild)
13520 ExprResult Res = getDerived().RebuildOMPIteratorExpr(
13521 E->getIteratorKwLoc(), E->getLParenLoc(), E->getRParenLoc(),
Data);
13522 if (!Res.isUsable())
13525 for (
unsigned I = 0; I < NumIterators; ++I)
13526 getDerived().transformedLocalDecl(E->getIteratorDecl(I),
13527 IE->getIteratorDecl(I));
13531template<
typename Derived>
13540 bool ArgChanged =
false;
13542 if (getDerived().TransformExprs(E->getArgs(), E->getNumArgs(),
true, Args,
13546 if (!getDerived().AlwaysRebuild() &&
13547 Callee.get() == E->getCallee() &&
13553 = ((
Expr *)
Callee.get())->getSourceRange().getBegin();
13556 if (E->hasStoredFPFeatures()) {
13558 getSema().CurFPFeatures =
13560 getSema().FpPragmaStack.CurrentValue = NewOverrides;
13563 return getDerived().RebuildCallExpr(
Callee.get(), FakeLParenLoc,
13565 E->getRParenLoc());
13568template<
typename Derived>
13572 if (
Base.isInvalid())
13576 if (E->hasQualifier()) {
13578 = getDerived().TransformNestedNameSpecifierLoc(E->getQualifierLoc());
13586 = cast_or_null<ValueDecl>(getDerived().TransformDecl(E->getMemberLoc(),
13587 E->getMemberDecl()));
13591 NamedDecl *FoundDecl = E->getFoundDecl();
13592 if (FoundDecl == E->getMemberDecl()) {
13595 FoundDecl = cast_or_null<NamedDecl>(
13596 getDerived().TransformDecl(E->getMemberLoc(), FoundDecl));
13601 if (!getDerived().AlwaysRebuild() &&
13602 Base.get() == E->getBase() &&
13603 QualifierLoc == E->getQualifierLoc() &&
13604 Member == E->getMemberDecl() &&
13605 FoundDecl == E->getFoundDecl() &&
13606 !E->hasExplicitTemplateArgs()) {
13611 getSema().OpenMP().isOpenMPRebuildMemberExpr(
13621 if (E->hasExplicitTemplateArgs()) {
13622 TransArgs.setLAngleLoc(E->getLAngleLoc());
13623 TransArgs.setRAngleLoc(E->getRAngleLoc());
13624 if (getDerived().TransformTemplateArguments(E->getTemplateArgs(),
13625 E->getNumTemplateArgs(),
13638 NamedDecl *FirstQualifierInScope =
nullptr;
13640 if (MemberNameInfo.getName()) {
13641 MemberNameInfo = getDerived().TransformDeclarationNameInfo(MemberNameInfo);
13642 if (!MemberNameInfo.getName())
13646 return getDerived().RebuildMemberExpr(
Base.get(), FakeOperatorLoc,
13653 (E->hasExplicitTemplateArgs()
13654 ? &TransArgs :
nullptr),
13655 FirstQualifierInScope);
13658template<
typename Derived>
13661 ExprResult LHS = getDerived().TransformExpr(E->getLHS());
13662 if (LHS.isInvalid())
13666 getDerived().TransformInitializer(E->getRHS(),
false);
13667 if (RHS.isInvalid())
13670 if (!getDerived().AlwaysRebuild() &&
13671 LHS.get() == E->getLHS() &&
13672 RHS.get() == E->getRHS())
13675 if (E->isCompoundAssignmentOp())
13677 return getDerived().RebuildBinaryOperator(
13678 E->getOperatorLoc(), E->getOpcode(), LHS.get(), RHS.get());
13681 getSema().CurFPFeatures =
13682 NewOverrides.applyOverrides(getSema().getLangOpts());
13683 getSema().FpPragmaStack.CurrentValue = NewOverrides;
13684 return getDerived().RebuildBinaryOperator(E->getOperatorLoc(), E->getOpcode(),
13685 LHS.get(), RHS.get());
13688template <
typename Derived>
13693 ExprResult LHS = getDerived().TransformExpr(
const_cast<Expr*
>(Decomp.LHS));
13694 if (LHS.isInvalid())
13697 ExprResult RHS = getDerived().TransformExpr(
const_cast<Expr*
>(Decomp.RHS));
13698 if (RHS.isInvalid())
13704 bool ChangedAnyLookups =
false;
13705 Expr *PossibleBinOps[] = {E->getSemanticForm(),
13706 const_cast<Expr *
>(Decomp.InnerBinOp)};
13707 for (
Expr *PossibleBinOp : PossibleBinOps) {
13708 auto *Op = dyn_cast<CXXOperatorCallExpr>(PossibleBinOp->IgnoreImplicit());
13711 auto *
Callee = dyn_cast<DeclRefExpr>(Op->getCallee()->IgnoreImplicit());
13717 NamedDecl *
Found = cast_or_null<NamedDecl>(getDerived().TransformDecl(
13718 E->getOperatorLoc(),
Callee->getFoundDecl()));
13722 ChangedAnyLookups =
true;
13723 UnqualLookups.addDecl(
Found);
13726 if (!getDerived().AlwaysRebuild() && !ChangedAnyLookups &&
13727 LHS.get() == Decomp.LHS && RHS.get() == Decomp.RHS) {
13733 const Expr *StopAt[] = {Decomp.LHS, Decomp.RHS};
13738 return getDerived().RebuildCXXRewrittenBinaryOperator(
13739 E->getOperatorLoc(), Decomp.Opcode, UnqualLookups, LHS.get(), RHS.get());
13742template<
typename Derived>
13748 getSema().CurFPFeatures =
13749 NewOverrides.applyOverrides(getSema().getLangOpts());
13750 getSema().FpPragmaStack.CurrentValue = NewOverrides;
13751 return getDerived().TransformBinaryOperator(E);
13754template<
typename Derived>
13760 ExprResult commonExpr = getDerived().TransformExpr(e->getCommon());
13761 if (commonExpr.isInvalid())
13764 ExprResult rhs = getDerived().TransformExpr(e->getFalseExpr());
13765 if (rhs.isInvalid())
13768 if (!getDerived().AlwaysRebuild() &&
13769 commonExpr.get() == e->getCommon() &&
13770 rhs.get() == e->getFalseExpr())
13773 return getDerived().RebuildConditionalOperator(commonExpr.get(),
13774 e->getQuestionLoc(),
13780template<
typename Derived>
13784 if (
Cond.isInvalid())
13787 ExprResult LHS = getDerived().TransformExpr(E->getLHS());
13788 if (LHS.isInvalid())
13791 ExprResult RHS = getDerived().TransformExpr(E->getRHS());
13792 if (RHS.isInvalid())
13795 if (!getDerived().AlwaysRebuild() &&
13796 Cond.get() == E->getCond() &&
13797 LHS.get() == E->getLHS() &&
13798 RHS.get() == E->getRHS())
13801 return getDerived().RebuildConditionalOperator(
Cond.get(),
13802 E->getQuestionLoc(),
13808template<
typename Derived>
13813 return getDerived().
TransformExpr(E->getSubExprAsWritten());
13816template<
typename Derived>
13824 = getDerived().TransformExpr(E->getSubExprAsWritten());
13825 if (SubExpr.isInvalid())
13828 if (!getDerived().AlwaysRebuild() &&
13829 Type == E->getTypeInfoAsWritten() &&
13830 SubExpr.get() == E->getSubExpr())
13833 return getDerived().RebuildCStyleCastExpr(E->getLParenLoc(),
13839template<
typename Derived>
13847 ExprResult Init = getDerived().TransformExpr(E->getInitializer());
13848 if (
Init.isInvalid())
13851 if (!getDerived().AlwaysRebuild() &&
13853 Init.get() == E->getInitializer())
13860 return getDerived().RebuildCompoundLiteralExpr(
13861 E->getLParenLoc(), NewT,
13862 E->getInitializer()->getEndLoc(),
Init.get());
13865template<
typename Derived>
13869 if (
Base.isInvalid())
13872 if (!getDerived().AlwaysRebuild() &&
13873 Base.get() == E->getBase())
13879 return getDerived().RebuildExtVectorElementExpr(
13880 Base.get(), FakeOperatorLoc, E->isArrow(), E->getAccessorLoc(),
13884template<
typename Derived>
13890 bool InitChanged =
false;
13896 if (getDerived().TransformExprs(E->getInits(), E->getNumInits(),
false,
13897 Inits, &InitChanged))
13900 if (!getDerived().AlwaysRebuild() && !InitChanged) {
13907 return getDerived().RebuildInitList(E->getLBraceLoc(), Inits,
13908 E->getRBraceLoc());
13911template<
typename Derived>
13918 if (
Init.isInvalid())
13923 bool ExprChanged =
false;
13925 if (D.isFieldDesignator()) {
13926 if (D.getFieldDecl()) {
13928 getDerived().TransformDecl(D.getFieldLoc(), D.getFieldDecl()));
13929 if (Field != D.getFieldDecl())
13932 ExprChanged =
true;
13933 if (
Field->isAnonymousStructOrUnion())
13939 ExprChanged =
true;
13942 D.getFieldName(), D.getDotLoc(), D.getFieldLoc()));
13946 if (D.isArrayDesignator()) {
13947 ExprResult Index = getDerived().TransformExpr(E->getArrayIndex(D));
13948 if (Index.isInvalid())
13951 Desig.AddDesignator(
13954 ExprChanged = ExprChanged || Index.get() != E->getArrayIndex(D);
13955 ArrayExprs.push_back(Index.get());
13959 assert(D.isArrayRangeDesignator() &&
"New kind of designator?");
13961 = getDerived().TransformExpr(E->getArrayRangeStart(D));
13962 if (Start.isInvalid())
13965 ExprResult End = getDerived().TransformExpr(E->getArrayRangeEnd(D));
13966 if (End.isInvalid())
13970 Start.get(), End.get(), D.getLBracketLoc(), D.getEllipsisLoc()));
13972 ExprChanged = ExprChanged || Start.get() != E->getArrayRangeStart(D) ||
13973 End.get() != E->getArrayRangeEnd(D);
13975 ArrayExprs.push_back(Start.get());
13976 ArrayExprs.push_back(End.get());
13979 if (!getDerived().AlwaysRebuild() &&
13980 Init.get() == E->getInit() &&
13984 return getDerived().RebuildDesignatedInitExpr(Desig, ArrayExprs,
13985 E->getEqualOrColonLoc(),
13986 E->usesGNUSyntax(),
Init.get());
13991template<
typename Derived>
13995 llvm_unreachable(
"Unexpected DesignatedInitUpdateExpr in syntactic form of "
14000template<
typename Derived>
14004 llvm_unreachable(
"Unexpected NoInitExpr in syntactic form of initializer");
14008template<
typename Derived>
14011 llvm_unreachable(
"Unexpected ArrayInitLoopExpr outside of initializer");
14015template<
typename Derived>
14018 llvm_unreachable(
"Unexpected ArrayInitIndexExpr outside of initializer");
14022template<
typename Derived>
14030 QualType T = getDerived().TransformType(E->getType());
14034 if (!getDerived().AlwaysRebuild() &&
14038 return getDerived().RebuildImplicitValueInitExpr(
T);
14041template<
typename Derived>
14044 TypeSourceInfo *TInfo = getDerived().TransformType(E->getWrittenTypeInfo());
14048 ExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
14049 if (SubExpr.isInvalid())
14052 if (!getDerived().AlwaysRebuild() &&
14053 TInfo == E->getWrittenTypeInfo() &&
14054 SubExpr.get() == E->getSubExpr())
14057 return getDerived().RebuildVAArgExpr(E->getBuiltinLoc(), SubExpr.get(),
14058 TInfo, E->getRParenLoc());
14061template<
typename Derived>
14064 bool ArgumentChanged =
false;
14066 if (TransformExprs(E->getExprs(), E->getNumExprs(),
true, Inits,
14070 return getDerived().RebuildParenListExpr(E->getLParenLoc(),
14072 E->getRParenLoc());
14080template<
typename Derived>
14083 Decl *LD = getDerived().TransformDecl(E->getLabel()->getLocation(),
14088 return getDerived().RebuildAddrLabelExpr(E->getAmpAmpLoc(), E->getLabelLoc(),
14092template<
typename Derived>
14097 = getDerived().TransformCompoundStmt(E->getSubStmt(),
true);
14098 if (SubStmt.isInvalid()) {
14103 unsigned OldDepth = E->getTemplateDepth();
14104 unsigned NewDepth = getDerived().TransformTemplateDepth(OldDepth);
14106 if (!getDerived().AlwaysRebuild() && OldDepth == NewDepth &&
14107 SubStmt.get() == E->getSubStmt()) {
14113 return getDerived().RebuildStmtExpr(E->getLParenLoc(), SubStmt.get(),
14114 E->getRParenLoc(), NewDepth);
14117template<
typename Derived>
14121 if (
Cond.isInvalid())
14124 ExprResult LHS = getDerived().TransformExpr(E->getLHS());
14125 if (LHS.isInvalid())
14128 ExprResult RHS = getDerived().TransformExpr(E->getRHS());
14129 if (RHS.isInvalid())
14132 if (!getDerived().AlwaysRebuild() &&
14133 Cond.get() == E->getCond() &&
14134 LHS.get() == E->getLHS() &&
14135 RHS.get() == E->getRHS())
14138 return getDerived().RebuildChooseExpr(E->getBuiltinLoc(),
14139 Cond.get(), LHS.get(), RHS.get(),
14140 E->getRParenLoc());
14143template<
typename Derived>
14149template<
typename Derived>
14152 switch (E->getOperator()) {
14156 case OO_Array_Delete:
14157 llvm_unreachable(
"new and delete operators cannot use CXXOperatorCallExpr");
14162 assert(E->getNumArgs() >= 1 &&
"Object call is missing arguments");
14175 if (FakeLParenLoc.isInvalid() && EndLoc.isValid())
14176 FakeLParenLoc = EndLoc;
14180 if (getDerived().TransformExprs(E->getArgs() + 1, E->getNumArgs() - 1,
true,
14184 if (E->getOperator() == OO_Subscript)
14185 return getDerived().RebuildCxxSubscriptExpr(
Object.get(), FakeLParenLoc,
14186 Args, E->getEndLoc());
14188 return getDerived().RebuildCallExpr(
Object.get(), FakeLParenLoc, Args,
14192#define OVERLOADED_OPERATOR(Name, Spelling, Token, Unary, Binary, MemberOnly) \
14196#define OVERLOADED_OPERATOR_MULTI(Name,Spelling,Unary,Binary,MemberOnly)
14197#include "clang/Basic/OperatorKinds.def"
14199 case OO_Conditional:
14200 llvm_unreachable(
"conditional operator is not actually overloadable");
14204 llvm_unreachable(
"not an overloaded operator?");
14208 if (E->getNumArgs() == 1 && E->getOperator() == OO_Amp)
14209 First = getDerived().TransformAddressOfOperand(E->getArg(0));
14211 First = getDerived().TransformExpr(E->getArg(0));
14212 if (
First.isInvalid())
14216 if (E->getNumArgs() == 2) {
14218 getDerived().TransformInitializer(E->getArg(1),
false);
14219 if (Second.isInvalid())
14225 getSema().CurFPFeatures =
14226 NewOverrides.applyOverrides(getSema().getLangOpts());
14227 getSema().FpPragmaStack.CurrentValue = NewOverrides;
14231 LookupResult R(SemaRef, ULE->getName(), ULE->getNameLoc(),
14233 if (getDerived().TransformOverloadExprDecls(ULE, ULE->requiresADL(), R))
14236 return getDerived().RebuildCXXOperatorCallExpr(
14237 E->getOperator(), E->getOperatorLoc(),
Callee->getBeginLoc(),
14238 ULE->requiresADL(), R.asUnresolvedSet(),
First.get(), Second.get());
14243 Callee = ICE->getSubExprAsWritten();
14245 ValueDecl *VD = cast_or_null<ValueDecl>(
14246 getDerived().TransformDecl(DR->getLocation(), DR));
14251 Functions.addDecl(VD);
14253 return getDerived().RebuildCXXOperatorCallExpr(
14254 E->getOperator(), E->getOperatorLoc(),
Callee->getBeginLoc(),
14255 false, Functions,
First.get(), Second.get());
14258template<
typename Derived>
14261 return getDerived().TransformCallExpr(E);
14264template <
typename Derived>
14267 getSema().CurContext != E->getParentContext();
14269 if (!getDerived().AlwaysRebuild() && !NeedRebuildFunc)
14272 return getDerived().RebuildSourceLocExpr(E->getIdentKind(), E->getType(),
14273 E->getBeginLoc(), E->getEndLoc(),
14274 getSema().CurContext);
14277template <
typename Derived>
14282template<
typename Derived>
14291 ExprResult EC = getDerived().TransformCallExpr(E->getConfig());
14292 if (EC.isInvalid())
14296 bool ArgChanged =
false;
14298 if (getDerived().TransformExprs(E->getArgs(), E->getNumArgs(),
true, Args,
14302 if (!getDerived().AlwaysRebuild() &&
14303 Callee.get() == E->getCallee() &&
14309 = ((
Expr *)
Callee.get())->getSourceRange().getBegin();
14310 return getDerived().RebuildCallExpr(
Callee.get(), FakeLParenLoc,
14312 E->getRParenLoc(), EC.get());
14315template<
typename Derived>
14331 return getDerived().RebuildCXXNamedCastExpr(
14338template<
typename Derived>
14347 if (Sub.isInvalid())
14350 return getDerived().RebuildBuiltinBitCastExpr(BCE->
getBeginLoc(), TSI,
14354template<
typename Derived>
14356TreeTransform<Derived>::TransformCXXStaticCastExpr(CXXStaticCastExpr *E) {
14357 return getDerived().TransformCXXNamedCastExpr(E);
14360template<
typename Derived>
14366template<
typename Derived>
14373template<
typename Derived>
14379template<
typename Derived>
14385template<
typename Derived>
14390 getDerived().TransformTypeWithDeducedTST(E->getTypeInfoAsWritten());
14395 = getDerived().TransformExpr(E->getSubExprAsWritten());
14396 if (SubExpr.isInvalid())
14399 if (!getDerived().AlwaysRebuild() &&
14400 Type == E->getTypeInfoAsWritten() &&
14401 SubExpr.get() == E->getSubExpr())
14404 return getDerived().RebuildCXXFunctionalCastExpr(
Type,
14408 E->isListInitialization());
14411template<
typename Derived>
14414 if (E->isTypeOperand()) {
14416 = getDerived().TransformType(E->getTypeOperandSourceInfo());
14420 if (!getDerived().AlwaysRebuild() &&
14421 TInfo == E->getTypeOperandSourceInfo())
14424 return getDerived().RebuildCXXTypeidExpr(E->getType(), E->getBeginLoc(),
14425 TInfo, E->getEndLoc());
14431 Expr *Op = E->getExprOperand();
14433 if (E->isGLValue())
14434 if (
auto *RD = Op->getType()->getAsCXXRecordDecl();
14435 RD && RD->isPolymorphic())
14441 ExprResult SubExpr = getDerived().TransformExpr(Op);
14442 if (SubExpr.isInvalid())
14445 if (!getDerived().AlwaysRebuild() &&
14446 SubExpr.get() == E->getExprOperand())
14449 return getDerived().RebuildCXXTypeidExpr(E->getType(), E->getBeginLoc(),
14450 SubExpr.get(), E->getEndLoc());
14453template<
typename Derived>
14456 if (E->isTypeOperand()) {
14458 = getDerived().TransformType(E->getTypeOperandSourceInfo());
14462 if (!getDerived().AlwaysRebuild() &&
14463 TInfo == E->getTypeOperandSourceInfo())
14466 return getDerived().RebuildCXXUuidofExpr(E->getType(), E->getBeginLoc(),
14467 TInfo, E->getEndLoc());
14473 ExprResult SubExpr = getDerived().TransformExpr(E->getExprOperand());
14474 if (SubExpr.isInvalid())
14477 if (!getDerived().AlwaysRebuild() &&
14478 SubExpr.get() == E->getExprOperand())
14481 return getDerived().RebuildCXXUuidofExpr(E->getType(), E->getBeginLoc(),
14482 SubExpr.get(), E->getEndLoc());
14485template<
typename Derived>
14491template<
typename Derived>
14498template<
typename Derived>
14514 auto &S = getSema();
14515 if (E->isCapturedByCopyInLambdaWithExplicitObjectParameter())
14516 return S.getCurrentThisType();
14517 if (S.getCurLambda())
14518 return getDerived().TransformType(E->getType());
14519 return S.getCurrentThisType();
14522 if (!getDerived().AlwaysRebuild() &&
T == E->getType() &&
14523 !E->isCapturedByCopyInLambdaWithExplicitObjectParameter()) {
14526 getSema().MarkThisReferenced(E);
14530 return getDerived().RebuildCXXThisExpr(E->getBeginLoc(),
T, E->isImplicit());
14533template<
typename Derived>
14536 ExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
14537 if (SubExpr.isInvalid())
14540 getSema().DiagnoseExceptionUse(E->getThrowLoc(),
false);
14542 if (!getDerived().AlwaysRebuild() &&
14543 SubExpr.get() == E->getSubExpr())
14546 return getDerived().RebuildCXXThrowExpr(E->getThrowLoc(), SubExpr.get(),
14547 E->isThrownVariableInScope());
14550template<
typename Derived>
14554 getDerived().TransformDecl(E->getBeginLoc(), E->getParam()));
14559 if (E->hasRewrittenInit()) {
14560 InitRes = getDerived().TransformExpr(E->getRewrittenExpr());
14561 if (InitRes.isInvalid())
14565 if (!getDerived().AlwaysRebuild() && Param == E->getParam() &&
14566 E->getUsedContext() == SemaRef.
CurContext &&
14567 InitRes.get() == E->getRewrittenExpr())
14570 return getDerived().RebuildCXXDefaultArgExpr(E->getUsedLocation(), Param,
14574template<
typename Derived>
14578 getDerived().TransformDecl(E->getBeginLoc(), E->getField()));
14582 if (!getDerived().AlwaysRebuild() && Field == E->getField() &&
14586 return getDerived().RebuildCXXDefaultInitExpr(E->getExprLoc(), Field);
14589template<
typename Derived>
14593 TypeSourceInfo *
T = getDerived().TransformType(E->getTypeSourceInfo());
14597 if (!getDerived().AlwaysRebuild() &&
14598 T == E->getTypeSourceInfo())
14601 return getDerived().RebuildCXXScalarValueInitExpr(
T,
14602 T->getTypeLoc().getEndLoc(),
14603 E->getRParenLoc());
14606template<
typename Derived>
14611 getDerived().TransformTypeWithDeducedTST(E->getAllocatedTypeSourceInfo());
14612 if (!AllocTypeInfo)
14616 std::optional<Expr *> ArraySize;
14617 if (E->isArray()) {
14619 if (std::optional<Expr *> OldArraySize = E->getArraySize()) {
14620 NewArraySize = getDerived().TransformExpr(*OldArraySize);
14621 if (NewArraySize.isInvalid())
14624 ArraySize = NewArraySize.get();
14628 bool ArgumentChanged =
false;
14630 if (getDerived().TransformExprs(E->getPlacementArgs(),
14631 E->getNumPlacementArgs(),
true,
14632 PlacementArgs, &ArgumentChanged))
14636 Expr *OldInit = E->getInitializer();
14639 NewInit = getDerived().TransformInitializer(OldInit,
true);
14640 if (NewInit.isInvalid())
14645 if (E->getOperatorNew()) {
14646 OperatorNew = cast_or_null<FunctionDecl>(
14647 getDerived().TransformDecl(E->getBeginLoc(), E->getOperatorNew()));
14653 if (E->getOperatorDelete()) {
14654 OperatorDelete = cast_or_null<FunctionDecl>(
14655 getDerived().TransformDecl(E->getBeginLoc(), E->getOperatorDelete()));
14656 if (!OperatorDelete)
14660 if (!getDerived().AlwaysRebuild() &&
14661 AllocTypeInfo == E->getAllocatedTypeSourceInfo() &&
14662 ArraySize == E->getArraySize() &&
14663 NewInit.get() == OldInit &&
14664 OperatorNew == E->getOperatorNew() &&
14665 OperatorDelete == E->getOperatorDelete() &&
14666 !ArgumentChanged) {
14671 if (OperatorDelete)
14674 if (E->isArray() && !E->getAllocatedType()->isDependentType()) {
14686 QualType AllocType = AllocTypeInfo->getType();
14697 = dyn_cast<ConstantArrayType>(ArrayT)) {
14701 AllocType = ConsArrayT->getElementType();
14703 = dyn_cast<DependentSizedArrayType>(ArrayT)) {
14704 if (DepArrayT->getSizeExpr()) {
14705 ArraySize = DepArrayT->getSizeExpr();
14706 AllocType = DepArrayT->getElementType();
14711 return getDerived().RebuildCXXNewExpr(
14712 E->getBeginLoc(), E->isGlobalNew(),
14713 E->getBeginLoc(), PlacementArgs,
14714 E->getBeginLoc(), E->getTypeIdParens(), AllocType,
14715 AllocTypeInfo, ArraySize, E->getDirectInitRange(), NewInit.get());
14718template<
typename Derived>
14727 if (E->getOperatorDelete()) {
14728 OperatorDelete = cast_or_null<FunctionDecl>(
14729 getDerived().TransformDecl(E->getBeginLoc(), E->getOperatorDelete()));
14730 if (!OperatorDelete)
14734 if (!getDerived().AlwaysRebuild() &&
14735 Operand.get() == E->getArgument() &&
14736 OperatorDelete == E->getOperatorDelete()) {
14739 if (OperatorDelete)
14742 if (!E->getArgument()->isTypeDependent()) {
14744 E->getDestroyedType());
14745 if (
auto *
Record = Destroyed->getAsCXXRecordDecl())
14753 return getDerived().RebuildCXXDeleteExpr(
14754 E->getBeginLoc(), E->isGlobalDelete(), E->isArrayForm(),
Operand.get());
14757template<
typename Derived>
14762 if (
Base.isInvalid())
14766 bool MayBePseudoDestructor =
false;
14768 E->getOperatorLoc(),
14769 E->isArrow()? tok::arrow : tok::period,
14771 MayBePseudoDestructor);
14772 if (
Base.isInvalid())
14775 QualType ObjectType = ObjectTypePtr.get();
14777 if (QualifierLoc) {
14779 = getDerived().TransformNestedNameSpecifierLoc(QualifierLoc, ObjectType);
14784 SS.
Adopt(QualifierLoc);
14787 if (E->getDestroyedTypeInfo()) {
14788 TypeSourceInfo *DestroyedTypeInfo = getDerived().TransformTypeInObjectScope(
14789 E->getDestroyedTypeInfo(), ObjectType,
14791 if (!DestroyedTypeInfo)
14793 Destroyed = DestroyedTypeInfo;
14794 }
else if (!ObjectType.isNull() && ObjectType->isDependentType()) {
14798 E->getDestroyedTypeLoc());
14802 *E->getDestroyedTypeIdentifier(), E->getDestroyedTypeLoc(),
14803 nullptr, SS, ObjectTypePtr,
false);
14809 E->getDestroyedTypeLoc());
14813 if (E->getScopeTypeInfo()) {
14814 ScopeTypeInfo = getDerived().TransformTypeInObjectScope(
14815 E->getScopeTypeInfo(), ObjectType,
nullptr);
14816 if (!ScopeTypeInfo)
14820 return getDerived().RebuildCXXPseudoDestructorExpr(
Base.get(),
14821 E->getOperatorLoc(),
14825 E->getColonColonLoc(),
14830template <
typename Derived>
14835 bool AllEmptyPacks =
true;
14836 for (
auto *OldD : Old->
decls()) {
14852 if (
auto *UPD = dyn_cast<UsingPackDecl>(InstD))
14853 Decls = UPD->expansions();
14856 for (
auto *D : Decls) {
14857 if (
auto *UD = dyn_cast<UsingDecl>(D)) {
14858 for (
auto *SD : UD->shadows())
14865 AllEmptyPacks &= Decls.empty();
14874 if (AllEmptyPacks && !RequiresADL) {
14886 getSema().FilterAcceptableTemplateNames(R,
14893 diag::err_template_kw_refers_to_non_template)
14897 diag::note_template_kw_refers_to_non_template)
14906template <
typename Derived>
14912template <
typename Derived>
14915 bool IsAddressOfOperand) {
14920 if (TransformOverloadExprDecls(Old, Old->
requiresADL(), R))
14927 = getDerived().TransformNestedNameSpecifierLoc(Old->
getQualifierLoc());
14931 SS.
Adopt(QualifierLoc);
14935 CXXRecordDecl *NamingClass
14936 = cast_or_null<CXXRecordDecl>(getDerived().TransformDecl(
14939 if (!NamingClass) {
14944 R.setNamingClass(NamingClass);
14965 SS, TemplateKWLoc, R,
14972 return getDerived().RebuildDeclarationNameExpr(SS, R, Old->
requiresADL());
14975 return getDerived().RebuildTemplateIdExpr(SS, TemplateKWLoc, R,
14979template<
typename Derived>
14982 bool ArgChanged =
false;
14984 for (
unsigned I = 0, N = E->getNumArgs(); I != N; ++I) {
14986 TypeLoc FromTL = From->getTypeLoc();
14989 TLB.
reserve(FromTL.getFullDataSize());
14990 QualType To = getDerived().TransformType(TLB, FromTL);
14994 if (To == From->getType())
14995 Args.push_back(From);
14997 Args.push_back(TLB.getTypeSourceInfo(SemaRef.
Context, To));
15007 TypeLoc PatternTL = ExpansionTL.getPatternLoc();
15013 bool Expand =
true;
15014 bool RetainExpansion =
false;
15016 ExpansionTL.getTypePtr()->getNumExpansions();
15018 if (getDerived().TryExpandParameterPacks(
15019 ExpansionTL.getEllipsisLoc(), PatternTL.getSourceRange(),
15020 Unexpanded,
true, Expand,
15021 RetainExpansion, NumExpansions))
15031 TLB.
reserve(From->getTypeLoc().getFullDataSize());
15033 QualType To = getDerived().TransformType(TLB, PatternTL);
15037 To = getDerived().RebuildPackExpansionType(To,
15038 PatternTL.getSourceRange(),
15039 ExpansionTL.getEllipsisLoc(),
15047 Args.push_back(TLB.getTypeSourceInfo(SemaRef.
Context, To));
15053 for (
unsigned I = 0; I != *NumExpansions; ++I) {
15056 TLB.
reserve(PatternTL.getFullDataSize());
15057 QualType To = getDerived().TransformType(TLB, PatternTL);
15061 if (To->containsUnexpandedParameterPack()) {
15062 To = getDerived().RebuildPackExpansionType(To,
15063 PatternTL.getSourceRange(),
15064 ExpansionTL.getEllipsisLoc(),
15074 Args.push_back(TLB.getTypeSourceInfo(SemaRef.
Context, To));
15077 if (!RetainExpansion)
15082 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
15085 TLB.
reserve(From->getTypeLoc().getFullDataSize());
15087 QualType To = getDerived().TransformType(TLB, PatternTL);
15091 To = getDerived().RebuildPackExpansionType(To,
15092 PatternTL.getSourceRange(),
15093 ExpansionTL.getEllipsisLoc(),
15101 Args.push_back(TLB.getTypeSourceInfo(SemaRef.
Context, To));
15104 if (!getDerived().AlwaysRebuild() && !ArgChanged)
15107 return getDerived().RebuildTypeTrait(E->getTrait(), E->getBeginLoc(), Args,
15111template<
typename Derived>
15117 if (getDerived().TransformTemplateArguments(Old->getTemplateArgs(),
15118 Old->NumTemplateArgs, TransArgs))
15121 return getDerived().RebuildConceptSpecializationExpr(
15122 E->getNestedNameSpecifierLoc(), E->getTemplateKWLoc(),
15123 E->getConceptNameInfo(), E->getFoundDecl(), E->getNamedConcept(),
15127template<
typename Derived>
15141 getSema().Context, getSema().CurContext,
15142 E->getBody()->getBeginLoc());
15146 ExprResult TypeParamResult = getDerived().TransformRequiresTypeParams(
15147 E->getRequiresKWLoc(), E->getRBraceLoc(), E, Body,
15148 E->getLocalParameters(), TransParamTypes, TransParams, ExtParamInfos);
15152 Param->setDeclContext(Body);
15158 if (!TypeParamResult.isUnset())
15159 return TypeParamResult;
15162 if (getDerived().TransformRequiresExprRequirements(E->getRequirements(),
15167 if (
auto *ER = dyn_cast<concepts::ExprRequirement>(Req)) {
15168 if (ER->getReturnTypeRequirement().isTypeConstraint()) {
15169 ER->getReturnTypeRequirement()
15170 .getTypeConstraintTemplateParameterList()->getParam(0)
15171 ->setDeclContext(Body);
15176 return getDerived().RebuildRequiresExpr(
15177 E->getRequiresKWLoc(), Body, E->getLParenLoc(), TransParams,
15178 E->getRParenLoc(), TransReqs, E->getRBraceLoc());
15181template<
typename Derived>
15187 if (
auto *TypeReq = dyn_cast<concepts::TypeRequirement>(Req))
15188 TransReq =
getDerived().TransformTypeRequirement(TypeReq);
15189 else if (
auto *ExprReq = dyn_cast<concepts::ExprRequirement>(Req))
15190 TransReq =
getDerived().TransformExprRequirement(ExprReq);
15192 TransReq =
getDerived().TransformNestedRequirement(
15196 Transformed.push_back(TransReq);
15201template<
typename Derived>
15214 return getDerived().RebuildTypeRequirement(TransType);
15217template<
typename Derived>
15220 llvm::PointerUnion<Expr *, concepts::Requirement::SubstitutionDiagnostic *> TransExpr;
15226 TransExprRes =
SemaRef.CheckPlaceholderExpr(TransExprRes.
get());
15229 TransExpr = TransExprRes.
get();
15232 std::optional<concepts::ExprRequirement::ReturnTypeRequirement> TransRetReq;
15234 if (RetReq.isEmpty())
15235 TransRetReq.emplace();
15236 else if (RetReq.isSubstitutionFailure())
15237 TransRetReq.emplace(RetReq.getSubstitutionDiagnostic());
15238 else if (RetReq.isTypeConstraint()) {
15240 RetReq.getTypeConstraintTemplateParameterList();
15242 getDerived().TransformTemplateParameterList(OrigTPL);
15245 TransRetReq.emplace(TPL);
15247 assert(TransRetReq &&
"All code paths leading here must set TransRetReq");
15248 if (
Expr *E = dyn_cast<Expr *>(TransExpr))
15251 std::move(*TransRetReq));
15257template<
typename Derived>
15263 return getDerived().RebuildNestedRequirement(
15271 return getDerived().RebuildNestedRequirement(TransConstraint.
get());
15274template<
typename Derived>
15281 if (!getDerived().AlwaysRebuild() &&
15298template<
typename Derived>
15305 SubExpr = getDerived().TransformExpr(E->getQueriedExpression());
15306 if (SubExpr.isInvalid())
15309 if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getQueriedExpression())
15313 return getDerived().RebuildExpressionTrait(E->getTrait(), E->getBeginLoc(),
15314 SubExpr.get(), E->getEndLoc());
15317template <
typename Derived>
15322 DRE, AddrTaken, RecoveryTSI);
15335template <
typename Derived>
15342template <
typename Derived>
15358 getDerived().TransformDeclarationNameInfo(E->
getNameInfo());
15363 if (!getDerived().AlwaysRebuild() && QualifierLoc == E->
getQualifierLoc() &&
15369 return getDerived().RebuildDependentScopeDeclRefExpr(
15370 QualifierLoc, TemplateKWLoc, NameInfo,
nullptr,
15371 IsAddressOfOperand, RecoveryTSI);
15375 if (getDerived().TransformTemplateArguments(
15379 return getDerived().RebuildDependentScopeDeclRefExpr(
15380 QualifierLoc, TemplateKWLoc, NameInfo, &TransArgs, IsAddressOfOperand,
15384template<
typename Derived>
15390 if (getDerived().AllowSkippingCXXConstructExpr() &&
15391 ((E->getNumArgs() == 1 ||
15392 (E->getNumArgs() > 1 && getDerived().DropCallArgument(E->getArg(1)))) &&
15393 (!getDerived().DropCallArgument(E->getArg(0))) &&
15394 !E->isListInitialization()))
15400 QualType T = getDerived().TransformType(E->getType());
15405 getDerived().TransformDecl(E->getBeginLoc(), E->getConstructor()));
15409 bool ArgumentChanged =
false;
15414 E->isListInitialization());
15415 if (getDerived().TransformExprs(E->getArgs(), E->getNumArgs(),
true, Args,
15420 if (!getDerived().AlwaysRebuild() &&
15421 T == E->getType() &&
15423 !ArgumentChanged) {
15430 return getDerived().RebuildCXXConstructExpr(
15431 T, E->getBeginLoc(),
Constructor, E->isElidable(), Args,
15432 E->hadMultipleCandidates(), E->isListInitialization(),
15433 E->isStdInitListInitialization(), E->requiresZeroInitialization(),
15434 E->getConstructionKind(), E->getParenOrBraceRange());
15437template<
typename Derived>
15440 QualType T = getDerived().TransformType(E->getType());
15445 getDerived().TransformDecl(E->getBeginLoc(), E->getConstructor()));
15449 if (!getDerived().AlwaysRebuild() &&
15450 T == E->getType() &&
15458 return getDerived().RebuildCXXInheritedCtorInitExpr(
15460 E->constructsVBase(), E->inheritedFromVBase());
15467template<
typename Derived>
15470 if (
auto *Dtor = E->getTemporary()->getDestructor())
15473 return getDerived().TransformExpr(E->getSubExpr());
15481template<
typename Derived>
15487template<
typename Derived>
15492 getDerived().TransformTypeWithDeducedTST(E->getTypeSourceInfo());
15497 getDerived().TransformDecl(E->getBeginLoc(), E->getConstructor()));
15501 bool ArgumentChanged =
false;
15503 Args.reserve(E->getNumArgs());
15507 E->isListInitialization());
15508 if (TransformExprs(E->getArgs(), E->getNumArgs(),
true, Args,
15512 if (E->isListInitialization() && !E->isStdInitListInitialization()) {
15513 ExprResult Res = RebuildInitList(E->getBeginLoc(), Args, E->getEndLoc());
15514 if (Res.isInvalid())
15516 Args = {Res.get()};
15520 if (!getDerived().AlwaysRebuild() &&
15521 T == E->getTypeSourceInfo() &&
15523 !ArgumentChanged) {
15530 return getDerived().RebuildCXXTemporaryObjectExpr(
15531 T, LParenLoc, Args, E->getEndLoc(), E->isListInitialization());
15534template<
typename Derived>
15539 typedef std::pair<ExprResult, QualType> InitCaptureInfoTy;
15540 struct TransformedInitCapture {
15542 SourceLocation EllipsisLoc;
15544 SmallVector<InitCaptureInfoTy, 4> Expansions;
15547 InitCaptures.resize(E->explicit_capture_end() - E->explicit_capture_begin());
15549 CEnd = E->capture_end();
15551 if (!E->isInitCapture(
C))
15554 TransformedInitCapture &
Result = InitCaptures[
C - E->capture_begin()];
15559 ExprResult NewExprInitResult = getDerived().TransformInitializer(
15562 if (NewExprInitResult.isInvalid()) {
15566 Expr *NewExprInit = NewExprInitResult.get();
15569 getSema().buildLambdaInitCaptureInitialization(
15570 C->getLocation(),
C->getCaptureKind() ==
LCK_ByRef,
15571 EllipsisLoc, NumExpansions, OldVD->getIdentifier(),
15575 Result.Expansions.push_back(
15576 InitCaptureInfoTy(NewExprInit, NewInitCaptureType));
15580 if (OldVD->isParameterPack()) {
15589 bool Expand =
true;
15590 bool RetainExpansion =
false;
15592 ExpansionTL.getTypePtr()->getNumExpansions();
15594 if (getDerived().TryExpandParameterPacks(
15595 ExpansionTL.getEllipsisLoc(), OldVD->getInit()->getSourceRange(),
15596 Unexpanded,
true, Expand,
15597 RetainExpansion, NumExpansions))
15599 assert(!RetainExpansion &&
"Should not need to retain expansion after a "
15600 "capture since it cannot be extended");
15602 for (
unsigned I = 0; I != *NumExpansions; ++I) {
15607 SubstInitCapture(ExpansionTL.getEllipsisLoc(), NumExpansions);
15608 Result.EllipsisLoc = ExpansionTL.getEllipsisLoc();
15645 while (DC->isRequiresExprBody())
15647 if ((getSema().isUnevaluatedContext() ||
15648 getSema().isConstantEvaluatedContext()) &&
15649 !(dyn_cast_or_null<CXXRecordDecl>(DC->getParent()) &&
15651 (DC->isFileContext() || !DC->getParent()->isDependentContext()))
15656 E->getIntroducerRange(),
nullptr, DependencyKind,
15657 E->getCaptureDefault());
15658 getDerived().transformedLocalDecl(OldClass, {
Class});
15661 getSema().CreateLambdaCallOperator(E->getIntroducerRange(),
Class);
15664 getSema().buildLambdaScope(LSI, NewCallOperator, E->getIntroducerRange(),
15665 E->getCaptureDefault(), E->getCaptureDefaultLoc(),
15666 E->hasExplicitParameters(), E->isMutable());
15676 CEnd = E->capture_end();
15680 if (
C->isImplicit())
15684 if (
C->capturesThis()) {
15692 dyn_cast_if_present<CXXRecordDecl>(
15693 getSema().getFunctionLevelDeclContext()),
15695 getSema().CheckCXXThisCapture(
C->getLocation(),
C->isExplicit(),
15702 if (
C->capturesVLAType())
15706 if (E->isInitCapture(
C)) {
15707 TransformedInitCapture &NewC = InitCaptures[
C - E->capture_begin()];
15712 for (InitCaptureInfoTy &Info : NewC.Expansions) {
15714 QualType InitQualType = Info.second;
15715 if (
Init.isInvalid() || InitQualType.isNull()) {
15719 VarDecl *NewVD = getSema().createLambdaInitCaptureVarDecl(
15720 OldVD->getLocation(), InitQualType, NewC.EllipsisLoc,
15721 OldVD->getIdentifier(), OldVD->getInitStyle(),
Init.get(),
15722 getSema().CurContext);
15727 NewVDs.push_back(NewVD);
15728 getSema().addInitCapture(LSI, NewVD,
C->getCaptureKind() ==
LCK_ByRef);
15733 if (NewC.EllipsisLoc.isInvalid())
15734 LSI->ContainsUnexpandedParameterPack |=
15735 Init.get()->containsUnexpandedParameterPack();
15741 getDerived().transformedLocalDecl(OldVD, NewVDs);
15745 assert(
C->capturesVariable() &&
"unexpected kind of lambda capture");
15753 if (
C->isPackExpansion()) {
15755 bool ShouldExpand =
false;
15756 bool RetainExpansion =
false;
15758 if (getDerived().TryExpandParameterPacks(
15759 C->getEllipsisLoc(),
C->getLocation(), Unexpanded,
15760 true, ShouldExpand,
15761 RetainExpansion, NumExpansions)) {
15766 if (ShouldExpand) {
15771 for (
unsigned I = 0; I != *NumExpansions; ++I) {
15773 ValueDecl *CapturedVar = cast_if_present<ValueDecl>(
15774 getDerived().TransformDecl(
C->getLocation(), Pack));
15775 if (!CapturedVar) {
15781 getSema().tryCaptureVariable(CapturedVar,
C->getLocation(), Kind);
15789 EllipsisLoc =
C->getEllipsisLoc();
15793 auto *CapturedVar = cast_or_null<ValueDecl>(
15794 getDerived().TransformDecl(
C->getLocation(),
C->getCapturedVar()));
15795 if (!CapturedVar || CapturedVar->isInvalidDecl()) {
15802 if (
auto *VD = dyn_cast<VarDecl>(CapturedVar); VD && !
C->isPackExpansion())
15803 LSI->ContainsUnexpandedParameterPack |= VD->isParameterPack();
15806 getSema().tryCaptureVariable(CapturedVar,
C->getLocation(), Kind,
15809 getSema().finishLambdaExplicitCaptures(LSI);
15813 auto TPL = getDerived().TransformTemplateParameterList(
15814 E->getTemplateParameterList());
15815 LSI->GLTemplateParameterList = TPL;
15817 getSema().AddTemplateParametersToLambdaCallOperator(NewCallOperator,
Class,
15819 LSI->ContainsUnexpandedParameterPack |=
15820 TPL->containsUnexpandedParameterPack();
15825 E->getCallOperator()->getTypeSourceInfo()->getTypeLoc();
15827 getDerived().TransformType(NewCallOpTLBuilder, OldCallOpTypeLoc);
15828 if (NewCallOpType.isNull())
15830 LSI->ContainsUnexpandedParameterPack |=
15831 NewCallOpType->containsUnexpandedParameterPack();
15833 NewCallOpTLBuilder.getTypeSourceInfo(getSema().Context, NewCallOpType);
15838 assert(FPTL &&
"Not a FunctionProtoType?");
15841 if (!TRC.ArgPackSubstIndex)
15844 getSema().CompleteLambdaCallOperator(
15845 NewCallOperator, E->getCallOperator()->getLocation(),
15846 E->getCallOperator()->getInnerLocStart(), TRC, NewCallOpTSI,
15847 E->getCallOperator()->getConstexprKind(),
15848 E->getCallOperator()->getStorageClass(), FPTL.getParams(),
15849 E->hasExplicitResultType());
15851 getDerived().transformAttrs(E->getCallOperator(), NewCallOperator);
15852 getDerived().transformedLocalDecl(E->getCallOperator(), {NewCallOperator});
15858 std::optional<CXXRecordDecl::LambdaNumbering> Numbering;
15859 if (getDerived().ReplacingOriginal()) {
15860 Numbering = OldClass->getLambdaNumbering();
15863 getSema().handleLambdaNumbering(
Class, NewCallOperator, Numbering);
15868 getSema().PushExpressionEvaluationContextForFunction(
15870 E->getCallOperator());
15877 C.PointOfInstantiation = E->getBody()->getBeginLoc();
15878 getSema().pushCodeSynthesisContext(
C);
15882 : getDerived().TransformLambdaBody(E, E->getBody());
15884 getSema().popCodeSynthesisContext();
15888 FuncScopeCleanup.disable();
15890 if (Body.isInvalid()) {
15891 SavedContext.pop();
15892 getSema().ActOnLambdaError(E->getBeginLoc(),
nullptr,
15897 getSema().ActOnFinishFunctionBody(NewCallOperator, Body.get(),
15900 SavedContext.pop();
15935 DependencyKind = getDerived().ComputeLambdaDependency(LSI);
15936 Class->setLambdaDependencyKind(DependencyKind);
15938 return getDerived().RebuildLambdaExpr(E->getBeginLoc(),
15939 Body.get()->getEndLoc(), LSI);
15942template<
typename Derived>
15948template<
typename Derived>
15957 if (!
C->isImplicit())
15961 if (
C->capturesThis()) {
15962 getSema().CheckCXXThisCapture(
C->getLocation(),
C->isExplicit(),
15969 if (
C->capturesVLAType())
15972 assert(
C->capturesVariable() &&
"unexpected kind of lambda capture");
15976 VarDecl *CapturedVar = cast_or_null<VarDecl>(
15982 getSema().tryCaptureVariable(CapturedVar,
C->getLocation());
15988template<
typename Derived>
15997 bool ArgumentChanged =
false;
16009 if (!getDerived().AlwaysRebuild() &&
16015 return getDerived().RebuildCXXUnresolvedConstructExpr(
16019template<
typename Derived>
16028 if (!E->isImplicitAccess()) {
16029 OldBase = E->getBase();
16030 Base = getDerived().TransformExpr(OldBase);
16031 if (
Base.isInvalid())
16036 bool MayBePseudoDestructor =
false;
16038 E->getOperatorLoc(),
16039 E->isArrow()? tok::arrow : tok::period,
16041 MayBePseudoDestructor);
16042 if (
Base.isInvalid())
16045 ObjectType = ObjectTy.get();
16046 BaseType = ((
Expr*)
Base.get())->getType();
16049 BaseType = getDerived().TransformType(E->getBaseType());
16056 = getDerived().TransformFirstQualifierInScope(
16057 E->getFirstQualifierFoundInScope(),
16058 E->getQualifierLoc().getBeginLoc());
16061 if (E->getQualifier()) {
16063 = getDerived().TransformNestedNameSpecifierLoc(E->getQualifierLoc(),
16065 FirstQualifierInScope);
16077 = getDerived().TransformDeclarationNameInfo(E->getMemberNameInfo());
16078 if (!NameInfo.getName())
16081 if (!E->hasExplicitTemplateArgs()) {
16084 if (!getDerived().AlwaysRebuild() &&
16085 Base.get() == OldBase &&
16086 BaseType == E->getBaseType() &&
16087 QualifierLoc == E->getQualifierLoc() &&
16088 NameInfo.getName() == E->getMember() &&
16089 FirstQualifierInScope == E->getFirstQualifierFoundInScope())
16092 return getDerived().RebuildCXXDependentScopeMemberExpr(
Base.get(),
16095 E->getOperatorLoc(),
16098 FirstQualifierInScope,
16104 if (getDerived().TransformTemplateArguments(E->getTemplateArgs(),
16105 E->getNumTemplateArgs(),
16109 return getDerived().RebuildCXXDependentScopeMemberExpr(
Base.get(),
16112 E->getOperatorLoc(),
16115 FirstQualifierInScope,
16120template <
typename Derived>
16126 if (!Old->isImplicitAccess()) {
16127 Base = getDerived().TransformExpr(Old->getBase());
16128 if (
Base.isInvalid())
16131 getSema().PerformMemberExprBaseConversion(
Base.get(), Old->isArrow());
16132 if (
Base.isInvalid())
16134 BaseType =
Base.get()->getType();
16136 BaseType = getDerived().TransformType(Old->getBaseType());
16140 if (Old->getQualifierLoc()) {
16142 getDerived().TransformNestedNameSpecifierLoc(Old->getQualifierLoc());
16152 if (TransformOverloadExprDecls(Old,
false, R))
16156 if (Old->getNamingClass()) {
16158 getDerived().TransformDecl(Old->getMemberLoc(), Old->getNamingClass()));
16162 R.setNamingClass(NamingClass);
16166 if (Old->hasExplicitTemplateArgs()) {
16167 TransArgs.setLAngleLoc(Old->getLAngleLoc());
16168 TransArgs.setRAngleLoc(Old->getRAngleLoc());
16169 if (getDerived().TransformTemplateArguments(
16170 Old->getTemplateArgs(), Old->getNumTemplateArgs(), TransArgs))
16178 NamedDecl *FirstQualifierInScope =
nullptr;
16180 return getDerived().RebuildUnresolvedMemberExpr(
16181 Base.get(), BaseType, Old->getOperatorLoc(), Old->isArrow(), QualifierLoc,
16182 TemplateKWLoc, FirstQualifierInScope, R,
16183 (Old->hasExplicitTemplateArgs() ? &TransArgs :
nullptr));
16186template<
typename Derived>
16191 ExprResult SubExpr = getDerived().TransformExpr(E->getOperand());
16192 if (SubExpr.isInvalid())
16195 if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getOperand())
16198 return getDerived().RebuildCXXNoexceptExpr(E->getSourceRange(),SubExpr.get());
16201template<
typename Derived>
16204 ExprResult Pattern = getDerived().TransformExpr(E->getPattern());
16205 if (Pattern.isInvalid())
16208 if (!getDerived().AlwaysRebuild() && Pattern.get() == E->getPattern())
16211 return getDerived().RebuildPackExpansion(Pattern.get(), E->getEllipsisLoc(),
16212 E->getNumExpansions());
16215template <
typename Derived>
16220 if (!Arg.isPackExpansion()) {
16232 getSema().getTemplateArgumentPackExpansionPattern(ArgLoc, Ellipsis,
16233 OrigNumExpansions);
16245 if (!NumExpansions) {
16257template<
typename Derived>
16276 bool ShouldExpand =
false;
16277 bool RetainExpansion =
false;
16278 UnsignedOrNone NumExpansions = std::nullopt;
16279 if (getDerived().TryExpandParameterPacks(
16281 true, ShouldExpand,
16282 RetainExpansion, NumExpansions))
16287 if (ShouldExpand) {
16289 if (
auto *TTPD = dyn_cast<TemplateTypeParmDecl>(Pack)) {
16290 ArgStorage = getSema().Context.getPackExpansionType(
16291 getSema().Context.getTypeDeclType(TTPD), std::nullopt);
16292 }
else if (
auto *TTPD = dyn_cast<TemplateTemplateParmDecl>(Pack)) {
16296 ExprResult DRE = getSema().BuildDeclRefExpr(
16297 VD, VD->getType().getNonLValueExprType(getSema().Context),
16300 if (DRE.isInvalid())
16303 new (getSema().Context)
16307 PackArgs = ArgStorage;
16312 if (!PackArgs.size()) {
16313 auto *Pack = cast_or_null<NamedDecl>(
16317 return getDerived().RebuildSizeOfPackExpr(
16324 getDerived().ComputeSizeOfPackExprWithoutSubstitution(PackArgs);
16336 TemporaryBase Rebase(*
this, E->
getPackLoc(), getBaseEntity());
16339 if (TransformTemplateArguments(PackLocIterator(*
this, PackArgs.begin()),
16340 PackLocIterator(*
this, PackArgs.end()),
16341 TransformedPackArgs,
true))
16348 bool PartialSubstitution =
false;
16349 for (
auto &Loc : TransformedPackArgs.arguments()) {
16350 Args.push_back(Loc.getArgument());
16351 if (Loc.getArgument().isPackExpansion())
16352 PartialSubstitution =
true;
16355 if (PartialSubstitution)
16356 return getDerived().RebuildSizeOfPackExpr(
16358 std::nullopt, Args);
16360 return getDerived().RebuildSizeOfPackExpr(
16362 static_cast<unsigned>(Args.size()),
16366template <
typename Derived>
16369 if (!E->isValueDependent())
16377 IndexExpr = getDerived().TransformExpr(E->getIndexExpr());
16378 if (IndexExpr.isInvalid())
16383 bool FullySubstituted =
true;
16384 if (!E->expandsToEmptyPack() && E->getExpressions().empty()) {
16385 Expr *Pattern = E->getPackIdExpression();
16387 getSema().collectUnexpandedParameterPacks(E->getPackIdExpression(),
16389 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
16393 bool ShouldExpand =
true;
16394 bool RetainExpansion =
false;
16396 NumExpansions = std::nullopt;
16397 if (getDerived().TryExpandParameterPacks(
16398 E->getEllipsisLoc(), Pattern->getSourceRange(), Unexpanded,
16399 true, ShouldExpand,
16400 RetainExpansion, NumExpansions))
16402 if (!ShouldExpand) {
16404 ExprResult Pack = getDerived().TransformExpr(Pattern);
16405 if (Pack.isInvalid())
16407 return getDerived().RebuildPackIndexingExpr(
16408 E->getEllipsisLoc(), E->getRSquareLoc(), Pack.get(), IndexExpr.get(),
16411 for (
unsigned I = 0; I != *NumExpansions; ++I) {
16414 if (
Out.isInvalid())
16416 if (
Out.get()->containsUnexpandedParameterPack()) {
16417 Out = getDerived().RebuildPackExpansion(
Out.get(), E->getEllipsisLoc(),
16418 OrigNumExpansions);
16419 if (
Out.isInvalid())
16421 FullySubstituted =
false;
16423 ExpandedExprs.push_back(
Out.get());
16427 if (RetainExpansion) {
16428 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
16431 if (
Out.isInvalid())
16434 Out = getDerived().RebuildPackExpansion(
Out.get(), E->getEllipsisLoc(),
16435 OrigNumExpansions);
16436 if (
Out.isInvalid())
16438 FullySubstituted =
false;
16439 ExpandedExprs.push_back(
Out.get());
16441 }
else if (!E->expandsToEmptyPack()) {
16442 if (getDerived().TransformExprs(E->getExpressions().data(),
16443 E->getExpressions().size(),
false,
16448 return getDerived().RebuildPackIndexingExpr(
16449 E->getEllipsisLoc(), E->getRSquareLoc(), E->getPackIdExpression(),
16450 IndexExpr.get(), ExpandedExprs, FullySubstituted);
16453template <
typename Derived>
16456 if (!getSema().ArgPackSubstIndex)
16463 E->getAssociatedDecl(), E->getParameterPack(),
16464 E->getParameterPackLocation(), Arg, SemaRef.
getPackIndex(Pack),
16468template <
typename Derived>
16472 ExprResult Replacement = getDerived().TransformExpr(OrigReplacement);
16473 if (Replacement.isInvalid())
16476 Decl *AssociatedDecl =
16477 getDerived().TransformDecl(E->getNameLoc(), E->getAssociatedDecl());
16478 if (!AssociatedDecl)
16481 if (Replacement.get() == OrigReplacement &&
16482 AssociatedDecl == E->getAssociatedDecl())
16485 auto getParamAndType = [E](
Decl *AssociatedDecl)
16486 -> std::tuple<NonTypeTemplateParmDecl *, QualType> {
16487 auto [PDecl, Arg] =
16491 return {Param, Param->getType()};
16493 Arg = Arg.getPackAsArray()[*PackIndex];
16494 return {Param, Arg.getNonTypeTemplateArgumentType()};
16500 if (
auto [Param, ParamType] = getParamAndType(AssociatedDecl);
16502 ParamType, std::get<1>(getParamAndType(E->getAssociatedDecl()))) ||
16503 Replacement.get() != OrigReplacement) {
16510 Param, ParamType, Replacement.get(), SugaredConverted,
16511 CanonicalConverted,
16513 if (Replacement.isInvalid())
16517 Replacement = E->getReplacement();
16521 Replacement.get()->getType(), Replacement.get()->getValueKind(),
16522 E->getNameLoc(), Replacement.get(), AssociatedDecl, E->getIndex(),
16523 E->getPackIndex(), E->isReferenceParameter(), E->getFinal());
16526template<
typename Derived>
16533template<
typename Derived>
16540template<
typename Derived>
16544 if (
Expr *OldCallee = E->getCallee()) {
16545 ExprResult CalleeResult = getDerived().TransformExpr(OldCallee);
16546 if (CalleeResult.isInvalid())
16551 Expr *Pattern = E->getPattern();
16554 getSema().collectUnexpandedParameterPacks(Pattern, Unexpanded);
16555 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
16559 bool Expand =
true;
16560 bool RetainExpansion =
false;
16562 NumExpansions = OrigNumExpansions;
16563 if (getDerived().TryExpandParameterPacks(
16564 E->getEllipsisLoc(), Pattern->getSourceRange(), Unexpanded,
16565 true, Expand, RetainExpansion,
16575 E->getLHS() ? getDerived().TransformExpr(E->getLHS()) :
ExprResult();
16576 if (LHS.isInvalid())
16580 E->getRHS() ? getDerived().TransformExpr(E->getRHS()) :
ExprResult();
16581 if (RHS.isInvalid())
16584 if (!getDerived().AlwaysRebuild() &&
16585 LHS.get() == E->getLHS() && RHS.get() == E->getRHS())
16588 return getDerived().RebuildCXXFoldExpr(
16589 Callee, E->getBeginLoc(), LHS.get(), E->getOperator(),
16590 E->getEllipsisLoc(), RHS.get(), E->getEndLoc(), NumExpansions);
16596 if (NumExpansions && SemaRef.
getLangOpts().BracketDepth < *NumExpansions) {
16597 SemaRef.
Diag(E->getEllipsisLoc(),
16598 clang::diag::err_fold_expression_limit_exceeded)
16599 << *NumExpansions << SemaRef.
getLangOpts().BracketDepth
16600 << E->getSourceRange();
16601 SemaRef.
Diag(E->getEllipsisLoc(), diag::note_bracket_depth);
16610 bool LeftFold = E->isLeftFold();
16614 if (!LeftFold && RetainExpansion) {
16615 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
16618 if (
Out.isInvalid())
16621 Result = getDerived().RebuildCXXFoldExpr(
16622 Callee, E->getBeginLoc(),
Out.get(), E->getOperator(),
16623 E->getEllipsisLoc(),
Result.get(), E->getEndLoc(), OrigNumExpansions);
16628 bool WarnedOnComparison =
false;
16629 for (
unsigned I = 0; I != *NumExpansions; ++I) {
16631 getSema(), LeftFold ? I : *NumExpansions - I - 1);
16633 if (
Out.isInvalid())
16636 if (
Out.get()->containsUnexpandedParameterPack()) {
16638 Result = getDerived().RebuildCXXFoldExpr(
16639 Callee, E->getBeginLoc(), LeftFold ?
Result.get() :
Out.get(),
16640 E->getOperator(), E->getEllipsisLoc(),
16641 LeftFold ?
Out.get() :
Result.get(), E->getEndLoc(),
16642 OrigNumExpansions);
16643 }
else if (
Result.isUsable()) {
16650 Result = getDerived().RebuildCXXOperatorCallExpr(
16652 E->getEllipsisLoc(),
Callee->getBeginLoc(),
Callee->requiresADL(),
16653 Functions, LHS, RHS);
16655 Result = getDerived().RebuildBinaryOperator(E->getEllipsisLoc(),
16656 E->getOperator(), LHS, RHS,
16658 if (!WarnedOnComparison &&
Result.isUsable()) {
16659 if (
auto *BO = dyn_cast<BinaryOperator>(
Result.get());
16660 BO && BO->isComparisonOp()) {
16661 WarnedOnComparison =
true;
16662 SemaRef.
Diag(BO->getBeginLoc(),
16663 diag::warn_comparison_in_fold_expression)
16664 << BO->getOpcodeStr();
16677 if (LeftFold && RetainExpansion) {
16678 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
16681 if (
Out.isInvalid())
16684 Result = getDerived().RebuildCXXFoldExpr(
16685 Callee, E->getBeginLoc(),
Result.get(), E->getOperator(),
16686 E->getEllipsisLoc(),
Out.get(), E->getEndLoc(), OrigNumExpansions);
16692 PE->setIsProducedByFoldExpansion();
16697 return getDerived().RebuildEmptyCXXFoldExpr(E->getEllipsisLoc(),
16702template <
typename Derived>
16708 QualType T = getDerived().TransformType(E->getType());
16710 bool ArgChanged =
false;
16712 if (getDerived().TransformExprs(InitExprs.data(), InitExprs.size(),
true,
16713 TransformedInits, &ArgChanged))
16716 if (!getDerived().AlwaysRebuild() && !ArgChanged &&
T == E->getType())
16719 return getDerived().RebuildCXXParenListInitExpr(
16720 TransformedInits,
T, E->getUserSpecifiedInitExprs().size(),
16721 E->getInitLoc(), E->getBeginLoc(), E->getEndLoc());
16724template<
typename Derived>
16731template<
typename Derived>
16737template<
typename Derived>
16743template<
typename Derived>
16746 ExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
16747 if (SubExpr.isInvalid())
16750 if (!getDerived().AlwaysRebuild() &&
16751 SubExpr.get() == E->getSubExpr())
16754 return getDerived().RebuildObjCBoxedExpr(E->getSourceRange(), SubExpr.get());
16757template<
typename Derived>
16762 bool ArgChanged =
false;
16763 if (getDerived().TransformExprs(E->getElements(), E->getNumElements(),
16764 false, Elements, &ArgChanged))
16767 if (!getDerived().AlwaysRebuild() && !ArgChanged)
16770 return getDerived().RebuildObjCArrayLiteral(E->getSourceRange(),
16775template<
typename Derived>
16781 bool ArgChanged =
false;
16782 for (
unsigned I = 0, N = E->getNumElements(); I != N; ++I) {
16785 if (OrigElement.isPackExpansion()) {
16788 getSema().collectUnexpandedParameterPacks(OrigElement.Key, Unexpanded);
16789 getSema().collectUnexpandedParameterPacks(OrigElement.Value, Unexpanded);
16790 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
16794 bool Expand =
true;
16795 bool RetainExpansion =
false;
16798 SourceRange PatternRange(OrigElement.Key->getBeginLoc(),
16799 OrigElement.Value->getEndLoc());
16800 if (getDerived().TryExpandParameterPacks(
16801 OrigElement.EllipsisLoc, PatternRange, Unexpanded,
16802 true, Expand, RetainExpansion,
16811 ExprResult Key = getDerived().TransformExpr(OrigElement.Key);
16812 if (Key.isInvalid())
16815 if (Key.get() != OrigElement.Key)
16819 if (
Value.isInvalid())
16826 Key.get(),
Value.get(), OrigElement.EllipsisLoc, NumExpansions
16828 Elements.push_back(Expansion);
16838 for (
unsigned I = 0; I != *NumExpansions; ++I) {
16840 ExprResult Key = getDerived().TransformExpr(OrigElement.Key);
16841 if (Key.isInvalid())
16845 if (
Value.isInvalid())
16855 if (Key.get()->containsUnexpandedParameterPack() ||
16856 Value.get()->containsUnexpandedParameterPack())
16857 Element.EllipsisLoc = OrigElement.EllipsisLoc;
16859 Elements.push_back(Element);
16869 ExprResult Key = getDerived().TransformExpr(OrigElement.Key);
16870 if (Key.isInvalid())
16873 if (Key.get() != OrigElement.Key)
16878 = getDerived().TransformExpr(OrigElement.Value);
16879 if (
Value.isInvalid())
16887 Elements.push_back(Element);
16890 if (!getDerived().AlwaysRebuild() && !ArgChanged)
16893 return getDerived().RebuildObjCDictionaryLiteral(E->getSourceRange(),
16897template<
typename Derived>
16901 = getDerived().TransformType(E->getEncodedTypeSourceInfo());
16902 if (!EncodedTypeInfo)
16905 if (!getDerived().AlwaysRebuild() &&
16906 EncodedTypeInfo == E->getEncodedTypeSourceInfo())
16909 return getDerived().RebuildObjCEncodeExpr(E->getAtLoc(),
16911 E->getRParenLoc());
16914template<
typename Derived>
16924template<
typename Derived>
16928 = getDerived().TransformType(E->getTypeInfoAsWritten());
16936 if (!getDerived().AlwaysRebuild() &&
16937 TSInfo == E->getTypeInfoAsWritten() &&
16938 Result.get() == E->getSubExpr())
16942 E->getLParenLoc(), E->getBridgeKind(), E->getBridgeKeywordLoc(), TSInfo,
16946template <
typename Derived>
16952template<
typename Derived>
16956 bool ArgChanged =
false;
16958 Args.reserve(E->getNumArgs());
16959 if (getDerived().TransformExprs(E->getArgs(), E->getNumArgs(),
false, Args,
16966 = getDerived().TransformType(E->getClassReceiverTypeInfo());
16967 if (!ReceiverTypeInfo)
16971 if (!getDerived().AlwaysRebuild() &&
16972 ReceiverTypeInfo == E->getClassReceiverTypeInfo() && !ArgChanged)
16977 E->getSelectorLocs(SelLocs);
16978 return getDerived().RebuildObjCMessageExpr(ReceiverTypeInfo,
16981 E->getMethodDecl(),
16988 if (!E->getMethodDecl())
16993 E->getSelectorLocs(SelLocs);
16994 return getDerived().RebuildObjCMessageExpr(E->getSuperLoc(),
16997 E->getReceiverType(),
16998 E->getMethodDecl(),
17006 "Only class and instance messages may be instantiated");
17008 = getDerived().TransformExpr(E->getInstanceReceiver());
17009 if (Receiver.isInvalid())
17013 if (!getDerived().AlwaysRebuild() &&
17014 Receiver.get() == E->getInstanceReceiver() && !ArgChanged)
17019 E->getSelectorLocs(SelLocs);
17020 return getDerived().RebuildObjCMessageExpr(Receiver.get(),
17023 E->getMethodDecl(),
17029template<
typename Derived>
17035template<
typename Derived>
17041template<
typename Derived>
17046 if (
Base.isInvalid())
17052 if (!getDerived().AlwaysRebuild() &&
17053 Base.get() == E->getBase())
17056 return getDerived().RebuildObjCIvarRefExpr(
Base.get(), E->getDecl(),
17058 E->isArrow(), E->isFreeIvar());
17061template<
typename Derived>
17066 if (!E->isObjectReceiver())
17071 if (
Base.isInvalid())
17077 if (!getDerived().AlwaysRebuild() &&
17078 Base.get() == E->getBase())
17081 if (E->isExplicitProperty())
17082 return getDerived().RebuildObjCPropertyRefExpr(
Base.get(),
17083 E->getExplicitProperty(),
17086 return getDerived().RebuildObjCPropertyRefExpr(
Base.get(),
17088 E->getImplicitPropertyGetter(),
17089 E->getImplicitPropertySetter(),
17093template<
typename Derived>
17098 if (
Base.isInvalid())
17102 ExprResult Key = getDerived().TransformExpr(E->getKeyExpr());
17103 if (Key.isInvalid())
17107 if (!getDerived().AlwaysRebuild() &&
17108 Key.get() == E->getKeyExpr() &&
Base.get() == E->getBaseExpr())
17111 return getDerived().RebuildObjCSubscriptRefExpr(E->getRBracket(),
17112 Base.get(), Key.get(),
17113 E->getAtIndexMethodDecl(),
17114 E->setAtIndexMethodDecl());
17117template<
typename Derived>
17122 if (
Base.isInvalid())
17126 if (!getDerived().AlwaysRebuild() &&
17127 Base.get() == E->getBase())
17130 return getDerived().RebuildObjCIsaExpr(
Base.get(), E->getIsaMemberLoc(),
17135template<
typename Derived>
17138 bool ArgumentChanged =
false;
17140 SubExprs.reserve(E->getNumSubExprs());
17141 if (getDerived().TransformExprs(E->getSubExprs(), E->getNumSubExprs(),
false,
17142 SubExprs, &ArgumentChanged))
17145 if (!getDerived().AlwaysRebuild() &&
17149 return getDerived().RebuildShuffleVectorExpr(E->getBuiltinLoc(),
17151 E->getRParenLoc());
17154template<
typename Derived>
17157 ExprResult SrcExpr = getDerived().TransformExpr(E->getSrcExpr());
17158 if (SrcExpr.isInvalid())
17165 if (!getDerived().AlwaysRebuild() &&
17166 Type == E->getTypeSourceInfo() &&
17167 SrcExpr.get() == E->getSrcExpr())
17170 return getDerived().RebuildConvertVectorExpr(E->getBuiltinLoc(),
17171 SrcExpr.get(),
Type,
17172 E->getRParenLoc());
17175template<
typename Derived>
17178 BlockDecl *oldBlock = E->getBlockDecl();
17184 blockScope->TheDecl->setBlockMissingReturnType(
17185 oldBlock->blockMissingReturnType());
17194 if (getDerived().TransformFunctionTypeParams(
17195 E->getCaretLocation(), oldBlock->parameters(),
nullptr,
17196 exprFunctionType->getExtParameterInfosOrNull(), paramTypes, ¶ms,
17198 getSema().ActOnBlockError(E->getCaretLocation(),
nullptr);
17203 getDerived().TransformType(exprFunctionType->getReturnType());
17205 auto epi = exprFunctionType->getExtProtoInfo();
17206 epi.ExtParameterInfos = extParamInfos.getPointerOrNull(paramTypes.size());
17209 getDerived().RebuildFunctionProtoType(exprResultType, paramTypes, epi);
17213 if (!params.empty())
17214 blockScope->TheDecl->setParams(params);
17216 if (!oldBlock->blockMissingReturnType()) {
17217 blockScope->HasImplicitReturnType =
false;
17218 blockScope->ReturnType = exprResultType;
17222 StmtResult body = getDerived().TransformStmt(E->getBody());
17223 if (body.isInvalid()) {
17224 getSema().ActOnBlockError(E->getCaretLocation(),
nullptr);
17232 for (
const auto &I : oldBlock->captures()) {
17233 VarDecl *oldCapture = I.getVariable();
17236 if (oldCapture->isParameterPack())
17240 cast<VarDecl>(getDerived().TransformDecl(E->getCaretLocation(),
17242 assert(blockScope->CaptureMap.count(newCapture));
17248 assert((!blockScope->isCXXThisCaptured() || oldBlock->capturesCXXThis()) &&
17249 "this pointer isn't captured in the old block");
17257template<
typename Derived>
17260 ExprResult SrcExpr = getDerived().TransformExpr(E->getSrcExpr());
17261 if (SrcExpr.isInvalid())
17264 QualType Type = getDerived().TransformType(E->getType());
17267 E->getRParenLoc());
17270template<
typename Derived>
17273 bool ArgumentChanged =
false;
17275 SubExprs.reserve(E->getNumSubExprs());
17276 if (getDerived().TransformExprs(E->getSubExprs(), E->getNumSubExprs(),
false,
17277 SubExprs, &ArgumentChanged))
17280 if (!getDerived().AlwaysRebuild() &&
17284 return getDerived().RebuildAtomicExpr(E->getBuiltinLoc(), SubExprs,
17285 E->getOp(), E->getRParenLoc());
17292template<
typename Derived>
17295 return SemaRef.BuildPointerType(PointeeType,
Star,
17299template<
typename Derived>
17302 return SemaRef.BuildBlockPointerType(PointeeType,
Star,
17306template<
typename Derived>
17309 bool WrittenAsLValue,
17311 return SemaRef.BuildReferenceType(ReferentType, WrittenAsLValue,
17315template <
typename Derived>
17319 return SemaRef.BuildMemberPointerType(PointeeType, SS, Cls, Sigil,
17323template<
typename Derived>
17330 return SemaRef.ObjC().BuildObjCTypeParamType(
17331 Decl, ProtocolLAngleLoc, Protocols, ProtocolLocs, ProtocolRAngleLoc,
17335template<
typename Derived>
17346 return SemaRef.ObjC().BuildObjCObjectType(
17347 BaseType, Loc, TypeArgsLAngleLoc, TypeArgs, TypeArgsRAngleLoc,
17348 ProtocolLAngleLoc, Protocols, ProtocolLocs, ProtocolRAngleLoc,
17353template<
typename Derived>
17357 return SemaRef.Context.getObjCObjectPointerType(PointeeType);
17360template <
typename Derived>
17363 Expr *SizeExpr,
unsigned IndexTypeQuals,
SourceRange BracketsRange) {
17364 if (SizeExpr || !Size)
17365 return SemaRef.BuildArrayType(ElementType, SizeMod, SizeExpr,
17366 IndexTypeQuals, BracketsRange,
17370 SemaRef.Context.UnsignedCharTy,
SemaRef.Context.UnsignedShortTy,
17372 SemaRef.Context.UnsignedLongLongTy,
SemaRef.Context.UnsignedInt128Ty
17375 for (
const auto &
T : Types)
17376 if (Size->getBitWidth() ==
SemaRef.Context.getIntWidth(
T)) {
17386 return SemaRef.BuildArrayType(ElementType, SizeMod, ArraySize,
17387 IndexTypeQuals, BracketsRange,
17391template <
typename Derived>
17394 Expr *SizeExpr,
unsigned IndexTypeQuals,
SourceRange BracketsRange) {
17395 return getDerived().RebuildArrayType(ElementType, SizeMod, &Size, SizeExpr,
17396 IndexTypeQuals, BracketsRange);
17399template <
typename Derived>
17403 return getDerived().RebuildArrayType(ElementType, SizeMod,
nullptr,
nullptr,
17404 IndexTypeQuals, BracketsRange);
17407template <
typename Derived>
17410 unsigned IndexTypeQuals,
SourceRange BracketsRange) {
17411 return getDerived().RebuildArrayType(ElementType, SizeMod,
nullptr,
17413 IndexTypeQuals, BracketsRange);
17416template <
typename Derived>
17419 unsigned IndexTypeQuals,
SourceRange BracketsRange) {
17420 return getDerived().RebuildArrayType(ElementType, SizeMod,
nullptr,
17422 IndexTypeQuals, BracketsRange);
17425template <
typename Derived>
17428 return SemaRef.BuildAddressSpaceAttr(PointeeType, AddrSpaceExpr,
17432template <
typename Derived>
17434 unsigned NumElements,
17437 return SemaRef.Context.getVectorType(ElementType, NumElements, VecKind);
17440template <
typename Derived>
17444 return SemaRef.BuildVectorType(ElementType, SizeExpr, AttributeLoc);
17447template<
typename Derived>
17449 unsigned NumElements,
17451 llvm::APInt numElements(
SemaRef.Context.getIntWidth(
SemaRef.Context.IntTy),
17452 NumElements,
true);
17456 return SemaRef.BuildExtVectorType(ElementType, VectorSize, AttributeLoc);
17459template<
typename Derived>
17464 return SemaRef.BuildExtVectorType(ElementType, SizeExpr, AttributeLoc);
17467template <
typename Derived>
17469 QualType ElementType,
unsigned NumRows,
unsigned NumColumns) {
17470 return SemaRef.Context.getConstantMatrixType(ElementType, NumRows,
17474template <
typename Derived>
17478 return SemaRef.BuildMatrixType(ElementType, RowExpr, ColumnExpr,
17482template <
typename Derived>
17486 return SemaRef.BuildFunctionType(
T, ParamTypes,
17492template<
typename Derived>
17494 return SemaRef.Context.getFunctionNoProtoType(
T);
17497template <
typename Derived>
17501 assert(D &&
"no decl found");
17505 if (
auto *UPD = dyn_cast<UsingPackDecl>(D)) {
17509 if (UPD->expansions().empty()) {
17510 getSema().Diag(NameLoc, diag::err_using_pack_expansion_empty)
17511 << UPD->isCXXClassMember() << UPD;
17520 for (
auto *E : UPD->expansions()) {
17527 else if (
T.isNull())
17530 assert(
getSema().Context.hasSameType(ThisT,
T) &&
17531 "mismatched resolved types in using pack expansion");
17533 return T.isNull() ? FallbackT :
T;
17535 if (
auto *Using = dyn_cast<UsingDecl>(D)) {
17536 assert(Using->hasTypename() &&
17537 "UnresolvedUsingTypenameDecl transformed to non-typename using");
17540 assert(++Using->shadow_begin() == Using->shadow_end());
17545 return SemaRef.Context.getUsingType(
Keyword, Qualifier, Shadow);
17548 "UnresolvedUsingTypenameDecl transformed to non-using decl");
17549 return SemaRef.Context.getUnresolvedUsingType(
17553template <
typename Derived>
17556 return SemaRef.BuildTypeofExprType(E, Kind);
17559template<
typename Derived>
17562 return SemaRef.Context.getTypeOfType(Underlying, Kind);
17565template <
typename Derived>
17567 return SemaRef.BuildDecltypeType(E);
17570template <
typename Derived>
17575 return SemaRef.BuildPackIndexingType(Pattern, IndexExpr, Loc, EllipsisLoc,
17576 FullySubstituted, Expansions);
17579template<
typename Derived>
17581 UnaryTransformType::UTTKind UKind,
17583 return SemaRef.BuildUnaryTransformType(BaseType, UKind, Loc);
17586template <
typename Derived>
17590 return SemaRef.CheckTemplateIdType(
17595template<
typename Derived>
17598 return SemaRef.BuildAtomicType(ValueType, KWLoc);
17601template<
typename Derived>
17605 return isReadPipe ?
SemaRef.BuildReadPipeType(ValueType, KWLoc)
17606 :
SemaRef.BuildWritePipeType(ValueType, KWLoc);
17609template <
typename Derived>
17613 llvm::APInt NumBitsAP(
SemaRef.Context.getIntWidth(
SemaRef.Context.IntTy),
17617 return SemaRef.BuildBitIntType(IsUnsigned, Bits, Loc);
17620template <
typename Derived>
17623 return SemaRef.BuildBitIntType(IsUnsigned, NumBitsExpr, Loc);
17626template <
typename Derived>
17634template <
typename Derived>
17641 getSema().ActOnTemplateName(
nullptr, SS, TemplateKWLoc,
17644 AllowInjectedClassName);
17648template<
typename Derived>
17655 bool AllowInjectedClassName) {
17658 SourceLocation SymbolLocations[3] = { NameLoc, NameLoc, NameLoc };
17663 false,
Template, AllowInjectedClassName);
17667template <
typename Derived>
17672 bool isPostIncDec = Second && (Op == OO_PlusPlus || Op == OO_MinusMinus);
17677 return SemaRef.PseudoObject().checkAssignment(
nullptr, OpLoc,
17678 Opc,
First, Second);
17693 if (Op == OO_Subscript) {
17694 if (!
First->getType()->isOverloadableType() &&
17696 return getSema().CreateBuiltinArraySubscriptExpr(
First, CalleeLoc, Second,
17698 }
else if (Op == OO_Arrow) {
17701 if (
First->getType()->isDependentType())
17704 return SemaRef.BuildOverloadedArrowExpr(
nullptr,
First, OpLoc);
17705 }
else if (Second ==
nullptr || isPostIncDec) {
17706 if (!
First->getType()->isOverloadableType() ||
17707 (Op == OO_Amp &&
getSema().isQualifiedMemberAccess(
First))) {
17714 return getSema().CreateBuiltinUnaryOp(OpLoc, Opc,
First);
17718 !
First->getType()->isOverloadableType() &&
17724 =
SemaRef.CreateBuiltinBinOp(OpLoc, Opc,
First, Second);
17733 if (!Second || isPostIncDec) {
17736 return SemaRef.CreateOverloadedUnaryOp(OpLoc, Opc, Functions,
First,
17743 First, Second, RequiresADL);
17750template<
typename Derived>
17760 QualType CanonicalBaseType =
Base->getType().getCanonicalType();
17766 ->getAsCanonical<RecordType>())) {
17768 return SemaRef.BuildPseudoDestructorExpr(
17769 Base, OperatorLoc, isArrow ? tok::arrow : tok::period, SS, ScopeType,
17770 CCLoc, TildeLoc, Destroyed);
17782 if (!
isa<TagType>(ScopeType->getType().getCanonicalType())) {
17783 getSema().Diag(ScopeType->getTypeLoc().getBeginLoc(),
17784 diag::err_expected_class_or_namespace)
17785 << ScopeType->getType() <<
getSema().getLangOpts().CPlusPlus;
17789 SS.
Make(
SemaRef.Context, ScopeType->getTypeLoc(), CCLoc);
17793 return getSema().BuildMemberReferenceExpr(
17794 Base,
Base->getType(), OperatorLoc, isArrow, SS, TemplateKWLoc,
17800template<
typename Derived>
17808 for (
unsigned I = 0; I < NumParams; ++I) {
17809 if (I != ContextParamPos) {
17815 Params.push_back(std::make_pair(StringRef(), QualType()));
17818 getSema().ActOnCapturedRegionStart(Loc,
nullptr,
17826 if (Body.isInvalid()) {
17827 getSema().ActOnCapturedRegionError();
17831 return getSema().ActOnCapturedRegionEnd(Body.get());
17834template <
typename Derived>
17840 llvm_unreachable(
"SYCL kernel call statement cannot appear in dependent "
17844template <
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)
void setAttrOperandParensRange(SourceRange range)
Represents an extended address space qualifier where the input address space value is dependent.
Represents a 'co_await' expression while the type of the promise is dependent.
void setElaboratedKeywordLoc(SourceLocation Loc)
A qualified reference to a name whose declaration cannot yet be resolved.
SourceLocation getRAngleLoc() const
Retrieve the location of the right angle bracket ending the explicit template argument list following...
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies the name, with source location information.
SourceLocation getLAngleLoc() const
Retrieve the location of the left angle bracket starting the explicit template argument list followin...
bool hasExplicitTemplateArgs() const
Determines whether this lookup had explicit template arguments.
SourceLocation getTemplateKeywordLoc() const
Retrieve the location of the template keyword preceding this name, if any.
unsigned getNumTemplateArgs() const
DeclarationName getDeclName() const
Retrieve the name that this expression refers to.
TemplateArgumentLoc const * getTemplateArgs() const
const DeclarationNameInfo & getNameInfo() const
Retrieve the name that this expression refers to.
Represents an array type in C++ whose size is a value-dependent expression.
void setNameLoc(SourceLocation Loc)
Represents an extended vector type where either the type or size is dependent.
Represents a matrix type where the type and the number of rows and columns is dependent on a template...
void setNameLoc(SourceLocation Loc)
Represents a vector type where either the type or size is dependent.
Represents a single C99 designator.
Represents a C99 designated initializer expression.
Designation - Represent a full designation, which is a sequence of designators.
static Designator CreateArrayRangeDesignator(Expr *Start, Expr *End, SourceLocation LBracketLoc, SourceLocation EllipsisLoc)
Creates a GNU array-range designator.
static Designator CreateArrayDesignator(Expr *Index, SourceLocation LBracketLoc)
Creates an array designator.
static Designator CreateFieldDesignator(const IdentifierInfo *FieldName, SourceLocation DotLoc, SourceLocation FieldLoc)
Creates a field designator.
bool hasErrorOccurred() const
DoStmt - This represents a 'do/while' stmt.
Wrap a function effect's condition expression in another struct so that FunctionProtoType's TrailingO...
Expr * getCondition() const
void set(SourceLocation ElaboratedKeywordLoc, NestedNameSpecifierLoc QualifierLoc, SourceLocation NameLoc)
Represents a reference to emded data.
RAII object that enters a new expression evaluation context.
Wrapper for source info for enum types.
TypeSourceInfo * getTypeInfoAsWritten() const
getTypeInfoAsWritten - Returns the type source info for the type that this expression is casting to.
Represents an expression – generally a full-expression – that introduces cleanups to be run at the en...
This represents one expression.
bool isValueDependent() const
Determines whether the value of this expression depends on.
bool isTypeDependent() const
Determines whether the type of this expression depends on.
ExprObjectKind getObjectKind() const
getObjectKind - The object kind that this expression produces.
Expr * IgnoreImplicitAsWritten() LLVM_READONLY
Skip past any implicit AST nodes which might surround this expression until reaching a fixed point.
bool isDefaultArgument() const
Determine whether this expression is a default function argument.
bool hasPlaceholderType() const
Returns whether this expression has a placeholder type.
static ExprValueKind getValueKindForType(QualType T)
getValueKindForType - Given a formal return or parameter type, give its value kind.
An expression trait intrinsic.
ExtVectorElementExpr - This represents access to specific elements of a vector, and may occur on the ...
Represents difference between two FPOptions values.
FPOptions applyOverrides(FPOptions Base)
Represents a member of a struct/union/class.
ForStmt - This represents a 'for (init;cond;inc)' stmt.
Represents a function declaration or definition.
ArrayRef< ParmVarDecl * > parameters() const
SmallVector< Conflict > Conflicts
Represents an abstract function effect, using just an enumeration describing its kind.
StringRef name() const
The description printed in diagnostics, e.g. 'nonblocking'.
Kind oppositeKind() const
Return the opposite kind, for effects which have opposites.
ArrayRef< EffectConditionExpr > conditions() const
Represents a K&R-style 'int foo()' function, which has no information available about its arguments.
Represents a reference to a function parameter pack, init-capture pack, or binding pack that has been...
Represents a prototype with parameter type info, e.g.
param_type_iterator param_type_begin() const
unsigned getNumParams() const
SourceLocation getLocalRangeEnd() const
void setLocalRangeBegin(SourceLocation L)
void setLParenLoc(SourceLocation Loc)
SourceRange getExceptionSpecRange() const
void setParam(unsigned i, ParmVarDecl *VD)
ArrayRef< ParmVarDecl * > getParams() const
void setRParenLoc(SourceLocation Loc)
void setLocalRangeEnd(SourceLocation L)
void setExceptionSpecRange(SourceRange R)
TypeLoc getReturnLoc() const
SourceLocation getLocalRangeBegin() const
SourceLocation getLParenLoc() const
SourceLocation getRParenLoc() const
Interesting information about a specific parameter that can't simply be reflected in parameter's type...
This represents a GCC inline-assembly statement extension.
GNUNullExpr - Implements the GNU __null extension, which is a name for a null pointer constant that h...
Represents a C11 generic selection.
AssociationTy< false > Association
GotoStmt - This represents a direct goto.
Type source information for HLSL attributed resource type.
This class represents temporary values used to represent inout and out arguments in HLSL.
One of these records is kept for each identifier that is lexed.
IfStmt - This represents an if/then/else.
ImaginaryLiteral - We support imaginary integer and floating point literals, like "1....
ImplicitCastExpr - Allows us to explicitly represent implicit type conversions, which have no direct ...
Represents an implicitly-generated value initialization of an object of a given type.
Represents a C array with an unspecified size.
IndirectGotoStmt - This represents an indirect goto.
const TypeClass * getTypePtr() const
Describes an C or C++ initializer list.
InitListExpr * getSyntacticForm() const
Wrapper for source info for injected class names of class templates.
static IntegerLiteral * Create(const ASTContext &C, const llvm::APInt &V, QualType type, SourceLocation l)
Returns a new integer literal with value 'V' and type 'type'.
Represents the declaration of a label.
LabelStmt - Represents a label, which has a substatement.
A C++ lambda expression, which produces a function object (of unspecified type) that can be invoked l...
capture_iterator capture_begin() const
Retrieve an iterator pointing to the first lambda capture.
bool isInitCapture(const LambdaCapture *Capture) const
Determine whether one of this lambda's captures is an init-capture.
capture_iterator capture_end() const
Retrieve an iterator pointing past the end of the sequence of lambda captures.
const LambdaCapture * capture_iterator
An iterator that walks over the captures of the lambda, both implicit and explicit.
Represents the results of name lookup.
LLVM_ATTRIBUTE_REINITIALIZES void clear()
Clears out any current state.
void addDecl(NamedDecl *D)
Add a declaration to these results with its natural access.
bool empty() const
Return true if no decls were found.
void resolveKind()
Resolves the result kind of the lookup, possibly hiding decls.
SourceLocation getNameLoc() const
Gets the location of the identifier.
NamedDecl * getRepresentativeDecl() const
Fetches a representative decl. Useful for lazy diagnostics.
DeclarationName getLookupName() const
Gets the name to look up.
This represents a Microsoft inline-assembly statement extension.
Representation of a Microsoft __if_exists or __if_not_exists statement with a dependent name.
An instance of this class represents the declaration of a property member.
A member reference to an MSPropertyDecl.
MS property subscript expression.
void setExpansionLoc(SourceLocation Loc)
Represents a prvalue temporary that is written into memory so that a reference can bind to it.
MatrixSubscriptExpr - Matrix subscript expression for the MatrixType extension.
void setAttrNameLoc(SourceLocation loc)
MemberExpr - [C99 6.5.2.3] Structure and Union Members.
Wrapper for source info for member pointers.
A pointer to member type per C++ 8.3.3 - Pointers to members.
Data structure that captures multiple levels of template argument lists for use in template instantia...
This represents a decl that may have a name.
NamedDecl * getUnderlyingDecl()
Looks through UsingDecls and ObjCCompatibleAliasDecls for the underlying named decl.
IdentifierInfo * getIdentifier() const
Get the identifier that names this declaration, if there is one.
StringRef getName() const
Get the name of identifier for this declaration as a StringRef.
DeclarationName getDeclName() const
Get the actual, stored name of the declaration, which may be a special name.
Represents C++ namespaces and their aliases.
Class that aids in the construction of nested-name-specifiers along with source-location information ...
void MakeTrivial(ASTContext &Context, NestedNameSpecifier Qualifier, SourceRange R)
Make a new nested-name-specifier from incomplete source-location information.
A C++ nested-name-specifier augmented with source location information.
NestedNameSpecifier getNestedNameSpecifier() const
Retrieve the nested-name-specifier to which this instance refers.
SourceLocation getLocalEndLoc() const
Retrieve the location of the end of this component of the nested-name-specifier.
SourceRange getSourceRange() const LLVM_READONLY
Retrieve the source range covering the entirety of this nested-name-specifier.
SourceLocation getEndLoc() const
Retrieve the location of the end of this nested-name-specifier.
SourceLocation getBeginLoc() const
Retrieve the location of the beginning of this nested-name-specifier.
TypeLoc castAsTypeLoc() const
For a nested-name-specifier that refers to a type, retrieve the type with source-location information...
void * getOpaqueData() const
Retrieve the opaque pointer that refers to source-location data.
SourceLocation getLocalBeginLoc() const
Retrieve the location of the beginning of this component of the nested-name-specifier.
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
NamespaceAndPrefix getAsNamespaceAndPrefix() const
CXXRecordDecl * getAsRecordDecl() const
Retrieve the record declaration stored in this nested name specifier, or null.
bool isDependent() const
Whether this nested name specifier refers to a dependent type or not.
@ MicrosoftSuper
Microsoft's '__super' specifier, stored as a CXXRecordDecl* of the class it appeared in.
@ Global
The global specifier '::'. There is no stored value.
@ Type
A type, stored as a Type*.
@ Namespace
A namespace-like entity, stored as a NamespaceBaseDecl*.
Represents a place-holder for an object not to be initialized by anything.
NullStmt - This is the null statement ";": C99 6.8.3p3.
This represents the 'absent' clause in the 'pragma omp assume' directive.
This represents 'acq_rel' clause in the 'pragma omp atomic|flush' directives.
This represents 'acquire' clause in the 'pragma omp atomic|flush' directives.
This represents clause 'affinity' in the 'pragma omp task'-based directives.
This represents the 'align' clause in the 'pragma omp allocate' directive.
This represents clause 'aligned' in the 'pragma omp ...' directives.
This represents clause 'allocate' in the 'pragma omp ...' directives.
This represents 'allocator' clause in the 'pragma omp ...' directive.
An explicit cast in C or a C-style cast in C++, which uses the syntax ([s1][s2]......
This represents 'at' clause in the 'pragma omp error' directive.
This represents 'atomic_default_mem_order' clause in the 'pragma omp requires' directive.
This represents 'bind' clause in the 'pragma omp ...' directives.
This represents 'capture' clause in the 'pragma omp atomic' directive.
This is a basic class for representing single OpenMP clause.
OpenMPClauseKind getClauseKind() const
Returns kind of OpenMP clause (private, shared, reduction, etc.).
This represents 'collapse' clause in the 'pragma omp ...' directive.
This represents 'compare' clause in the 'pragma omp atomic' directive.
This represents the 'contains' clause in the 'pragma omp assume' directive.
This represents clause 'copyin' in the 'pragma omp ...' directives.
This represents clause 'copyprivate' in the 'pragma omp ...' directives.
This represents 'default' clause in the 'pragma omp ...' directive.
This represents 'defaultmap' clause in the 'pragma omp ...' directive.
This represents implicit clause 'depend' for the 'pragma omp task' directive.
This represents implicit clause 'depobj' for the 'pragma omp depobj' directive.
This represents 'destroy' clause in the 'pragma omp depobj' directive or the 'pragma omp interop' dir...
This represents 'detach' clause in the 'pragma omp task' directive.
This represents 'device' clause in the 'pragma omp ...' directive.
This represents 'dist_schedule' clause in the 'pragma omp ...' directive.
This represents the 'doacross' clause for the 'pragma omp ordered' directive.
This represents 'dyn_groupprivate' clause in 'pragma omp target ...' and 'pragma omp teams ....
This represents 'dynamic_allocators' clause in the 'pragma omp requires' directive.
This represents clause 'exclusive' in the 'pragma omp scan' directive.
This represents 'fail' clause in the 'pragma omp atomic' directive.
This represents 'filter' clause in the 'pragma omp ...' directive.
This represents 'final' clause in the 'pragma omp ...' directive.
This represents clause 'firstprivate' in the 'pragma omp ...' directives.
This represents implicit clause 'flush' for the 'pragma omp flush' directive.
This represents clause 'from' in the 'pragma omp ...' directives.
Representation of the 'full' clause of the 'pragma omp unroll' directive.
This represents 'grainsize' clause in the 'pragma omp ...' directive.
This represents clause 'has_device_ptr' in the 'pragma omp ...' directives.
This represents 'hint' clause in the 'pragma omp ...' directive.
This represents the 'holds' clause in the 'pragma omp assume' directive.
This represents 'if' clause in the 'pragma omp ...' directive.
This represents clause 'in_reduction' in the 'pragma omp task' directives.
This represents clause 'inclusive' in the 'pragma omp scan' directive.
This represents the 'init' clause in 'pragma omp ...' directives.
This represents clause 'is_device_ptr' in the 'pragma omp ...' directives.
OpenMP 5.0 [2.1.6 Iterators] Iterators are identifiers that expand to multiple values in the clause o...
This represents clause 'lastprivate' in the 'pragma omp ...' directives.
This represents clause 'linear' in the 'pragma omp ...' directives.
This class represents the 'looprange' clause in the 'pragma omp fuse' directive.
This represents clauses with a list of expressions that are mappable.
This represents 'mergeable' clause in the 'pragma omp ...' directive.
This represents the 'message' clause in the 'pragma omp error' and the 'pragma omp parallel' directiv...
This represents the 'no_openmp' clause in the 'pragma omp assume' directive.
This represents the 'no_openmp_constructs' clause in the.
This represents the 'no_openmp_routines' clause in the 'pragma omp assume' directive.
This represents the 'no_parallelism' clause in the 'pragma omp assume' directive.
This represents 'nocontext' clause in the 'pragma omp ...' directive.
This represents 'nogroup' clause in the 'pragma omp ...' directive.
This represents clause 'nontemporal' in the 'pragma omp ...' directives.
This represents 'novariants' clause in the 'pragma omp ...' directive.
This represents 'nowait' clause in the 'pragma omp ...' directive.
This represents 'num_tasks' clause in the 'pragma omp ...' directive.
This represents 'num_teams' clause in the 'pragma omp ...' directive.
This represents 'num_threads' clause in the 'pragma omp ...' directive.
This represents 'order' clause in the 'pragma omp ...' directive.
This represents 'ordered' clause in the 'pragma omp ...' directive.
Representation of the 'partial' clause of the 'pragma omp unroll' directive.
This class represents the 'permutation' clause in the 'pragma omp interchange' directive.
This represents 'priority' clause in the 'pragma omp ...' directive.
This represents clause 'private' in the 'pragma omp ...' directives.
This represents 'proc_bind' clause in the 'pragma omp ...' directive.
This represents 'read' clause in the 'pragma omp atomic' directive.
This represents clause 'reduction' in the 'pragma omp ...' directives.
This represents 'relaxed' clause in the 'pragma omp atomic' directives.
This represents 'release' clause in the 'pragma omp atomic|flush' directives.
This represents 'reverse_offload' clause in the 'pragma omp requires' directive.
This represents 'simd' clause in the 'pragma omp ...' directive.
This represents 'safelen' clause in the 'pragma omp ...' directive.
This represents 'schedule' clause in the 'pragma omp ...' directive.
This represents 'self_maps' clause in the 'pragma omp requires' directive.
This represents 'seq_cst' clause in the 'pragma omp atomic|flush' directives.
This represents the 'severity' clause in the 'pragma omp error' and the 'pragma omp parallel' directi...
This represents clause 'shared' in the 'pragma omp ...' directives.
This represents 'simdlen' clause in the 'pragma omp ...' directive.
This represents the 'sizes' clause in the 'pragma omp tile' directive.
This represents clause 'task_reduction' in the 'pragma omp taskgroup' directives.
This represents 'thread_limit' clause in the 'pragma omp ...' directive.
This represents 'threads' clause in the 'pragma omp ...' directive.
This represents 'threadset' clause in the 'pragma omp task ...' directive.
This represents clause 'to' in the 'pragma omp ...' directives.
This represents 'unified_address' clause in the 'pragma omp requires' directive.
This represents 'unified_shared_memory' clause in the 'pragma omp requires' directive.
This represents 'untied' clause in the 'pragma omp ...' directive.
This represents 'update' clause in the 'pragma omp atomic' directive.
This represents the 'use' clause in 'pragma omp ...' directives.
This represents clause 'use_device_addr' in the 'pragma omp ...' directives.
This represents clause 'use_device_ptr' in the 'pragma omp ...' directives.
This represents clause 'uses_allocators' in the 'pragma omp target'-based directives.
This represents 'weak' clause in the 'pragma omp atomic' directives.
This represents 'write' clause in the 'pragma omp atomic' directive.
This represents 'ompx_attribute' clause in a directive that might generate an outlined function.
This represents 'ompx_bare' clause in the 'pragma omp target teams ...' directive.
This represents 'ompx_dyn_cgroup_mem' clause in the 'pragma omp target ...' directive.
ObjCArrayLiteral - used for objective-c array containers; as in: @["Hello", NSApp,...
Represents Objective-C's @catch statement.
Represents Objective-C's @finally statement.
Represents Objective-C's @synchronized statement.
Represents Objective-C's @throw statement.
Represents Objective-C's @try ... @catch ... @finally statement.
Represents Objective-C's @autoreleasepool Statement.
A runtime availability query.
ObjCBoolLiteralExpr - Objective-C Boolean Literal.
ObjCBoxedExpr - used for generalized expression boxing.
An Objective-C "bridged" cast expression, which casts between Objective-C pointers and C pointers,...
ObjCDictionaryLiteral - AST node to represent objective-c dictionary literals; as in:"name" : NSUserN...
ObjCEncodeExpr, used for @encode in Objective-C.
Represents Objective-C's collection statement.
ObjCIndirectCopyRestoreExpr - Represents the passing of a function argument by indirect copy-restore ...
Wrapper for source info for ObjC interfaces.
ObjCIsaExpr - Represent X->isa and X.isa when X is an ObjC 'id' type.
ObjCIvarDecl - Represents an ObjC instance variable.
ObjCIvarRefExpr - A reference to an ObjC instance variable.
An expression that sends a message to the given Objective-C object or class.
@ SuperInstance
The receiver is the instance of the superclass object.
@ Instance
The receiver is an object instance.
@ SuperClass
The receiver is a superclass.
@ Class
The receiver is a class.
ObjCMethodDecl - Represents an instance or class method declaration.
Wraps an ObjCPointerType with source location information.
void setStarLoc(SourceLocation Loc)
void setHasBaseTypeAsWritten(bool HasBaseType)
Represents one property declaration in an Objective-C interface.
ObjCPropertyRefExpr - A dot-syntax expression to access an ObjC property.
ObjCProtocolExpr used for protocol expression in Objective-C.
ObjCSelectorExpr used for @selector in Objective-C.
ObjCStringLiteral, used for Objective-C string literals i.e.
ObjCSubscriptRefExpr - used for array and dictionary subscripting.
Represents the declaration of an Objective-C type parameter.
ProtocolLAngleLoc, ProtocolRAngleLoc, and the source locations for protocol qualifiers are stored aft...
@ Array
An index into an array.
@ Identifier
A field in a dependent type, known only by its name.
@ Base
An implicit indirection through a C++ base class, when the field found is in a base class.
static OpaquePtr make(QualType P)
OpaqueValueExpr - An expression referring to an opaque object of a fixed type and value class.
Expr * getSourceExpr() const
The source expression of an opaque value expression is the expression which originally generated the ...
This expression type represents an asterisk in an OpenACC Size-Expr, used in the 'tile' and 'gang' cl...
static OpenACCAsyncClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *IntExpr, SourceLocation EndLoc)
static OpenACCAttachClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCAutoClause * Create(const ASTContext &Ctx, SourceLocation BeginLoc, SourceLocation EndLoc)
This is the base type for all OpenACC Clauses.
Represents a 'collapse' clause on a 'loop' construct.
static OpenACCCollapseClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, bool HasForce, Expr *LoopCount, SourceLocation EndLoc)
static OpenACCCopyClause * Create(const ASTContext &C, OpenACCClauseKind Spelling, SourceLocation BeginLoc, SourceLocation LParenLoc, OpenACCModifierKind Mods, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCCopyInClause * Create(const ASTContext &C, OpenACCClauseKind Spelling, SourceLocation BeginLoc, SourceLocation LParenLoc, OpenACCModifierKind Mods, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCCopyOutClause * Create(const ASTContext &C, OpenACCClauseKind Spelling, SourceLocation BeginLoc, SourceLocation LParenLoc, OpenACCModifierKind Mods, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCCreateClause * Create(const ASTContext &C, OpenACCClauseKind Spelling, SourceLocation BeginLoc, SourceLocation LParenLoc, OpenACCModifierKind Mods, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCDefaultAsyncClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *IntExpr, SourceLocation EndLoc)
A 'default' clause, has the optional 'none' or 'present' argument.
static OpenACCDefaultClause * Create(const ASTContext &C, OpenACCDefaultClauseKind K, SourceLocation BeginLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
static OpenACCDeleteClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCDetachClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCDeviceClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCDeviceNumClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *IntExpr, SourceLocation EndLoc)
static OpenACCDevicePtrClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
A 'device_type' or 'dtype' clause, takes a list of either an 'asterisk' or an identifier.
static OpenACCDeviceTypeClause * Create(const ASTContext &C, OpenACCClauseKind K, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< DeviceTypeArgument > Archs, SourceLocation EndLoc)
static OpenACCFinalizeClause * Create(const ASTContext &Ctx, SourceLocation BeginLoc, SourceLocation EndLoc)
static OpenACCFirstPrivateClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, ArrayRef< OpenACCFirstPrivateRecipe > InitRecipes, SourceLocation EndLoc)
static OpenACCHostClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
An 'if' clause, which has a required condition expression.
static OpenACCIfClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *ConditionExpr, SourceLocation EndLoc)
static OpenACCIfPresentClause * Create(const ASTContext &Ctx, SourceLocation BeginLoc, SourceLocation EndLoc)
static OpenACCIndependentClause * Create(const ASTContext &Ctx, SourceLocation BeginLoc, SourceLocation EndLoc)
static OpenACCNoCreateClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCNumGangsClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > IntExprs, SourceLocation EndLoc)
static OpenACCNumWorkersClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *IntExpr, SourceLocation EndLoc)
static OpenACCPresentClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCPrivateClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, ArrayRef< OpenACCPrivateRecipe > InitRecipes, SourceLocation EndLoc)
A 'self' clause, which has an optional condition expression, or, in the event of an 'update' directiv...
static OpenACCSelfClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *ConditionExpr, SourceLocation EndLoc)
static OpenACCSeqClause * Create(const ASTContext &Ctx, SourceLocation BeginLoc, SourceLocation EndLoc)
static OpenACCTileClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > SizeExprs, SourceLocation EndLoc)
static OpenACCUseDeviceClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCVectorClause * Create(const ASTContext &Ctx, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *IntExpr, SourceLocation EndLoc)
static OpenACCVectorLengthClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *IntExpr, SourceLocation EndLoc)
static OpenACCWaitClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *DevNumExpr, SourceLocation QueuesLoc, ArrayRef< Expr * > QueueIdExprs, SourceLocation EndLoc)
static OpenACCWorkerClause * Create(const ASTContext &Ctx, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *IntExpr, SourceLocation EndLoc)
A reference to an overloaded function set, either an UnresolvedLookupExpr or an UnresolvedMemberExpr.
bool hasExplicitTemplateArgs() const
Determines whether this expression had explicit template arguments.
SourceLocation getLAngleLoc() const
Retrieve the location of the left angle bracket starting the explicit template argument list followin...
SourceLocation getNameLoc() const
Gets the location of the name.
SourceLocation getTemplateKeywordLoc() const
Retrieve the location of the template keyword preceding this name, if any.
NestedNameSpecifierLoc getQualifierLoc() const
Fetches the nested-name qualifier with source-location information, if one was given.
TemplateArgumentLoc const * getTemplateArgs() const
llvm::iterator_range< decls_iterator > decls() const
unsigned getNumTemplateArgs() const
DeclarationName getName() const
Gets the name looked up.
SourceLocation getRAngleLoc() const
Retrieve the location of the right angle bracket ending the explicit template argument list following...
bool hasTemplateKeyword() const
Determines whether the name was preceded by the template keyword.
Represents a C++11 pack expansion that produces a sequence of expressions.
void setEllipsisLoc(SourceLocation Loc)
SourceLocation getEllipsisLoc() const
TypeLoc getPatternLoc() const
void setEllipsisLoc(SourceLocation Loc)
ParenExpr - This represents a parenthesized expression, e.g.
SourceLocation getLParen() const
Get the location of the left parentheses '('.
SourceLocation getRParen() const
Get the location of the right parentheses ')'.
void setLParenLoc(SourceLocation Loc)
Represents a parameter to a function.
unsigned getFunctionScopeIndex() const
Returns the index of this parameter in its prototype or method scope.
void setScopeInfo(unsigned scopeDepth, unsigned parameterIndex)
static ParmVarDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, const IdentifierInfo *Id, QualType T, TypeSourceInfo *TInfo, StorageClass S, Expr *DefArg)
unsigned getFunctionScopeDepth() const
void setKWLoc(SourceLocation Loc)
Pointer-authentication qualifiers.
void setSigilLoc(SourceLocation Loc)
TypeLoc getPointeeLoc() const
SourceLocation getSigilLoc() const
Wrapper for source info for pointers.
PointerType - C99 6.7.5.1 - Pointer Declarators.
[C99 6.4.2.2] - A predefined identifier such as func.
Stores the type being destroyed by a pseudo-destructor expression.
const IdentifierInfo * getIdentifier() const
SourceLocation getLocation() const
TypeSourceInfo * getTypeSourceInfo() const
PseudoObjectExpr - An expression which accesses a pseudo-object l-value.
A (possibly-)qualified type.
bool isNull() const
Return true if this QualType doesn't point to a type yet.
const Type * getTypePtr() const
Retrieves a pointer to the underlying (unqualified) type.
Qualifiers getQualifiers() const
Retrieve the set of qualifiers applied to this type.
QualType getUnqualifiedType() const
Retrieve the unqualified variant of the given type, removing as little sugar as possible.
Qualifiers getLocalQualifiers() const
Retrieve the set of qualifiers local to this particular QualType instance, not including any qualifie...
Represents a template name as written in source code.
Wrapper of type source information for a type with non-trivial direct qualifiers.
The collection of all-type qualifiers we support.
void removeObjCLifetime()
static Qualifiers fromCVRMask(unsigned CVR)
PointerAuthQualifier getPointerAuth() const
bool hasObjCLifetime() const
LangAS getAddressSpace() const
Frontend produces RecoveryExprs on semantic errors that prevent creating other well-formed expression...
Base for LValueReferenceType and RValueReferenceType.
QualType getPointeeTypeAsWritten() const
Represents the body of a requires-expression.
static RequiresExprBodyDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc)
C++2a [expr.prim.req]: A requires-expression provides a concise way to express requirements on templa...
static RequiresExpr * Create(ASTContext &C, SourceLocation RequiresKWLoc, RequiresExprBodyDecl *Body, SourceLocation LParenLoc, ArrayRef< ParmVarDecl * > LocalParameters, SourceLocation RParenLoc, ArrayRef< concepts::Requirement * > Requirements, SourceLocation RBraceLoc)
ReturnStmt - This represents a return, optionally of an expression: return; return 4;.
static SEHFinallyStmt * Create(const ASTContext &C, SourceLocation FinallyLoc, Stmt *Block)
Represents a __leave statement.
SYCLKernelCallStmt represents the transformation that is applied to the body of a function declared w...
Smart pointer class that efficiently represents Objective-C method names.
SemaDiagnosticBuilder Diag(SourceLocation Loc, unsigned DiagID)
Emit a diagnostic.
VarDecl * BuildObjCExceptionDecl(TypeSourceInfo *TInfo, QualType ExceptionType, SourceLocation StartLoc, SourceLocation IdLoc, const IdentifierInfo *Id, bool Invalid=false)
Build a type-check a new Objective-C exception variable declaration.
StmtResult ActOnObjCForCollectionStmt(SourceLocation ForColLoc, Stmt *First, Expr *collection, SourceLocation RParenLoc)
StmtResult FinishObjCForCollectionStmt(Stmt *ForCollection, Stmt *Body)
FinishObjCForCollectionStmt - Attach the body to a objective-C foreach statement.
ExprResult BuildObjCDictionaryLiteral(SourceRange SR, MutableArrayRef< ObjCDictionaryElement > Elements)
StmtResult ActOnObjCAtSynchronizedStmt(SourceLocation AtLoc, Expr *SynchExpr, Stmt *SynchBody)
ExprResult BuildObjCArrayLiteral(SourceRange SR, MultiExprArg Elements)
ExprResult BuildObjCBoxedExpr(SourceRange SR, Expr *ValueExpr)
BuildObjCBoxedExpr - builds an ObjCBoxedExpr AST node for the '@' prefixed parenthesized expression.
StmtResult ActOnObjCAtTryStmt(SourceLocation AtLoc, Stmt *Try, MultiStmtArg Catch, Stmt *Finally)
StmtResult ActOnObjCAtFinallyStmt(SourceLocation AtLoc, Stmt *Body)
StmtResult BuildObjCAtThrowStmt(SourceLocation AtLoc, Expr *Throw)
ExprResult ActOnObjCAtSynchronizedOperand(SourceLocation atLoc, Expr *operand)
ExprResult BuildObjCBridgedCast(SourceLocation LParenLoc, ObjCBridgeCastKind Kind, SourceLocation BridgeKeywordLoc, TypeSourceInfo *TSInfo, Expr *SubExpr)
StmtResult ActOnObjCAtCatchStmt(SourceLocation AtLoc, SourceLocation RParen, Decl *Parm, Stmt *Body)
StmtResult ActOnObjCAutoreleasePoolStmt(SourceLocation AtLoc, Stmt *Body)
ExprResult BuildObjCSubscriptExpression(SourceLocation RB, Expr *BaseExpr, Expr *IndexExpr, ObjCMethodDecl *getterMethod, ObjCMethodDecl *setterMethod)
Build an ObjC subscript pseudo-object expression, given that that's supported by the runtime.
Helper type for the registration/assignment of constructs that need to 'know' about their parent cons...
Helper type to restore the state of various 'loop' constructs when we run into a loop (for,...
A type to represent all the data for an OpenACC Clause that has been parsed, but not yet created/sema...
void ActOnWhileStmt(SourceLocation WhileLoc)
ExprResult ActOnOpenACCAsteriskSizeExpr(SourceLocation AsteriskLoc)
void ActOnDoStmt(SourceLocation DoLoc)
void ActOnRangeForStmtBegin(SourceLocation ForLoc, const Stmt *OldRangeFor, const Stmt *RangeFor)
StmtResult ActOnEndStmtDirective(OpenACCDirectiveKind K, SourceLocation StartLoc, SourceLocation DirLoc, SourceLocation LParenLoc, SourceLocation MiscLoc, ArrayRef< Expr * > Exprs, OpenACCAtomicKind AK, SourceLocation RParenLoc, SourceLocation EndLoc, ArrayRef< OpenACCClause * > Clauses, StmtResult AssocStmt)
Called after the directive has been completely parsed, including the declaration group or associated ...
void ActOnForStmtEnd(SourceLocation ForLoc, StmtResult Body)
void ActOnForStmtBegin(SourceLocation ForLoc, const Stmt *First, const Stmt *Second, const Stmt *Third)
ExprResult ActOnArraySectionExpr(Expr *Base, SourceLocation LBLoc, Expr *LowerBound, SourceLocation ColonLocFirst, Expr *Length, SourceLocation RBLoc)
Checks and creates an Array Section used in an OpenACC construct/clause.
OMPClause * ActOnOpenMPNocontextClause(Expr *Condition, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'nocontext' clause.
OMPClause * ActOnOpenMPXDynCGroupMemClause(Expr *Size, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on a well-formed 'ompx_dyn_cgroup_mem' clause.
OMPClause * ActOnOpenMPSafelenClause(Expr *Length, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'safelen' clause.
OMPClause * ActOnOpenMPHoldsClause(Expr *E, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'holds' clause.
OMPClause * ActOnOpenMPFilterClause(Expr *ThreadID, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'filter' clause.
OMPClause * ActOnOpenMPFullClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-form 'full' clauses.
OMPClause * ActOnOpenMPDetachClause(Expr *Evt, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'detach' clause.
OMPClause * ActOnOpenMPUseClause(Expr *InteropVar, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation VarLoc, SourceLocation EndLoc)
Called on well-formed 'use' clause.
OMPClause * ActOnOpenMPPrivateClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'private' clause.
OMPClause * ActOnOpenMPOrderedClause(SourceLocation StartLoc, SourceLocation EndLoc, SourceLocation LParenLoc=SourceLocation(), Expr *NumForLoops=nullptr)
Called on well-formed 'ordered' clause.
OMPClause * ActOnOpenMPIsDevicePtrClause(ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs)
Called on well-formed 'is_device_ptr' clause.
OMPClause * ActOnOpenMPHasDeviceAddrClause(ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs)
Called on well-formed 'has_device_addr' clause.
OMPClause * ActOnOpenMPPartialClause(Expr *FactorExpr, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-form 'partial' clauses.
OMPClause * ActOnOpenMPLastprivateClause(ArrayRef< Expr * > VarList, OpenMPLastprivateModifier LPKind, SourceLocation LPKindLoc, SourceLocation ColonLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'lastprivate' clause.
OMPClause * ActOnOpenMPFirstprivateClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'firstprivate' clause.
OMPClause * ActOnOpenMPPriorityClause(Expr *Priority, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'priority' clause.
OMPClause * ActOnOpenMPDistScheduleClause(OpenMPDistScheduleClauseKind Kind, Expr *ChunkSize, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation KindLoc, SourceLocation CommaLoc, SourceLocation EndLoc)
Called on well-formed 'dist_schedule' clause.
OMPClause * ActOnOpenMPLoopRangeClause(Expr *First, Expr *Count, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation FirstLoc, SourceLocation CountLoc, SourceLocation EndLoc)
Called on well-form 'looprange' clause after parsing its arguments.
OMPClause * ActOnOpenMPPermutationClause(ArrayRef< Expr * > PermExprs, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-form 'permutation' clause after parsing its arguments.
OMPClause * ActOnOpenMPNontemporalClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'nontemporal' clause.
OMPClause * ActOnOpenMPBindClause(OpenMPBindClauseKind Kind, SourceLocation KindLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on a well-formed 'bind' clause.
OMPClause * ActOnOpenMPThreadLimitClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'thread_limit' clause.
OMPClause * ActOnOpenMPSharedClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'shared' clause.
OMPClause * ActOnOpenMPCopyinClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'copyin' clause.
OMPClause * ActOnOpenMPDestroyClause(Expr *InteropVar, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation VarLoc, SourceLocation EndLoc)
Called on well-formed 'destroy' clause.
OMPClause * ActOnOpenMPAffinityClause(SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc, Expr *Modifier, ArrayRef< Expr * > Locators)
Called on well-formed 'affinity' clause.
OMPClause * ActOnOpenMPNumTeamsClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'num_teams' clause.
OMPClause * ActOnOpenMPDependClause(const OMPDependClause::DependDataTy &Data, Expr *DepModifier, ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'depend' clause.
OMPClause * ActOnOpenMPDoacrossClause(OpenMPDoacrossClauseModifier DepType, SourceLocation DepLoc, SourceLocation ColonLoc, ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'doacross' clause.
OMPClause * ActOnOpenMPGrainsizeClause(OpenMPGrainsizeClauseModifier Modifier, Expr *Size, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ModifierLoc, SourceLocation EndLoc)
Called on well-formed 'grainsize' clause.
ExprResult ActOnOMPArraySectionExpr(Expr *Base, SourceLocation LBLoc, Expr *LowerBound, SourceLocation ColonLocFirst, SourceLocation ColonLocSecond, Expr *Length, Expr *Stride, SourceLocation RBLoc)
ExprResult ActOnOMPIteratorExpr(Scope *S, SourceLocation IteratorKwLoc, SourceLocation LLoc, SourceLocation RLoc, ArrayRef< OMPIteratorData > Data)
OMPClause * ActOnOpenMPUsesAllocatorClause(SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc, ArrayRef< UsesAllocatorsData > Data)
Called on well-formed 'uses_allocators' clause.
OMPClause * ActOnOpenMPAllocatorClause(Expr *Allocator, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'allocator' clause.
OMPClause * ActOnOpenMPInclusiveClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'inclusive' clause.
OMPClause * ActOnOpenMPTaskReductionClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc, CXXScopeSpec &ReductionIdScopeSpec, const DeclarationNameInfo &ReductionId, ArrayRef< Expr * > UnresolvedReductions={})
Called on well-formed 'task_reduction' clause.
OMPClause * ActOnOpenMPNowaitClause(SourceLocation StartLoc, SourceLocation EndLoc, SourceLocation LParenLoc, Expr *Condition)
Called on well-formed 'nowait' clause.
OMPClause * ActOnOpenMPOrderClause(OpenMPOrderClauseModifier Modifier, OpenMPOrderClauseKind Kind, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation MLoc, SourceLocation KindLoc, SourceLocation EndLoc)
Called on well-formed 'order' clause.
OMPClause * ActOnOpenMPSizesClause(ArrayRef< Expr * > SizeExprs, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-form 'sizes' clause.
OMPClause * ActOnOpenMPDeviceClause(OpenMPDeviceClauseModifier Modifier, Expr *Device, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ModifierLoc, SourceLocation EndLoc)
Called on well-formed 'device' clause.
OMPClause * ActOnOpenMPInReductionClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc, CXXScopeSpec &ReductionIdScopeSpec, const DeclarationNameInfo &ReductionId, ArrayRef< Expr * > UnresolvedReductions={})
Called on well-formed 'in_reduction' clause.
OMPClause * ActOnOpenMPFlushClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'flush' pseudo clause.
StmtResult ActOnOpenMPExecutableDirective(OpenMPDirectiveKind Kind, const DeclarationNameInfo &DirName, OpenMPDirectiveKind CancelRegion, ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
OMPClause * ActOnOpenMPMessageClause(Expr *MS, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'message' clause.
OMPClause * ActOnOpenMPScheduleClause(OpenMPScheduleClauseModifier M1, OpenMPScheduleClauseModifier M2, OpenMPScheduleClauseKind Kind, Expr *ChunkSize, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation M1Loc, SourceLocation M2Loc, SourceLocation KindLoc, SourceLocation CommaLoc, SourceLocation EndLoc)
Called on well-formed 'schedule' clause.
OMPClause * ActOnOpenMPSimdlenClause(Expr *Length, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'simdlen' clause.
OMPClause * ActOnOpenMPUseDevicePtrClause(ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs)
Called on well-formed 'use_device_ptr' clause.
OMPClause * ActOnOpenMPProcBindClause(llvm::omp::ProcBindKind Kind, SourceLocation KindLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'proc_bind' clause.
OMPClause * ActOnOpenMPXBareClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on a well-formed 'ompx_bare' clause.
StmtResult ActOnOpenMPInformationalDirective(OpenMPDirectiveKind Kind, const DeclarationNameInfo &DirName, ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Process an OpenMP informational directive.
StmtResult ActOnOpenMPCanonicalLoop(Stmt *AStmt)
Called for syntactical loops (ForStmt or CXXForRangeStmt) associated to an OpenMP loop directive.
OMPClause * ActOnOpenMPHintClause(Expr *Hint, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'hint' clause.
ExprResult ActOnOMPArrayShapingExpr(Expr *Base, SourceLocation LParenLoc, SourceLocation RParenLoc, ArrayRef< Expr * > Dims, ArrayRef< SourceRange > Brackets)
OMPClause * ActOnOpenMPNumThreadsClause(OpenMPNumThreadsClauseModifier Modifier, Expr *NumThreads, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ModifierLoc, SourceLocation EndLoc)
Called on well-formed 'num_threads' clause.
OMPClause * ActOnOpenMPAtClause(OpenMPAtClauseKind Kind, SourceLocation KindLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'at' clause.
OMPClause * ActOnOpenMPInitClause(Expr *InteropVar, OMPInteropInfo &InteropInfo, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation VarLoc, SourceLocation EndLoc)
Called on well-formed 'init' clause.
OMPClause * ActOnOpenMPUseDeviceAddrClause(ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs)
Called on well-formed 'use_device_addr' clause.
OMPClause * ActOnOpenMPAllocateClause(Expr *Allocator, Expr *Alignment, OpenMPAllocateClauseModifier FirstModifier, SourceLocation FirstModifierLoc, OpenMPAllocateClauseModifier SecondModifier, SourceLocation SecondModifierLoc, ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation ColonLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'allocate' clause.
OMPClause * ActOnOpenMPFinalClause(Expr *Condition, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'final' clause.
OMPClause * ActOnOpenMPMapClause(Expr *IteratorModifier, ArrayRef< OpenMPMapModifierKind > MapTypeModifiers, ArrayRef< SourceLocation > MapTypeModifiersLoc, CXXScopeSpec &MapperIdScopeSpec, DeclarationNameInfo &MapperId, OpenMPMapClauseKind MapType, bool IsMapTypeImplicit, SourceLocation MapLoc, SourceLocation ColonLoc, ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs, bool NoDiagnose=false, ArrayRef< Expr * > UnresolvedMappers={})
Called on well-formed 'map' clause.
OMPClause * ActOnOpenMPNumTasksClause(OpenMPNumTasksClauseModifier Modifier, Expr *NumTasks, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ModifierLoc, SourceLocation EndLoc)
Called on well-formed 'num_tasks' clause.
OMPClause * ActOnOpenMPFromClause(ArrayRef< OpenMPMotionModifierKind > MotionModifiers, ArrayRef< SourceLocation > MotionModifiersLoc, Expr *IteratorModifier, CXXScopeSpec &MapperIdScopeSpec, DeclarationNameInfo &MapperId, SourceLocation ColonLoc, ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs, ArrayRef< Expr * > UnresolvedMappers={})
Called on well-formed 'from' clause.
OMPClause * ActOnOpenMPDynGroupprivateClause(OpenMPDynGroupprivateClauseModifier M1, OpenMPDynGroupprivateClauseFallbackModifier M2, Expr *Size, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation M1Loc, SourceLocation M2Loc, SourceLocation EndLoc)
Called on a well-formed 'dyn_groupprivate' clause.
void StartOpenMPDSABlock(OpenMPDirectiveKind K, const DeclarationNameInfo &DirName, Scope *CurScope, SourceLocation Loc)
Called on start of new data sharing attribute block.
OMPClause * ActOnOpenMPSeverityClause(OpenMPSeverityClauseKind Kind, SourceLocation KindLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'severity' clause.
OMPClause * ActOnOpenMPToClause(ArrayRef< OpenMPMotionModifierKind > MotionModifiers, ArrayRef< SourceLocation > MotionModifiersLoc, Expr *IteratorModifier, CXXScopeSpec &MapperIdScopeSpec, DeclarationNameInfo &MapperId, SourceLocation ColonLoc, ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs, ArrayRef< Expr * > UnresolvedMappers={})
Called on well-formed 'to' clause.
OMPClause * ActOnOpenMPLinearClause(ArrayRef< Expr * > VarList, Expr *Step, SourceLocation StartLoc, SourceLocation LParenLoc, OpenMPLinearClauseKind LinKind, SourceLocation LinLoc, SourceLocation ColonLoc, SourceLocation StepModifierLoc, SourceLocation EndLoc)
Called on well-formed 'linear' clause.
OMPClause * ActOnOpenMPDefaultmapClause(OpenMPDefaultmapClauseModifier M, OpenMPDefaultmapClauseKind Kind, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation MLoc, SourceLocation KindLoc, SourceLocation EndLoc)
Called on well-formed 'defaultmap' clause.
OMPClause * ActOnOpenMPReductionClause(ArrayRef< Expr * > VarList, OpenMPVarListDataTy::OpenMPReductionClauseModifiers Modifiers, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ModifierLoc, SourceLocation ColonLoc, SourceLocation EndLoc, CXXScopeSpec &ReductionIdScopeSpec, const DeclarationNameInfo &ReductionId, ArrayRef< Expr * > UnresolvedReductions={})
Called on well-formed 'reduction' clause.
OMPClause * ActOnOpenMPAlignedClause(ArrayRef< Expr * > VarList, Expr *Alignment, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc)
Called on well-formed 'aligned' clause.
OMPClause * ActOnOpenMPDepobjClause(Expr *Depobj, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'depobj' pseudo clause.
OMPClause * ActOnOpenMPNovariantsClause(Expr *Condition, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'novariants' clause.
OMPClause * ActOnOpenMPCopyprivateClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'copyprivate' clause.
OMPClause * ActOnOpenMPCollapseClause(Expr *NumForLoops, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'collapse' clause.
OMPClause * ActOnOpenMPDefaultClause(llvm::omp::DefaultKind M, SourceLocation MLoc, OpenMPDefaultClauseVariableCategory VCKind, SourceLocation VCKindLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'default' clause.
OMPClause * ActOnOpenMPAlignClause(Expr *Alignment, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'align' clause.
OMPClause * ActOnOpenMPXAttributeClause(ArrayRef< const Attr * > Attrs, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on a well-formed 'ompx_attribute' clause.
OMPClause * ActOnOpenMPExclusiveClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'exclusive' clause.
OMPClause * ActOnOpenMPIfClause(OpenMPDirectiveKind NameModifier, Expr *Condition, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation NameModifierLoc, SourceLocation ColonLoc, SourceLocation EndLoc)
Called on well-formed 'if' clause.
Expr * recreateSyntacticForm(PseudoObjectExpr *E)
Given a pseudo-object expression, recreate what it looks like syntactically without the attendant Opa...
ExprResult checkRValue(Expr *E)
ExprResult BuildUniqueStableNameExpr(SourceLocation OpLoc, SourceLocation LParen, SourceLocation RParen, TypeSourceInfo *TSI)
RAII object used to change the argument pack substitution index within a Sema object.
RAII object used to temporarily allow the C++ 'this' expression to be used, with the given qualifiers...
A RAII object to enter scope of a compound statement.
A helper class for building up ExtParameterInfos.
const FunctionProtoType::ExtParameterInfo * getPointerOrNull(unsigned numParams)
Return a pointer (suitable for setting in an ExtProtoInfo) to the ExtParameterInfo array we've built ...
void set(unsigned index, FunctionProtoType::ExtParameterInfo info)
Set the ExtParameterInfo for the parameter at the given index,.
Records and restores the CurFPFeatures state on entry/exit of compound statements.
Sema - This implements semantic analysis and AST building for C.
ParsedType CreateParsedType(QualType T, TypeSourceInfo *TInfo)
Package the given type and TSI into a ParsedType.
ExprResult ActOnCXXParenListInitExpr(ArrayRef< Expr * > Args, QualType T, unsigned NumUserSpecifiedExprs, SourceLocation InitLoc, SourceLocation LParenLoc, SourceLocation RParenLoc)
ExprResult BuildOperatorCoawaitCall(SourceLocation Loc, Expr *E, UnresolvedLookupExpr *Lookup)
Build a call to 'operator co_await' if there is a suitable operator for the given expression.
ExprResult BuildMemberReferenceExpr(Expr *Base, QualType BaseType, SourceLocation OpLoc, bool IsArrow, CXXScopeSpec &SS, SourceLocation TemplateKWLoc, NamedDecl *FirstQualifierInScope, const DeclarationNameInfo &NameInfo, const TemplateArgumentListInfo *TemplateArgs, const Scope *S, ActOnMemberAccessExtraArgs *ExtraArgs=nullptr)
StmtResult BuildMSDependentExistsStmt(SourceLocation KeywordLoc, bool IsIfExists, NestedNameSpecifierLoc QualifierLoc, DeclarationNameInfo NameInfo, Stmt *Nested)
@ LookupOrdinaryName
Ordinary name lookup, which finds ordinary names (functions, variables, typedefs, etc....
@ LookupMemberName
Member name lookup, which finds the names of class/struct/union members.
@ LookupTagName
Tag name lookup, which finds the names of enums, classes, structs, and unions.
bool checkFinalSuspendNoThrow(const Stmt *FinalSuspend)
Check that the expression co_await promise.final_suspend() shall not be potentially-throwing.
ExprResult ActOnConstantExpression(ExprResult Res)
StmtResult ActOnMSAsmStmt(SourceLocation AsmLoc, SourceLocation LBraceLoc, ArrayRef< Token > AsmToks, StringRef AsmString, unsigned NumOutputs, unsigned NumInputs, ArrayRef< StringRef > Constraints, ArrayRef< StringRef > Clobbers, ArrayRef< Expr * > Exprs, SourceLocation EndLoc)
StmtResult BuildCoroutineBodyStmt(CoroutineBodyStmt::CtorArgs)
ExprResult BuildCoyieldExpr(SourceLocation KwLoc, Expr *E)
void ActOnStartStmtExpr()
void ActOnStmtExprError()
void MarkDeclarationsReferencedInExpr(Expr *E, bool SkipLocalVariables=false, ArrayRef< const Expr * > StopAt={})
Mark any declarations that appear within this expression or any potentially-evaluated subexpressions ...
VarDecl * buildCoroutinePromise(SourceLocation Loc)
ExprResult CheckBooleanCondition(SourceLocation Loc, Expr *E, bool IsConstexpr=false)
CheckBooleanCondition - Diagnose problems involving the use of the given expression as a boolean cond...
@ Boolean
A boolean condition, from 'if', 'while', 'for', or 'do'.
@ Switch
An integral condition for a 'switch' statement.
@ ConstexprIf
A constant boolean condition from 'if constexpr'.
ExprResult BuildSubstNonTypeTemplateParmExpr(Decl *AssociatedDecl, const NonTypeTemplateParmDecl *NTTP, SourceLocation loc, TemplateArgument Replacement, UnsignedOrNone PackIndex, bool Final)
ExprResult BuildBuiltinBitCastExpr(SourceLocation KWLoc, TypeSourceInfo *TSI, Expr *Operand, SourceLocation RParenLoc)
StmtResult ActOnGotoStmt(SourceLocation GotoLoc, SourceLocation LabelLoc, LabelDecl *TheDecl)
ExprResult MaybeBindToTemporary(Expr *E)
MaybeBindToTemporary - If the passed in expression has a record type with a non-trivial destructor,...
StmtResult BuildCoreturnStmt(SourceLocation KwLoc, Expr *E, bool IsImplicit=false)
ExprResult ActOnStartCXXMemberReference(Scope *S, Expr *Base, SourceLocation OpLoc, tok::TokenKind OpKind, ParsedType &ObjectType, bool &MayBePseudoDestructor)
ExprResult ActOnCaseExpr(SourceLocation CaseLoc, ExprResult Val)
ExprResult BuildStmtExpr(SourceLocation LPLoc, Stmt *SubStmt, SourceLocation RPLoc, unsigned TemplateDepth)
ExprResult BuildResolvedCoawaitExpr(SourceLocation KwLoc, Expr *Operand, Expr *Awaiter, bool IsImplicit=false)
ExprResult BuildVAArgExpr(SourceLocation BuiltinLoc, Expr *E, TypeSourceInfo *TInfo, SourceLocation RPLoc)
@ CTAK_Specified
The template argument was specified in the code or was instantiated with some deduced template argume...
ExprResult ActOnCXXDelete(SourceLocation StartLoc, bool UseGlobal, bool ArrayForm, Expr *Operand)
ActOnCXXDelete - Parsed a C++ 'delete' expression (C++ 5.3.5), as in:
ExprResult BuildCXXTypeId(QualType TypeInfoType, SourceLocation TypeidLoc, TypeSourceInfo *Operand, SourceLocation RParenLoc)
Build a C++ typeid expression with a type operand.
ExprResult PerformMemberExprBaseConversion(Expr *Base, bool IsArrow)
Perform conversions on the LHS of a member access expression.
DiagnosticsEngine & getDiagnostics() const
ExprResult BuildPackIndexingExpr(Expr *PackExpression, SourceLocation EllipsisLoc, Expr *IndexExpr, SourceLocation RSquareLoc, ArrayRef< Expr * > ExpandedExprs={}, bool FullySubstituted=false)
ParsedType getDestructorName(const IdentifierInfo &II, SourceLocation NameLoc, Scope *S, CXXScopeSpec &SS, ParsedType ObjectType, bool EnteringContext)
ASTContext & getASTContext() const
CXXDestructorDecl * LookupDestructor(CXXRecordDecl *Class)
Look for the destructor of the given class.
ExprResult BuildUnaryOp(Scope *S, SourceLocation OpLoc, UnaryOperatorKind Opc, Expr *Input, bool IsAfterAmp=false)
ExprResult BuildTemplateIdExpr(const CXXScopeSpec &SS, SourceLocation TemplateKWLoc, LookupResult &R, bool RequiresADL, const TemplateArgumentListInfo *TemplateArgs)
ExprResult CreateOverloadedBinOp(SourceLocation OpLoc, BinaryOperatorKind Opc, const UnresolvedSetImpl &Fns, Expr *LHS, Expr *RHS, bool RequiresADL=true, bool AllowRewrittenCandidates=true, FunctionDecl *DefaultedFn=nullptr)
Create a binary operation that may resolve to an overloaded operator.
StmtResult ActOnSEHTryBlock(bool IsCXXTry, SourceLocation TryLoc, Stmt *TryBlock, Stmt *Handler)
ExprResult BuildPredefinedExpr(SourceLocation Loc, PredefinedIdentKind IK)
ExprResult CheckConceptTemplateId(const CXXScopeSpec &SS, SourceLocation TemplateKWLoc, const DeclarationNameInfo &ConceptNameInfo, NamedDecl *FoundDecl, TemplateDecl *NamedConcept, const TemplateArgumentListInfo *TemplateArgs, bool DoCheckConstraintSatisfaction=true)
ExprResult BuildCompoundLiteralExpr(SourceLocation LParenLoc, TypeSourceInfo *TInfo, SourceLocation RParenLoc, Expr *LiteralExpr)
ExprResult ActOnAddrLabel(SourceLocation OpLoc, SourceLocation LabLoc, LabelDecl *TheDecl)
ActOnAddrLabel - Parse the GNU address of label extension: "&&foo".
ExprResult ActOnParenListExpr(SourceLocation L, SourceLocation R, MultiExprArg Val)
QualType BuildCountAttributedArrayOrPointerType(QualType WrappedTy, Expr *CountExpr, bool CountInBytes, bool OrNull)
ExprResult BuildCXXNew(SourceRange Range, bool UseGlobal, SourceLocation PlacementLParen, MultiExprArg PlacementArgs, SourceLocation PlacementRParen, SourceRange TypeIdParens, QualType AllocType, TypeSourceInfo *AllocTypeInfo, std::optional< Expr * > ArraySize, SourceRange DirectInitRange, Expr *Initializer)
DeclRefExpr * BuildDeclRefExpr(ValueDecl *D, QualType Ty, ExprValueKind VK, SourceLocation Loc, const CXXScopeSpec *SS=nullptr)
ExprResult BuildCXXFoldExpr(UnresolvedLookupExpr *Callee, SourceLocation LParenLoc, Expr *LHS, BinaryOperatorKind Operator, SourceLocation EllipsisLoc, Expr *RHS, SourceLocation RParenLoc, UnsignedOrNone NumExpansions)
ExprResult CreateGenericSelectionExpr(SourceLocation KeyLoc, SourceLocation DefaultLoc, SourceLocation RParenLoc, bool PredicateIsExpr, void *ControllingExprOrType, ArrayRef< TypeSourceInfo * > Types, ArrayRef< Expr * > Exprs)
ControllingExprOrType is either a TypeSourceInfo * or an Expr *.
bool CheckTemplateArgument(NamedDecl *Param, TemplateArgumentLoc &Arg, NamedDecl *Template, SourceLocation TemplateLoc, SourceLocation RAngleLoc, unsigned ArgumentPackIndex, CheckTemplateArgumentInfo &CTAI, CheckTemplateArgumentKind CTAK)
Check that the given template argument corresponds to the given template parameter.
StmtResult ActOnFinishSwitchStmt(SourceLocation SwitchLoc, Stmt *Switch, Stmt *Body)
SourceLocation getLocForEndOfToken(SourceLocation Loc, unsigned Offset=0)
Calls Lexer::getLocForEndOfToken()
const LangOptions & getLangOpts() const
StmtResult ActOnWhileStmt(SourceLocation WhileLoc, SourceLocation LParenLoc, ConditionResult Cond, SourceLocation RParenLoc, Stmt *Body)
bool isPotentialImplicitMemberAccess(const CXXScopeSpec &SS, LookupResult &R, bool IsAddressOfOperand)
Check whether an expression might be an implicit class member access.
void collectUnexpandedParameterPacks(TemplateArgument Arg, SmallVectorImpl< UnexpandedParameterPack > &Unexpanded)
Collect the set of unexpanded parameter packs within the given template argument.
ExprResult BuildSourceLocExpr(SourceLocIdentKind Kind, QualType ResultTy, SourceLocation BuiltinLoc, SourceLocation RPLoc, DeclContext *ParentContext)
ExprResult BuildCXXTypeConstructExpr(TypeSourceInfo *Type, SourceLocation LParenLoc, MultiExprArg Exprs, SourceLocation RParenLoc, bool ListInitialization)
ExprResult BuildBuiltinOffsetOf(SourceLocation BuiltinLoc, TypeSourceInfo *TInfo, ArrayRef< OffsetOfComponent > Components, SourceLocation RParenLoc)
__builtin_offsetof(type, a.b[123][456].c)
ExprResult TemporaryMaterializationConversion(Expr *E)
If E is a prvalue denoting an unmaterialized temporary, materialize it as an xvalue.
ExprResult BuildTypeTrait(TypeTrait Kind, SourceLocation KWLoc, ArrayRef< TypeSourceInfo * > Args, SourceLocation RParenLoc)
TemplateArgument getPackSubstitutedTemplateArgument(TemplateArgument Arg) const
ExprResult BuildUnresolvedCoawaitExpr(SourceLocation KwLoc, Expr *Operand, UnresolvedLookupExpr *Lookup)
ExprResult BuildExpressionTrait(ExpressionTrait OET, SourceLocation KWLoc, Expr *Queried, SourceLocation RParen)
bool buildCoroutineParameterMoves(SourceLocation Loc)
ExprResult BuildCStyleCastExpr(SourceLocation LParenLoc, TypeSourceInfo *Ty, SourceLocation RParenLoc, Expr *Op)
ExprResult BuildCXXUuidof(QualType TypeInfoType, SourceLocation TypeidLoc, TypeSourceInfo *Operand, SourceLocation RParenLoc)
Build a Microsoft __uuidof expression with a type operand.
sema::FunctionScopeInfo * getCurFunction() const
DeclGroupPtrTy BuildDeclaratorGroup(MutableArrayRef< Decl * > Group)
BuildDeclaratorGroup - convert a list of declarations into a declaration group, performing any necess...
Expr * BuildCXXThisExpr(SourceLocation Loc, QualType Type, bool IsImplicit)
Build a CXXThisExpr and mark it referenced in the current context.
UnsignedOrNone getPackIndex(TemplateArgument Pack) const
ExprResult BuildDeclarationNameExpr(const CXXScopeSpec &SS, LookupResult &R, bool NeedsADL, bool AcceptInvalidDecl=false)
sema::BlockScopeInfo * getCurBlock()
Retrieve the current block, if any.
DeclContext * CurContext
CurContext - This is the current declaration context of parsing.
VarDecl * BuildExceptionDeclaration(Scope *S, TypeSourceInfo *TInfo, SourceLocation StartLoc, SourceLocation IdLoc, const IdentifierInfo *Id)
Perform semantic analysis for the variable declaration that occurs within a C++ catch clause,...
void MarkDeclRefReferenced(DeclRefExpr *E, const Expr *Base=nullptr)
Perform reference-marking and odr-use handling for a DeclRefExpr.
ExprResult BuildQualifiedDeclarationNameExpr(CXXScopeSpec &SS, const DeclarationNameInfo &NameInfo, bool IsAddressOfOperand, TypeSourceInfo **RecoveryTSI=nullptr)
BuildQualifiedDeclarationNameExpr - Build a C++ qualified declaration name, generally during template...
StmtResult ActOnForStmt(SourceLocation ForLoc, SourceLocation LParenLoc, Stmt *First, ConditionResult Second, FullExprArg Third, SourceLocation RParenLoc, Stmt *Body)
StmtResult ActOnIndirectGotoStmt(SourceLocation GotoLoc, SourceLocation StarLoc, Expr *DestExp)
ExprResult ActOnParenExpr(SourceLocation L, SourceLocation R, Expr *E)
ExprResult BuildCXXConstructExpr(SourceLocation ConstructLoc, QualType DeclInitType, NamedDecl *FoundDecl, CXXConstructorDecl *Constructor, MultiExprArg Exprs, bool HadMultipleCandidates, bool IsListInitialization, bool IsStdInitListInitialization, bool RequiresZeroInit, CXXConstructionKind ConstructKind, SourceRange ParenRange)
BuildCXXConstructExpr - Creates a complete call to a constructor, including handling of its default a...
ExprResult BuildAsTypeExpr(Expr *E, QualType DestTy, SourceLocation BuiltinLoc, SourceLocation RParenLoc)
Create a new AsTypeExpr node (bitcast) from the arguments.
ExprResult BuildFieldReferenceExpr(Expr *BaseExpr, bool IsArrow, SourceLocation OpLoc, const CXXScopeSpec &SS, FieldDecl *Field, DeclAccessPair FoundDecl, const DeclarationNameInfo &MemberNameInfo)
ExprResult ActOnConditionalOp(SourceLocation QuestionLoc, SourceLocation ColonLoc, Expr *CondExpr, Expr *LHSExpr, Expr *RHSExpr)
ActOnConditionalOp - Parse a ?
ExprResult BuildPossibleImplicitMemberExpr(const CXXScopeSpec &SS, SourceLocation TemplateKWLoc, LookupResult &R, const TemplateArgumentListInfo *TemplateArgs, const Scope *S)
Builds an expression which might be an implicit member expression.
UnsignedOrNone ArgPackSubstIndex
The current index into pack expansion arguments that will be used for substitution of parameter packs...
StmtResult BuildReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp, bool AllowRecovery=false)
StmtResult BuildCXXForRangeStmt(SourceLocation ForLoc, SourceLocation CoawaitLoc, Stmt *InitStmt, SourceLocation ColonLoc, Stmt *RangeDecl, Stmt *Begin, Stmt *End, Expr *Cond, Expr *Inc, Stmt *LoopVarDecl, SourceLocation RParenLoc, BuildForRangeKind Kind, ArrayRef< MaterializeTemporaryExpr * > LifetimeExtendTemps={})
BuildCXXForRangeStmt - Build or instantiate a C++11 for-range statement.
StmtResult ActOnDoStmt(SourceLocation DoLoc, Stmt *Body, SourceLocation WhileLoc, SourceLocation CondLParen, Expr *Cond, SourceLocation CondRParen)
StmtResult ActOnStartOfSwitchStmt(SourceLocation SwitchLoc, SourceLocation LParenLoc, Stmt *InitStmt, ConditionResult Cond, SourceLocation RParenLoc)
ExprResult BuildQualifiedTemplateIdExpr(CXXScopeSpec &SS, SourceLocation TemplateKWLoc, const DeclarationNameInfo &NameInfo, const TemplateArgumentListInfo *TemplateArgs, bool IsAddressOfOperand)
@ ConstantEvaluated
The current context is "potentially evaluated" in C++11 terms, but the expression is evaluated at com...
@ PotentiallyEvaluated
The current expression is potentially evaluated at run time, which means that code may be generated t...
@ Unevaluated
The current expression and its subexpressions occur within an unevaluated operand (C++11 [expr]p7),...
@ ImmediateFunctionContext
In addition of being constant evaluated, the current expression occurs in an immediate function conte...
StmtResult ActOnSEHExceptBlock(SourceLocation Loc, Expr *FilterExpr, Stmt *Block)
ExprResult CreateUnaryExprOrTypeTraitExpr(TypeSourceInfo *TInfo, SourceLocation OpLoc, UnaryExprOrTypeTrait ExprKind, SourceRange R)
Build a sizeof or alignof expression given a type operand.
StmtResult ActOnDeclStmt(DeclGroupPtrTy Decl, SourceLocation StartLoc, SourceLocation EndLoc)
ExprResult PerformObjectMemberConversion(Expr *From, NestedNameSpecifier Qualifier, NamedDecl *FoundDecl, NamedDecl *Member)
Cast a base object to a member's actual type.
Expr * MaybeCreateExprWithCleanups(Expr *SubExpr)
MaybeCreateExprWithCleanups - If the current full-expression requires any cleanups,...
SmallVector< ExpressionEvaluationContextRecord, 8 > ExprEvalContexts
A stack of expression evaluation contexts.
ExprResult BuildEmptyCXXFoldExpr(SourceLocation EllipsisLoc, BinaryOperatorKind Operator)
ExprResult BuildCXXThrow(SourceLocation OpLoc, Expr *Ex, bool IsThrownVarInScope)
ExprResult BuildBinOp(Scope *S, SourceLocation OpLoc, BinaryOperatorKind Opc, Expr *LHSExpr, Expr *RHSExpr, bool ForFoldExpression=false)
ExprResult BuildCXXDefaultInitExpr(SourceLocation Loc, FieldDecl *Field)
ExprResult BuildLambdaExpr(SourceLocation StartLoc, SourceLocation EndLoc)
Complete a lambda-expression having processed and attached the lambda body.
@ BFRK_Rebuild
Instantiation or recovery rebuild of a for-range statement.
void ActOnCaseStmtBody(Stmt *CaseStmt, Stmt *SubStmt)
ActOnCaseStmtBody - This installs a statement as the body of a case.
ExprResult ActOnBlockStmtExpr(SourceLocation CaretLoc, Stmt *Body, Scope *CurScope)
ActOnBlockStmtExpr - This is called when the body of a block statement literal was successfully compl...
ExprResult BuildArrayTypeTrait(ArrayTypeTrait ATT, SourceLocation KWLoc, TypeSourceInfo *TSInfo, Expr *DimExpr, SourceLocation RParen)
void MarkMemberReferenced(MemberExpr *E)
Perform reference-marking and odr-use handling for a MemberExpr.
ExprResult BuildCXXNamedCast(SourceLocation OpLoc, tok::TokenKind Kind, TypeSourceInfo *Ty, Expr *E, SourceRange AngleBrackets, SourceRange Parens)
void MarkFunctionReferenced(SourceLocation Loc, FunctionDecl *Func, bool MightBeOdrUse=true)
Mark a function referenced, and check whether it is odr-used (C++ [basic.def.odr]p2,...
ExprResult CreateRecoveryExpr(SourceLocation Begin, SourceLocation End, ArrayRef< Expr * > SubExprs, QualType T=QualType())
Attempts to produce a RecoveryExpr after some AST node cannot be created.
ExprResult ActOnGCCAsmStmtString(Expr *Stm, bool ForAsmLabel)
StmtResult ActOnIfStmt(SourceLocation IfLoc, IfStatementKind StatementKind, SourceLocation LParenLoc, Stmt *InitStmt, ConditionResult Cond, SourceLocation RParenLoc, Stmt *ThenVal, SourceLocation ElseLoc, Stmt *ElseVal)
void ActOnBlockStart(SourceLocation CaretLoc, Scope *CurScope)
ActOnBlockStart - This callback is invoked when a block literal is started.
ExprResult ActOnArraySubscriptExpr(Scope *S, Expr *Base, SourceLocation LLoc, MultiExprArg ArgExprs, SourceLocation RLoc)
ExprResult BuildAtomicExpr(SourceRange CallRange, SourceRange ExprRange, SourceLocation RParenLoc, MultiExprArg Args, AtomicExpr::AtomicOp Op, AtomicArgumentOrder ArgOrder=AtomicArgumentOrder::API)
ExprResult ActOnCallExpr(Scope *S, Expr *Fn, SourceLocation LParenLoc, MultiExprArg ArgExprs, SourceLocation RParenLoc, Expr *ExecConfig=nullptr)
ActOnCallExpr - Handle a call to Fn with the specified array of arguments.
OpaquePtr< TemplateName > TemplateTy
static QualType GetTypeFromParser(ParsedType Ty, TypeSourceInfo **TInfo=nullptr)
static ConditionResult ConditionError()
StmtResult ActOnCompoundStmt(SourceLocation L, SourceLocation R, ArrayRef< Stmt * > Elts, bool isStmtExpr)
SemaPseudoObject & PseudoObject()
StmtResult ActOnCXXTryBlock(SourceLocation TryLoc, Stmt *TryBlock, ArrayRef< Stmt * > Handlers)
ActOnCXXTryBlock - Takes a try compound-statement and a number of handlers and creates a try statemen...
OpaquePtr< DeclGroupRef > DeclGroupPtrTy
StmtResult ActOnDefaultStmt(SourceLocation DefaultLoc, SourceLocation ColonLoc, Stmt *SubStmt, Scope *CurScope)
ExprResult HandleExprEvaluationContextForTypeof(Expr *E)
StmtResult ActOnCaseStmt(SourceLocation CaseLoc, ExprResult LHS, SourceLocation DotDotDotLoc, ExprResult RHS, SourceLocation ColonLoc)
TypeSourceInfo * CheckPackExpansion(TypeSourceInfo *Pattern, SourceLocation EllipsisLoc, UnsignedOrNone NumExpansions)
Construct a pack expansion type from the pattern of the pack expansion.
StmtResult FinishCXXForRangeStmt(Stmt *ForRange, Stmt *Body)
FinishCXXForRangeStmt - Attach the body to a C++0x for-range statement.
ExprResult ActOnFinishFullExpr(Expr *Expr, bool DiscardedValue)
ExprResult CreateBuiltinMatrixSubscriptExpr(Expr *Base, Expr *RowIdx, Expr *ColumnIdx, SourceLocation RBLoc)
StmtResult ActOnGCCAsmStmt(SourceLocation AsmLoc, bool IsSimple, bool IsVolatile, unsigned NumOutputs, unsigned NumInputs, IdentifierInfo **Names, MultiExprArg Constraints, MultiExprArg Exprs, Expr *AsmString, MultiExprArg Clobbers, unsigned NumLabels, SourceLocation RParenLoc)
ShuffleVectorExpr - clang-specific builtin-in function __builtin_shufflevector.
Represents an expression that computes the length of a parameter pack.
SourceLocation getPackLoc() const
Determine the location of the parameter pack.
bool isPartiallySubstituted() const
Determine whether this represents a partially-substituted sizeof... expression, such as is produced f...
static SizeOfPackExpr * Create(ASTContext &Context, SourceLocation OperatorLoc, NamedDecl *Pack, SourceLocation PackLoc, SourceLocation RParenLoc, UnsignedOrNone Length=std::nullopt, ArrayRef< TemplateArgument > PartialArgs={})
ArrayRef< TemplateArgument > getPartialArguments() const
Get.
SourceLocation getOperatorLoc() const
Determine the location of the 'sizeof' keyword.
SourceLocation getRParenLoc() const
Determine the location of the right parenthesis.
NamedDecl * getPack() const
Retrieve the parameter pack.
Represents a function call to one of __builtin_LINE(), __builtin_COLUMN(), __builtin_FUNCTION(),...
static bool MayBeDependent(SourceLocIdentKind Kind)
Encodes a location in the source.
bool isValid() const
Return true if this is a valid SourceLocation object.
A trivial tuple used to represent a source range.
SourceLocation getEnd() const
SourceLocation getBegin() const
StmtExpr - This is the GNU Statement Expression extension: ({int X=4; X;}).
Stmt - This represents one statement.
SourceLocation getEndLoc() const LLVM_READONLY
StmtClass getStmtClass() const
SourceRange getSourceRange() const LLVM_READONLY
SourceLocation tokens are not useful in isolation - they are low level value objects created/interpre...
StringLiteral - This represents a string literal expression, e.g.
Wrapper for substituted template type parameters.
Represents a reference to a non-type template parameter that has been substituted with a template arg...
Represents a reference to a non-type template parameter pack that has been substituted with a non-tem...
A structure for storing an already-substituted template template parameter pack.
A structure for storing the information associated with a substituted template template parameter.
Wrapper for substituted template type parameters.
SwitchStmt - This represents a 'switch' stmt.
Represents the declaration of a struct/union/class/enum.
SourceLocation getNameLoc() const
SourceLocation getElaboratedKeywordLoc() const
NestedNameSpecifierLoc getQualifierLoc() const
void setQualifierLoc(NestedNameSpecifierLoc QualifierLoc)
void setNameLoc(SourceLocation Loc)
void setElaboratedKeywordLoc(SourceLocation Loc)
A convenient class for passing around template argument information.
void setLAngleLoc(SourceLocation Loc)
void setRAngleLoc(SourceLocation Loc)
void addArgument(const TemplateArgumentLoc &Loc)
const TemplateArgumentLoc * operator->() const
pointer(TemplateArgumentLoc Arg)
Simple iterator that traverses the template arguments in a container that provides a getArgLoc() memb...
TemplateArgumentLoc operator*() const
TemplateArgumentLocContainerIterator operator++(int)
friend bool operator!=(const TemplateArgumentLocContainerIterator &X, const TemplateArgumentLocContainerIterator &Y)
TemplateArgumentLocContainerIterator()
TemplateArgumentLoc value_type
TemplateArgumentLocContainerIterator(ArgLocContainer &Container, unsigned Index)
friend bool operator==(const TemplateArgumentLocContainerIterator &X, const TemplateArgumentLocContainerIterator &Y)
TemplateArgumentLocContainerIterator & operator++()
std::input_iterator_tag iterator_category
TemplateArgumentLoc reference
pointer operator->() const
const TemplateArgumentLoc * operator->() const
pointer(TemplateArgumentLoc Arg)
Iterator adaptor that invents template argument location information for each of the template argumen...
TemplateArgumentLocInventIterator & operator++()
pointer operator->() const
std::iterator_traits< InputIterator >::difference_type difference_type
reference operator*() const
TemplateArgumentLocInventIterator operator++(int)
friend bool operator==(const TemplateArgumentLocInventIterator &X, const TemplateArgumentLocInventIterator &Y)
TemplateArgumentLocInventIterator(TreeTransform< Derived > &Self, InputIterator Iter)
friend bool operator!=(const TemplateArgumentLocInventIterator &X, const TemplateArgumentLocInventIterator &Y)
std::input_iterator_tag iterator_category
TemplateArgumentLoc reference
TemplateArgumentLoc value_type
Location wrapper for a TemplateArgument.
const TemplateArgument & getArgument() const
SourceLocation getTemplateNameLoc() const
SourceLocation getTemplateKWLoc() const
TypeSourceInfo * getTypeSourceInfo() const
Expr * getSourceExpression() const
NestedNameSpecifierLoc getTemplateQualifierLoc() const
Represents a template argument.
Expr * getAsExpr() const
Retrieve the template argument as an expression.
const TemplateArgument * pack_iterator
Iterator that traverses the elements of a template argument pack.
QualType getNonTypeTemplateArgumentType() const
If this is a non-type template argument, get its type.
QualType getAsType() const
Retrieve the type for a type template argument.
llvm::APSInt getAsIntegral() const
Retrieve the template argument as an integral value.
TemplateName getAsTemplate() const
Retrieve the template name for a template name argument.
bool containsUnexpandedParameterPack() const
Whether this template argument contains an unexpanded parameter pack.
ValueDecl * getAsDecl() const
Retrieve the declaration for a declaration non-type template argument.
@ Declaration
The template argument is a declaration that was provided for a pointer, reference,...
@ Template
The template argument is a template name that was provided for a template template parameter.
@ StructuralValue
The template argument is a non-type template argument that can't be represented by the special-case D...
@ Pack
The template argument is actually a parameter pack.
@ TemplateExpansion
The template argument is a pack expansion of a template name that was provided for a template templat...
@ NullPtr
The template argument is a null pointer or null pointer to member that was provided for a non-type te...
@ Type
The template argument is a type.
@ Null
Represents an empty template argument, e.g., one that has not been deduced.
@ Integral
The template argument is an integral value stored in an llvm::APSInt that was provided for an integra...
@ Expression
The template argument is an expression, and we've not resolved it to one of the other forms yet,...
ArgKind getKind() const
Return the kind of stored template argument.
bool isPackExpansion() const
Determine whether this template argument is a pack expansion.
const APValue & getAsStructuralValue() const
Get the value of a StructuralValue.
The base class of all kinds of template declarations (e.g., class, function, etc.).
Represents a C++ template name within the type system.
TemplateDecl * getAsTemplateDecl(bool IgnoreDeduced=false) const
Retrieve the underlying template declaration that this template name refers to, if known.
DeducedTemplateStorage * getAsDeducedTemplateName() const
Retrieve the deduced template info, if any.
bool isNull() const
Determine whether this template name is NULL.
DependentTemplateName * getAsDependentTemplateName() const
Retrieve the underlying dependent template name structure, if any.
QualifiedTemplateName * getAsQualifiedTemplateName() const
Retrieve the underlying qualified template name structure, if any.
NestedNameSpecifier getQualifier() const
SubstTemplateTemplateParmPackStorage * getAsSubstTemplateTemplateParmPack() const
Retrieve the substituted template template parameter pack, if known.
SubstTemplateTemplateParmStorage * getAsSubstTemplateTemplateParm() const
Retrieve the substituted template template parameter, if known.
Stores a list of template parameters for a TemplateDecl and its derived classes.
unsigned getNumArgs() const
SourceLocation getLAngleLoc() const
SourceLocation getRAngleLoc() const
SourceLocation getTemplateNameLoc() const
SourceLocation getTemplateKeywordLoc() const
NestedNameSpecifierLoc getQualifierLoc() const
SourceLocation getElaboratedKeywordLoc() const
Wrapper for template type parameters.
The top declaration context.
TypeLoc getTypeLocInContext(ASTContext &Context, QualType T)
Copies the type-location information to the given AST context and returns a TypeLoc referring into th...
TyLocType push(QualType T)
Pushes space for a new TypeLoc of the given type.
void reserve(size_t Requested)
Ensures that this buffer has at least as much capacity as described.
void TypeWasModifiedSafely(QualType T)
Tell the TypeLocBuilder that the type it is storing has been modified in some safe way that doesn't a...
TypeSourceInfo * getTypeSourceInfo(ASTContext &Context, QualType T)
Creates a TypeSourceInfo for the given type.
Base wrapper for a particular "section" of type source info.
UnqualTypeLoc getUnqualifiedLoc() const
Skips past any qualifiers, if this is qualified.
QualType getType() const
Get the type for which this source info wrapper provides information.
T getAs() const
Convert to the specified TypeLoc type, returning a null TypeLoc if this TypeLoc is not of the desired...
T castAs() const
Convert to the specified TypeLoc type, asserting that this TypeLoc is of the desired type.
SourceRange getSourceRange() const LLVM_READONLY
Get the full source range.
unsigned getFullDataSize() const
Returns the size of the type source info data block.
TypeLocClass getTypeLocClass() const
T getAsAdjusted() const
Convert to the specified TypeLoc type, returning a null TypeLoc if this TypeLoc is not of the desired...
SourceLocation getBeginLoc() const
Get the begin source location.
Represents a typeof (or typeof) expression (a C23 feature and GCC extension) or a typeof_unqual expre...
A container of type source information.
TypeLoc getTypeLoc() const
Return the TypeLoc wrapper for the type source info.
QualType getType() const
Return the type wrapped by this type source info.
void setNameLoc(SourceLocation Loc)
A type trait used in the implementation of various C++11 and Library TR1 trait templates.
The base class of the type hierarchy.
bool isDependentType() const
Whether this type is a dependent type, meaning that its definition somehow depends on a template para...
bool containsUnexpandedParameterPack() const
Whether this type is or contains an unexpanded parameter pack, used to support C++0x variadic templat...
bool isOverloadableType() const
Determines whether this is a type for which one can define an overloaded operator.
bool isObjCObjectPointerType() const
const T * getAs() const
Member-template getAs<specific type>'.
Base class for declarations which introduce a typedef-name.
Wrapper for source info for typedefs.
void setTypeofLoc(SourceLocation Loc)
UnaryExprOrTypeTraitExpr - expression with either a type or (unevaluated) expression operand.
UnaryOperator - This represents the unary-expression's (except sizeof and alignof),...
SourceLocation getOperatorLoc() const
getOperatorLoc - Return the location of the operator.
Expr * getSubExpr() const
static Opcode getOverloadedOpcode(OverloadedOperatorKind OO, bool Postfix)
Retrieve the unary opcode that corresponds to the given overloaded operator.
Represents a C++ unqualified-id that has been parsed.
void setOperatorFunctionId(SourceLocation OperatorLoc, OverloadedOperatorKind Op, SourceLocation SymbolLocations[3])
Specify that this unqualified-id was parsed as an operator-function-id.
A reference to a name which we were able to look up during parsing but could not resolve to a specifi...
CXXRecordDecl * getNamingClass()
Gets the 'naming class' (in the sense of C++0x [class.access.base]p5) of the lookup.
bool requiresADL() const
True if this declaration should be extended by argument-dependent lookup.
static UnresolvedLookupExpr * Create(const ASTContext &Context, CXXRecordDecl *NamingClass, NestedNameSpecifierLoc QualifierLoc, const DeclarationNameInfo &NameInfo, bool RequiresADL, UnresolvedSetIterator Begin, UnresolvedSetIterator End, bool KnownDependent, bool KnownInstantiationDependent)
Represents a C++ member access expression for which lookup produced a set of overloaded functions.
A set of unresolved declarations.
void append(iterator I, iterator E)
A set of unresolved declarations.
Wrapper for source info for unresolved typename using decls.
Represents the dependent type named by a dependently-scoped typename using declaration,...
A call to a literal operator (C++11 [over.literal]) written as a user-defined literal (C++11 [lit....
Represents a shadow declaration implicitly introduced into a scope by a (resolved) using-declaration ...
NamedDecl * getTargetDecl() const
Gets the underlying declaration which has been brought into the local scope.
Wrapper for source info for types used via transparent aliases.
Represents a call to the builtin function __builtin_va_arg.
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
bool isParameterPack() const
Determine whether this value is actually a function parameter pack, init-capture pack,...
Represents a variable declaration or definition.
@ CInit
C-style initialization with assignment.
@ CallInit
Call-style initialization (C++98)
StorageClass getStorageClass() const
Returns the storage class as written in the source.
Represents a C array with a specified size that is not an integer-constant-expression.
void setNameLoc(SourceLocation Loc)
Represents a GCC generic vector type.
WhileStmt - This represents a 'while' stmt.
A requires-expression requirement which queries the validity and properties of an expression ('simple...
SubstitutionDiagnostic * getExprSubstitutionDiagnostic() const
bool isExprSubstitutionFailure() const
const ReturnTypeRequirement & getReturnTypeRequirement() const
SourceLocation getNoexceptLoc() const
A requires-expression requirement which is satisfied when a general constraint expression is satisfie...
const ASTConstraintSatisfaction & getConstraintSatisfaction() const
bool hasInvalidConstraint() const
Expr * getConstraintExpr() const
StringRef getInvalidConstraintEntity()
A static requirement that can be used in a requires-expression to check properties of types and expre...
A requires-expression requirement which queries the existence of a type name or type template special...
bool isSubstitutionFailure() const
SubstitutionDiagnostic * getSubstitutionDiagnostic() const
TypeSourceInfo * getType() const
Retains information about a block that is currently being parsed.
bool ContainsUnexpandedParameterPack
Whether this contains an unexpanded parameter pack.
CXXRecordDecl * Lambda
The class that describes the lambda.
CXXMethodDecl * CallOperator
The lambda's compiler-generated operator().
@ AttributedType
The l-value was considered opaque, so the alignment was determined from a type, but that type was an ...
const AstTypeMatcher< FunctionType > functionType
llvm::PointerUnion< const Decl *, const Expr * > DeclTy
bool Comp(InterpState &S, CodePtr OpPC)
1) Pops the value from the stack.
bool Inc(InterpState &S, CodePtr OpPC, bool CanOverflow)
1) Pops a pointer from the stack 2) Load the value from the pointer 3) Writes the value increased by ...
The JSON file list parser is used to communicate input to InstallAPI.
CanQual< Type > CanQualType
Represents a canonical, potentially-qualified type.
OpenMPOriginalSharingModifier
OpenMP 6.0 original sharing modifiers.
OverloadedOperatorKind
Enumeration specifying the different kinds of C++ overloaded operators.
@ OO_None
Not an overloaded operator.
@ NUM_OVERLOADED_OPERATORS
bool isa(CodeGen::Address addr)
ArrayTypeTrait
Names for the array type traits.
OpenMPDefaultClauseVariableCategory
OpenMP variable-category for 'default' clause.
AutoTypeKeyword
Which keyword(s) were used to create an AutoType.
OpenMPDefaultmapClauseModifier
OpenMP modifiers for 'defaultmap' clause.
OpenMPOrderClauseModifier
OpenMP modifiers for 'order' clause.
@ Ambiguous
Name lookup results in an ambiguity; use getAmbiguityKind to figure out what kind of ambiguity we hav...
@ NotFound
No entity found met the criteria.
@ FoundOverloaded
Name lookup found a set of overloaded functions that met the criteria.
@ Found
Name lookup found a single declaration that met the criteria.
@ FoundUnresolvedValue
Name lookup found an unresolvable value declaration and cannot yet complete.
@ NotFoundInCurrentInstantiation
No entity found met the criteria within the current instantiation,, but there were dependent base cla...
IfStatementKind
In an if statement, this denotes whether the statement is a constexpr or consteval if statement.
@ TemplateName
The identifier is a template name. FIXME: Add an annotation for that.
@ OK_ObjCProperty
An Objective-C property is a logical field of an Objective-C object which is read and written via Obj...
OpenMPAtClauseKind
OpenMP attributes for 'at' clause.
@ LCK_ByCopy
Capturing by copy (a.k.a., by value)
@ LCK_ByRef
Capturing by reference.
@ LCK_StarThis
Capturing the *this object by copy.
NonTagKind
Common ways to introduce type names without a tag for use in diagnostics.
OpenMPReductionClauseModifier
OpenMP modifiers for 'reduction' clause.
std::pair< llvm::PointerUnion< const TemplateTypeParmType *, NamedDecl *, const TemplateSpecializationType *, const SubstBuiltinTemplatePackType * >, SourceLocation > UnexpandedParameterPack
@ DevicePtr
'deviceptr' clause, allowed on Compute and Combined Constructs, plus 'data' and 'declare'.
@ Invalid
Represents an invalid clause, for the purposes of parsing.
@ Attach
'attach' clause, allowed on Compute and Combined constructs, plus 'data' and 'enter data'.
@ Self
'self' clause, allowed on Compute and Combined Constructs, plus 'update'.
@ Detach
'detach' clause, allowed on the 'exit data' construct.
TypeOfKind
The kind of 'typeof' expression we're after.
OpenMPScheduleClauseModifier
OpenMP modifiers for 'schedule' clause.
OpenACCComputeConstruct(OpenACCDirectiveKind K, SourceLocation Start, SourceLocation DirectiveLoc, SourceLocation End, ArrayRef< const OpenACCClause * > Clauses, Stmt *StructuredBlock)
OpenMPDistScheduleClauseKind
OpenMP attributes for 'dist_schedule' clause.
OpenMPDoacrossClauseModifier
OpenMP dependence types for 'doacross' clause.
@ Dependent
Parse the block as a dependent block, which may be used in some template instantiations but not other...
UnaryExprOrTypeTrait
Names for the "expression or type" traits.
std::pair< NullabilityKind, bool > DiagNullabilityKind
A nullability kind paired with a bit indicating whether it used a context-sensitive keyword.
OpenMPDynGroupprivateClauseFallbackModifier
MutableArrayRef< Expr * > MultiExprArg
@ Property
The type of a property.
@ Result
The result type of a method or function.
OpenMPBindClauseKind
OpenMP bindings for the 'bind' clause.
ArraySizeModifier
Capture whether this is a normal array (e.g.
const FunctionProtoType * T
bool isComputedNoexcept(ExceptionSpecificationType ESpecType)
OpenMPLastprivateModifier
OpenMP 'lastprivate' clause modifier.
@ Template
We are parsing a template declaration.
ActionResult< CXXBaseSpecifier * > BaseResult
OpenMPGrainsizeClauseModifier
OpenMPNumTasksClauseModifier
TagTypeKind
The kind of a tag type.
bool transformOMPMappableExprListClause(TreeTransform< Derived > &TT, OMPMappableExprListClause< T > *C, llvm::SmallVectorImpl< Expr * > &Vars, CXXScopeSpec &MapperIdScopeSpec, DeclarationNameInfo &MapperIdInfo, llvm::SmallVectorImpl< Expr * > &UnresolvedMappers)
@ Keyword
The name has been typo-corrected to a keyword.
bool isOpenMPLoopDirective(OpenMPDirectiveKind DKind)
Checks if the specified directive is a directive with an associated loop construct.
OpenMPSeverityClauseKind
OpenMP attributes for 'severity' clause.
std::tuple< NamedDecl *, TemplateArgument > getReplacedTemplateParameter(Decl *D, unsigned Index)
Internal helper used by Subst* nodes to retrieve a parameter from the AssociatedDecl,...
OpenMPDefaultmapClauseKind
OpenMP attributes for 'defaultmap' clause.
OpenMPAllocateClauseModifier
OpenMP modifiers for 'allocate' clause.
OpenMPLinearClauseKind
OpenMP attributes for 'linear' clause.
llvm::omp::Directive OpenMPDirectiveKind
OpenMP directives.
OpenMPDynGroupprivateClauseModifier
@ VK_PRValue
A pr-value expression (in the C++11 taxonomy) produces a temporary value.
@ VK_LValue
An l-value expression is a reference to an object with independent storage.
@ Dependent
The name is a dependent name, so the results will differ from one instantiation to the next.
@ Exists
The symbol exists.
@ Error
An error occurred.
@ DoesNotExist
The symbol does not exist.
MutableArrayRef< Stmt * > MultiStmtArg
OpenMPNumThreadsClauseModifier
U cast(CodeGen::Address addr)
OpenMPDeviceClauseModifier
OpenMP modifiers for 'device' clause.
OpaquePtr< QualType > ParsedType
An opaque type for threading parsed type information through the parser.
ElaboratedTypeKeyword
The elaboration keyword that precedes a qualified type name or introduces an elaborated-type-specifie...
@ None
No keyword precedes the qualified type name.
@ Class
The "class" keyword introduces the elaborated-type-specifier.
@ Typename
The "typename" keyword precedes the qualified type name, e.g., typename T::type.
ActionResult< Expr * > ExprResult
OpenMPOrderClauseKind
OpenMP attributes for 'order' clause.
TypeTrait
Names for traits that operate specifically on types.
@ Parens
New-expression has a C++98 paren-delimited initializer.
ExceptionSpecificationType
The various types of exception specifications that exist in C++11.
@ EST_Uninstantiated
not instantiated yet
@ EST_Unevaluated
not evaluated yet, for special member function
@ EST_Dynamic
throw(T1, T2)
OpenMPScheduleClauseKind
OpenMP attributes for 'schedule' clause.
static QualType TransformTypeSpecType(TypeLocBuilder &TLB, TyLoc T)
ActionResult< Stmt * > StmtResult
OpenMPMapClauseKind
OpenMP mapping kind for 'map' clause.
The result of a constraint satisfaction check, containing the necessary information to diagnose an un...
Represents an explicit template argument list in C++, e.g., the "<int>" in "sort<int>".
static const ASTTemplateArgumentListInfo * Create(const ASTContext &C, const TemplateArgumentListInfo &List)
UnsignedOrNone ArgPackSubstIndex
DeclarationNameInfo - A collector data type for bundling together a DeclarationName and the correspon...
SourceLocation getLoc() const
getLoc - Returns the main location of the declaration name.
DeclarationName getName() const
getName - Returns the embedded declaration name.
void setNamedTypeInfo(TypeSourceInfo *TInfo)
setNamedTypeInfo - Sets the source type info associated to the name.
void setName(DeclarationName N)
setName - Sets the embedded declaration name.
TypeSourceInfo * getNamedTypeInfo() const
getNamedTypeInfo - Returns the source type info associated to the name.
A FunctionEffect plus a potential boolean expression determining whether the effect is declared (e....
Holds information about the various types of exception specification.
FunctionDecl * SourceTemplate
The function template whose exception specification this is instantiated from, for EST_Uninstantiated...
ExceptionSpecificationType Type
The kind of exception specification this is.
ArrayRef< QualType > Exceptions
Explicitly-specified list of exception types.
Expr * NoexceptExpr
Noexcept expression, if this is a computed noexcept specification.
Extra information about a function prototype.
ExceptionSpecInfo ExceptionSpec
FunctionEffectsRef FunctionEffects
const ExtParameterInfo * ExtParameterInfos
const IdentifierInfo * getIdentifier() const
Returns the identifier to which this template name refers.
OverloadedOperatorKind getOperator() const
Return the overloaded operator to which this template name refers.
static TagTypeKind getTagTypeKindForKeyword(ElaboratedTypeKeyword Keyword)
Converts an elaborated type keyword into a TagTypeKind.
const NamespaceBaseDecl * Namespace
Iterator range representation begin:end[:step].
Data for list of allocators.
This structure contains most locations needed for by an OMPVarListClause.
An element in an Objective-C dictionary literal.
Data for list of allocators.
A context in which code is being synthesized (where a source location alone is not sufficient to iden...
@ LambdaExpressionSubstitution
We are substituting into a lambda expression.
An RAII helper that pops function a function scope on exit.
Keeps information about an identifier in a nested-name-spec.
Location information for a TemplateArgument.
UnsignedOrNone OrigNumExpansions
bool ExpandUnderForgetSubstitions
UnsignedOrNone NumExpansions