13#ifndef LLVM_CLANG_LIB_SEMA_TREETRANSFORM_H
14#define LLVM_CLANG_LIB_SEMA_TREETRANSFORM_H
49#include "llvm/ADT/ArrayRef.h"
50#include "llvm/Support/ErrorHandling.h"
54using namespace llvm::omp;
121template<
typename Derived>
126 class ForgetPartiallySubstitutedPackRAII {
134 ForgetPartiallySubstitutedPackRAII(Derived &
Self)
135 :
Self(
Self), ResetPackSubstIndex(
Self.getSema(), std::nullopt) {
136 Old =
Self.ForgetPartiallySubstitutedPack();
139 ~ForgetPartiallySubstitutedPackRAII() {
140 Self.RememberPartiallySubstitutedPack(Old);
157 Derived &
getDerived() {
return static_cast<Derived&
>(*this); }
161 return static_cast<const Derived&
>(*this);
229 if (Location.isValid())
230 Self.getDerived().setBase(Location, Entity);
234 Self.getDerived().setBase(OldLocation, OldEntity);
307 bool FailOnPackProducingTemplates,
308 bool &ShouldExpand,
bool &RetainExpansion,
310 ShouldExpand =
false;
338 struct ForgetSubstitutionRAII {
344 Old =
Self.ForgetSubstitution();
347 ~ForgetSubstitutionRAII() {
Self.RememberSubstitution(std::move(Old)); }
447 const X##Attr *Transform##X##Attr(const X##Attr *R) { return R; }
448#include "clang/Basic/AttrList.inc"
458 const X##Attr *TransformStmt##X##Attr(const Stmt *, const Stmt *, \
459 const X##Attr *A) { \
460 return getDerived().Transform##X##Attr(A); \
462#include "clang/Basic/AttrList.inc"
508 bool *ArgChanged =
nullptr);
517 llvm::DenseMap<Decl *, Decl *>::iterator Known
520 return Known->second;
548 assert(
New.size() == 1 &&
549 "must override transformedLocalDecl if performing pack expansion");
587 NamedDecl *FirstQualifierInScope =
nullptr);
632 NamedDecl *FirstQualifierInScope =
nullptr,
633 bool AllowInjectedClassName =
false);
645 bool Uneval =
false);
672 bool Uneval =
false) {
691 template<
typename InputIterator>
695 bool Uneval =
false);
697 template <
typename InputIterator>
701 bool Uneval =
false);
722 return SemaRef.Context.getTrivialTypeSourceInfo(
T,
726#define ABSTRACT_TYPELOC(CLASS, PARENT)
727#define TYPELOC(CLASS, PARENT) \
728 QualType Transform##CLASS##Type(TypeLocBuilder &TLB, CLASS##TypeLoc T);
729#include "clang/AST/TypeLocNodes.def"
733 bool SuppressObjCLifetime);
737 bool SuppressObjCLifetime);
739 template<
typename Fn>
757 bool AllowInjectedClassName);
785 return getDerived().TransformFunctionTypeParams(
786 Loc, Params, ParamTypes, ParamInfos, PTypes, PVars, PInfos,
nullptr);
804 KWLoc, Params,
nullptr,
805 nullptr, PTypes, &TransParams, PInfos))
819 bool ExpectParameterPack);
846 bool IsAddressOfOperand,
854 bool IsAddressOfOperand);
862#define STMT(Node, Parent) \
863 LLVM_ATTRIBUTE_NOINLINE \
864 StmtResult Transform##Node(Node *S);
865#define VALUESTMT(Node, Parent) \
866 LLVM_ATTRIBUTE_NOINLINE \
867 StmtResult Transform##Node(Node *S, StmtDiscardKind SDK);
868#define EXPR(Node, Parent) \
869 LLVM_ATTRIBUTE_NOINLINE \
870 ExprResult Transform##Node(Node *E);
871#define ABSTRACT_STMT(Stmt)
872#include "clang/AST/StmtNodes.inc"
874#define GEN_CLANG_CLAUSE_CLASS
875#define CLAUSE_CLASS(Enum, Str, Class) \
876 LLVM_ATTRIBUTE_NOINLINE \
877 OMPClause *Transform##Class(Class *S);
878#include "llvm/Frontend/OpenMP/OMP.inc"
956 const llvm::APInt *Size,
Expr *SizeExpr,
957 unsigned IndexTypeQuals,
SourceRange BracketsRange);
966 const llvm::APInt &Size,
Expr *SizeExpr,
967 unsigned IndexTypeQuals,
977 unsigned IndexTypeQuals,
987 unsigned IndexTypeQuals,
998 unsigned IndexTypeQuals,
1036 unsigned NumColumns);
1053 Expr *AddrSpaceExpr,
1077 return SemaRef.Context.getUsingType(
Keyword, Qualifier, D, UnderlyingType);
1090 return SemaRef.Context.getMacroQualifiedType(
T, MacroII);
1100 return SemaRef.Context.getCanonicalTagType(Tag);
1117 UnaryTransformType::UTTKind UKind,
1129 bool FullySubstituted,
1143 TypeConstraintConcept,
1144 TypeConstraintArgs);
1151 return SemaRef.Context.getDeducedTemplateSpecializationType(
1170 return SemaRef.BuildParenType(InnerType);
1183 bool DeducedTSTContext) {
1185 SS.
Adopt(QualifierLoc);
1189 if (!
SemaRef.computeDeclContext(SS))
1197 return SemaRef.CheckTypenameType(
Keyword, KeywordLoc, QualifierLoc,
1198 *Id, IdLoc, DeducedTSTContext);
1211 if (
SemaRef.RequireCompleteDeclContext(SS, DC))
1216 switch (
Result.getResultKind()) {
1227 llvm_unreachable(
"Tag lookup cannot find non-tags");
1239 switch (
Result.getResultKind()) {
1245 SemaRef.Diag(IdLoc, diag::err_tag_reference_non_tag)
1246 << SomeDecl << NTK << Kind;
1251 SemaRef.Diag(IdLoc, diag::err_not_tag_in_scope)
1257 if (!
SemaRef.isAcceptableTagRedeclaration(Tag, Kind,
false,
1259 SemaRef.Diag(KeywordLoc, diag::err_use_with_wrong_tag) << Id;
1260 SemaRef.Diag(Tag->getLocation(), diag::note_previous_use);
1316 bool AllowInjectedClassName);
1329 bool AllowInjectedClassName);
1335 bool AllowInjectedClassName);
1345 Decl *AssociatedDecl,
unsigned Index,
1348 ArgPack, AssociatedDecl, Index, Final);
1402 return SemaRef.ActOnLabelStmt(IdentLoc, L, ColonLoc, SubStmt);
1412 if (
SemaRef.CheckRebuiltStmtAttributes(Attrs))
1414 return SemaRef.BuildAttributedStmt(AttrLoc, Attrs, SubStmt);
1426 Then, ElseLoc, Else);
1480 Inc, RParenLoc, Body);
1525 bool IsVolatile,
unsigned NumOutputs,
1532 NumInputs, Names, Constraints, Exprs,
1533 AsmString, Clobbers, NumLabels, RParenLoc);
1542 StringRef AsmString,
1543 unsigned NumOutputs,
unsigned NumInputs,
1549 NumOutputs, NumInputs,
1550 Constraints, Clobbers, Exprs, EndLoc);
1579 CoawaitLoc, Operand, OpCoawaitLookup);
1583 Suspend.
get(),
true);
1684 Kind, DirName, CancelRegion, Clauses, AStmt, StartLoc, EndLoc);
1696 Kind, DirName, Clauses, AStmt, StartLoc, EndLoc);
1710 NameModifier,
Condition, StartLoc, LParenLoc, NameModifierLoc, ColonLoc,
1736 Modifier, NumThreads, StartLoc, LParenLoc, ModifierLoc, EndLoc);
1797 First, Count, StartLoc, LParenLoc, FirstLoc, CountLoc, EndLoc);
1833 Kind, KindKwLoc, VCKind, VCLoc, StartLoc, LParenLoc, EndLoc);
1846 Kind, KindKwLoc, StartLoc, LParenLoc, EndLoc);
1859 M1, M2, Kind, ChunkSize, StartLoc, LParenLoc, M1Loc, M2Loc, KindLoc,
1921 VarList, LPKind, LPKindLoc, ColonLoc, StartLoc, LParenLoc, EndLoc);
1949 VarList, {Modifier, OriginalSharingModifier}, StartLoc, LParenLoc,
1950 ModifierLoc, ColonLoc, EndLoc, ReductionIdScopeSpec, ReductionId,
1951 UnresolvedReductions);
1965 VarList, StartLoc, LParenLoc, ColonLoc, EndLoc, ReductionIdScopeSpec,
1966 ReductionId, UnresolvedReductions);
1981 VarList, StartLoc, LParenLoc, ColonLoc, EndLoc, ReductionIdScopeSpec,
1982 ReductionId, UnresolvedReductions);
1995 VarList, Step, StartLoc, LParenLoc, Modifier, ModifierLoc, ColonLoc,
1996 StepModifierLoc, EndLoc);
2009 VarList, Alignment, StartLoc, LParenLoc, ColonLoc, EndLoc);
2069 Data, DepModifier, VarList, StartLoc, LParenLoc, EndLoc);
2082 Modifier,
Device, StartLoc, LParenLoc, ModifierLoc, EndLoc);
2097 IteratorModifier, MapTypeModifiers, MapTypeModifiersLoc,
2098 MapperIdScopeSpec, MapperId, MapType, IsMapTypeImplicit, MapLoc,
2099 ColonLoc, VarList, Locs,
2100 false, UnresolvedMappers);
2117 Allocate, Alignment, FirstModifier, FirstModifierLoc, SecondModifier,
2118 SecondModifierLoc, VarList, StartLoc, LParenLoc, ColonLoc, EndLoc);
2166 Modifier,
Device, StartLoc, LParenLoc, ModifierLoc, EndLoc);
2179 Modifier, NumTasks, StartLoc, LParenLoc, ModifierLoc, EndLoc);
2214 Kind, ChunkSize, StartLoc, LParenLoc, KindLoc, CommaLoc, EndLoc);
2229 MotionModifiers, MotionModifiersLoc, MapperIdScopeSpec, MapperId,
2230 ColonLoc, VarList, Locs, UnresolvedMappers);
2245 MotionModifiers, MotionModifiersLoc, MapperIdScopeSpec, MapperId,
2246 ColonLoc, VarList, Locs, UnresolvedMappers);
2297 M, Kind, StartLoc, LParenLoc, MLoc, KindLoc, EndLoc);
2344 StartLoc, LParenLoc, EndLoc,
Data);
2357 StartLoc, LParenLoc, ColonLoc, EndLoc, Modifier, Locators);
2369 Modifier, Kind, StartLoc, LParenLoc, ModifierKwLoc, KindKwLoc, EndLoc);
2382 InteropVar, InteropInfo, StartLoc, LParenLoc, VarLoc, EndLoc);
2393 LParenLoc, VarLoc, EndLoc);
2405 InteropVar, StartLoc, LParenLoc, VarLoc, EndLoc);
2476 M1, M2, Size, StartLoc, LParenLoc, M1Loc, M2Loc, EndLoc);
2557 DepType, DepLoc, ColonLoc, VarList, StartLoc, LParenLoc, EndLoc);
2605 ForLoc, Element, Collection, RParenLoc);
2623 StartLoc, IdLoc, Id);
2660 if (
DeclStmt *RangeStmt = dyn_cast<DeclStmt>(Range)) {
2661 if (RangeStmt->isSingleDecl()) {
2662 if (
VarDecl *RangeVar = dyn_cast<VarDecl>(RangeStmt->getSingleDecl())) {
2663 if (RangeVar->isInvalidDecl())
2666 Expr *RangeExpr = RangeVar->getInit();
2673 diag::err_objc_for_range_init_stmt)
2674 <<
Init->getSourceRange();
2677 ForLoc, LoopVar, RangeExpr, RParenLoc);
2684 ForLoc, CoawaitLoc,
Init, ColonLoc, Range, Begin, End,
Cond, Inc,
2698 QualifierLoc, NameInfo, Nested);
2760 SS.
Adopt(QualifierLoc);
2872 if (IsOMPArraySection)
2874 Base, LBracketLoc, LowerBound, ColonLocFirst, ColonLocSecond, Length,
2875 Stride, RBracketLoc);
2877 assert(Stride ==
nullptr && !ColonLocSecond.
isValid() &&
2878 "Stride/second colon not allowed for OpenACC");
2881 Base, LBracketLoc, LowerBound, ColonLocFirst, Length, RBracketLoc);
2893 Base, LParenLoc, RParenLoc, Dims, BracketsRanges);
2905 nullptr, IteratorKwLoc, LLoc, RLoc,
Data);
2915 Expr *ExecConfig =
nullptr) {
2917 nullptr, Callee, LParenLoc, Args, RParenLoc, ExecConfig);
2924 nullptr, Callee, LParenLoc, Args, RParenLoc);
2942 if (!
Member->getDeclName()) {
2946 assert(
Member->getType()->isRecordType() &&
2947 "unnamed member not of record type?");
2960 if (!isArrow &&
Base->isPRValue()) {
2975 SS.
Adopt(QualifierLoc);
2978 if (
Base->containsErrors())
2983 if (isArrow && !BaseType->isPointerType())
2992 if (
getSema().isUnevaluatedContext() &&
Base->isImplicitCXXThis() &&
2997 ->getAsCXXRecordDecl()) {
3001 if (!ThisClass->Equals(
Class) && !ThisClass->isDerivedFrom(
Class))
3009 FirstQualifierInScope,
3010 R, ExplicitTemplateArgs,
3020 bool ForFoldExpression =
false) {
3098 return SemaRef.BuildInitList(LBraceLoc, Inits, RBraceLoc);
3111 =
SemaRef.ActOnDesignatedInitializer(Desig, EqualOrColonLoc, GNUSyntax,
3151 unsigned NumUserSpecifiedExprs,
3156 InitLoc, LParenLoc, RParenLoc);
3186 return SemaRef.ActOnChooseExpr(BuiltinLoc,
3198 Expr *ControllingExpr,
3203 ControllingExpr, Types, Exprs);
3218 ControllingType, Types, Exprs);
3251 case Stmt::CXXStaticCastExprClass:
3252 return getDerived().RebuildCXXStaticCastExpr(OpLoc, LAngleLoc, TInfo,
3253 RAngleLoc, LParenLoc,
3254 SubExpr, RParenLoc);
3256 case Stmt::CXXDynamicCastExprClass:
3257 return getDerived().RebuildCXXDynamicCastExpr(OpLoc, LAngleLoc, TInfo,
3258 RAngleLoc, LParenLoc,
3259 SubExpr, RParenLoc);
3261 case Stmt::CXXReinterpretCastExprClass:
3262 return getDerived().RebuildCXXReinterpretCastExpr(OpLoc, LAngleLoc, TInfo,
3263 RAngleLoc, LParenLoc,
3267 case Stmt::CXXConstCastExprClass:
3268 return getDerived().RebuildCXXConstCastExpr(OpLoc, LAngleLoc, TInfo,
3269 RAngleLoc, LParenLoc,
3270 SubExpr, RParenLoc);
3272 case Stmt::CXXAddrspaceCastExprClass:
3273 return getDerived().RebuildCXXAddrspaceCastExpr(
3274 OpLoc, LAngleLoc, TInfo, RAngleLoc, LParenLoc, SubExpr, RParenLoc);
3277 llvm_unreachable(
"Invalid C++ named cast");
3355 OpLoc, tok::kw_addrspace_cast, TInfo, SubExpr,
3367 bool ListInitialization) {
3371 if (
auto *PLE = dyn_cast<ParenListExpr>(Sub))
3373 TInfo, LParenLoc,
MultiExprArg(PLE->getExprs(), PLE->getNumExprs()),
3374 RParenLoc, ListInitialization);
3376 if (
auto *PLE = dyn_cast<CXXParenListInitExpr>(Sub))
3378 TInfo, LParenLoc, PLE->getInitExprs(), RParenLoc, ListInitialization);
3382 ListInitialization);
3446 if (
getSema().CheckCXXThisType(ThisLoc, ThisType))
3456 bool IsThrownVariableInScope) {
3466 Expr *RewrittenExpr) {
3468 RewrittenExpr,
getSema().CurContext);
3502 std::optional<Expr *> ArraySize,
3521 bool IsGlobalDelete,
3572 bool IsAddressOfOperand,
3575 SS.
Adopt(QualifierLoc);
3577 if (TemplateArgs || TemplateKWLoc.
isValid())
3579 SS, TemplateKWLoc, NameInfo, TemplateArgs, IsAddressOfOperand);
3582 SS, NameInfo, IsAddressOfOperand, RecoveryTSI);
3604 bool IsElidable,
MultiExprArg Args,
bool HadMultipleCandidates,
3605 bool ListInitialization,
bool StdInitListInitialization,
3612 FoundCtor =
Constructor->getInheritedConstructor().getConstructor();
3615 if (
getSema().CompleteConstructorCall(FoundCtor,
T, Args, Loc,
3622 HadMultipleCandidates,
3624 StdInitListInitialization,
3625 RequiresZeroInit, ConstructKind,
3633 bool ConstructsVBase,
3634 bool InheritedFromVBase) {
3636 Loc,
T,
Constructor, ConstructsVBase, InheritedFromVBase);
3647 bool ListInitialization) {
3649 TSInfo, LParenOrBraceLoc, Args, RParenOrBraceLoc, ListInitialization);
3660 bool ListInitialization) {
3662 RParenLoc, ListInitialization);
3679 SS.
Adopt(QualifierLoc);
3681 return SemaRef.BuildMemberReferenceExpr(BaseE, BaseType,
3682 OperatorLoc, IsArrow,
3684 FirstQualifierInScope,
3686 TemplateArgs,
nullptr);
3702 SS.
Adopt(QualifierLoc);
3704 return SemaRef.BuildMemberReferenceExpr(BaseE, BaseType,
3705 OperatorLoc, IsArrow,
3707 FirstQualifierInScope,
3708 R, TemplateArgs,
nullptr);
3716 return SemaRef.BuildCXXNoexceptExpr(Range.getBegin(), Arg, Range.getEnd());
3729 RParenLoc, Length, PartialArgs);
3734 Expr *PackIdExpression,
Expr *IndexExpr,
3736 bool FullySubstituted =
false) {
3738 IndexExpr, RSquareLoc, ExpandedExprs,
3764 NamedConcept, TALI);
3782 LocalParameters, RParenLoc, Requirements,
3789 return SemaRef.BuildTypeRequirement(SubstDiag);
3793 return SemaRef.BuildTypeRequirement(
T);
3801 return SemaRef.BuildExprRequirement(SubstDiag, IsSimple, NoexceptLoc,
3808 return SemaRef.BuildExprRequirement(E, IsSimple, NoexceptLoc,
3815 return SemaRef.BuildNestedRequirement(InvalidConstraintEntity,
3820 return SemaRef.BuildNestedRequirement(Constraint);
3836 Expr **Elements,
unsigned NumElements) {
3846 RB,
Base, Key, getterMethod, setterMethod);
3865 return SemaRef.ObjC().BuildObjCEncodeExpression(AtLoc, EncodeTypeInfo,
3877 return SemaRef.ObjC().BuildClassMessage(
3878 ReceiverTypeInfo, ReceiverTypeInfo->
getType(),
3891 return SemaRef.ObjC().BuildInstanceMessage(Receiver, Receiver->
getType(),
3894 SelectorLocs, RBracLoc, Args);
3906 return Method->isInstanceMethod()
3907 ?
SemaRef.ObjC().BuildInstanceMessage(
3908 nullptr, SuperType, SuperLoc, Sel,
Method, LBracLoc,
3909 SelectorLocs, RBracLoc, Args)
3910 :
SemaRef.ObjC().BuildClassMessage(
nullptr, SuperType, SuperLoc,
3912 SelectorLocs, RBracLoc, Args);
3921 bool IsArrow,
bool IsFreeIvar) {
3930 if (IsFreeIvar &&
Result.isUsable())
3967 PropertyLoc,
Base));
3996 =
SemaRef.Context.Idents.get(
"__builtin_shufflevector");
3999 assert(!Lookup.
empty() &&
"No __builtin_shufflevector?");
4007 Callee =
SemaRef.ImpCastExprToType(Callee, CalleePtrTy,
4008 CK_BuiltinFnToFnPtr).get();
4024 return SemaRef.ConvertVectorExpr(SrcExpr, DstTInfo, BuiltinLoc, RParenLoc);
4039 EllipsisLoc, NumExpansions);
4063 llvm_unreachable(
"Pack expansion pattern has no parameter packs");
4099 EllipsisLoc, RHS, RParenLoc,
4108 Init->containsUnexpandedParameterPack();
4109 else if (PVD->hasUninstantiatedDefaultArg())
4111 PVD->getUninstantiatedDefaultArg()
4112 ->containsUnexpandedParameterPack();
4266 Exprs.push_back(DevNumExpr);
4267 llvm::append_range(Exprs, QueueIdExprs);
4311 ObjectType, FirstQualifierInScope);
4317 QualType TransformDependentNameType(TypeLocBuilder &TLB,
4318 DependentNameTypeLoc TL,
4319 bool DeducibleTSTContext,
4320 QualType ObjectType = QualType(),
4321 NamedDecl *UnqualLookup =
nullptr);
4324 TransformOpenACCClauseList(OpenACCDirectiveKind DirKind,
4329 OpenACCDirectiveKind DirKind,
4330 const OpenACCClause *OldClause);
4333template <
typename Derived>
4343#define STMT(Node, Parent) \
4344 case Stmt::Node##Class: return getDerived().Transform##Node(cast<Node>(S));
4345#define VALUESTMT(Node, Parent) \
4346 case Stmt::Node##Class: \
4347 return getDerived().Transform##Node(cast<Node>(S), SDK);
4348#define ABSTRACT_STMT(Node)
4349#define EXPR(Node, Parent)
4350#include "clang/AST/StmtNodes.inc"
4353#define STMT(Node, Parent)
4354#define ABSTRACT_STMT(Stmt)
4355#define EXPR(Node, Parent) case Stmt::Node##Class:
4356#include "clang/AST/StmtNodes.inc"
4361 E =
getSema().ActOnStmtExprResult(E);
4369template<
typename Derived>
4377#define GEN_CLANG_CLAUSE_CLASS
4378#define CLAUSE_CLASS(Enum, Str, Class) \
4380 return getDerived().Transform##Class(cast<Class>(S));
4381#include "llvm/Frontend/OpenMP/OMP.inc"
4388template<
typename Derived>
4395#define STMT(Node, Parent) case Stmt::Node##Class: break;
4396#define ABSTRACT_STMT(Stmt)
4397#define EXPR(Node, Parent) \
4398 case Stmt::Node##Class: return getDerived().Transform##Node(cast<Node>(E));
4399#include "clang/AST/StmtNodes.inc"
4405template<
typename Derived>
4413 if (
auto *FE = dyn_cast<FullExpr>(
Init))
4414 Init = FE->getSubExpr();
4416 if (
auto *AIL = dyn_cast<ArrayInitLoopExpr>(
Init)) {
4422 Init = MTE->getSubExpr();
4425 Init = Binder->getSubExpr();
4428 Init = ICE->getSubExprAsWritten();
4431 dyn_cast<CXXStdInitializerListExpr>(
Init))
4468 getSema().currentEvaluationContext().InLifetimeExtendingContext =
4469 getSema().parentEvaluationContext().InLifetimeExtendingContext;
4470 getSema().currentEvaluationContext().RebuildDefaultArgOrDefaultInit =
4471 getSema().parentEvaluationContext().RebuildDefaultArgOrDefaultInit;
4473 bool ArgChanged =
false;
4475 true, NewArgs, &ArgChanged))
4485 if (
Parens.isInvalid()) {
4488 assert(NewArgs.empty() &&
4489 "no parens or braces but have direct init with arguments?");
4496template<
typename Derived>
4502 for (
unsigned I = 0; I != NumInputs; ++I) {
4512 Expr *Pattern = Expansion->getPattern();
4515 getSema().collectUnexpandedParameterPacks(Pattern, Unexpanded);
4516 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
4521 bool RetainExpansion =
false;
4522 UnsignedOrNone OrigNumExpansions = Expansion->getNumExpansions();
4526 Unexpanded,
true, Expand,
4527 RetainExpansion, NumExpansions))
4540 Expansion->getEllipsisLoc(),
4542 if (Out.isInvalid())
4547 Outputs.push_back(Out.get());
4553 if (ArgChanged) *ArgChanged =
true;
4557 for (
unsigned I = 0; I != *NumExpansions; ++I) {
4560 if (Out.isInvalid())
4563 if (Out.get()->containsUnexpandedParameterPack()) {
4565 Out.get(), Expansion->getEllipsisLoc(), OrigNumExpansions);
4566 if (Out.isInvalid())
4570 Outputs.push_back(Out.get());
4575 if (RetainExpansion) {
4576 ForgetPartiallySubstitutedPackRAII Forget(
getDerived());
4579 if (Out.isInvalid())
4583 Out.get(), Expansion->getEllipsisLoc(), OrigNumExpansions);
4584 if (Out.isInvalid())
4587 Outputs.push_back(Out.get());
4594 IsCall ?
getDerived().TransformInitializer(Inputs[I],
false)
4599 if (
Result.get() != Inputs[I] && ArgChanged)
4602 Outputs.push_back(
Result.get());
4608template <
typename Derived>
4619 VarDecl *ConditionVar = cast_or_null<VarDecl>(
4625 return getSema().ActOnConditionVariable(ConditionVar, Loc, Kind);
4634 return getSema().ActOnCondition(
nullptr, Loc, CondExpr.
get(), Kind,
4641template <
typename Derived>
4649 Qualifier = Qualifier.getAsNamespaceAndPrefix().Prefix)
4661 llvm_unreachable(
"unexpected null nested name specifier");
4692 QualifierLoc =
getDerived().TransformNestedNameSpecifierLoc(
4693 QualifierLoc, ObjectType, FirstQualifierInScope);
4697 FirstQualifierInScope =
nullptr;
4699 SS.
Adopt(QualifierLoc);
4703 if (
SemaRef.BuildCXXNestedNameSpecifier(
nullptr, IdInfo,
4705 FirstQualifierInScope,
false))
4713 T = TransformTypeInObjectScope(TLB, TL, ObjectType,
4714 FirstQualifierInScope);
4720 if (
T->isDependentType() ||
T->isRecordType() ||
4721 (
SemaRef.getLangOpts().CPlusPlus11 &&
T->isEnumeralType())) {
4722 if (
T->isEnumeralType())
4724 diag::warn_cxx98_compat_enum_nested_name_spec);
4731 if (!TTL || !TTL.
getDecl()->isInvalidDecl()) {
4755template<
typename Derived>
4775 TemplateDecl *NewTemplate = cast_or_null<TemplateDecl>(
4782 SemaRef.Context.DeclarationNames.getCXXDeductionGuideName(NewTemplate));
4792 NewTInfo =
getDerived().TransformType(OldTInfo);
4795 NewCanTy =
SemaRef.Context.getCanonicalType(NewTInfo->
getType());
4803 NewCanTy =
SemaRef.Context.getCanonicalType(NewT);
4816 llvm_unreachable(
"Unknown name kind.");
4819template <
typename Derived>
4823 QualType ObjectType,
bool AllowInjectedClassName) {
4825 return getDerived().RebuildTemplateName(SS, TemplateKWLoc, *II, NameLoc,
4826 ObjectType, AllowInjectedClassName);
4828 NameLoc, ObjectType,
4829 AllowInjectedClassName);
4832template <
typename Derived>
4836 NamedDecl *FirstQualifierInScope,
bool AllowInjectedClassName) {
4838 TemplateName UnderlyingName = QTN->getUnderlyingTemplate();
4841 QualifierLoc =
getDerived().TransformNestedNameSpecifierLoc(
4842 QualifierLoc, ObjectType, FirstQualifierInScope);
4849 UnderlyingQualifier, TemplateKWLoc, UnderlyingName, NameLoc, ObjectType,
4850 FirstQualifierInScope, AllowInjectedClassName);
4851 if (NewUnderlyingName.
isNull())
4853 assert(!UnderlyingQualifier &&
"unexpected qualifier");
4857 NewUnderlyingName == UnderlyingName)
4860 SS.
Adopt(QualifierLoc);
4861 return getDerived().RebuildTemplateName(SS, QTN->hasTemplateKeyword(),
4867 QualifierLoc =
getDerived().TransformNestedNameSpecifierLoc(
4868 QualifierLoc, ObjectType, FirstQualifierInScope);
4882 SS.
Adopt(QualifierLoc);
4883 return getDerived().RebuildTemplateName(SS, TemplateKWLoc, DTN->getName(),
4884 NameLoc, ObjectType,
4885 AllowInjectedClassName);
4890 assert(!QualifierLoc &&
"Unexpected qualified SubstTemplateTemplateParm");
4897 ReplacementQualifierLoc = Builder.getWithLocInContext(
SemaRef.Context);
4901 ReplacementQualifierLoc, TemplateKWLoc, ReplacementName, NameLoc,
4902 ObjectType, FirstQualifierInScope, AllowInjectedClassName);
4905 Decl *AssociatedDecl =
4906 getDerived().TransformDecl(NameLoc, S->getAssociatedDecl());
4908 AssociatedDecl == S->getAssociatedDecl())
4910 return SemaRef.Context.getSubstTemplateTemplateParm(
4911 NewName, AssociatedDecl, S->getIndex(), S->getPackIndex(),
4916 "DeducedTemplateName should not escape partial ordering");
4920 assert(!QualifierLoc &&
"Unexpected qualifier");
4927 assert(!QualifierLoc &&
4928 "Unexpected qualified SubstTemplateTemplateParmPack");
4930 SubstPack->getArgumentPack(), SubstPack->getAssociatedDecl(),
4931 SubstPack->getIndex(), SubstPack->getFinal());
4935 llvm_unreachable(
"overloaded function decl survived to here");
4938template <
typename Derived>
4943 QualifierLoc, TemplateKeywordLoc, Name, NameLoc);
4949template<
typename Derived>
4953 Output =
getSema().getTrivialTemplateArgumentLoc(
4957template <
typename Derived>
4965 llvm_unreachable(
"Unexpected TemplateArgument");
4988 if (NewT ==
T && D == NewD)
5005 llvm_unreachable(
"unexpected template argument kind");
5037 llvm_unreachable(
"Caller should expand pack expansions");
5053 E =
SemaRef.ActOnConstantExpression(E);
5068template<
typename Derived,
typename InputIterator>
5076 typedef typename std::iterator_traits<InputIterator>::difference_type
5091 : Self(Self), Iter(Iter) { }
5106 Self.InventTemplateArgumentLoc(*Iter,
Result);
5114 return X.Iter == Y.Iter;
5119 return X.Iter != Y.Iter;
5123template<
typename Derived>
5124template<
typename InputIterator>
5144 PackLocIterator(*
this, In.getArgument().pack_begin()),
5145 PackLocIterator(*
this, In.getArgument().pack_end()), *PackOutput,
5152 if (In.getArgument().isPackExpansion()) {
5164 std::optional<ForgetSubstitutionRAII> ForgetSubst;
5174 if (Out.getArgument().containsUnexpandedParameterPack()) {
5177 if (Out.getArgument().isNull())
5187 ForgetPartiallySubstitutedPackRAII Forget(
getDerived());
5195 if (Out.getArgument().isNull())
5214template <
typename Derived>
5215template <
typename InputIterator>
5224 return !Arg.isDependent() && Arg.isConceptOrConceptTemplateParameter();
5236 PackLocIterator(*
this, In.getArgument().pack_begin()),
5237 PackLocIterator(*
this, In.getArgument().pack_end()), Outputs,
5243 if (!isNonDependentConceptArgument(In.getArgument())) {
5258template <
typename Derived>
5269 Pattern =
getSema().getTemplateArgumentPackExpansionPattern(
5272 getSema().collectUnexpandedParameterPacks(Pattern, Unexpanded);
5273 if (IsLateExpansionAttempt) {
5278 return P.first.dyn_cast<
const SubstBuiltinTemplatePackType *>();
5280 if (!SawPackTypes) {
5285 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
5293 Info.
Ellipsis, Pattern.getSourceRange(), Unexpanded,
5299 if (ComputeInfo(In,
false, Info, Pattern))
5311 std::optional<Sema::ArgPackSubstIndexRAII> SubstIndex(
5312 std::in_place,
getSema(), std::nullopt);
5318 if (Out.getArgument().isNull())
5355 ForgetSubstitutionRAII ForgetSubst(
getDerived());
5356 if (ComputeInfo(Out,
true, Info, OutPattern))
5369template<
typename Derived>
5387template <
typename Derived>
5407template<
typename Derived>
5410 switch (
T.getTypeLocClass()) {
5411#define ABSTRACT_TYPELOC(CLASS, PARENT)
5412#define TYPELOC(CLASS, PARENT) \
5413 case TypeLoc::CLASS: \
5414 return getDerived().Transform##CLASS##Type(TLB, \
5415 T.castAs<CLASS##TypeLoc>());
5416#include "clang/AST/TypeLocNodes.def"
5419 llvm_unreachable(
"unhandled type loc!");
5422template<
typename Derived>
5435template <
typename Derived>
5473template<
typename Derived>
5478 TypeLoc UnqualTL =
T.getUnqualifiedLoc();
5479 auto SuppressObjCLifetime =
5480 T.getType().getLocalQualifiers().hasObjCLifetime();
5482 Result = getDerived().TransformTemplateTypeParmType(TLB, TTP,
5483 SuppressObjCLifetime);
5484 }
else if (
auto STTP = UnqualTL.
getAs<SubstTemplateTypeParmPackTypeLoc>()) {
5485 Result = getDerived().TransformSubstTemplateTypeParmPackType(
5486 TLB, STTP, SuppressObjCLifetime);
5488 Result = getDerived().TransformType(TLB, UnqualTL);
5507template <
typename Derived>
5517 SemaRef.Diag(Loc, diag::err_address_space_mismatch_templ_inst)
5524 if (
T.getPointerAuth().isPresent()) {
5525 SemaRef.Diag(Loc, diag::err_ptrauth_qualifier_redundant) << TL.
getType();
5528 if (!
T->isDependentType()) {
5529 if (!
T->isSignableType(
SemaRef.getASTContext())) {
5530 SemaRef.Diag(Loc, diag::err_ptrauth_qualifier_invalid_target) <<
T;
5538 if (
T->isFunctionType()) {
5539 T =
SemaRef.getASTContext().getAddrSpaceQualType(
T,
5549 if (
T->isReferenceType()) {
5559 if (!
T->isObjCLifetimeType() && !
T->isDependentType())
5561 else if (
T.getObjCLifetime()) {
5565 const AutoType *AutoTy;
5566 if ((AutoTy = dyn_cast<AutoType>(
T)) && AutoTy->isDeduced()) {
5568 QualType Deduced = AutoTy->getDeducedType();
5573 T =
SemaRef.Context.getAutoType(Deduced, AutoTy->getKeyword(),
5576 AutoTy->getTypeConstraintConcept(),
5577 AutoTy->getTypeConstraintArguments());
5582 SemaRef.Diag(Loc, diag::err_attr_objc_ownership_redundant) <<
T;
5588 return SemaRef.BuildQualifiedType(
T, Loc, Quals);
5591template <
typename Derived>
5592QualType TreeTransform<Derived>::TransformTypeInObjectScope(
5595 assert(!getDerived().AlreadyTransformed(TL.
getType()));
5598 case TypeLoc::TemplateSpecialization:
5599 return getDerived().TransformTemplateSpecializationType(
5601 FirstQualifierInScope,
true);
5602 case TypeLoc::DependentName:
5603 return getDerived().TransformDependentNameType(
5605 ObjectType, FirstQualifierInScope);
5609 return getDerived().TransformType(TLB, TL);
5613template <
class TyLoc>
static inline
5615 TyLoc NewT = TLB.
push<TyLoc>(
T.getType());
5616 NewT.setNameLoc(
T.getNameLoc());
5620template<
typename Derived>
5621QualType TreeTransform<Derived>::TransformBuiltinType(TypeLocBuilder &TLB,
5623 BuiltinTypeLoc NewT = TLB.push<BuiltinTypeLoc>(T.getType());
5624 NewT.setBuiltinLoc(T.getBuiltinLoc());
5625 if (T.needsExtraLocalData())
5626 NewT.getWrittenBuiltinSpecs() = T.getWrittenBuiltinSpecs();
5630template<
typename Derived>
5637template <
typename Derived>
5641 return getDerived().
TransformType(TLB, TL.getOriginalLoc());
5644template<
typename Derived>
5647 QualType OriginalType = getDerived().TransformType(TLB, TL.getOriginalLoc());
5648 if (OriginalType.isNull())
5652 if (getDerived().AlwaysRebuild() ||
5653 OriginalType != TL.getOriginalLoc().getType())
5660template <
typename Derived>
5664 QualType OriginalType = getDerived().TransformType(TLB, TL.getElementLoc());
5665 if (OriginalType.isNull())
5669 if (getDerived().AlwaysRebuild() ||
5670 OriginalType != TL.getElementLoc().getType())
5677template<
typename Derived>
5681 = getDerived().TransformType(TLB, TL.getPointeeLoc());
5682 if (PointeeType.isNull())
5686 if (PointeeType->getAs<ObjCObjectType>()) {
5698 if (getDerived().AlwaysRebuild() ||
5699 PointeeType != TL.getPointeeLoc().getType()) {
5700 Result = getDerived().RebuildPointerType(PointeeType, TL.getSigilLoc());
5707 TLB.TypeWasModifiedSafely(
Result->getPointeeType());
5714template<
typename Derived>
5719 = getDerived().TransformType(TLB, TL.getPointeeLoc());
5720 if (PointeeType.isNull())
5724 if (getDerived().AlwaysRebuild() ||
5725 PointeeType != TL.getPointeeLoc().getType()) {
5726 Result = getDerived().RebuildBlockPointerType(PointeeType,
5741template<
typename Derived>
5749 if (PointeeType.
isNull())
5754 PointeeType !=
T->getPointeeTypeAsWritten()) {
5756 T->isSpelledAsLValue(),
5778template<
typename Derived>
5782 return TransformReferenceType(TLB, TL);
5785template<
typename Derived>
5787TreeTransform<Derived>::TransformRValueReferenceType(TypeLocBuilder &TLB,
5788 RValueReferenceTypeLoc TL) {
5789 return TransformReferenceType(TLB, TL);
5792template<
typename Derived>
5796 QualType PointeeType = getDerived().TransformType(TLB, TL.getPointeeLoc());
5797 if (PointeeType.isNull())
5804 getDerived().TransformNestedNameSpecifierLoc(OldQualifierLoc);
5805 if (!NewQualifierLoc)
5808 CXXRecordDecl *OldCls =
T->getMostRecentCXXRecordDecl(), *NewCls =
nullptr;
5810 NewCls = cast_or_null<CXXRecordDecl>(
5811 getDerived().TransformDecl(TL.getStarLoc(), OldCls));
5817 if (getDerived().AlwaysRebuild() || PointeeType !=
T->getPointeeType() ||
5818 NewQualifierLoc.getNestedNameSpecifier() !=
5819 OldQualifierLoc.getNestedNameSpecifier() ||
5822 SS.
Adopt(NewQualifierLoc);
5823 Result = getDerived().RebuildMemberPointerType(PointeeType, SS, NewCls,
5832 if (MPT && PointeeType != MPT->getPointeeType()) {
5839 NewTL.setQualifierLoc(NewQualifierLoc);
5844template<
typename Derived>
5849 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
5850 if (ElementType.isNull())
5854 Expr *OldSize = TL.getSizeExpr();
5856 OldSize =
const_cast<Expr*
>(
T->getSizeExpr());
5857 Expr *NewSize =
nullptr;
5861 NewSize = getDerived().TransformExpr(OldSize).template getAs<Expr>();
5866 if (getDerived().AlwaysRebuild() ||
5867 ElementType !=
T->getElementType() ||
5868 (
T->getSizeExpr() && NewSize != OldSize)) {
5869 Result = getDerived().RebuildConstantArrayType(ElementType,
5870 T->getSizeModifier(),
5871 T->getSize(), NewSize,
5872 T->getIndexTypeCVRQualifiers(),
5873 TL.getBracketsRange());
5884 NewTL.setRBracketLoc(TL.getRBracketLoc());
5885 NewTL.setSizeExpr(NewSize);
5890template<
typename Derived>
5895 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
5896 if (ElementType.isNull())
5900 if (getDerived().AlwaysRebuild() ||
5901 ElementType !=
T->getElementType()) {
5902 Result = getDerived().RebuildIncompleteArrayType(ElementType,
5903 T->getSizeModifier(),
5904 T->getIndexTypeCVRQualifiers(),
5905 TL.getBracketsRange());
5912 NewTL.setRBracketLoc(TL.getRBracketLoc());
5913 NewTL.setSizeExpr(
nullptr);
5918template<
typename Derived>
5923 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
5924 if (ElementType.isNull())
5931 SizeResult = getDerived().TransformExpr(
T->getSizeExpr());
5933 if (SizeResult.isInvalid())
5937 if (SizeResult.isInvalid())
5943 if (getDerived().AlwaysRebuild() ||
5944 ElementType !=
T->getElementType() ||
5945 Size !=
T->getSizeExpr()) {
5946 Result = getDerived().RebuildVariableArrayType(ElementType,
5947 T->getSizeModifier(),
5949 T->getIndexTypeCVRQualifiers(),
5950 TL.getBracketsRange());
5959 NewTL.setRBracketLoc(TL.getRBracketLoc());
5960 NewTL.setSizeExpr(Size);
5965template<
typename Derived>
5970 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
5971 if (ElementType.isNull())
5979 SemaRef.
ExprEvalContexts.back().InConditionallyConstantEvaluateContext =
true;
5982 Expr *origSize = TL.getSizeExpr();
5983 if (!origSize) origSize =
T->getSizeExpr();
5986 = getDerived().TransformExpr(origSize);
5988 if (sizeResult.isInvalid())
5991 Expr *size = sizeResult.get();
5994 if (getDerived().AlwaysRebuild() ||
5995 ElementType !=
T->getElementType() ||
5997 Result = getDerived().RebuildDependentSizedArrayType(ElementType,
5998 T->getSizeModifier(),
6000 T->getIndexTypeCVRQualifiers(),
6001 TL.getBracketsRange());
6010 NewTL.setRBracketLoc(TL.getRBracketLoc());
6011 NewTL.setSizeExpr(size);
6016template <
typename Derived>
6020 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
6021 if (ElementType.isNull())
6029 if (
Size.isInvalid())
6033 if (getDerived().AlwaysRebuild() || ElementType !=
T->getElementType() ||
6034 Size.get() !=
T->getSizeExpr()) {
6035 Result = getDerived().RebuildDependentVectorType(
6036 ElementType,
Size.get(),
T->getAttributeLoc(),
T->getVectorKind());
6054template<
typename Derived>
6061 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
6062 if (ElementType.isNull())
6071 if (
Size.isInvalid())
6075 if (getDerived().AlwaysRebuild() ||
6076 ElementType !=
T->getElementType() ||
6077 Size.get() !=
T->getSizeExpr()) {
6078 Result = getDerived().RebuildDependentSizedExtVectorType(ElementType,
6080 T->getAttributeLoc());
6098template <
typename Derived>
6103 QualType ElementType = getDerived().TransformType(
T->getElementType());
6104 if (ElementType.isNull())
6108 if (getDerived().AlwaysRebuild() || ElementType !=
T->getElementType()) {
6109 Result = getDerived().RebuildConstantMatrixType(
6110 ElementType,
T->getNumRows(),
T->getNumColumns());
6117 NewTL.setAttrOperandParensRange(TL.getAttrOperandParensRange());
6118 NewTL.setAttrRowOperand(TL.getAttrRowOperand());
6119 NewTL.setAttrColumnOperand(TL.getAttrColumnOperand());
6124template <
typename Derived>
6129 QualType ElementType = getDerived().TransformType(
T->getElementType());
6130 if (ElementType.isNull()) {
6138 Expr *origRows = TL.getAttrRowOperand();
6140 origRows =
T->getRowExpr();
6141 Expr *origColumns = TL.getAttrColumnOperand();
6143 origColumns =
T->getColumnExpr();
6145 ExprResult rowResult = getDerived().TransformExpr(origRows);
6147 if (rowResult.isInvalid())
6150 ExprResult columnResult = getDerived().TransformExpr(origColumns);
6152 if (columnResult.isInvalid())
6155 Expr *rows = rowResult.get();
6156 Expr *columns = columnResult.get();
6159 if (getDerived().AlwaysRebuild() || ElementType !=
T->getElementType() ||
6160 rows != origRows || columns != origColumns) {
6161 Result = getDerived().RebuildDependentSizedMatrixType(
6162 ElementType, rows, columns,
T->getAttributeLoc());
6172 NewTL.setAttrOperandParensRange(TL.getAttrOperandParensRange());
6173 NewTL.setAttrRowOperand(rows);
6174 NewTL.setAttrColumnOperand(columns);
6178template <
typename Derived>
6184 getDerived().TransformType(TLB, TL.getPointeeTypeLoc());
6186 if (pointeeType.isNull())
6193 ExprResult AddrSpace = getDerived().TransformExpr(
T->getAddrSpaceExpr());
6195 if (AddrSpace.isInvalid())
6199 if (getDerived().AlwaysRebuild() || pointeeType !=
T->getPointeeType() ||
6200 AddrSpace.get() !=
T->getAddrSpaceExpr()) {
6201 Result = getDerived().RebuildDependentAddressSpaceType(
6202 pointeeType, AddrSpace.get(),
T->getAttributeLoc());
6213 NewTL.setAttrExprOperand(TL.getAttrExprOperand());
6214 NewTL.setAttrNameLoc(TL.getAttrNameLoc());
6217 TLB.TypeWasModifiedSafely(
Result);
6223template <
typename Derived>
6227 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
6228 if (ElementType.isNull())
6232 if (getDerived().AlwaysRebuild() ||
6233 ElementType !=
T->getElementType()) {
6234 Result = getDerived().RebuildVectorType(ElementType,
T->getNumElements(),
6235 T->getVectorKind());
6246template<
typename Derived>
6250 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
6251 if (ElementType.isNull())
6255 if (getDerived().AlwaysRebuild() ||
6256 ElementType !=
T->getElementType()) {
6257 Result = getDerived().RebuildExtVectorType(ElementType,
6258 T->getNumElements(),
6270template <
typename Derived>
6273 bool ExpectParameterPack) {
6308 if (NewTSI == OldTSI && indexAdjustment == 0)
6318 getDerived().transformedLocalDecl(OldParm, {newParm});
6322template <
typename Derived>
6330 unsigned *LastParamTransformed) {
6331 int indexAdjustment = 0;
6333 unsigned NumParams = Params.size();
6334 for (
unsigned i = 0; i != NumParams; ++i) {
6335 if (LastParamTransformed)
6336 *LastParamTransformed = i;
6338 assert(OldParm->getFunctionScopeIndex() == i);
6342 if (OldParm->isParameterPack()) {
6347 TypeLoc TL = OldParm->getTypeSourceInfo()->getTypeLoc();
6350 SemaRef.collectUnexpandedParameterPacks(Pattern, Unexpanded);
6353 bool ShouldExpand =
false;
6354 bool RetainExpansion =
false;
6356 if (Unexpanded.size() > 0) {
6357 OrigNumExpansions = ExpansionTL.
getTypePtr()->getNumExpansions();
6358 NumExpansions = OrigNumExpansions;
6362 ShouldExpand, RetainExpansion, NumExpansions)) {
6367 const AutoType *AT =
6368 Pattern.getType().getTypePtr()->getContainedAutoType();
6369 assert((AT && (!AT->isDeduced() || AT->getDeducedType().isNull())) &&
6370 "Could not find parameter packs or undeduced auto type!");
6377 getDerived().ExpandingFunctionParameterPack(OldParm);
6378 for (
unsigned I = 0; I != *NumExpansions; ++I) {
6381 =
getDerived().TransformFunctionTypeParam(OldParm,
6389 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6390 OutParamTypes.push_back(NewParm->
getType());
6392 PVars->push_back(NewParm);
6397 if (RetainExpansion) {
6398 ForgetPartiallySubstitutedPackRAII Forget(
getDerived());
6400 =
getDerived().TransformFunctionTypeParam(OldParm,
6408 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6409 OutParamTypes.push_back(NewParm->
getType());
6411 PVars->push_back(NewParm);
6427 NewParm =
getDerived().TransformFunctionTypeParam(OldParm,
6432 "Parameter pack no longer a parameter pack after "
6435 NewParm =
getDerived().TransformFunctionTypeParam(
6436 OldParm, indexAdjustment, std::nullopt,
6444 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6445 OutParamTypes.push_back(NewParm->
getType());
6447 PVars->push_back(NewParm);
6455 bool IsPackExpansion =
false;
6458 if (
const PackExpansionType *Expansion
6459 = dyn_cast<PackExpansionType>(OldType)) {
6461 QualType Pattern = Expansion->getPattern();
6463 getSema().collectUnexpandedParameterPacks(Pattern, Unexpanded);
6466 bool ShouldExpand =
false;
6467 bool RetainExpansion =
false;
6471 RetainExpansion, NumExpansions)) {
6478 for (
unsigned I = 0; I != *NumExpansions; ++I) {
6485 NewType =
getSema().getASTContext().getPackExpansionType(
6486 NewType, std::nullopt);
6493 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6494 OutParamTypes.push_back(NewType);
6496 PVars->push_back(
nullptr);
6505 if (RetainExpansion) {
6506 ForgetPartiallySubstitutedPackRAII Forget(
getDerived());
6512 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6513 OutParamTypes.push_back(NewType);
6515 PVars->push_back(
nullptr);
6520 OldType = Expansion->getPattern();
6521 IsPackExpansion =
true;
6523 NewType =
getDerived().TransformType(OldType);
6525 NewType =
getDerived().TransformType(OldType);
6531 if (IsPackExpansion)
6532 NewType =
getSema().Context.getPackExpansionType(NewType,
6536 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6537 OutParamTypes.push_back(NewType);
6539 PVars->push_back(
nullptr);
6544 for (
unsigned i = 0, e = PVars->size(); i != e; ++i)
6546 assert(parm->getFunctionScopeIndex() == i);
6553template<
typename Derived>
6558 return getDerived().TransformFunctionProtoType(
6562 ExceptionStorage, Changed);
6566template<
typename Derived>
template<
typename Fn>
6585 if (
T->hasTrailingReturn()) {
6589 T->getExtParameterInfosOrNull(),
6590 ParamTypes, &ParamDecls, ExtParamInfos))
6600 auto *RD = dyn_cast<CXXRecordDecl>(
SemaRef.getCurLexicalContext());
6602 SemaRef, !ThisContext && RD ? RD : ThisContext, ThisTypeQuals);
6617 T->getExtParameterInfosOrNull(),
6618 ParamTypes, &ParamDecls, ExtParamInfos))
6624 bool EPIChanged =
false;
6629 if (
auto NewExtParamInfos =
6645 std::optional<FunctionEffectSet> NewFX;
6657 std::optional<FunctionEffectMode> Mode =
6677 "FunctionEffectMode::None shouldn't be possible here");
6680 if (!
SemaRef.diagnoseConflictingFunctionEffect(*NewFX, NewEC,
6683 NewFX->insert(NewEC, Errs);
6684 assert(Errs.empty());
6694 Result =
getDerived().RebuildFunctionProtoType(ResultType, ParamTypes, EPI);
6705 for (
unsigned i = 0, e = NewTL.
getNumParams(); i != e; ++i)
6711template<
typename Derived>
6734 getSema().ActOnNoexceptSpec(NoexceptExpr.
get(), EST);
6749 if (
const PackExpansionType *PackExpansion =
6750 T->getAs<PackExpansionType>()) {
6755 SemaRef.collectUnexpandedParameterPacks(PackExpansion->getPattern(),
6757 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
6762 bool Expand =
false;
6763 bool RetainExpansion =
false;
6764 UnsignedOrNone NumExpansions = PackExpansion->getNumExpansions();
6769 true, Expand, RetainExpansion,
6782 U =
SemaRef.Context.getPackExpansionType(
U, NumExpansions);
6783 Exceptions.push_back(
U);
6789 for (
unsigned ArgIdx = 0; ArgIdx != *NumExpansions; ++ArgIdx) {
6793 if (
U.isNull() ||
SemaRef.CheckSpecifiedExceptionType(
U, Loc))
6796 Exceptions.push_back(
U);
6800 if (
U.isNull() ||
SemaRef.CheckSpecifiedExceptionType(
U, Loc))
6805 Exceptions.push_back(
U);
6815template<
typename Derived>
6825 if (getDerived().AlwaysRebuild() || ResultType !=
T->getReturnType())
6826 Result = getDerived().RebuildFunctionNoProtoType(ResultType);
6837template <
typename Derived>
6838QualType TreeTransform<Derived>::TransformUnresolvedUsingType(
6839 TypeLocBuilder &TLB, UnresolvedUsingTypeLoc TL) {
6841 const UnresolvedUsingType *T = TL.getTypePtr();
6842 bool Changed =
false;
6844 NestedNameSpecifierLoc QualifierLoc = TL.getQualifierLoc();
6845 if (NestedNameSpecifierLoc OldQualifierLoc = QualifierLoc) {
6846 QualifierLoc = getDerived().TransformNestedNameSpecifierLoc(QualifierLoc);
6849 Changed |= QualifierLoc != OldQualifierLoc;
6852 auto *D = getDerived().TransformDecl(TL.getNameLoc(),
T->getDecl());
6858 if (getDerived().AlwaysRebuild() || Changed) {
6859 Result = getDerived().RebuildUnresolvedUsingType(
6860 T->getKeyword(), QualifierLoc.getNestedNameSpecifier(), TL.getNameLoc(),
6868 QualifierLoc, TL.getNameLoc());
6871 QualifierLoc, TL.getNameLoc());
6875template <
typename Derived>
6883 QualifierLoc = getDerived().TransformNestedNameSpecifierLoc(QualifierLoc);
6886 Changed |= QualifierLoc != OldQualifierLoc;
6889 auto *D = cast_or_null<UsingShadowDecl>(
6890 getDerived().TransformDecl(TL.getNameLoc(),
T->getDecl()));
6895 QualType UnderlyingType = getDerived().TransformType(
T->desugar());
6896 if (UnderlyingType.isNull())
6898 Changed |= UnderlyingType !=
T->desugar();
6901 if (getDerived().AlwaysRebuild() || Changed) {
6902 Result = getDerived().RebuildUsingType(
6903 T->getKeyword(), QualifierLoc.getNestedNameSpecifier(), D,
6913template<
typename Derived>
6921 QualifierLoc = getDerived().TransformNestedNameSpecifierLoc(QualifierLoc);
6924 Changed |= QualifierLoc != OldQualifierLoc;
6927 auto *
Typedef = cast_or_null<TypedefNameDecl>(
6928 getDerived().TransformDecl(TL.getNameLoc(),
T->getDecl()));
6936 if (getDerived().AlwaysRebuild() || Changed) {
6937 Result = getDerived().RebuildTypedefType(
6938 T->getKeyword(), QualifierLoc.getNestedNameSpecifier(),
Typedef);
6944 QualifierLoc, TL.getNameLoc());
6948template<
typename Derived>
6956 ExprResult E = getDerived().TransformExpr(TL.getUnderlyingExpr());
6966 if (getDerived().AlwaysRebuild() || E.get() != TL.getUnderlyingExpr()) {
6968 getDerived().RebuildTypeOfExprType(E.get(), TL.getTypeofLoc(), Kind);
6975 NewTL.setLParenLoc(TL.getLParenLoc());
6976 NewTL.setRParenLoc(TL.getRParenLoc());
6981template<
typename Derived>
6985 TypeSourceInfo* New_Under_TI = getDerived().TransformType(Old_Under_TI);
6991 if (getDerived().AlwaysRebuild() || New_Under_TI != Old_Under_TI) {
6992 Result = getDerived().RebuildTypeOfType(New_Under_TI->getType(), Kind);
6999 NewTL.setLParenLoc(TL.getLParenLoc());
7000 NewTL.setRParenLoc(TL.getRParenLoc());
7001 NewTL.setUnmodifiedTInfo(New_Under_TI);
7006template<
typename Derived>
7009 const DecltypeType *
T = TL.getTypePtr();
7016 ExprResult E = getDerived().TransformExpr(
T->getUnderlyingExpr());
7020 E = getSema().ActOnDecltypeExpression(E.get());
7025 if (getDerived().AlwaysRebuild() ||
7026 E.get() !=
T->getUnderlyingExpr()) {
7027 Result = getDerived().RebuildDecltypeType(E.get(), TL.getDecltypeLoc());
7035 NewTL.setRParenLoc(TL.getRParenLoc());
7039template <
typename Derived>
7049 IndexExpr = getDerived().TransformExpr(TL.getIndexExpr());
7050 if (IndexExpr.isInvalid())
7053 QualType Pattern = TL.getPattern();
7055 const PackIndexingType *PIT = TL.
getTypePtr();
7059 bool NotYetExpanded = Types.empty();
7060 bool FullySubstituted =
true;
7062 if (Types.empty() && !PIT->expandsToEmptyPack())
7066 if (!
T->containsUnexpandedParameterPack()) {
7067 QualType Transformed = getDerived().TransformType(
T);
7068 if (Transformed.isNull())
7070 SubtitutedTypes.push_back(Transformed);
7075 getSema().collectUnexpandedParameterPacks(
T, Unexpanded);
7076 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
7079 bool ShouldExpand =
true;
7080 bool RetainExpansion =
false;
7082 if (getDerived().TryExpandParameterPacks(
7085 RetainExpansion, NumExpansions))
7087 if (!ShouldExpand) {
7093 QualType Pack = getDerived().TransformType(TLB, TI->getTypeLoc());
7096 if (NotYetExpanded) {
7097 FullySubstituted =
false;
7098 QualType Out = getDerived().RebuildPackIndexingType(
7108 SubtitutedTypes.push_back(Pack);
7111 for (
unsigned I = 0; I != *NumExpansions; ++I) {
7116 SubtitutedTypes.push_back(Out);
7117 FullySubstituted &= !
Out->containsUnexpandedParameterPack();
7121 if (RetainExpansion) {
7122 FullySubstituted =
false;
7123 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
7127 SubtitutedTypes.push_back(Out);
7135 QualType Result = getDerived().TransformType(TLB, TL.getPatternLoc());
7137 QualType Out = getDerived().RebuildPackIndexingType(
7139 FullySubstituted, SubtitutedTypes);
7148template<
typename Derived>
7154 if (
Result->isDependentType()) {
7155 const UnaryTransformType *
T = TL.getTypePtr();
7157 NewBaseTSI = getDerived().TransformType(TL.getUnderlyingTInfo());
7160 QualType NewBase = NewBaseTSI->getType();
7162 Result = getDerived().RebuildUnaryTransformType(NewBase,
7171 NewTL.setParensRange(TL.getParensRange());
7172 NewTL.setUnderlyingTInfo(NewBaseTSI);
7176template<
typename Derived>
7179 const DeducedTemplateSpecializationType *
T = TL.getTypePtr();
7184 TL.getTemplateNameLoc());
7188 QualType OldDeduced =
T->getDeducedType();
7190 if (!OldDeduced.isNull()) {
7191 NewDeduced = getDerived().TransformType(OldDeduced);
7192 if (NewDeduced.isNull())
7196 QualType Result = getDerived().RebuildDeducedTemplateSpecializationType(
7203 NewTL.setTemplateNameLoc(TL.getTemplateNameLoc());
7204 NewTL.setQualifierLoc(QualifierLoc);
7208template <
typename Derived>
7215 QualifierLoc =
getDerived().TransformNestedNameSpecifierLoc(QualifierLoc);
7220 auto *TD = cast_or_null<TagDecl>(
7227 TD !=
T->getDecl()) {
7228 if (
T->isCanonicalUnqualified())
7245template <
typename Derived>
7251template <
typename Derived>
7252QualType TreeTransform<Derived>::TransformRecordType(TypeLocBuilder &TLB,
7254 return getDerived().TransformTagType(TLB, TL);
7257template<
typename Derived>
7264template<
typename Derived>
7268 return getDerived().TransformTemplateTypeParmType(
7273template <
typename Derived>
7279template<
typename Derived>
7280QualType TreeTransform<Derived>::TransformSubstTemplateTypeParmType(
7281 TypeLocBuilder &TLB,
7282 SubstTemplateTypeParmTypeLoc TL) {
7283 const SubstTemplateTypeParmType *T = TL.getTypePtr();
7286 getDerived().TransformDecl(TL.getNameLoc(), T->getAssociatedDecl());
7291 TemporaryBase Rebase(*
this, TL.getNameLoc(), DeclarationName());
7292 QualType Replacement = getDerived().TransformType(T->getReplacementType());
7293 if (Replacement.isNull())
7297 Replacement, NewReplaced, T->getIndex(), T->getPackIndex(),
7301 SubstTemplateTypeParmTypeLoc NewTL
7302 = TLB.push<SubstTemplateTypeParmTypeLoc>(Result);
7303 NewTL.setNameLoc(TL.getNameLoc());
7307template <
typename Derived>
7313template<
typename Derived>
7317 return getDerived().TransformSubstTemplateTypeParmPackType(
7321template <
typename Derived>
7327template<
typename Derived>
7328QualType TreeTransform<Derived>::TransformAtomicType(TypeLocBuilder &TLB,
7330 QualType ValueType = getDerived().TransformType(TLB, TL.getValueLoc());
7331 if (ValueType.isNull())
7334 QualType Result = TL.getType();
7335 if (getDerived().AlwaysRebuild() ||
7336 ValueType != TL.getValueLoc().getType()) {
7337 Result = getDerived().RebuildAtomicType(ValueType, TL.getKWLoc());
7338 if (Result.isNull())
7344 NewTL.setLParenLoc(TL.getLParenLoc());
7345 NewTL.setRParenLoc(TL.getRParenLoc());
7350template <
typename Derived>
7353 QualType ValueType = getDerived().TransformType(TLB, TL.getValueLoc());
7354 if (ValueType.isNull())
7358 if (getDerived().AlwaysRebuild() || ValueType != TL.getValueLoc().getType()) {
7361 Result = getDerived().RebuildPipeType(ValueType, TL.getKWLoc(), isReadPipe);
7372template <
typename Derived>
7378 if (getDerived().AlwaysRebuild()) {
7379 Result = getDerived().RebuildBitIntType(EIT->isUnsigned(),
7380 EIT->getNumBits(), TL.getNameLoc());
7390template <
typename Derived>
7397 ExprResult BitsExpr = getDerived().TransformExpr(EIT->getNumBitsExpr());
7400 if (BitsExpr.isInvalid())
7405 if (getDerived().AlwaysRebuild() || BitsExpr.get() != EIT->getNumBitsExpr()) {
7406 Result = getDerived().RebuildDependentBitIntType(
7407 EIT->isUnsigned(), BitsExpr.get(), TL.getNameLoc());
7423template <
typename Derived>
7426 llvm_unreachable(
"This type does not need to be transformed.");
7434 template<
typename ArgLocContainer>
7436 ArgLocContainer *Container;
7461 : Container(&Container), Index(Index) { }
7475 return Container->getArgLoc(Index);
7479 return pointer(Container->getArgLoc(Index));
7484 return X.Container == Y.Container &&
X.Index == Y.Index;
7493template<
typename Derived>
7494QualType TreeTransform<Derived>::TransformAutoType(TypeLocBuilder &TLB,
7496 const AutoType *T = TL.getTypePtr();
7497 QualType OldDeduced = T->getDeducedType();
7498 QualType NewDeduced;
7499 if (!OldDeduced.isNull()) {
7500 NewDeduced = getDerived().TransformType(OldDeduced);
7501 if (NewDeduced.isNull())
7508 if (
T->isConstrained()) {
7509 assert(TL.getConceptReference());
7510 NewCD = cast_or_null<ConceptDecl>(getDerived().TransformDecl(
7511 TL.getConceptNameLoc(),
T->getTypeConstraintConcept()));
7513 NewTemplateArgs.setLAngleLoc(TL.getLAngleLoc());
7514 NewTemplateArgs.setRAngleLoc(TL.getRAngleLoc());
7516 if (getDerived().TransformTemplateArguments(
7517 ArgIterator(TL, 0), ArgIterator(TL, TL.getNumArgs()),
7521 if (TL.getNestedNameSpecifierLoc()) {
7523 = getDerived().TransformNestedNameSpecifierLoc(
7524 TL.getNestedNameSpecifierLoc());
7525 if (!NewNestedNameSpec)
7531 if (getDerived().AlwaysRebuild() || NewDeduced != OldDeduced ||
7532 T->isDependentType() ||
T->isConstrained()) {
7535 NewArgList.reserve(NewTemplateArgs.size());
7536 for (
const auto &ArgLoc : NewTemplateArgs.arguments())
7537 NewArgList.push_back(ArgLoc.getArgument());
7538 Result = getDerived().RebuildAutoType(NewDeduced,
T->getKeyword(), NewCD,
7546 NewTL.setRParenLoc(TL.getRParenLoc());
7547 NewTL.setConceptReference(
nullptr);
7549 if (
T->isConstrained()) {
7551 TL.getTypePtr()->getTypeConstraintConcept()->getDeclName(),
7552 TL.getConceptNameLoc(),
7553 TL.getTypePtr()->getTypeConstraintConcept()->getDeclName());
7555 SemaRef.
Context, NewNestedNameSpec, TL.getTemplateKWLoc(), DNI,
7556 TL.getFoundDecl(), TL.getTypePtr()->getTypeConstraintConcept(),
7558 NewTL.setConceptReference(CR);
7564template <
typename Derived>
7567 return getDerived().TransformTemplateSpecializationType(
7572template <
typename Derived>
7575 NamedDecl *FirstQualifierInScope,
bool AllowInjectedClassName) {
7576 const TemplateSpecializationType *
T = TL.
getTypePtr();
7582 AllowInjectedClassName);
7591 if (getDerived().TransformTemplateArguments(ArgIterator(TL, 0),
7600 QualType Result = getDerived().RebuildTemplateSpecializationType(
7613template <
typename Derived>
7617 QualType modifiedType = getDerived().TransformType(TLB, TL.getModifiedLoc());
7618 if (modifiedType.isNull())
7622 const Attr *oldAttr = TL.getAttr();
7623 const Attr *newAttr = oldAttr ? getDerived().TransformAttr(oldAttr) :
nullptr;
7624 if (oldAttr && !newAttr)
7630 if (getDerived().AlwaysRebuild() ||
7631 modifiedType != oldType->getModifiedType()) {
7644 QualType equivalentType = modifiedType;
7645 if (TL.getModifiedLoc().getType() != TL.getEquivalentTypeLoc().getType()) {
7647 AuxiliaryTLB.
reserve(TL.getFullDataSize());
7649 getDerived().TransformType(AuxiliaryTLB, TL.getEquivalentTypeLoc());
7650 if (equivalentType.isNull())
7656 if (
auto nullability = oldType->getImmediateNullability()) {
7657 if (!modifiedType->canHaveNullability()) {
7658 SemaRef.
Diag((TL.getAttr() ? TL.getAttr()->getLocation()
7659 : TL.getModifiedLoc().getBeginLoc()),
7660 diag::err_nullability_nonpointer)
7677template <
typename Derived>
7681 QualType InnerTy = getDerived().TransformType(TLB, TL.getInnerLoc());
7682 if (InnerTy.isNull())
7685 Expr *OldCount = TL.getCountExpr();
7686 Expr *NewCount =
nullptr;
7688 ExprResult CountResult = getDerived().TransformExpr(OldCount);
7689 if (CountResult.isInvalid())
7691 NewCount = CountResult.get();
7695 if (getDerived().AlwaysRebuild() || InnerTy != OldTy->desugar() ||
7696 OldCount != NewCount) {
7699 InnerTy, NewCount, OldTy->isCountInBytes(), OldTy->isOrNull());
7706template <
typename Derived>
7710 llvm_unreachable(
"Unexpected TreeTransform for BTFTagAttributedType");
7713template <
typename Derived>
7717 const HLSLAttributedResourceType *oldType = TL.getTypePtr();
7719 QualType WrappedTy = getDerived().TransformType(TLB, TL.getWrappedLoc());
7720 if (WrappedTy.isNull())
7724 QualType OldContainedTy = oldType->getContainedType();
7725 if (!OldContainedTy.isNull()) {
7726 TypeSourceInfo *oldContainedTSI = TL.getContainedTypeSourceInfo();
7727 if (!oldContainedTSI)
7728 oldContainedTSI = getSema().getASTContext().getTrivialTypeSourceInfo(
7730 TypeSourceInfo *ContainedTSI = getDerived().TransformType(oldContainedTSI);
7733 ContainedTy = ContainedTSI->getType();
7737 if (getDerived().AlwaysRebuild() || WrappedTy != oldType->getWrappedType() ||
7738 ContainedTy != oldType->getContainedType()) {
7740 WrappedTy, ContainedTy, oldType->getAttrs());
7747template <
typename Derived>
7751 return TL.getType();
7754template<
typename Derived>
7758 QualType Inner = getDerived().TransformType(TLB, TL.getInnerLoc());
7763 if (getDerived().AlwaysRebuild() ||
7764 Inner != TL.getInnerLoc().getType()) {
7765 Result = getDerived().RebuildParenType(Inner);
7772 NewTL.setRParenLoc(TL.getRParenLoc());
7776template <
typename Derived>
7780 QualType Inner = getDerived().TransformType(TLB, TL.getInnerLoc());
7785 if (getDerived().AlwaysRebuild() || Inner != TL.getInnerLoc().getType()) {
7787 getDerived().RebuildMacroQualifiedType(Inner, TL.getMacroIdentifier());
7797template<
typename Derived>
7798QualType TreeTransform<Derived>::TransformDependentNameType(
7800 return TransformDependentNameType(TLB, TL,
false);
7803template <
typename Derived>
7804QualType TreeTransform<Derived>::TransformDependentNameType(
7807 const DependentNameType *
T = TL.getTypePtr();
7811 QualifierLoc = getDerived().TransformNestedNameSpecifierLoc(
7812 QualifierLoc, ObjectType, UnqualLookup);
7816 assert((ObjectType.isNull() && !UnqualLookup) &&
7817 "must be transformed by TransformNestedNameSpecifierLoc");
7821 = getDerived().RebuildDependentNameType(
T->getKeyword(),
7822 TL.getElaboratedKeywordLoc(),
7833 NewTL.setQualifierLoc(QualifierLoc);
7834 NewTL.setNameLoc(TL.getNameLoc());
7838 NewTL.setTemplateNameLoc(TL.getNameLoc());
7839 NewTL.setQualifierLoc(QualifierLoc);
7842 QualifierLoc, TL.getNameLoc());
7845 NewTL.
set(TL.getElaboratedKeywordLoc(), QualifierLoc, TL.getNameLoc());
7849 NewTL.setQualifierLoc(QualifierLoc);
7850 NewTL.setNameLoc(TL.getNameLoc());
7855template<
typename Derived>
7859 = getDerived().TransformType(TLB, TL.getPatternLoc());
7860 if (Pattern.isNull())
7864 if (getDerived().AlwaysRebuild() ||
7865 Pattern != TL.getPatternLoc().getType()) {
7866 Result = getDerived().RebuildPackExpansionType(Pattern,
7867 TL.getPatternLoc().getSourceRange(),
7868 TL.getEllipsisLoc(),
7869 TL.getTypePtr()->getNumExpansions());
7879template<
typename Derived>
7884 TLB.pushFullCopy(TL);
7885 return TL.getType();
7888template<
typename Derived>
7892 const ObjCTypeParamType *
T = TL.getTypePtr();
7894 getDerived().TransformDecl(
T->getDecl()->getLocation(),
T->getDecl()));
7899 if (getDerived().AlwaysRebuild() ||
7900 OTP !=
T->getDecl()) {
7901 Result = getDerived().RebuildObjCTypeParamType(
7902 OTP, TL.getProtocolLAngleLoc(),
7903 llvm::ArrayRef(TL.getTypePtr()->qual_begin(), TL.getNumProtocols()),
7904 TL.getProtocolLocs(), TL.getProtocolRAngleLoc());
7910 if (TL.getNumProtocols()) {
7911 NewTL.setProtocolLAngleLoc(TL.getProtocolLAngleLoc());
7912 for (
unsigned i = 0, n = TL.getNumProtocols(); i != n; ++i)
7913 NewTL.setProtocolLoc(i, TL.getProtocolLoc(i));
7914 NewTL.setProtocolRAngleLoc(TL.getProtocolRAngleLoc());
7919template<
typename Derived>
7924 QualType BaseType = getDerived().TransformType(TLB, TL.getBaseLoc());
7925 if (BaseType.isNull())
7928 bool AnyChanged = BaseType != TL.getBaseLoc().getType();
7932 for (
unsigned i = 0, n = TL.getNumTypeArgs(); i != n; ++i) {
7934 TypeLoc TypeArgLoc = TypeArgInfo->getTypeLoc();
7935 QualType TypeArg = TypeArgInfo->getType();
7940 const auto *PackExpansion = PackExpansionLoc.getType()
7941 ->castAs<PackExpansionType>();
7945 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
7949 TypeLoc PatternLoc = PackExpansionLoc.getPatternLoc();
7950 bool Expand =
false;
7951 bool RetainExpansion =
false;
7952 UnsignedOrNone NumExpansions = PackExpansion->getNumExpansions();
7953 if (getDerived().TryExpandParameterPacks(
7954 PackExpansionLoc.getEllipsisLoc(), PatternLoc.getSourceRange(),
7955 Unexpanded,
true, Expand,
7956 RetainExpansion, NumExpansions))
7966 TypeArgBuilder.
reserve(PatternLoc.getFullDataSize());
7967 QualType NewPatternType = getDerived().TransformType(TypeArgBuilder,
7969 if (NewPatternType.isNull())
7973 NewPatternType, NumExpansions);
7975 NewExpansionLoc.
setEllipsisLoc(PackExpansionLoc.getEllipsisLoc());
7976 NewTypeArgInfos.push_back(
7977 TypeArgBuilder.getTypeSourceInfo(SemaRef.
Context, NewExpansionType));
7983 for (
unsigned ArgIdx = 0; ArgIdx != *NumExpansions; ++ArgIdx) {
7987 TypeArgBuilder.
reserve(PatternLoc.getFullDataSize());
7989 QualType NewTypeArg = getDerived().TransformType(TypeArgBuilder,
7991 if (NewTypeArg.isNull())
7994 NewTypeArgInfos.push_back(
7995 TypeArgBuilder.getTypeSourceInfo(SemaRef.
Context, NewTypeArg));
8002 TypeArgBuilder.
reserve(TypeArgLoc.getFullDataSize());
8004 getDerived().TransformType(TypeArgBuilder, TypeArgLoc);
8005 if (NewTypeArg.isNull())
8009 if (NewTypeArg == TypeArg) {
8010 NewTypeArgInfos.push_back(TypeArgInfo);
8014 NewTypeArgInfos.push_back(
8015 TypeArgBuilder.getTypeSourceInfo(SemaRef.
Context, NewTypeArg));
8020 if (getDerived().AlwaysRebuild() || AnyChanged) {
8022 Result = getDerived().RebuildObjCObjectType(
8023 BaseType, TL.getBeginLoc(), TL.getTypeArgsLAngleLoc(), NewTypeArgInfos,
8024 TL.getTypeArgsRAngleLoc(), TL.getProtocolLAngleLoc(),
8025 llvm::ArrayRef(TL.getTypePtr()->qual_begin(), TL.getNumProtocols()),
8026 TL.getProtocolLocs(), TL.getProtocolRAngleLoc());
8034 NewT.setTypeArgsLAngleLoc(TL.getTypeArgsLAngleLoc());
8035 for (
unsigned i = 0, n = TL.getNumTypeArgs(); i != n; ++i)
8036 NewT.setTypeArgTInfo(i, NewTypeArgInfos[i]);
8037 NewT.setTypeArgsRAngleLoc(TL.getTypeArgsRAngleLoc());
8038 NewT.setProtocolLAngleLoc(TL.getProtocolLAngleLoc());
8039 for (
unsigned i = 0, n = TL.getNumProtocols(); i != n; ++i)
8040 NewT.setProtocolLoc(i, TL.getProtocolLoc(i));
8041 NewT.setProtocolRAngleLoc(TL.getProtocolRAngleLoc());
8045template<
typename Derived>
8049 QualType PointeeType = getDerived().TransformType(TLB, TL.getPointeeLoc());
8050 if (PointeeType.isNull())
8054 if (getDerived().AlwaysRebuild() ||
8055 PointeeType != TL.getPointeeLoc().getType()) {
8056 Result = getDerived().RebuildObjCObjectPointerType(PointeeType,
8070template<
typename Derived>
8076template<
typename Derived>
8079 return getDerived().TransformCompoundStmt(S,
false);
8082template<
typename Derived>
8089 getSema().resetFPOptions(
8092 bool SubStmtInvalid =
false;
8093 bool SubStmtChanged =
false;
8095 for (
auto *B : S->
body()) {
8097 B, IsStmtExpr && B == S->
body_back() ? StmtDiscardKind::StmtExprResult
8098 : StmtDiscardKind::Discarded);
8100 if (
Result.isInvalid()) {
8107 SubStmtInvalid =
true;
8111 SubStmtChanged = SubStmtChanged || Result.get() != B;
8112 Statements.push_back(Result.getAs<Stmt>());
8118 if (!getDerived().AlwaysRebuild() &&
8122 return getDerived().RebuildCompoundStmt(S->
getLBracLoc(),
8128template<
typename Derived>
8137 LHS = getDerived().TransformExpr(S->getLHS());
8139 if (LHS.isInvalid())
8143 RHS = getDerived().TransformExpr(S->getRHS());
8145 if (RHS.isInvalid())
8152 StmtResult Case = getDerived().RebuildCaseStmt(S->getCaseLoc(),
8154 S->getEllipsisLoc(),
8157 if (Case.isInvalid())
8162 getDerived().TransformStmt(S->getSubStmt());
8163 if (SubStmt.isInvalid())
8167 return getDerived().RebuildCaseStmtBody(Case.get(), SubStmt.get());
8170template <
typename Derived>
8174 getDerived().TransformStmt(S->getSubStmt());
8175 if (SubStmt.isInvalid())
8179 return getDerived().RebuildDefaultStmt(S->getDefaultLoc(), S->getColonLoc(),
8183template<
typename Derived>
8186 StmtResult SubStmt = getDerived().TransformStmt(S->getSubStmt(), SDK);
8187 if (SubStmt.isInvalid())
8190 Decl *LD = getDerived().TransformDecl(S->getDecl()->getLocation(),
8198 if (LD == S->getDecl())
8199 S->getDecl()->setStmt(
nullptr);
8202 return getDerived().RebuildLabelStmt(S->getIdentLoc(),
8207template <
typename Derived>
8216 return getDerived().Transform##X##Attr(cast<X##Attr>(R));
8217#include "clang/Basic/AttrList.inc"
8222template <
typename Derived>
8233 return getDerived().TransformStmt##X##Attr(OrigS, InstS, cast<X##Attr>(R));
8234#include "clang/Basic/AttrList.inc"
8239template <
typename Derived>
8242 StmtDiscardKind SDK) {
8247 bool AttrsChanged =
false;
8251 for (
const auto *I : S->
getAttrs()) {
8253 getDerived().TransformStmtAttr(S->
getSubStmt(), SubStmt.
get(), I);
8254 AttrsChanged |= (I != R);
8267 return getDerived().RebuildAttributedStmt(S->
getAttrLoc(), Attrs,
8271template<
typename Derived>
8276 if (
Init.isInvalid())
8280 if (!S->isConsteval()) {
8282 Cond = getDerived().TransformCondition(
8283 S->getIfLoc(), S->getConditionVariable(), S->getCond(),
8286 if (
Cond.isInvalid())
8291 std::optional<bool> ConstexprConditionValue;
8292 if (S->isConstexpr())
8293 ConstexprConditionValue =
Cond.getKnownValue();
8297 if (!ConstexprConditionValue || *ConstexprConditionValue) {
8301 S->isNonNegatedConsteval());
8303 Then = getDerived().TransformStmt(S->getThen());
8304 if (Then.isInvalid())
8310 Then =
new (getSema().Context)
8311 CompoundStmt(S->getThen()->getBeginLoc(), S->getThen()->getEndLoc());
8316 if (!ConstexprConditionValue || !*ConstexprConditionValue) {
8320 S->isNegatedConsteval());
8322 Else = getDerived().TransformStmt(S->getElse());
8323 if (Else.isInvalid())
8325 }
else if (S->getElse() && ConstexprConditionValue &&
8326 *ConstexprConditionValue) {
8330 Else =
new (getSema().Context)
8331 CompoundStmt(S->getElse()->getBeginLoc(), S->getElse()->getEndLoc());
8334 if (!getDerived().AlwaysRebuild() &&
8335 Init.get() == S->getInit() &&
8336 Cond.get() == std::make_pair(S->getConditionVariable(), S->getCond()) &&
8337 Then.get() == S->getThen() &&
8338 Else.get() == S->getElse())
8341 return getDerived().RebuildIfStmt(
8342 S->getIfLoc(), S->getStatementKind(), S->getLParenLoc(),
Cond,
8343 S->getRParenLoc(),
Init.get(), Then.get(), S->getElseLoc(), Else.get());
8346template<
typename Derived>
8351 if (
Init.isInvalid())
8356 S->getSwitchLoc(), S->getConditionVariable(), S->getCond(),
8358 if (
Cond.isInvalid())
8363 getDerived().RebuildSwitchStmtStart(S->getSwitchLoc(), S->getLParenLoc(),
8364 Init.get(),
Cond, S->getRParenLoc());
8369 StmtResult Body = getDerived().TransformStmt(S->getBody());
8370 if (Body.isInvalid())
8374 return getDerived().RebuildSwitchStmtBody(S->getSwitchLoc(),
Switch.get(),
8378template<
typename Derived>
8383 S->getWhileLoc(), S->getConditionVariable(), S->getCond(),
8385 if (
Cond.isInvalid())
8394 StmtResult Body = getDerived().TransformStmt(S->getBody());
8395 if (Body.isInvalid())
8398 if (!getDerived().AlwaysRebuild() &&
8399 Cond.get() == std::make_pair(S->getConditionVariable(), S->getCond()) &&
8400 Body.get() == S->getBody())
8403 return getDerived().RebuildWhileStmt(S->getWhileLoc(), S->getLParenLoc(),
8404 Cond, S->getRParenLoc(), Body.get());
8407template<
typename Derived>
8416 StmtResult Body = getDerived().TransformStmt(S->getBody());
8417 if (Body.isInvalid())
8422 if (
Cond.isInvalid())
8425 if (!getDerived().AlwaysRebuild() &&
8426 Cond.get() == S->getCond() &&
8427 Body.get() == S->getBody())
8430 return getDerived().RebuildDoStmt(S->getDoLoc(), Body.get(), S->getWhileLoc(),
8431 S->getWhileLoc(),
Cond.get(),
8435template<
typename Derived>
8438 if (getSema().getLangOpts().OpenMP)
8439 getSema().OpenMP().startOpenMPLoop();
8443 if (
Init.isInvalid())
8448 if (getSema().getLangOpts().OpenMP &&
Init.isUsable())
8449 getSema().OpenMP().ActOnOpenMPLoopInitialization(S->getForLoc(),
8454 S->getForLoc(), S->getConditionVariable(), S->getCond(),
8456 if (
Cond.isInvalid())
8461 if (
Inc.isInvalid())
8465 if (S->getInc() && !FullInc.get())
8472 S->getBeginLoc(), S->getInit(),
Init.get(), S->getCond(),
8473 Cond.get().second, S->getInc(),
Inc.get());
8476 StmtResult Body = getDerived().TransformStmt(S->getBody());
8477 if (Body.isInvalid())
8482 if (!getDerived().AlwaysRebuild() &&
8483 Init.get() == S->getInit() &&
8484 Cond.get() == std::make_pair(S->getConditionVariable(), S->getCond()) &&
8485 Inc.get() == S->getInc() &&
8486 Body.get() == S->getBody())
8489 return getDerived().RebuildForStmt(S->getForLoc(), S->getLParenLoc(),
8491 S->getRParenLoc(), Body.get());
8494template<
typename Derived>
8497 Decl *LD = getDerived().TransformDecl(S->getLabel()->getLocation(),
8503 return getDerived().RebuildGotoStmt(S->getGotoLoc(), S->getLabelLoc(),
8507template<
typename Derived>
8515 if (!getDerived().AlwaysRebuild() &&
8516 Target.get() == S->getTarget())
8519 return getDerived().RebuildIndirectGotoStmt(S->getGotoLoc(), S->getStarLoc(),
8523template<
typename Derived>
8526 if (!S->hasLabelTarget())
8529 Decl *LD = getDerived().TransformDecl(S->getLabelDecl()->getLocation(),
8538template<
typename Derived>
8541 if (!S->hasLabelTarget())
8544 Decl *LD = getDerived().TransformDecl(S->getLabelDecl()->getLocation(),
8553template<
typename Derived>
8563 return getDerived().RebuildReturnStmt(S->getReturnLoc(),
Result.get());
8566template<
typename Derived>
8569 bool DeclChanged =
false;
8572 for (
auto *D : S->decls()) {
8573 Decl *Transformed = getDerived().TransformDefinition(D->getLocation(), D);
8577 if (Transformed != D)
8581 if (
auto *TD = dyn_cast<TypeDecl>(Transformed)) {
8582 if (
auto *TN = dyn_cast<TypedefNameDecl>(TD)) {
8583 LSI->ContainsUnexpandedParameterPack |=
8584 TN->getUnderlyingType()->containsUnexpandedParameterPack();
8586 LSI->ContainsUnexpandedParameterPack |=
8589 .getTypeDeclType(TD)
8590 ->containsUnexpandedParameterPack();
8593 if (
auto *VD = dyn_cast<VarDecl>(Transformed))
8594 LSI->ContainsUnexpandedParameterPack |=
8595 VD->getType()->containsUnexpandedParameterPack();
8598 Decls.push_back(Transformed);
8601 if (!getDerived().AlwaysRebuild() && !DeclChanged)
8604 return getDerived().RebuildDeclStmt(Decls, S->getBeginLoc(), S->getEndLoc());
8607template<
typename Derived>
8617 bool ExprsChanged =
false;
8619 auto RebuildString = [&](
Expr *E) {
8624 ExprsChanged =
true;
8631 for (
unsigned I = 0, E = S->getNumOutputs(); I != E; ++I) {
8632 Names.push_back(S->getOutputIdentifier(I));
8638 Constraints.push_back(
Result.get());
8641 Expr *OutputExpr = S->getOutputExpr(I);
8642 Result = getDerived().TransformExpr(OutputExpr);
8646 ExprsChanged |=
Result.get() != OutputExpr;
8648 Exprs.push_back(
Result.get());
8652 for (
unsigned I = 0, E = S->getNumInputs(); I != E; ++I) {
8653 Names.push_back(S->getInputIdentifier(I));
8659 Constraints.push_back(
Result.get());
8662 Expr *InputExpr = S->getInputExpr(I);
8663 Result = getDerived().TransformExpr(InputExpr);
8667 ExprsChanged |=
Result.get() != InputExpr;
8669 Exprs.push_back(
Result.get());
8673 for (
unsigned I = 0, E = S->getNumLabels(); I != E; ++I) {
8674 Names.push_back(S->getLabelIdentifier(I));
8679 ExprsChanged |=
Result.get() != S->getLabelExpr(I);
8680 Exprs.push_back(
Result.get());
8684 for (
unsigned I = 0, E = S->getNumClobbers(); I != E; ++I) {
8688 Clobbers.push_back(
Result.get());
8691 ExprResult AsmString = RebuildString(S->getAsmStringExpr());
8692 if (AsmString.isInvalid())
8695 if (!getDerived().AlwaysRebuild() && !ExprsChanged)
8698 return getDerived().RebuildGCCAsmStmt(S->getAsmLoc(), S->isSimple(),
8699 S->isVolatile(), S->getNumOutputs(),
8700 S->getNumInputs(), Names.data(),
8701 Constraints, Exprs, AsmString.get(),
8702 Clobbers, S->getNumLabels(),
8706template<
typename Derived>
8711 bool HadError =
false, HadChange =
false;
8715 TransformedExprs.reserve(SrcExprs.size());
8716 for (
unsigned i = 0, e = SrcExprs.size(); i != e; ++i) {
8718 if (!
Result.isUsable()) {
8721 HadChange |= (
Result.get() != SrcExprs[i]);
8722 TransformedExprs.push_back(
Result.get());
8727 if (!HadChange && !getDerived().AlwaysRebuild())
8730 return getDerived().RebuildMSAsmStmt(S->getAsmLoc(), S->getLBraceLoc(),
8731 AsmToks, S->getAsmString(),
8732 S->getNumOutputs(), S->getNumInputs(),
8733 S->getAllConstraints(), S->getClobbers(),
8734 TransformedExprs, S->getEndLoc());
8738template<
typename Derived>
8743 assert(FD && ScopeInfo && !ScopeInfo->CoroutinePromise &&
8744 ScopeInfo->NeedsCoroutineSuspends &&
8745 ScopeInfo->CoroutineSuspends.first ==
nullptr &&
8746 ScopeInfo->CoroutineSuspends.second ==
nullptr &&
8747 "expected clean scope info");
8751 ScopeInfo->setNeedsCoroutineSuspends(
false);
8764 getDerived().transformedLocalDecl(S->getPromiseDecl(), {Promise});
8765 ScopeInfo->CoroutinePromise = Promise;
8770 StmtResult InitSuspend = getDerived().TransformStmt(S->getInitSuspendStmt());
8771 if (InitSuspend.isInvalid())
8774 getDerived().TransformStmt(S->getFinalSuspendStmt());
8775 if (FinalSuspend.isInvalid() ||
8778 ScopeInfo->setCoroutineSuspends(InitSuspend.get(), FinalSuspend.get());
8781 StmtResult BodyRes = getDerived().TransformStmt(S->getBody());
8782 if (BodyRes.isInvalid())
8786 if (Builder.isInvalid())
8789 Expr *ReturnObject = S->getReturnValueInit();
8790 assert(ReturnObject &&
"the return object is expected to be valid");
8791 ExprResult Res = getDerived().TransformInitializer(ReturnObject,
8793 if (Res.isInvalid())
8795 Builder.ReturnValue = Res.get();
8800 if (S->hasDependentPromiseType()) {
8803 if (!Promise->getType()->isDependentType()) {
8804 assert(!S->getFallthroughHandler() && !S->getExceptionHandler() &&
8805 !S->getReturnStmtOnAllocFailure() && !S->getDeallocate() &&
8806 "these nodes should not have been built yet");
8807 if (!Builder.buildDependentStatements())
8811 if (
auto *OnFallthrough = S->getFallthroughHandler()) {
8812 StmtResult Res = getDerived().TransformStmt(OnFallthrough);
8813 if (Res.isInvalid())
8815 Builder.OnFallthrough = Res.get();
8818 if (
auto *OnException = S->getExceptionHandler()) {
8819 StmtResult Res = getDerived().TransformStmt(OnException);
8820 if (Res.isInvalid())
8822 Builder.OnException = Res.get();
8825 if (
auto *OnAllocFailure = S->getReturnStmtOnAllocFailure()) {
8826 StmtResult Res = getDerived().TransformStmt(OnAllocFailure);
8827 if (Res.isInvalid())
8829 Builder.ReturnStmtOnAllocFailure = Res.get();
8833 assert(S->getAllocate() && S->getDeallocate() &&
8834 "allocation and deallocation calls must already be built");
8835 ExprResult AllocRes = getDerived().TransformExpr(S->getAllocate());
8836 if (AllocRes.isInvalid())
8838 Builder.Allocate = AllocRes.get();
8840 ExprResult DeallocRes = getDerived().TransformExpr(S->getDeallocate());
8841 if (DeallocRes.isInvalid())
8843 Builder.Deallocate = DeallocRes.get();
8845 if (
auto *ResultDecl = S->getResultDecl()) {
8846 StmtResult Res = getDerived().TransformStmt(ResultDecl);
8847 if (Res.isInvalid())
8849 Builder.ResultDecl = Res.get();
8854 if (Res.isInvalid())
8856 Builder.ReturnStmt = Res.get();
8860 return getDerived().RebuildCoroutineBodyStmt(Builder);
8863template<
typename Derived>
8873 return getDerived().RebuildCoreturnStmt(S->getKeywordLoc(),
Result.get(),
8877template <
typename Derived>
8890 ExprResult Lookup = getSema().BuildOperatorCoawaitLookupExpr(
8891 getSema().getCurScope(), E->getKeywordLoc());
8895 return getDerived().RebuildCoawaitExpr(
8896 E->getKeywordLoc(),
Operand.get(),
8900template <
typename Derived>
8903 ExprResult OperandResult = getDerived().TransformInitializer(E->getOperand(),
8905 if (OperandResult.isInvalid())
8909 E->getOperatorCoawaitLookup());
8916 return getDerived().RebuildDependentCoawaitExpr(
8917 E->getKeywordLoc(), OperandResult.get(),
8921template<
typename Derived>
8931 return getDerived().RebuildCoyieldExpr(E->getKeywordLoc(),
Result.get());
8936template<
typename Derived>
8940 StmtResult TryBody = getDerived().TransformStmt(S->getTryBody());
8941 if (TryBody.isInvalid())
8945 bool AnyCatchChanged =
false;
8947 for (
unsigned I = 0, N = S->getNumCatchStmts(); I != N; ++I) {
8948 StmtResult Catch = getDerived().TransformStmt(S->getCatchStmt(I));
8949 if (Catch.isInvalid())
8951 if (Catch.get() != S->getCatchStmt(I))
8952 AnyCatchChanged =
true;
8953 CatchStmts.push_back(Catch.get());
8958 if (S->getFinallyStmt()) {
8959 Finally = getDerived().TransformStmt(S->getFinallyStmt());
8960 if (Finally.isInvalid())
8965 if (!getDerived().AlwaysRebuild() &&
8966 TryBody.get() == S->getTryBody() &&
8968 Finally.get() == S->getFinallyStmt())
8972 return getDerived().RebuildObjCAtTryStmt(S->getAtTryLoc(), TryBody.get(),
8973 CatchStmts, Finally.get());
8976template<
typename Derived>
8981 if (
VarDecl *FromVar = S->getCatchParamDecl()) {
8983 if (FromVar->getTypeSourceInfo()) {
8984 TSInfo = getDerived().TransformType(FromVar->getTypeSourceInfo());
8991 T = TSInfo->getType();
8993 T = getDerived().TransformType(FromVar->getType());
8998 Var = getDerived().RebuildObjCExceptionDecl(FromVar, TSInfo,
T);
9003 StmtResult Body = getDerived().TransformStmt(S->getCatchBody());
9004 if (Body.isInvalid())
9007 return getDerived().RebuildObjCAtCatchStmt(S->getAtCatchLoc(),
9012template<
typename Derived>
9016 StmtResult Body = getDerived().TransformStmt(S->getFinallyBody());
9017 if (Body.isInvalid())
9021 if (!getDerived().AlwaysRebuild() &&
9022 Body.get() == S->getFinallyBody())
9026 return getDerived().RebuildObjCAtFinallyStmt(S->getAtFinallyLoc(),
9030template<
typename Derived>
9034 if (S->getThrowExpr()) {
9035 Operand = getDerived().TransformExpr(S->getThrowExpr());
9040 if (!getDerived().AlwaysRebuild() &&
9041 Operand.get() == S->getThrowExpr())
9044 return getDerived().RebuildObjCAtThrowStmt(S->getThrowLoc(),
Operand.get());
9047template<
typename Derived>
9056 getDerived().RebuildObjCAtSynchronizedOperand(S->getAtSynchronizedLoc(),
9062 StmtResult Body = getDerived().TransformStmt(S->getSynchBody());
9063 if (Body.isInvalid())
9067 if (!getDerived().AlwaysRebuild() &&
9068 Object.get() == S->getSynchExpr() &&
9069 Body.get() == S->getSynchBody())
9073 return getDerived().RebuildObjCAtSynchronizedStmt(S->getAtSynchronizedLoc(),
9074 Object.get(), Body.get());
9077template<
typename Derived>
9082 StmtResult Body = getDerived().TransformStmt(S->getSubStmt());
9083 if (Body.isInvalid())
9087 if (!getDerived().AlwaysRebuild() &&
9088 Body.get() == S->getSubStmt())
9092 return getDerived().RebuildObjCAutoreleasePoolStmt(
9093 S->getAtLoc(), Body.get());
9096template<
typename Derived>
9101 StmtResult Element = getDerived().TransformStmt(
9102 S->getElement(), StmtDiscardKind::NotDiscarded);
9103 if (Element.isInvalid())
9107 ExprResult Collection = getDerived().TransformExpr(S->getCollection());
9108 if (Collection.isInvalid())
9112 StmtResult Body = getDerived().TransformStmt(S->getBody());
9113 if (Body.isInvalid())
9117 if (!getDerived().AlwaysRebuild() &&
9118 Element.get() == S->getElement() &&
9119 Collection.get() == S->getCollection() &&
9120 Body.get() == S->getBody())
9124 return getDerived().RebuildObjCForCollectionStmt(S->getForLoc(),
9131template <
typename Derived>
9135 if (
VarDecl *ExceptionDecl = S->getExceptionDecl()) {
9137 getDerived().TransformType(ExceptionDecl->getTypeSourceInfo());
9141 Var = getDerived().RebuildExceptionDecl(
9142 ExceptionDecl,
T, ExceptionDecl->getInnerLocStart(),
9143 ExceptionDecl->getLocation(), ExceptionDecl->getIdentifier());
9144 if (!Var || Var->isInvalidDecl())
9149 StmtResult Handler = getDerived().TransformStmt(S->getHandlerBlock());
9150 if (Handler.isInvalid())
9153 if (!getDerived().AlwaysRebuild() && !Var &&
9154 Handler.get() == S->getHandlerBlock())
9157 return getDerived().RebuildCXXCatchStmt(S->getCatchLoc(), Var, Handler.get());
9160template <
typename Derived>
9163 StmtResult TryBlock = getDerived().TransformCompoundStmt(S->getTryBlock());
9164 if (TryBlock.isInvalid())
9168 bool HandlerChanged =
false;
9170 for (
unsigned I = 0, N = S->getNumHandlers(); I != N; ++I) {
9171 StmtResult Handler = getDerived().TransformCXXCatchStmt(S->getHandler(I));
9172 if (Handler.isInvalid())
9175 HandlerChanged = HandlerChanged || Handler.get() != S->getHandler(I);
9176 Handlers.push_back(Handler.getAs<
Stmt>());
9179 getSema().DiagnoseExceptionUse(S->getTryLoc(),
true);
9181 if (!getDerived().AlwaysRebuild() && TryBlock.get() == S->getTryBlock() &&
9185 return getDerived().RebuildCXXTryStmt(S->getTryLoc(), TryBlock.get(),
9189template<
typename Derived>
9200 auto &LastRecord = getSema().currentEvaluationContext();
9201 LastRecord.InLifetimeExtendingContext =
true;
9202 LastRecord.RebuildDefaultArgOrDefaultInit =
true;
9205 S->getInit() ? getDerived().TransformStmt(S->getInit()) :
StmtResult();
9206 if (
Init.isInvalid())
9210 if (
Range.isInvalid())
9215 getSema().ExprEvalContexts.back().ForRangeLifetimeExtendTemps.empty());
9216 auto ForRangeLifetimeExtendTemps =
9217 getSema().ExprEvalContexts.back().ForRangeLifetimeExtendTemps;
9219 StmtResult Begin = getDerived().TransformStmt(S->getBeginStmt());
9220 if (Begin.isInvalid())
9222 StmtResult End = getDerived().TransformStmt(S->getEndStmt());
9223 if (End.isInvalid())
9227 if (
Cond.isInvalid())
9231 if (
Cond.isInvalid())
9237 if (
Inc.isInvalid())
9242 StmtResult LoopVar = getDerived().TransformStmt(S->getLoopVarStmt());
9243 if (LoopVar.isInvalid())
9247 if (getDerived().AlwaysRebuild() ||
9248 Init.get() != S->getInit() ||
9249 Range.get() != S->getRangeStmt() ||
9250 Begin.get() != S->getBeginStmt() ||
9251 End.get() != S->getEndStmt() ||
9252 Cond.get() != S->getCond() ||
9253 Inc.get() != S->getInc() ||
9254 LoopVar.get() != S->getLoopVarStmt()) {
9255 NewStmt = getDerived().RebuildCXXForRangeStmt(
9256 S->getForLoc(), S->getCoawaitLoc(),
Init.get(), S->getColonLoc(),
9257 Range.get(), Begin.get(), End.get(),
Cond.get(),
Inc.get(),
9258 LoopVar.get(), S->getRParenLoc(), ForRangeLifetimeExtendTemps);
9259 if (NewStmt.isInvalid() && LoopVar.get() != S->getLoopVarStmt()) {
9261 getSema().ActOnInitializerError(
9272 StmtResult Body = getDerived().TransformStmt(S->getBody());
9273 if (Body.isInvalid())
9280 if (Body.get() != S->getBody() && NewStmt.get() == S) {
9281 NewStmt = getDerived().RebuildCXXForRangeStmt(
9282 S->getForLoc(), S->getCoawaitLoc(),
Init.get(), S->getColonLoc(),
9283 Range.get(), Begin.get(), End.get(),
Cond.get(),
Inc.get(),
9284 LoopVar.get(), S->getRParenLoc(), ForRangeLifetimeExtendTemps);
9285 if (NewStmt.isInvalid())
9289 if (NewStmt.get() == S)
9292 return FinishCXXForRangeStmt(NewStmt.get(), Body.get());
9295template<
typename Derived>
9301 if (S->getQualifierLoc()) {
9303 = getDerived().TransformNestedNameSpecifierLoc(S->getQualifierLoc());
9310 if (NameInfo.getName()) {
9311 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
9312 if (!NameInfo.getName())
9317 if (!getDerived().AlwaysRebuild() &&
9318 QualifierLoc == S->getQualifierLoc() &&
9319 NameInfo.getName() == S->getNameInfo().getName())
9324 SS.
Adopt(QualifierLoc);
9326 switch (getSema().CheckMicrosoftIfExistsSymbol(
nullptr, SS, NameInfo)) {
9328 if (S->isIfExists())
9331 return new (getSema().Context)
NullStmt(S->getKeywordLoc());
9334 if (S->isIfNotExists())
9337 return new (getSema().Context)
NullStmt(S->getKeywordLoc());
9348 StmtResult SubStmt = getDerived().TransformCompoundStmt(S->getSubStmt());
9349 if (SubStmt.isInvalid())
9357 return getDerived().RebuildMSDependentExistsStmt(S->getKeywordLoc(),
9364template<
typename Derived>
9368 if (E->getQualifierLoc()) {
9370 = getDerived().TransformNestedNameSpecifierLoc(E->getQualifierLoc());
9376 getDerived().TransformDecl(E->getMemberLoc(), E->getPropertyDecl()));
9381 if (
Base.isInvalid())
9387 QualifierLoc, E->getMemberLoc());
9390template <
typename Derived>
9394 if (BaseRes.isInvalid())
9396 auto IdxRes = getDerived().TransformExpr(E->getIdx());
9397 if (IdxRes.isInvalid())
9400 if (!getDerived().AlwaysRebuild() &&
9401 BaseRes.get() == E->getBase() &&
9402 IdxRes.get() == E->getIdx())
9405 return getDerived().RebuildArraySubscriptExpr(
9406 BaseRes.get(),
SourceLocation(), IdxRes.get(), E->getRBracketLoc());
9409template <
typename Derived>
9411 StmtResult TryBlock = getDerived().TransformCompoundStmt(S->getTryBlock());
9412 if (TryBlock.isInvalid())
9415 StmtResult Handler = getDerived().TransformSEHHandler(S->getHandler());
9416 if (Handler.isInvalid())
9419 if (!getDerived().AlwaysRebuild() && TryBlock.get() == S->getTryBlock() &&
9420 Handler.get() == S->getHandler())
9423 return getDerived().RebuildSEHTryStmt(S->getIsCXXTry(), S->getTryLoc(),
9424 TryBlock.get(), Handler.get());
9427template <
typename Derived>
9430 if (
Block.isInvalid())
9433 return getDerived().RebuildSEHFinallyStmt(S->getFinallyLoc(),
Block.get());
9436template <
typename Derived>
9438 ExprResult FilterExpr = getDerived().TransformExpr(S->getFilterExpr());
9439 if (FilterExpr.isInvalid())
9443 if (
Block.isInvalid())
9446 return getDerived().RebuildSEHExceptStmt(S->getExceptLoc(), FilterExpr.get(),
9450template <
typename Derived>
9458template<
typename Derived>
9468template <
typename Derived>
9470TreeTransform<Derived>::TransformOMPCanonicalLoop(OMPCanonicalLoop *L) {
9474 return getDerived().TransformStmt(L->getLoopStmt());
9477template <
typename Derived>
9484 TClauses.reserve(Clauses.size());
9488 getDerived().getSema().OpenMP().StartOpenMPClause((*I)->getClauseKind());
9490 getDerived().getSema().OpenMP().EndOpenMPClause();
9492 TClauses.push_back(Clause);
9494 TClauses.push_back(
nullptr);
9498 if (D->hasAssociatedStmt() && D->getAssociatedStmt()) {
9499 getDerived().getSema().OpenMP().ActOnOpenMPRegionStart(
9500 D->getDirectiveKind(),
9506 if (D->getDirectiveKind() == OMPD_atomic ||
9507 D->getDirectiveKind() == OMPD_critical ||
9508 D->getDirectiveKind() == OMPD_section ||
9509 D->getDirectiveKind() == OMPD_master)
9510 CS = D->getAssociatedStmt();
9512 CS = D->getRawStmt();
9515 getSema().getLangOpts().OpenMPIRBuilder)
9519 getDerived().getSema().OpenMP().ActOnOpenMPRegionEnd(Body, TClauses);
9524 if (TClauses.size() != Clauses.size()) {
9530 if (D->getDirectiveKind() == OMPD_critical) {
9532 DirName =
getDerived().TransformDeclarationNameInfo(DirName);
9535 if (D->getDirectiveKind() == OMPD_cancellation_point) {
9537 }
else if (D->getDirectiveKind() == OMPD_cancel) {
9541 return getDerived().RebuildOMPExecutableDirective(
9542 D->getDirectiveKind(), DirName, CancelRegion, TClauses,
9543 AssociatedStmt.
get(), D->getBeginLoc(), D->getEndLoc());
9551template <
typename Derived>
9558 TClauses.reserve(Clauses.size());
9561 getDerived().getSema().OpenMP().StartOpenMPClause(
C->getClauseKind());
9563 getDerived().getSema().OpenMP().EndOpenMPClause();
9565 TClauses.push_back(Clause);
9567 TClauses.push_back(
nullptr);
9571 if (D->hasAssociatedStmt() && D->getAssociatedStmt()) {
9572 getDerived().getSema().OpenMP().ActOnOpenMPRegionStart(
9573 D->getDirectiveKind(),
9578 assert(D->getDirectiveKind() == OMPD_assume &&
9579 "Unexpected informational directive");
9580 Stmt *CS = D->getAssociatedStmt();
9584 getDerived().getSema().OpenMP().ActOnOpenMPRegionEnd(Body, TClauses);
9588 if (TClauses.size() != Clauses.size())
9593 return getDerived().RebuildOMPInformationalDirective(
9594 D->getDirectiveKind(), DirName, TClauses, AssociatedStmt.
get(),
9595 D->getBeginLoc(), D->getEndLoc());
9598template <
typename Derived>
9603 SemaRef.
Diag(D->getBeginLoc(), diag::err_omp_instantiation_not_supported)
9604 << getOpenMPDirectiveName(D->getDirectiveKind(), OMPVersion);
9608template <
typename Derived>
9610TreeTransform<Derived>::TransformOMPParallelDirective(OMPParallelDirective *D) {
9611 DeclarationNameInfo DirName;
9612 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9613 OMPD_parallel, DirName,
nullptr, D->getBeginLoc());
9614 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9615 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9619template <
typename Derived>
9623 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9624 OMPD_simd, DirName,
nullptr, D->getBeginLoc());
9625 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9626 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9630template <
typename Derived>
9634 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9635 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
9636 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9637 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9641template <
typename Derived>
9645 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9646 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
9647 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9648 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9652template <
typename Derived>
9656 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9657 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
9658 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9659 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9663template <
typename Derived>
9667 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9668 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
9669 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9670 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9674template <
typename Derived>
9676 OMPInterchangeDirective *D) {
9678 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9679 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
9680 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9681 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9685template <
typename Derived>
9689 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9690 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
9691 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9692 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9696template <
typename Derived>
9700 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9701 OMPD_for, DirName,
nullptr, D->getBeginLoc());
9702 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9703 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9707template <
typename Derived>
9711 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9712 OMPD_for_simd, DirName,
nullptr, D->getBeginLoc());
9713 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9714 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9718template <
typename Derived>
9722 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9723 OMPD_sections, DirName,
nullptr, D->getBeginLoc());
9724 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9725 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9729template <
typename Derived>
9733 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9734 OMPD_section, DirName,
nullptr, D->getBeginLoc());
9735 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9736 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9740template <
typename Derived>
9744 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9745 OMPD_scope, DirName,
nullptr, D->getBeginLoc());
9746 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9747 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9751template <
typename Derived>
9755 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9756 OMPD_single, DirName,
nullptr, D->getBeginLoc());
9757 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9758 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9762template <
typename Derived>
9766 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9767 OMPD_master, DirName,
nullptr, D->getBeginLoc());
9768 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9769 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9773template <
typename Derived>
9777 OMPD_critical, D->getDirectiveName(),
nullptr, D->getBeginLoc());
9778 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9779 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9783template <
typename Derived>
9785 OMPParallelForDirective *D) {
9787 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9788 OMPD_parallel_for, DirName,
nullptr, D->getBeginLoc());
9789 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9790 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9794template <
typename Derived>
9796 OMPParallelForSimdDirective *D) {
9798 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9799 OMPD_parallel_for_simd, DirName,
nullptr, D->getBeginLoc());
9800 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9801 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9805template <
typename Derived>
9807 OMPParallelMasterDirective *D) {
9809 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9810 OMPD_parallel_master, DirName,
nullptr, D->getBeginLoc());
9811 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9812 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9816template <
typename Derived>
9818 OMPParallelMaskedDirective *D) {
9820 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9821 OMPD_parallel_masked, DirName,
nullptr, D->getBeginLoc());
9822 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9823 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9827template <
typename Derived>
9829 OMPParallelSectionsDirective *D) {
9831 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9832 OMPD_parallel_sections, DirName,
nullptr, D->getBeginLoc());
9833 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9834 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9838template <
typename Derived>
9842 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9843 OMPD_task, DirName,
nullptr, D->getBeginLoc());
9844 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9845 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9849template <
typename Derived>
9851 OMPTaskyieldDirective *D) {
9853 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9854 OMPD_taskyield, DirName,
nullptr, D->getBeginLoc());
9855 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9856 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9860template <
typename Derived>
9864 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9865 OMPD_barrier, DirName,
nullptr, D->getBeginLoc());
9866 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9867 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9871template <
typename Derived>
9875 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9876 OMPD_taskwait, DirName,
nullptr, D->getBeginLoc());
9877 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9878 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9882template <
typename Derived>
9886 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9887 OMPD_assume, DirName,
nullptr, D->getBeginLoc());
9888 StmtResult Res = getDerived().TransformOMPInformationalDirective(D);
9889 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9893template <
typename Derived>
9897 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9898 OMPD_error, DirName,
nullptr, D->getBeginLoc());
9899 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9900 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9904template <
typename Derived>
9906 OMPTaskgroupDirective *D) {
9908 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9909 OMPD_taskgroup, DirName,
nullptr, D->getBeginLoc());
9910 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9911 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9915template <
typename Derived>
9919 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9920 OMPD_flush, DirName,
nullptr, D->getBeginLoc());
9921 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9922 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9926template <
typename Derived>
9930 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9931 OMPD_depobj, DirName,
nullptr, D->getBeginLoc());
9932 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9933 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9937template <
typename Derived>
9941 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9942 OMPD_scan, DirName,
nullptr, D->getBeginLoc());
9943 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9944 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9948template <
typename Derived>
9952 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9953 OMPD_ordered, DirName,
nullptr, D->getBeginLoc());
9954 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9955 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9959template <
typename Derived>
9963 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9964 OMPD_atomic, DirName,
nullptr, D->getBeginLoc());
9965 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9966 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9970template <
typename Derived>
9974 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9975 OMPD_target, DirName,
nullptr, D->getBeginLoc());
9976 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9977 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9981template <
typename Derived>
9983 OMPTargetDataDirective *D) {
9985 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9986 OMPD_target_data, DirName,
nullptr, D->getBeginLoc());
9987 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9988 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9992template <
typename Derived>
9994 OMPTargetEnterDataDirective *D) {
9996 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9997 OMPD_target_enter_data, DirName,
nullptr, D->getBeginLoc());
9998 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9999 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10003template <
typename Derived>
10005 OMPTargetExitDataDirective *D) {
10007 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10008 OMPD_target_exit_data, DirName,
nullptr, D->getBeginLoc());
10009 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10010 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10014template <
typename Derived>
10016 OMPTargetParallelDirective *D) {
10018 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10019 OMPD_target_parallel, DirName,
nullptr, D->getBeginLoc());
10020 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10021 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10025template <
typename Derived>
10027 OMPTargetParallelForDirective *D) {
10029 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10030 OMPD_target_parallel_for, DirName,
nullptr, D->getBeginLoc());
10031 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10032 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10036template <
typename Derived>
10038 OMPTargetUpdateDirective *D) {
10040 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10041 OMPD_target_update, DirName,
nullptr, D->getBeginLoc());
10042 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10043 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10047template <
typename Derived>
10051 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10052 OMPD_teams, DirName,
nullptr, D->getBeginLoc());
10053 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10054 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10058template <
typename Derived>
10060 OMPCancellationPointDirective *D) {
10062 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10063 OMPD_cancellation_point, DirName,
nullptr, D->getBeginLoc());
10064 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10065 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10069template <
typename Derived>
10073 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10074 OMPD_cancel, DirName,
nullptr, D->getBeginLoc());
10075 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10076 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10080template <
typename Derived>
10084 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10085 OMPD_taskloop, DirName,
nullptr, D->getBeginLoc());
10086 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10087 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10091template <
typename Derived>
10093 OMPTaskLoopSimdDirective *D) {
10095 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10096 OMPD_taskloop_simd, DirName,
nullptr, D->getBeginLoc());
10097 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10098 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10102template <
typename Derived>
10104 OMPMasterTaskLoopDirective *D) {
10106 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10107 OMPD_master_taskloop, DirName,
nullptr, D->getBeginLoc());
10108 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10109 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10113template <
typename Derived>
10115 OMPMaskedTaskLoopDirective *D) {
10117 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10118 OMPD_masked_taskloop, DirName,
nullptr, D->getBeginLoc());
10119 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10120 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10124template <
typename Derived>
10126 OMPMasterTaskLoopSimdDirective *D) {
10128 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10129 OMPD_master_taskloop_simd, DirName,
nullptr, D->getBeginLoc());
10130 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10131 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10135template <
typename Derived>
10137 OMPMaskedTaskLoopSimdDirective *D) {
10139 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10140 OMPD_masked_taskloop_simd, DirName,
nullptr, D->getBeginLoc());
10141 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10142 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10146template <
typename Derived>
10148 OMPParallelMasterTaskLoopDirective *D) {
10150 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10151 OMPD_parallel_master_taskloop, DirName,
nullptr, D->getBeginLoc());
10152 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10153 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10157template <
typename Derived>
10159 OMPParallelMaskedTaskLoopDirective *D) {
10161 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10162 OMPD_parallel_masked_taskloop, DirName,
nullptr, D->getBeginLoc());
10163 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10164 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10168template <
typename Derived>
10171 OMPParallelMasterTaskLoopSimdDirective *D) {
10173 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10174 OMPD_parallel_master_taskloop_simd, DirName,
nullptr, D->getBeginLoc());
10175 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10176 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10180template <
typename Derived>
10183 OMPParallelMaskedTaskLoopSimdDirective *D) {
10185 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10186 OMPD_parallel_masked_taskloop_simd, DirName,
nullptr, D->getBeginLoc());
10187 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10188 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10192template <
typename Derived>
10194 OMPDistributeDirective *D) {
10196 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10197 OMPD_distribute, DirName,
nullptr, D->getBeginLoc());
10198 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10199 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10203template <
typename Derived>
10205 OMPDistributeParallelForDirective *D) {
10207 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10208 OMPD_distribute_parallel_for, DirName,
nullptr, D->getBeginLoc());
10209 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10210 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10214template <
typename Derived>
10217 OMPDistributeParallelForSimdDirective *D) {
10219 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10220 OMPD_distribute_parallel_for_simd, DirName,
nullptr, D->getBeginLoc());
10221 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10222 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10226template <
typename Derived>
10228 OMPDistributeSimdDirective *D) {
10230 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10231 OMPD_distribute_simd, DirName,
nullptr, D->getBeginLoc());
10232 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10233 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10237template <
typename Derived>
10239 OMPTargetParallelForSimdDirective *D) {
10241 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10242 OMPD_target_parallel_for_simd, DirName,
nullptr, D->getBeginLoc());
10243 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10244 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10248template <
typename Derived>
10250 OMPTargetSimdDirective *D) {
10252 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10253 OMPD_target_simd, DirName,
nullptr, D->getBeginLoc());
10254 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10255 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10259template <
typename Derived>
10261 OMPTeamsDistributeDirective *D) {
10263 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10264 OMPD_teams_distribute, DirName,
nullptr, D->getBeginLoc());
10265 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10266 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10270template <
typename Derived>
10272 OMPTeamsDistributeSimdDirective *D) {
10274 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10275 OMPD_teams_distribute_simd, DirName,
nullptr, D->getBeginLoc());
10276 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10277 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10281template <
typename Derived>
10283 OMPTeamsDistributeParallelForSimdDirective *D) {
10285 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10286 OMPD_teams_distribute_parallel_for_simd, DirName,
nullptr,
10288 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10289 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10293template <
typename Derived>
10295 OMPTeamsDistributeParallelForDirective *D) {
10297 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10298 OMPD_teams_distribute_parallel_for, DirName,
nullptr, D->getBeginLoc());
10299 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10300 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10304template <
typename Derived>
10306 OMPTargetTeamsDirective *D) {
10308 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10309 OMPD_target_teams, DirName,
nullptr, D->getBeginLoc());
10310 auto Res = getDerived().TransformOMPExecutableDirective(D);
10311 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10315template <
typename Derived>
10317 OMPTargetTeamsDistributeDirective *D) {
10319 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10320 OMPD_target_teams_distribute, DirName,
nullptr, D->getBeginLoc());
10321 auto Res = getDerived().TransformOMPExecutableDirective(D);
10322 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10326template <
typename Derived>
10329 OMPTargetTeamsDistributeParallelForDirective *D) {
10331 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10332 OMPD_target_teams_distribute_parallel_for, DirName,
nullptr,
10334 auto Res = getDerived().TransformOMPExecutableDirective(D);
10335 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10339template <
typename Derived>
10342 OMPTargetTeamsDistributeParallelForSimdDirective *D) {
10344 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10345 OMPD_target_teams_distribute_parallel_for_simd, DirName,
nullptr,
10347 auto Res = getDerived().TransformOMPExecutableDirective(D);
10348 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10352template <
typename Derived>
10355 OMPTargetTeamsDistributeSimdDirective *D) {
10357 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10358 OMPD_target_teams_distribute_simd, DirName,
nullptr, D->getBeginLoc());
10359 auto Res = getDerived().TransformOMPExecutableDirective(D);
10360 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10364template <
typename Derived>
10368 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10369 OMPD_interop, DirName,
nullptr, D->getBeginLoc());
10370 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10371 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10375template <
typename Derived>
10379 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10380 OMPD_dispatch, DirName,
nullptr, D->getBeginLoc());
10381 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10382 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10386template <
typename Derived>
10390 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10391 OMPD_masked, DirName,
nullptr, D->getBeginLoc());
10392 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10393 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10397template <
typename Derived>
10399 OMPGenericLoopDirective *D) {
10401 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10402 OMPD_loop, DirName,
nullptr, D->getBeginLoc());
10403 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10404 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10408template <
typename Derived>
10410 OMPTeamsGenericLoopDirective *D) {
10412 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10413 OMPD_teams_loop, DirName,
nullptr, D->getBeginLoc());
10414 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10415 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10419template <
typename Derived>
10421 OMPTargetTeamsGenericLoopDirective *D) {
10423 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10424 OMPD_target_teams_loop, DirName,
nullptr, D->getBeginLoc());
10425 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10426 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10430template <
typename Derived>
10432 OMPParallelGenericLoopDirective *D) {
10434 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10435 OMPD_parallel_loop, DirName,
nullptr, D->getBeginLoc());
10436 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10437 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10441template <
typename Derived>
10444 OMPTargetParallelGenericLoopDirective *D) {
10446 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10447 OMPD_target_parallel_loop, DirName,
nullptr, D->getBeginLoc());
10448 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10449 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10456template <
typename Derived>
10459 if (
Cond.isInvalid())
10461 return getDerived().RebuildOMPIfClause(
10462 C->getNameModifier(),
Cond.get(),
C->getBeginLoc(),
C->getLParenLoc(),
10463 C->getNameModifierLoc(),
C->getColonLoc(),
C->getEndLoc());
10466template <
typename Derived>
10469 if (
Cond.isInvalid())
10471 return getDerived().RebuildOMPFinalClause(
Cond.get(),
C->getBeginLoc(),
10472 C->getLParenLoc(),
C->getEndLoc());
10475template <
typename Derived>
10478 ExprResult NumThreads = getDerived().TransformExpr(
C->getNumThreads());
10479 if (NumThreads.isInvalid())
10481 return getDerived().RebuildOMPNumThreadsClause(
10482 C->getModifier(), NumThreads.get(),
C->getBeginLoc(),
C->getLParenLoc(),
10483 C->getModifierLoc(),
C->getEndLoc());
10486template <
typename Derived>
10489 ExprResult E = getDerived().TransformExpr(
C->getSafelen());
10492 return getDerived().RebuildOMPSafelenClause(
10493 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10496template <
typename Derived>
10499 ExprResult E = getDerived().TransformExpr(
C->getAllocator());
10502 return getDerived().RebuildOMPAllocatorClause(
10503 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10506template <
typename Derived>
10509 ExprResult E = getDerived().TransformExpr(
C->getSimdlen());
10512 return getDerived().RebuildOMPSimdlenClause(
10513 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10516template <
typename Derived>
10519 TransformedSizes.reserve(
C->getNumSizes());
10521 for (
Expr *E :
C->getSizesRefs()) {
10523 TransformedSizes.push_back(
nullptr);
10532 TransformedSizes.push_back(
T.get());
10535 if (!Changed && !getDerived().AlwaysRebuild())
10537 return RebuildOMPSizesClause(TransformedSizes,
C->getBeginLoc(),
10538 C->getLParenLoc(),
C->getEndLoc());
10541template <
typename Derived>
10545 TransformedArgs.reserve(
C->getNumLoops());
10547 for (
Expr *E :
C->getArgsRefs()) {
10549 TransformedArgs.push_back(
nullptr);
10558 TransformedArgs.push_back(
T.get());
10561 if (!Changed && !getDerived().AlwaysRebuild())
10563 return RebuildOMPPermutationClause(TransformedArgs,
C->getBeginLoc(),
10564 C->getLParenLoc(),
C->getEndLoc());
10567template <
typename Derived>
10569 if (!getDerived().AlwaysRebuild())
10571 return RebuildOMPFullClause(
C->getBeginLoc(),
C->getEndLoc());
10574template <
typename Derived>
10577 ExprResult T = getDerived().TransformExpr(
C->getFactor());
10580 Expr *Factor =
T.get();
10581 bool Changed = Factor !=
C->getFactor();
10583 if (!Changed && !getDerived().AlwaysRebuild())
10585 return RebuildOMPPartialClause(Factor,
C->getBeginLoc(),
C->getLParenLoc(),
10589template <
typename Derived>
10592 ExprResult F = getDerived().TransformExpr(
C->getFirst());
10596 ExprResult Cn = getDerived().TransformExpr(
C->getCount());
10597 if (Cn.isInvalid())
10601 Expr *Count = Cn.get();
10603 bool Changed = (
First !=
C->getFirst()) || (Count !=
C->getCount());
10606 if (!Changed && !getDerived().AlwaysRebuild())
10609 return RebuildOMPLoopRangeClause(
First, Count,
C->getBeginLoc(),
10610 C->getLParenLoc(),
C->getFirstLoc(),
10611 C->getCountLoc(),
C->getEndLoc());
10614template <
typename Derived>
10617 ExprResult E = getDerived().TransformExpr(
C->getNumForLoops());
10620 return getDerived().RebuildOMPCollapseClause(
10621 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10624template <
typename Derived>
10628 C->getDefaultKind(),
C->getDefaultKindKwLoc(),
C->getDefaultVC(),
10629 C->getDefaultVCLoc(),
C->getBeginLoc(),
C->getLParenLoc(),
10633template <
typename Derived>
10640template <
typename Derived>
10644 C->getProcBindKind(),
C->getProcBindKindKwLoc(),
C->getBeginLoc(),
10645 C->getLParenLoc(),
C->getEndLoc());
10648template <
typename Derived>
10651 ExprResult E = getDerived().TransformExpr(
C->getChunkSize());
10654 return getDerived().RebuildOMPScheduleClause(
10655 C->getFirstScheduleModifier(),
C->getSecondScheduleModifier(),
10656 C->getScheduleKind(), E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
10657 C->getFirstScheduleModifierLoc(),
C->getSecondScheduleModifierLoc(),
10658 C->getScheduleKindLoc(),
C->getCommaLoc(),
C->getEndLoc());
10661template <
typename Derived>
10665 if (
auto *
Num =
C->getNumForLoops()) {
10666 E = getDerived().TransformExpr(
Num);
10670 return getDerived().RebuildOMPOrderedClause(
C->getBeginLoc(),
C->getEndLoc(),
10671 C->getLParenLoc(), E.get());
10674template <
typename Derived>
10678 if (
Expr *Evt =
C->getEventHandler()) {
10679 E = getDerived().TransformExpr(Evt);
10683 return getDerived().RebuildOMPDetachClause(E.get(),
C->getBeginLoc(),
10684 C->getLParenLoc(),
C->getEndLoc());
10687template <
typename Derived>
10693 if (
Cond.isInvalid())
10696 return getDerived().RebuildOMPNowaitClause(
Cond.get(),
C->getBeginLoc(),
10697 C->getLParenLoc(),
C->getEndLoc());
10700template <
typename Derived>
10707template <
typename Derived>
10714template <
typename Derived>
10720template <
typename Derived>
10726template <
typename Derived>
10733template <
typename Derived>
10740template <
typename Derived>
10747template <
typename Derived>
10753template <
typename Derived>
10759template <
typename Derived>
10761 ExprResult E = getDerived().TransformExpr(
C->getExpr());
10764 return getDerived().RebuildOMPHoldsClause(E.get(),
C->getBeginLoc(),
10765 C->getLParenLoc(),
C->getEndLoc());
10768template <
typename Derived>
10774template <
typename Derived>
10779template <
typename Derived>
10784template <
typename Derived>
10789template <
typename Derived>
10795template <
typename Derived>
10802template <
typename Derived>
10809template <
typename Derived>
10816template <
typename Derived>
10823template <
typename Derived>
10830template <
typename Derived>
10836template <
typename Derived>
10843template <
typename Derived>
10849template <
typename Derived>
10856template <
typename Derived>
10858 ExprResult IVR = getDerived().TransformExpr(
C->getInteropVar());
10859 if (IVR.isInvalid())
10863 InteropInfo.PreferTypes.reserve(
C->varlist_size() - 1);
10864 for (
Expr *E : llvm::drop_begin(
C->varlist())) {
10866 if (ER.isInvalid())
10868 InteropInfo.PreferTypes.push_back(ER.get());
10870 return getDerived().RebuildOMPInitClause(IVR.get(), InteropInfo,
10871 C->getBeginLoc(),
C->getLParenLoc(),
10872 C->getVarLoc(),
C->getEndLoc());
10875template <
typename Derived>
10877 ExprResult ER = getDerived().TransformExpr(
C->getInteropVar());
10878 if (ER.isInvalid())
10880 return getDerived().RebuildOMPUseClause(ER.get(),
C->getBeginLoc(),
10881 C->getLParenLoc(),
C->getVarLoc(),
10885template <
typename Derived>
10889 if (
Expr *IV =
C->getInteropVar()) {
10890 ER = getDerived().TransformExpr(IV);
10891 if (ER.isInvalid())
10894 return getDerived().RebuildOMPDestroyClause(ER.get(),
C->getBeginLoc(),
10895 C->getLParenLoc(),
C->getVarLoc(),
10899template <
typename Derived>
10903 if (
Cond.isInvalid())
10905 return getDerived().RebuildOMPNovariantsClause(
10906 Cond.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10909template <
typename Derived>
10913 if (
Cond.isInvalid())
10915 return getDerived().RebuildOMPNocontextClause(
10916 Cond.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10919template <
typename Derived>
10922 ExprResult ThreadID = getDerived().TransformExpr(
C->getThreadID());
10923 if (ThreadID.isInvalid())
10925 return getDerived().RebuildOMPFilterClause(ThreadID.get(),
C->getBeginLoc(),
10926 C->getLParenLoc(),
C->getEndLoc());
10929template <
typename Derived>
10931 ExprResult E = getDerived().TransformExpr(
C->getAlignment());
10934 return getDerived().RebuildOMPAlignClause(E.get(),
C->getBeginLoc(),
10935 C->getLParenLoc(),
C->getEndLoc());
10938template <
typename Derived>
10941 llvm_unreachable(
"unified_address clause cannot appear in dependent context");
10944template <
typename Derived>
10948 "unified_shared_memory clause cannot appear in dependent context");
10951template <
typename Derived>
10954 llvm_unreachable(
"reverse_offload clause cannot appear in dependent context");
10957template <
typename Derived>
10961 "dynamic_allocators clause cannot appear in dependent context");
10964template <
typename Derived>
10968 "atomic_default_mem_order clause cannot appear in dependent context");
10971template <
typename Derived>
10974 llvm_unreachable(
"self_maps clause cannot appear in dependent context");
10977template <
typename Derived>
10980 C->getBeginLoc(),
C->getLParenLoc(),
10984template <
typename Derived>
10988 C->getSeverityKind(),
C->getSeverityKindKwLoc(),
C->getBeginLoc(),
10989 C->getLParenLoc(),
C->getEndLoc());
10992template <
typename Derived>
10995 ExprResult E = getDerived().TransformExpr(
C->getMessageString());
10998 return getDerived().RebuildOMPMessageClause(
10999 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11002template <
typename Derived>
11006 Vars.reserve(
C->varlist_size());
11007 for (
auto *
VE :
C->varlist()) {
11009 if (EVar.isInvalid())
11011 Vars.push_back(EVar.get());
11013 return getDerived().RebuildOMPPrivateClause(
11014 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11017template <
typename Derived>
11021 Vars.reserve(
C->varlist_size());
11022 for (
auto *
VE :
C->varlist()) {
11024 if (EVar.isInvalid())
11026 Vars.push_back(EVar.get());
11028 return getDerived().RebuildOMPFirstprivateClause(
11029 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11032template <
typename Derived>
11036 Vars.reserve(
C->varlist_size());
11037 for (
auto *
VE :
C->varlist()) {
11039 if (EVar.isInvalid())
11041 Vars.push_back(EVar.get());
11043 return getDerived().RebuildOMPLastprivateClause(
11044 Vars,
C->getKind(),
C->getKindLoc(),
C->getColonLoc(),
C->getBeginLoc(),
11045 C->getLParenLoc(),
C->getEndLoc());
11048template <
typename Derived>
11052 Vars.reserve(
C->varlist_size());
11053 for (
auto *
VE :
C->varlist()) {
11055 if (EVar.isInvalid())
11057 Vars.push_back(EVar.get());
11059 return getDerived().RebuildOMPSharedClause(Vars,
C->getBeginLoc(),
11060 C->getLParenLoc(),
C->getEndLoc());
11063template <
typename Derived>
11067 Vars.reserve(
C->varlist_size());
11068 for (
auto *
VE :
C->varlist()) {
11070 if (EVar.isInvalid())
11072 Vars.push_back(EVar.get());
11075 ReductionIdScopeSpec.
Adopt(
C->getQualifierLoc());
11078 if (NameInfo.getName()) {
11079 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
11080 if (!NameInfo.getName())
11086 for (
auto *E :
C->reduction_ops()) {
11091 for (
auto *D : ULE->decls()) {
11094 Decls.addDecl(InstD, InstD->getAccess());
11098 ReductionIdScopeSpec.getWithLocInContext(SemaRef.
Context), NameInfo,
11099 true, Decls.begin(), Decls.end(),
11102 UnresolvedReductions.push_back(
nullptr);
11104 return getDerived().RebuildOMPReductionClause(
11105 Vars,
C->getModifier(),
C->getOriginalSharingModifier(),
C->getBeginLoc(),
11106 C->getLParenLoc(),
C->getModifierLoc(),
C->getColonLoc(),
C->getEndLoc(),
11107 ReductionIdScopeSpec, NameInfo, UnresolvedReductions);
11110template <
typename Derived>
11114 Vars.reserve(
C->varlist_size());
11115 for (
auto *
VE :
C->varlist()) {
11117 if (EVar.isInvalid())
11119 Vars.push_back(EVar.get());
11122 ReductionIdScopeSpec.
Adopt(
C->getQualifierLoc());
11125 if (NameInfo.getName()) {
11126 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
11127 if (!NameInfo.getName())
11133 for (
auto *E :
C->reduction_ops()) {
11138 for (
auto *D : ULE->decls()) {
11141 Decls.addDecl(InstD, InstD->getAccess());
11145 ReductionIdScopeSpec.getWithLocInContext(SemaRef.
Context), NameInfo,
11146 true, Decls.begin(), Decls.end(),
11149 UnresolvedReductions.push_back(
nullptr);
11151 return getDerived().RebuildOMPTaskReductionClause(
11152 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getColonLoc(),
11153 C->getEndLoc(), ReductionIdScopeSpec, NameInfo, UnresolvedReductions);
11156template <
typename Derived>
11160 Vars.reserve(
C->varlist_size());
11161 for (
auto *
VE :
C->varlist()) {
11163 if (EVar.isInvalid())
11165 Vars.push_back(EVar.get());
11168 ReductionIdScopeSpec.
Adopt(
C->getQualifierLoc());
11171 if (NameInfo.getName()) {
11172 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
11173 if (!NameInfo.getName())
11179 for (
auto *E :
C->reduction_ops()) {
11184 for (
auto *D : ULE->decls()) {
11187 Decls.addDecl(InstD, InstD->getAccess());
11191 ReductionIdScopeSpec.getWithLocInContext(SemaRef.
Context), NameInfo,
11192 true, Decls.begin(), Decls.end(),
11195 UnresolvedReductions.push_back(
nullptr);
11197 return getDerived().RebuildOMPInReductionClause(
11198 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getColonLoc(),
11199 C->getEndLoc(), ReductionIdScopeSpec, NameInfo, UnresolvedReductions);
11202template <
typename Derived>
11206 Vars.reserve(
C->varlist_size());
11207 for (
auto *
VE :
C->varlist()) {
11209 if (EVar.isInvalid())
11211 Vars.push_back(EVar.get());
11213 ExprResult Step = getDerived().TransformExpr(
C->getStep());
11214 if (Step.isInvalid())
11216 return getDerived().RebuildOMPLinearClause(
11217 Vars, Step.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getModifier(),
11218 C->getModifierLoc(),
C->getColonLoc(),
C->getStepModifierLoc(),
11222template <
typename Derived>
11226 Vars.reserve(
C->varlist_size());
11227 for (
auto *
VE :
C->varlist()) {
11229 if (EVar.isInvalid())
11231 Vars.push_back(EVar.get());
11233 ExprResult Alignment = getDerived().TransformExpr(
C->getAlignment());
11234 if (Alignment.isInvalid())
11236 return getDerived().RebuildOMPAlignedClause(
11237 Vars, Alignment.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11238 C->getColonLoc(),
C->getEndLoc());
11241template <
typename Derived>
11245 Vars.reserve(
C->varlist_size());
11246 for (
auto *
VE :
C->varlist()) {
11248 if (EVar.isInvalid())
11250 Vars.push_back(EVar.get());
11252 return getDerived().RebuildOMPCopyinClause(Vars,
C->getBeginLoc(),
11253 C->getLParenLoc(),
C->getEndLoc());
11256template <
typename Derived>
11260 Vars.reserve(
C->varlist_size());
11261 for (
auto *
VE :
C->varlist()) {
11263 if (EVar.isInvalid())
11265 Vars.push_back(EVar.get());
11267 return getDerived().RebuildOMPCopyprivateClause(
11268 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11271template <
typename Derived>
11274 Vars.reserve(
C->varlist_size());
11275 for (
auto *
VE :
C->varlist()) {
11277 if (EVar.isInvalid())
11279 Vars.push_back(EVar.get());
11281 return getDerived().RebuildOMPFlushClause(Vars,
C->getBeginLoc(),
11282 C->getLParenLoc(),
C->getEndLoc());
11285template <
typename Derived>
11288 ExprResult E = getDerived().TransformExpr(
C->getDepobj());
11291 return getDerived().RebuildOMPDepobjClause(E.get(),
C->getBeginLoc(),
11292 C->getLParenLoc(),
C->getEndLoc());
11295template <
typename Derived>
11299 Expr *DepModifier =
C->getModifier();
11301 ExprResult DepModRes = getDerived().TransformExpr(DepModifier);
11302 if (DepModRes.isInvalid())
11304 DepModifier = DepModRes.get();
11306 Vars.reserve(
C->varlist_size());
11307 for (
auto *
VE :
C->varlist()) {
11309 if (EVar.isInvalid())
11311 Vars.push_back(EVar.get());
11313 return getDerived().RebuildOMPDependClause(
11314 {
C->getDependencyKind(),
C->getDependencyLoc(),
C->getColonLoc(),
11315 C->getOmpAllMemoryLoc()},
11316 DepModifier, Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11319template <
typename Derived>
11322 ExprResult E = getDerived().TransformExpr(
C->getDevice());
11325 return getDerived().RebuildOMPDeviceClause(
11326 C->getModifier(), E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11327 C->getModifierLoc(),
C->getEndLoc());
11330template <
typename Derived,
class T>
11337 Vars.reserve(
C->varlist_size());
11338 for (
auto *
VE :
C->varlist()) {
11342 Vars.push_back(EVar.
get());
11346 if (
C->getMapperQualifierLoc()) {
11347 QualifierLoc = TT.
getDerived().TransformNestedNameSpecifierLoc(
11348 C->getMapperQualifierLoc());
11352 MapperIdScopeSpec.
Adopt(QualifierLoc);
11353 MapperIdInfo =
C->getMapperIdInfo();
11354 if (MapperIdInfo.
getName()) {
11355 MapperIdInfo = TT.
getDerived().TransformDeclarationNameInfo(MapperIdInfo);
11361 for (
auto *E :
C->mapperlists()) {
11366 for (
auto *D : ULE->decls()) {
11369 Decls.addDecl(InstD, InstD->
getAccess());
11374 MapperIdInfo,
true, Decls.begin(), Decls.end(),
11377 UnresolvedMappers.push_back(
nullptr);
11383template <
typename Derived>
11384OMPClause *TreeTransform<Derived>::TransformOMPMapClause(OMPMapClause *
C) {
11385 OMPVarListLocTy Locs(
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11387 Expr *IteratorModifier =
C->getIteratorModifier();
11388 if (IteratorModifier) {
11389 ExprResult MapModRes = getDerived().TransformExpr(IteratorModifier);
11390 if (MapModRes.isInvalid())
11392 IteratorModifier = MapModRes.
get();
11398 *
this,
C, Vars, MapperIdScopeSpec, MapperIdInfo, UnresolvedMappers))
11400 return getDerived().RebuildOMPMapClause(
11401 IteratorModifier,
C->getMapTypeModifiers(),
C->getMapTypeModifiersLoc(),
11402 MapperIdScopeSpec, MapperIdInfo,
C->getMapType(),
C->isImplicitMapType(),
11403 C->getMapLoc(),
C->getColonLoc(), Vars, Locs, UnresolvedMappers);
11406template <
typename Derived>
11409 Expr *Allocator =
C->getAllocator();
11411 ExprResult AllocatorRes = getDerived().TransformExpr(Allocator);
11412 if (AllocatorRes.isInvalid())
11414 Allocator = AllocatorRes.get();
11416 Expr *Alignment =
C->getAlignment();
11418 ExprResult AlignmentRes = getDerived().TransformExpr(Alignment);
11419 if (AlignmentRes.isInvalid())
11421 Alignment = AlignmentRes.get();
11424 Vars.reserve(
C->varlist_size());
11425 for (
auto *
VE :
C->varlist()) {
11427 if (EVar.isInvalid())
11429 Vars.push_back(EVar.get());
11431 return getDerived().RebuildOMPAllocateClause(
11432 Allocator, Alignment,
C->getFirstAllocateModifier(),
11433 C->getFirstAllocateModifierLoc(),
C->getSecondAllocateModifier(),
11434 C->getSecondAllocateModifierLoc(), Vars,
C->getBeginLoc(),
11435 C->getLParenLoc(),
C->getColonLoc(),
C->getEndLoc());
11438template <
typename Derived>
11442 Vars.reserve(
C->varlist_size());
11443 for (
auto *
VE :
C->varlist()) {
11445 if (EVar.isInvalid())
11447 Vars.push_back(EVar.get());
11449 return getDerived().RebuildOMPNumTeamsClause(
11450 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11453template <
typename Derived>
11457 Vars.reserve(
C->varlist_size());
11458 for (
auto *
VE :
C->varlist()) {
11460 if (EVar.isInvalid())
11462 Vars.push_back(EVar.get());
11464 return getDerived().RebuildOMPThreadLimitClause(
11465 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11468template <
typename Derived>
11471 ExprResult E = getDerived().TransformExpr(
C->getPriority());
11474 return getDerived().RebuildOMPPriorityClause(
11475 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11478template <
typename Derived>
11481 ExprResult E = getDerived().TransformExpr(
C->getGrainsize());
11484 return getDerived().RebuildOMPGrainsizeClause(
11485 C->getModifier(), E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11486 C->getModifierLoc(),
C->getEndLoc());
11489template <
typename Derived>
11492 ExprResult E = getDerived().TransformExpr(
C->getNumTasks());
11495 return getDerived().RebuildOMPNumTasksClause(
11496 C->getModifier(), E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11497 C->getModifierLoc(),
C->getEndLoc());
11500template <
typename Derived>
11502 ExprResult E = getDerived().TransformExpr(
C->getHint());
11505 return getDerived().RebuildOMPHintClause(E.get(),
C->getBeginLoc(),
11506 C->getLParenLoc(),
C->getEndLoc());
11509template <
typename Derived>
11512 ExprResult E = getDerived().TransformExpr(
C->getChunkSize());
11515 return getDerived().RebuildOMPDistScheduleClause(
11516 C->getDistScheduleKind(), E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11517 C->getDistScheduleKindLoc(),
C->getCommaLoc(),
C->getEndLoc());
11520template <
typename Derived>
11526 C->getDefaultmapKind(),
11529 C->getDefaultmapModifierLoc(),
11530 C->getDefaultmapKindLoc(),
11534template <
typename Derived>
11542 *
this,
C, Vars, MapperIdScopeSpec, MapperIdInfo, UnresolvedMappers))
11544 return getDerived().RebuildOMPToClause(
11545 C->getMotionModifiers(),
C->getMotionModifiersLoc(), MapperIdScopeSpec,
11546 MapperIdInfo,
C->getColonLoc(), Vars, Locs, UnresolvedMappers);
11549template <
typename Derived>
11557 *
this,
C, Vars, MapperIdScopeSpec, MapperIdInfo, UnresolvedMappers))
11559 return getDerived().RebuildOMPFromClause(
11560 C->getMotionModifiers(),
C->getMotionModifiersLoc(), MapperIdScopeSpec,
11561 MapperIdInfo,
C->getColonLoc(), Vars, Locs, UnresolvedMappers);
11564template <
typename Derived>
11568 Vars.reserve(
C->varlist_size());
11569 for (
auto *
VE :
C->varlist()) {
11571 if (EVar.isInvalid())
11573 Vars.push_back(EVar.get());
11576 return getDerived().RebuildOMPUseDevicePtrClause(Vars, Locs);
11579template <
typename Derived>
11583 Vars.reserve(
C->varlist_size());
11584 for (
auto *
VE :
C->varlist()) {
11586 if (EVar.isInvalid())
11588 Vars.push_back(EVar.get());
11591 return getDerived().RebuildOMPUseDeviceAddrClause(Vars, Locs);
11594template <
typename Derived>
11598 Vars.reserve(
C->varlist_size());
11599 for (
auto *
VE :
C->varlist()) {
11601 if (EVar.isInvalid())
11603 Vars.push_back(EVar.get());
11606 return getDerived().RebuildOMPIsDevicePtrClause(Vars, Locs);
11609template <
typename Derived>
11613 Vars.reserve(
C->varlist_size());
11614 for (
auto *
VE :
C->varlist()) {
11616 if (EVar.isInvalid())
11618 Vars.push_back(EVar.get());
11621 return getDerived().RebuildOMPHasDeviceAddrClause(Vars, Locs);
11624template <
typename Derived>
11628 Vars.reserve(
C->varlist_size());
11629 for (
auto *
VE :
C->varlist()) {
11631 if (EVar.isInvalid())
11633 Vars.push_back(EVar.get());
11635 return getDerived().RebuildOMPNontemporalClause(
11636 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11639template <
typename Derived>
11643 Vars.reserve(
C->varlist_size());
11644 for (
auto *
VE :
C->varlist()) {
11646 if (EVar.isInvalid())
11648 Vars.push_back(EVar.get());
11650 return getDerived().RebuildOMPInclusiveClause(
11651 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11654template <
typename Derived>
11658 Vars.reserve(
C->varlist_size());
11659 for (
auto *
VE :
C->varlist()) {
11661 if (EVar.isInvalid())
11663 Vars.push_back(EVar.get());
11665 return getDerived().RebuildOMPExclusiveClause(
11666 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11669template <
typename Derived>
11673 Data.reserve(
C->getNumberOfAllocators());
11674 for (
unsigned I = 0, E =
C->getNumberOfAllocators(); I < E; ++I) {
11676 ExprResult Allocator = getDerived().TransformExpr(D.Allocator);
11677 if (Allocator.isInvalid())
11680 if (
Expr *AT = D.AllocatorTraits) {
11681 AllocatorTraits = getDerived().TransformExpr(AT);
11682 if (AllocatorTraits.isInvalid())
11686 NewD.Allocator = Allocator.get();
11687 NewD.AllocatorTraits = AllocatorTraits.get();
11688 NewD.LParenLoc = D.LParenLoc;
11689 NewD.RParenLoc = D.RParenLoc;
11691 return getDerived().RebuildOMPUsesAllocatorsClause(
11692 Data,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11695template <
typename Derived>
11699 Locators.reserve(
C->varlist_size());
11701 if (
Expr *Modifier =
C->getModifier()) {
11702 ModifierRes = getDerived().TransformExpr(Modifier);
11703 if (ModifierRes.isInvalid())
11706 for (
Expr *E :
C->varlist()) {
11707 ExprResult Locator = getDerived().TransformExpr(E);
11708 if (Locator.isInvalid())
11710 Locators.push_back(Locator.get());
11712 return getDerived().RebuildOMPAffinityClause(
11713 C->getBeginLoc(),
C->getLParenLoc(),
C->getColonLoc(),
C->getEndLoc(),
11714 ModifierRes.get(), Locators);
11717template <
typename Derived>
11720 C->getKind(),
C->getKindKwLoc(),
C->getBeginLoc(),
C->getLParenLoc(),
11721 C->getEndLoc(),
C->getModifier(),
C->getModifierKwLoc());
11724template <
typename Derived>
11727 C->getBindKind(),
C->getBindKindLoc(),
C->getBeginLoc(),
11728 C->getLParenLoc(),
C->getEndLoc());
11731template <
typename Derived>
11735 if (
Size.isInvalid())
11737 return getDerived().RebuildOMPXDynCGroupMemClause(
11738 Size.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11741template <
typename Derived>
11745 if (
Size.isInvalid())
11747 return getDerived().RebuildOMPDynGroupprivateClause(
11748 C->getDynGroupprivateModifier(),
C->getDynGroupprivateFallbackModifier(),
11749 Size.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11750 C->getDynGroupprivateModifierLoc(),
11751 C->getDynGroupprivateFallbackModifierLoc(),
C->getEndLoc());
11754template <
typename Derived>
11758 Vars.reserve(
C->varlist_size());
11759 for (
auto *
VE :
C->varlist()) {
11761 if (EVar.isInvalid())
11763 Vars.push_back(EVar.get());
11765 return getDerived().RebuildOMPDoacrossClause(
11766 C->getDependenceType(),
C->getDependenceLoc(),
C->getColonLoc(), Vars,
11767 C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11770template <
typename Derived>
11774 for (
auto *A :
C->getAttrs())
11775 NewAttrs.push_back(getDerived().TransformAttr(A));
11776 return getDerived().RebuildOMPXAttributeClause(
11777 NewAttrs,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11780template <
typename Derived>
11789template <
typename Derived>
11790class OpenACCClauseTransform final
11792 TreeTransform<Derived> &Self;
11793 ArrayRef<const OpenACCClause *> ExistingClauses;
11794 SemaOpenACC::OpenACCParsedClause &ParsedClause;
11795 OpenACCClause *NewClause =
nullptr;
11798 ExprResult Res = Self.TransformExpr(VarRef);
11800 if (!Res.isUsable())
11803 Res = Self.getSema().OpenACC().ActOnVar(ParsedClause.getDirectiveKind(),
11804 ParsedClause.getClauseKind(),
11810 llvm::SmallVector<Expr *> VisitVarList(ArrayRef<Expr *> VarList) {
11811 llvm::SmallVector<Expr *> InstantiatedVarList;
11812 for (Expr *CurVar : VarList) {
11815 if (VarRef.isUsable())
11816 InstantiatedVarList.push_back(VarRef.get());
11819 return InstantiatedVarList;
11823 OpenACCClauseTransform(TreeTransform<Derived> &Self,
11824 ArrayRef<const OpenACCClause *> ExistingClauses,
11825 SemaOpenACC::OpenACCParsedClause &PC)
11826 : Self(Self), ExistingClauses(ExistingClauses), ParsedClause(PC) {}
11828 OpenACCClause *CreatedClause()
const {
return NewClause; }
11830#define VISIT_CLAUSE(CLAUSE_NAME) \
11831 void Visit##CLAUSE_NAME##Clause(const OpenACC##CLAUSE_NAME##Clause &Clause);
11832#include "clang/Basic/OpenACCClauses.def"
11835template <
typename Derived>
11836void OpenACCClauseTransform<Derived>::VisitDefaultClause(
11838 ParsedClause.setDefaultDetails(
C.getDefaultClauseKind());
11841 Self.getSema().getASTContext(), ParsedClause.getDefaultClauseKind(),
11842 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
11843 ParsedClause.getEndLoc());
11846template <
typename Derived>
11847void OpenACCClauseTransform<Derived>::VisitIfClause(
const OpenACCIfClause &
C) {
11849 assert(
Cond &&
"If constructed with invalid Condition");
11853 if (Res.isInvalid() || !Res.get().second)
11856 ParsedClause.setConditionDetails(Res.get().second);
11859 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
11860 ParsedClause.getLParenLoc(), ParsedClause.getConditionExpr(),
11861 ParsedClause.getEndLoc());
11864template <
typename Derived>
11865void OpenACCClauseTransform<Derived>::VisitSelfClause(
11871 for (
Expr *CurVar :
C.getVarList()) {
11874 if (!Res.isUsable())
11877 Res =
Self.getSema().OpenACC().ActOnVar(ParsedClause.getDirectiveKind(),
11878 ParsedClause.getClauseKind(),
11881 if (Res.isUsable())
11882 InstantiatedVarList.push_back(Res.get());
11885 ParsedClause.setVarListDetails(InstantiatedVarList,
11889 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
11890 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
11891 ParsedClause.getEndLoc());
11894 if (
C.hasConditionExpr()) {
11897 Self.TransformCondition(
Cond->getExprLoc(),
nullptr,
Cond,
11900 if (Res.isInvalid() || !Res.get().second)
11903 ParsedClause.setConditionDetails(Res.get().second);
11907 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
11908 ParsedClause.getLParenLoc(), ParsedClause.getConditionExpr(),
11909 ParsedClause.getEndLoc());
11913template <
typename Derived>
11914void OpenACCClauseTransform<Derived>::VisitNumGangsClause(
11918 for (
Expr *CurIntExpr :
C.getIntExprs()) {
11921 if (!Res.isUsable())
11926 C.getBeginLoc(), Res.get());
11927 if (!Res.isUsable())
11930 InstantiatedIntExprs.push_back(Res.get());
11933 ParsedClause.setIntExprDetails(InstantiatedIntExprs);
11935 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
11936 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs(),
11937 ParsedClause.getEndLoc());
11940template <
typename Derived>
11941void OpenACCClauseTransform<Derived>::VisitPrivateClause(
11946 for (
const auto [RefExpr, InitRecipe] :
11947 llvm::zip(
C.getVarList(),
C.getInitRecipes())) {
11950 if (VarRef.isUsable()) {
11951 InstantiatedVarList.push_back(VarRef.get());
11955 if (InitRecipe.isSet())
11956 InitRecipes.push_back(InitRecipe);
11958 InitRecipes.push_back(
11959 Self.getSema().OpenACC().CreatePrivateInitRecipe(VarRef.get()));
11962 ParsedClause.setVarListDetails(InstantiatedVarList,
11966 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
11967 ParsedClause.getLParenLoc(), ParsedClause.getVarList(), InitRecipes,
11968 ParsedClause.getEndLoc());
11971template <
typename Derived>
11972void OpenACCClauseTransform<Derived>::VisitHostClause(
11974 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
11978 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
11979 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
11980 ParsedClause.getEndLoc());
11983template <
typename Derived>
11984void OpenACCClauseTransform<Derived>::VisitDeviceClause(
11986 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
11990 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
11991 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
11992 ParsedClause.getEndLoc());
11995template <
typename Derived>
11996void OpenACCClauseTransform<Derived>::VisitFirstPrivateClause(
12001 for (
const auto [RefExpr, InitRecipe] :
12002 llvm::zip(
C.getVarList(),
C.getInitRecipes())) {
12005 if (VarRef.isUsable()) {
12006 InstantiatedVarList.push_back(VarRef.get());
12010 if (InitRecipe.isSet())
12011 InitRecipes.push_back(InitRecipe);
12013 InitRecipes.push_back(
12014 Self.getSema().OpenACC().CreateFirstPrivateInitRecipe(
12018 ParsedClause.setVarListDetails(InstantiatedVarList,
12022 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12023 ParsedClause.getLParenLoc(), ParsedClause.getVarList(), InitRecipes,
12024 ParsedClause.getEndLoc());
12027template <
typename Derived>
12028void OpenACCClauseTransform<Derived>::VisitNoCreateClause(
12030 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12034 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12035 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12036 ParsedClause.getEndLoc());
12039template <
typename Derived>
12040void OpenACCClauseTransform<Derived>::VisitPresentClause(
12042 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12046 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12047 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12048 ParsedClause.getEndLoc());
12051template <
typename Derived>
12052void OpenACCClauseTransform<Derived>::VisitCopyClause(
12054 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12055 C.getModifierList());
12058 Self.getSema().getASTContext(), ParsedClause.getClauseKind(),
12059 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12060 ParsedClause.getModifierList(), ParsedClause.getVarList(),
12061 ParsedClause.getEndLoc());
12064template <
typename Derived>
12065void OpenACCClauseTransform<Derived>::VisitLinkClause(
12067 llvm_unreachable(
"link clause not valid unless a decl transform");
12070template <
typename Derived>
12071void OpenACCClauseTransform<Derived>::VisitDeviceResidentClause(
12073 llvm_unreachable(
"device_resident clause not valid unless a decl transform");
12075template <
typename Derived>
12076void OpenACCClauseTransform<Derived>::VisitNoHostClause(
12078 llvm_unreachable(
"nohost clause not valid unless a decl transform");
12080template <
typename Derived>
12081void OpenACCClauseTransform<Derived>::VisitBindClause(
12083 llvm_unreachable(
"bind clause not valid unless a decl transform");
12086template <
typename Derived>
12087void OpenACCClauseTransform<Derived>::VisitCopyInClause(
12089 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12090 C.getModifierList());
12093 Self.getSema().getASTContext(), ParsedClause.getClauseKind(),
12094 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12095 ParsedClause.getModifierList(), ParsedClause.getVarList(),
12096 ParsedClause.getEndLoc());
12099template <
typename Derived>
12100void OpenACCClauseTransform<Derived>::VisitCopyOutClause(
12102 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12103 C.getModifierList());
12106 Self.getSema().getASTContext(), ParsedClause.getClauseKind(),
12107 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12108 ParsedClause.getModifierList(), ParsedClause.getVarList(),
12109 ParsedClause.getEndLoc());
12112template <
typename Derived>
12113void OpenACCClauseTransform<Derived>::VisitCreateClause(
12115 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12116 C.getModifierList());
12119 Self.getSema().getASTContext(), ParsedClause.getClauseKind(),
12120 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12121 ParsedClause.getModifierList(), ParsedClause.getVarList(),
12122 ParsedClause.getEndLoc());
12124template <
typename Derived>
12125void OpenACCClauseTransform<Derived>::VisitAttachClause(
12130 llvm::erase_if(VarList, [&](
Expr *E) {
12131 return Self.getSema().OpenACC().CheckVarIsPointerType(
12137 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12138 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12139 ParsedClause.getEndLoc());
12142template <
typename Derived>
12143void OpenACCClauseTransform<Derived>::VisitDetachClause(
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>::VisitDeleteClause(
12163 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12166 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12167 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12168 ParsedClause.getEndLoc());
12171template <
typename Derived>
12172void OpenACCClauseTransform<Derived>::VisitUseDeviceClause(
12174 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12177 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12178 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12179 ParsedClause.getEndLoc());
12182template <
typename Derived>
12183void OpenACCClauseTransform<Derived>::VisitDevicePtrClause(
12188 llvm::erase_if(VarList, [&](
Expr *E) {
12189 return Self.getSema().OpenACC().CheckVarIsPointerType(
12195 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12196 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12197 ParsedClause.getEndLoc());
12200template <
typename Derived>
12201void OpenACCClauseTransform<Derived>::VisitNumWorkersClause(
12203 Expr *IntExpr =
const_cast<Expr *
>(
C.getIntExpr());
12204 assert(IntExpr &&
"num_workers clause constructed with invalid int expr");
12207 if (!Res.isUsable())
12212 C.getBeginLoc(), Res.get());
12213 if (!Res.isUsable())
12216 ParsedClause.setIntExprDetails(Res.get());
12218 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12219 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs()[0],
12220 ParsedClause.getEndLoc());
12223template <
typename Derived>
12224void OpenACCClauseTransform<Derived>::VisitDeviceNumClause (
12226 Expr *IntExpr =
const_cast<Expr *
>(
C.getIntExpr());
12227 assert(IntExpr &&
"device_num clause constructed with invalid int expr");
12230 if (!Res.isUsable())
12235 C.getBeginLoc(), Res.get());
12236 if (!Res.isUsable())
12239 ParsedClause.setIntExprDetails(Res.get());
12241 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12242 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs()[0],
12243 ParsedClause.getEndLoc());
12246template <
typename Derived>
12247void OpenACCClauseTransform<Derived>::VisitDefaultAsyncClause(
12249 Expr *IntExpr =
const_cast<Expr *
>(
C.getIntExpr());
12250 assert(IntExpr &&
"default_async clause constructed with invalid int expr");
12253 if (!Res.isUsable())
12258 C.getBeginLoc(), Res.get());
12259 if (!Res.isUsable())
12262 ParsedClause.setIntExprDetails(Res.get());
12264 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12265 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs()[0],
12266 ParsedClause.getEndLoc());
12269template <
typename Derived>
12270void OpenACCClauseTransform<Derived>::VisitVectorLengthClause(
12272 Expr *IntExpr =
const_cast<Expr *
>(
C.getIntExpr());
12273 assert(IntExpr &&
"vector_length clause constructed with invalid int expr");
12276 if (!Res.isUsable())
12281 C.getBeginLoc(), Res.get());
12282 if (!Res.isUsable())
12285 ParsedClause.setIntExprDetails(Res.get());
12287 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12288 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs()[0],
12289 ParsedClause.getEndLoc());
12292template <
typename Derived>
12293void OpenACCClauseTransform<Derived>::VisitAsyncClause(
12295 if (
C.hasIntExpr()) {
12297 if (!Res.isUsable())
12302 C.getBeginLoc(), Res.get());
12303 if (!Res.isUsable())
12305 ParsedClause.setIntExprDetails(Res.get());
12309 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12310 ParsedClause.getLParenLoc(),
12311 ParsedClause.getNumIntExprs() != 0 ? ParsedClause.getIntExprs()[0]
12313 ParsedClause.getEndLoc());
12316template <
typename Derived>
12317void OpenACCClauseTransform<Derived>::VisitWorkerClause(
12319 if (
C.hasIntExpr()) {
12324 if (!Res.isUsable())
12329 C.getBeginLoc(), Res.get());
12330 if (!Res.isUsable())
12332 ParsedClause.setIntExprDetails(Res.get());
12336 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12337 ParsedClause.getLParenLoc(),
12338 ParsedClause.getNumIntExprs() != 0 ? ParsedClause.getIntExprs()[0]
12340 ParsedClause.getEndLoc());
12343template <
typename Derived>
12344void OpenACCClauseTransform<Derived>::VisitVectorClause(
12346 if (
C.hasIntExpr()) {
12351 if (!Res.isUsable())
12356 C.getBeginLoc(), Res.get());
12357 if (!Res.isUsable())
12359 ParsedClause.setIntExprDetails(Res.get());
12363 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12364 ParsedClause.getLParenLoc(),
12365 ParsedClause.getNumIntExprs() != 0 ? ParsedClause.getIntExprs()[0]
12367 ParsedClause.getEndLoc());
12370template <
typename Derived>
12371void OpenACCClauseTransform<Derived>::VisitWaitClause(
12373 if (
C.hasExprs()) {
12374 Expr *DevNumExpr =
nullptr;
12378 if (
C.getDevNumExpr()) {
12380 if (!Res.isUsable())
12384 C.getBeginLoc(), Res.get());
12385 if (!Res.isUsable())
12388 DevNumExpr = Res.get();
12392 for (
Expr *CurQueueIdExpr :
C.getQueueIdExprs()) {
12394 if (!Res.isUsable())
12398 C.getBeginLoc(), Res.get());
12399 if (!Res.isUsable())
12402 InstantiatedQueueIdExprs.push_back(Res.get());
12405 ParsedClause.setWaitDetails(DevNumExpr,
C.getQueuesLoc(),
12406 std::move(InstantiatedQueueIdExprs));
12410 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12411 ParsedClause.getLParenLoc(), ParsedClause.getDevNumExpr(),
12412 ParsedClause.getQueuesLoc(), ParsedClause.getQueueIdExprs(),
12413 ParsedClause.getEndLoc());
12416template <
typename Derived>
12417void OpenACCClauseTransform<Derived>::VisitDeviceTypeClause(
12421 Self.getSema().getASTContext(),
C.getClauseKind(),
12422 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12423 C.getArchitectures(), ParsedClause.getEndLoc());
12426template <
typename Derived>
12427void OpenACCClauseTransform<Derived>::VisitAutoClause(
12431 ParsedClause.getBeginLoc(),
12432 ParsedClause.getEndLoc());
12435template <
typename Derived>
12436void OpenACCClauseTransform<Derived>::VisitIndependentClause(
12439 ParsedClause.getBeginLoc(),
12440 ParsedClause.getEndLoc());
12443template <
typename Derived>
12444void OpenACCClauseTransform<Derived>::VisitSeqClause(
12447 ParsedClause.getBeginLoc(),
12448 ParsedClause.getEndLoc());
12450template <
typename Derived>
12451void OpenACCClauseTransform<Derived>::VisitFinalizeClause(
12454 ParsedClause.getBeginLoc(),
12455 ParsedClause.getEndLoc());
12458template <
typename Derived>
12459void OpenACCClauseTransform<Derived>::VisitIfPresentClause(
12462 ParsedClause.getBeginLoc(),
12463 ParsedClause.getEndLoc());
12466template <
typename Derived>
12467void OpenACCClauseTransform<Derived>::VisitReductionClause(
12473 for (
const auto [Var, OrigRecipe] :
12474 llvm::zip(TransformedVars,
C.getRecipes())) {
12476 ParsedClause.getDirectiveKind(),
C.getReductionOp(), Var);
12477 if (Res.isUsable()) {
12478 ValidVars.push_back(Res.get());
12480 if (OrigRecipe.isSet())
12481 Recipes.emplace_back(OrigRecipe.AllocaDecl, OrigRecipe.CombinerRecipes);
12483 Recipes.push_back(
Self.getSema().OpenACC().CreateReductionInitRecipe(
12484 C.getReductionOp(), Res.get()));
12488 NewClause =
Self.getSema().OpenACC().CheckReductionClause(
12489 ExistingClauses, ParsedClause.getDirectiveKind(),
12490 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12491 C.getReductionOp(), ValidVars, Recipes, ParsedClause.getEndLoc());
12494template <
typename Derived>
12495void OpenACCClauseTransform<Derived>::VisitCollapseClause(
12497 Expr *LoopCount =
const_cast<Expr *
>(
C.getLoopCount());
12498 assert(LoopCount &&
"collapse clause constructed with invalid loop count");
12502 NewLoopCount =
Self.getSema().OpenACC().ActOnIntExpr(
12504 NewLoopCount.get()->getBeginLoc(), NewLoopCount.get());
12507 Self.getSema().OpenACC().CheckCollapseLoopCount(NewLoopCount.get());
12509 ParsedClause.setCollapseDetails(
C.hasForce(), NewLoopCount.get());
12511 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12512 ParsedClause.getLParenLoc(), ParsedClause.isForce(),
12513 ParsedClause.getLoopCount(), ParsedClause.getEndLoc());
12516template <
typename Derived>
12517void OpenACCClauseTransform<Derived>::VisitTileClause(
12522 for (
Expr *E :
C.getSizeExprs()) {
12525 if (!NewSizeExpr.isUsable())
12528 NewSizeExpr =
Self.getSema().OpenACC().ActOnIntExpr(
12530 NewSizeExpr.get()->getBeginLoc(), NewSizeExpr.get());
12532 NewSizeExpr =
Self.getSema().OpenACC().CheckTileSizeExpr(NewSizeExpr.get());
12534 if (!NewSizeExpr.isUsable())
12536 TransformedExprs.push_back(NewSizeExpr.get());
12539 ParsedClause.setIntExprDetails(TransformedExprs);
12541 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12542 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs(),
12543 ParsedClause.getEndLoc());
12545template <
typename Derived>
12546void OpenACCClauseTransform<Derived>::VisitGangClause(
12551 for (
unsigned I = 0; I <
C.getNumExprs(); ++I) {
12553 if (!ER.isUsable())
12556 ER =
Self.getSema().OpenACC().CheckGangExpr(ExistingClauses,
12557 ParsedClause.getDirectiveKind(),
12558 C.getExpr(I).first, ER.get());
12559 if (!ER.isUsable())
12561 TransformedGangKinds.push_back(
C.getExpr(I).first);
12562 TransformedIntExprs.push_back(ER.get());
12565 NewClause =
Self.getSema().OpenACC().CheckGangClause(
12566 ParsedClause.getDirectiveKind(), ExistingClauses,
12567 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12568 TransformedGangKinds, TransformedIntExprs, ParsedClause.getEndLoc());
12571template <
typename Derived>
12572OpenACCClause *TreeTransform<Derived>::TransformOpenACCClause(
12577 DirKind, OldClause->getClauseKind(), OldClause->getBeginLoc());
12578 ParsedClause.setEndLoc(OldClause->getEndLoc());
12580 if (
const auto *WithParms = dyn_cast<OpenACCClauseWithParams>(OldClause))
12581 ParsedClause.setLParenLoc(WithParms->getLParenLoc());
12583 OpenACCClauseTransform<Derived> Transform{*
this, ExistingClauses,
12585 Transform.Visit(OldClause);
12587 return Transform.CreatedClause();
12590template <
typename Derived>
12592TreeTransform<Derived>::TransformOpenACCClauseList(
12595 for (
const auto *Clause : OldClauses) {
12596 if (
OpenACCClause *TransformedClause = getDerived().TransformOpenACCClause(
12597 TransformedClauses, DirKind, Clause))
12598 TransformedClauses.push_back(TransformedClause);
12600 return TransformedClauses;
12603template <
typename Derived>
12606 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12609 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12612 if (getSema().OpenACC().ActOnStartStmtDirective(
12613 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12618 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
12619 C->clauses(), TransformedClauses);
12620 StmtResult StrBlock = getDerived().TransformStmt(
C->getStructuredBlock());
12621 StrBlock = getSema().OpenACC().ActOnAssociatedStmt(
12622 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses, StrBlock);
12624 return getDerived().RebuildOpenACCComputeConstruct(
12625 C->getDirectiveKind(),
C->getBeginLoc(),
C->getDirectiveLoc(),
12626 C->getEndLoc(), TransformedClauses, StrBlock);
12629template <
typename Derived>
12633 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12636 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12639 if (getSema().OpenACC().ActOnStartStmtDirective(
12640 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12645 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
12646 C->clauses(), TransformedClauses);
12648 Loop = getSema().OpenACC().ActOnAssociatedStmt(
12649 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses,
Loop);
12651 return getDerived().RebuildOpenACCLoopConstruct(
12652 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12653 TransformedClauses,
Loop);
12656template <
typename Derived>
12658 OpenACCCombinedConstruct *
C) {
12659 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12662 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12665 if (getSema().OpenACC().ActOnStartStmtDirective(
12666 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12671 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
12672 C->clauses(), TransformedClauses);
12674 Loop = getSema().OpenACC().ActOnAssociatedStmt(
12675 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses,
Loop);
12677 return getDerived().RebuildOpenACCCombinedConstruct(
12678 C->getDirectiveKind(),
C->getBeginLoc(),
C->getDirectiveLoc(),
12679 C->getEndLoc(), TransformedClauses,
Loop);
12682template <
typename Derived>
12685 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12688 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12690 if (getSema().OpenACC().ActOnStartStmtDirective(
12691 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12695 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
12696 C->clauses(), TransformedClauses);
12697 StmtResult StrBlock = getDerived().TransformStmt(
C->getStructuredBlock());
12698 StrBlock = getSema().OpenACC().ActOnAssociatedStmt(
12699 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses, StrBlock);
12701 return getDerived().RebuildOpenACCDataConstruct(
12702 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12703 TransformedClauses, StrBlock);
12706template <
typename Derived>
12708 OpenACCEnterDataConstruct *
C) {
12709 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12712 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12714 if (getSema().OpenACC().ActOnStartStmtDirective(
12715 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12718 return getDerived().RebuildOpenACCEnterDataConstruct(
12719 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12720 TransformedClauses);
12723template <
typename Derived>
12725 OpenACCExitDataConstruct *
C) {
12726 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12729 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12731 if (getSema().OpenACC().ActOnStartStmtDirective(
12732 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12735 return getDerived().RebuildOpenACCExitDataConstruct(
12736 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12737 TransformedClauses);
12740template <
typename Derived>
12742 OpenACCHostDataConstruct *
C) {
12743 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12746 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12748 if (getSema().OpenACC().ActOnStartStmtDirective(
12749 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12753 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
12754 C->clauses(), TransformedClauses);
12755 StmtResult StrBlock = getDerived().TransformStmt(
C->getStructuredBlock());
12756 StrBlock = getSema().OpenACC().ActOnAssociatedStmt(
12757 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses, StrBlock);
12759 return getDerived().RebuildOpenACCHostDataConstruct(
12760 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12761 TransformedClauses, StrBlock);
12764template <
typename Derived>
12767 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12770 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12772 if (getSema().OpenACC().ActOnStartStmtDirective(
12773 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12776 return getDerived().RebuildOpenACCInitConstruct(
12777 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12778 TransformedClauses);
12781template <
typename Derived>
12783 OpenACCShutdownConstruct *
C) {
12784 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12787 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12789 if (getSema().OpenACC().ActOnStartStmtDirective(
12790 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12793 return getDerived().RebuildOpenACCShutdownConstruct(
12794 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12795 TransformedClauses);
12797template <
typename Derived>
12800 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12803 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12805 if (getSema().OpenACC().ActOnStartStmtDirective(
12806 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12809 return getDerived().RebuildOpenACCSetConstruct(
12810 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12811 TransformedClauses);
12814template <
typename Derived>
12816 OpenACCUpdateConstruct *
C) {
12817 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12820 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12822 if (getSema().OpenACC().ActOnStartStmtDirective(
12823 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12826 return getDerived().RebuildOpenACCUpdateConstruct(
12827 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12828 TransformedClauses);
12831template <
typename Derived>
12834 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12837 if (
C->hasDevNumExpr()) {
12838 DevNumExpr = getDerived().TransformExpr(
C->getDevNumExpr());
12840 if (DevNumExpr.isUsable())
12841 DevNumExpr = getSema().OpenACC().ActOnIntExpr(
12843 C->getBeginLoc(), DevNumExpr.get());
12848 for (
Expr *QE :
C->getQueueIdExprs()) {
12849 assert(QE &&
"Null queue id expr?");
12850 ExprResult NewEQ = getDerived().TransformExpr(QE);
12852 if (!NewEQ.isUsable())
12856 C->getBeginLoc(), NewEQ.get());
12857 if (NewEQ.isUsable())
12858 QueueIdExprs.push_back(NewEQ.get());
12862 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12865 if (getSema().OpenACC().ActOnStartStmtDirective(
12866 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12869 return getDerived().RebuildOpenACCWaitConstruct(
12870 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getLParenLoc(),
12871 DevNumExpr.isUsable() ? DevNumExpr.get() :
nullptr,
C->getQueuesLoc(),
12872 QueueIdExprs,
C->getRParenLoc(),
C->getEndLoc(), TransformedClauses);
12874template <
typename Derived>
12876 OpenACCCacheConstruct *
C) {
12877 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12880 for (
Expr *Var :
C->getVarList()) {
12881 assert(Var &&
"Null var listexpr?");
12883 ExprResult NewVar = getDerived().TransformExpr(Var);
12885 if (!NewVar.isUsable())
12888 NewVar = getSema().OpenACC().ActOnVar(
12890 if (!NewVar.isUsable())
12893 TransformedVarList.push_back(NewVar.get());
12896 if (getSema().OpenACC().ActOnStartStmtDirective(
C->getDirectiveKind(),
12897 C->getBeginLoc(), {}))
12900 return getDerived().RebuildOpenACCCacheConstruct(
12901 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getLParenLoc(),
12902 C->getReadOnlyLoc(), TransformedVarList,
C->getRParenLoc(),
12906template <
typename Derived>
12908 OpenACCAtomicConstruct *
C) {
12909 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12912 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12915 if (getSema().OpenACC().ActOnStartStmtDirective(
C->getDirectiveKind(),
12916 C->getBeginLoc(), {}))
12921 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(), {}, {});
12923 StmtResult AssocStmt = getDerived().TransformStmt(
C->getAssociatedStmt());
12924 AssocStmt = getSema().OpenACC().ActOnAssociatedStmt(
12925 C->getBeginLoc(),
C->getDirectiveKind(),
C->getAtomicKind(), {},
12928 return getDerived().RebuildOpenACCAtomicConstruct(
12929 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getAtomicKind(),
12930 C->getEndLoc(), TransformedClauses, AssocStmt);
12933template <
typename Derived>
12936 if (getDerived().AlwaysRebuild())
12945template<
typename Derived>
12948 return TransformExpr(E->getSubExpr());
12951template <
typename Derived>
12954 if (!E->isTypeDependent())
12957 TypeSourceInfo *NewT = getDerived().TransformType(E->getTypeSourceInfo());
12962 if (!getDerived().AlwaysRebuild() && E->getTypeSourceInfo() == NewT)
12965 return getDerived().RebuildSYCLUniqueStableNameExpr(
12966 E->getLocation(), E->getLParenLocation(), E->getRParenLocation(), NewT);
12969template<
typename Derived>
12972 if (!E->isTypeDependent())
12976 E->getIdentKind());
12979template<
typename Derived>
12983 if (E->getQualifierLoc()) {
12985 = getDerived().TransformNestedNameSpecifierLoc(E->getQualifierLoc());
12991 = cast_or_null<ValueDecl>(getDerived().TransformDecl(E->getLocation(),
12993 if (!ND || ND->isInvalidDecl())
12997 if (E->getFoundDecl() != E->getDecl()) {
12998 Found = cast_or_null<NamedDecl>(
12999 getDerived().TransformDecl(E->getLocation(), E->getFoundDecl()));
13005 if (NameInfo.getName()) {
13006 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
13007 if (!NameInfo.getName())
13011 if (!getDerived().AlwaysRebuild() &&
13012 !E->isCapturedByCopyInLambdaWithExplicitObjectParameter() &&
13013 QualifierLoc == E->getQualifierLoc() && ND == E->getDecl() &&
13014 Found == E->getFoundDecl() &&
13015 NameInfo.getName() == E->getDecl()->getDeclName() &&
13016 !E->hasExplicitTemplateArgs()) {
13026 if (E->hasExplicitTemplateArgs()) {
13027 TemplateArgs = &TransArgs;
13028 TransArgs.setLAngleLoc(E->getLAngleLoc());
13029 TransArgs.setRAngleLoc(E->getRAngleLoc());
13030 if (getDerived().TransformTemplateArguments(E->getTemplateArgs(),
13031 E->getNumTemplateArgs(),
13036 return getDerived().RebuildDeclRefExpr(QualifierLoc, ND, NameInfo,
13037 Found, TemplateArgs);
13040template<
typename Derived>
13046template <
typename Derived>
13052template<
typename Derived>
13058template<
typename Derived>
13064template<
typename Derived>
13070template<
typename Derived>
13076template<
typename Derived>
13079 return getDerived().TransformCallExpr(E);
13082template<
typename Derived>
13087 if (E->isExprPredicate())
13088 ControllingExpr = getDerived().TransformExpr(E->getControllingExpr());
13090 ControllingType = getDerived().TransformType(E->getControllingType());
13092 if (ControllingExpr.isInvalid() && !ControllingType)
13103 AssocTypes.push_back(AssocType);
13105 AssocTypes.push_back(
nullptr);
13109 getDerived().TransformExpr(Assoc.getAssociationExpr());
13110 if (AssocExpr.isInvalid())
13112 AssocExprs.push_back(AssocExpr.get());
13115 if (!ControllingType)
13116 return getDerived().RebuildGenericSelectionExpr(E->getGenericLoc(),
13117 E->getDefaultLoc(),
13119 ControllingExpr.get(),
13122 return getDerived().RebuildGenericSelectionExpr(
13123 E->getGenericLoc(), E->getDefaultLoc(), E->getRParenLoc(),
13124 ControllingType, AssocTypes, AssocExprs);
13127template<
typename Derived>
13130 ExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
13131 if (SubExpr.isInvalid())
13134 if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getSubExpr())
13137 return getDerived().RebuildParenExpr(SubExpr.get(), E->getLParen(),
13144template<
typename Derived>
13148 return getDerived().TransformDependentScopeDeclRefExpr(
13149 DRE,
true,
nullptr);
13151 return getDerived().TransformUnresolvedLookupExpr(
13157template<
typename Derived>
13162 SubExpr = TransformAddressOfOperand(E->
getSubExpr());
13168 if (!getDerived().AlwaysRebuild() && SubExpr.
get() == E->
getSubExpr())
13176template<
typename Derived>
13178TreeTransform<Derived>::TransformOffsetOfExpr(OffsetOfExpr *E) {
13180 TypeSourceInfo *Type = getDerived().TransformType(E->getTypeSourceInfo());
13190 bool ExprChanged =
false;
13191 typedef Sema::OffsetOfComponent Component;
13193 for (
unsigned I = 0, N = E->getNumComponents(); I != N; ++I) {
13194 const OffsetOfNode &ON = E->getComponent(I);
13196 Comp.isBrackets =
true;
13197 Comp.LocStart = ON.getSourceRange().getBegin();
13198 Comp.LocEnd = ON.getSourceRange().getEnd();
13199 switch (ON.getKind()) {
13201 Expr *FromIndex = E->getIndexExpr(ON.getArrayExprIndex());
13202 ExprResult Index = getDerived().TransformExpr(FromIndex);
13203 if (Index.isInvalid())
13206 ExprChanged = ExprChanged || Index.get() != FromIndex;
13207 Comp.isBrackets =
true;
13208 Comp.U.E = Index.get();
13214 Comp.isBrackets =
false;
13215 Comp.U.IdentInfo = ON.getFieldName();
13216 if (!
Comp.U.IdentInfo)
13226 Components.push_back(Comp);
13230 if (!getDerived().AlwaysRebuild() &&
13231 Type == E->getTypeSourceInfo() &&
13236 return getDerived().RebuildOffsetOfExpr(E->getOperatorLoc(),
Type,
13237 Components, E->getRParenLoc());
13240template<
typename Derived>
13243 assert((!E->getSourceExpr() || getDerived().AlreadyTransformed(E->getType())) &&
13244 "opaque value expression requires transformation");
13248template <
typename Derived>
13252 for (
Expr *
C : E->subExpressions()) {
13254 if (NewC.isInvalid())
13260 if (!getDerived().AlwaysRebuild() && !Changed)
13262 return getDerived().RebuildRecoveryExpr(E->getBeginLoc(), E->getEndLoc(),
13266template<
typename Derived>
13276 ExprResult result = getDerived().TransformExpr(newSyntacticForm);
13277 if (result.isInvalid())
return ExprError();
13282 if (result.get()->hasPlaceholderType(BuiltinType::PseudoObject))
13288template<
typename Derived>
13292 if (E->isArgumentType()) {
13299 if (!getDerived().AlwaysRebuild() && OldT == NewT)
13302 return getDerived().RebuildUnaryExprOrTypeTrait(NewT, E->getOperatorLoc(),
13304 E->getSourceRange());
13318 auto *PE = dyn_cast<ParenExpr>(E->getArgumentExpr());
13320 PE ? dyn_cast<DependentScopeDeclRefExpr>(PE->getSubExpr()) :
nullptr)
13321 SubExpr = getDerived().TransformParenDependentScopeDeclRefExpr(
13322 PE, DRE,
false, &RecoveryTSI);
13324 SubExpr = getDerived().TransformExpr(E->getArgumentExpr());
13327 return getDerived().RebuildUnaryExprOrTypeTrait(
13328 RecoveryTSI, E->getOperatorLoc(), E->getKind(), E->getSourceRange());
13329 }
else if (SubExpr.isInvalid())
13332 if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getArgumentExpr())
13335 return getDerived().RebuildUnaryExprOrTypeTrait(SubExpr.get(),
13336 E->getOperatorLoc(),
13338 E->getSourceRange());
13341template<
typename Derived>
13344 ExprResult LHS = getDerived().TransformExpr(E->getLHS());
13345 if (LHS.isInvalid())
13348 ExprResult RHS = getDerived().TransformExpr(E->getRHS());
13349 if (RHS.isInvalid())
13353 if (!getDerived().AlwaysRebuild() &&
13354 LHS.get() == E->getLHS() &&
13355 RHS.get() == E->getRHS())
13358 return getDerived().RebuildArraySubscriptExpr(
13360 E->getLHS()->getBeginLoc(), RHS.get(), E->getRBracketLoc());
13363template <
typename Derived>
13367 if (
Base.isInvalid())
13370 ExprResult RowIdx = getDerived().TransformExpr(E->getRowIdx());
13371 if (RowIdx.isInvalid())
13374 ExprResult ColumnIdx = getDerived().TransformExpr(E->getColumnIdx());
13375 if (ColumnIdx.isInvalid())
13378 if (!getDerived().AlwaysRebuild() &&
Base.get() == E->getBase() &&
13379 RowIdx.get() == E->getRowIdx() && ColumnIdx.get() == E->getColumnIdx())
13382 return getDerived().RebuildMatrixSubscriptExpr(
13383 Base.get(), RowIdx.get(), ColumnIdx.get(), E->getRBracketLoc());
13386template <
typename Derived>
13390 if (
Base.isInvalid())
13394 if (E->getLowerBound()) {
13395 LowerBound = getDerived().TransformExpr(E->getLowerBound());
13396 if (LowerBound.isInvalid())
13401 if (E->getLength()) {
13402 Length = getDerived().TransformExpr(E->getLength());
13403 if (Length.isInvalid())
13408 if (E->isOMPArraySection()) {
13409 if (
Expr *Str = E->getStride()) {
13410 Stride = getDerived().TransformExpr(Str);
13411 if (Stride.isInvalid())
13416 if (!getDerived().AlwaysRebuild() &&
Base.get() == E->getBase() &&
13417 LowerBound.get() == E->getLowerBound() &&
13418 Length.get() == E->getLength() &&
13419 (E->isOpenACCArraySection() || Stride.get() == E->getStride()))
13422 return getDerived().RebuildArraySectionExpr(
13423 E->isOMPArraySection(),
Base.get(), E->getBase()->getEndLoc(),
13424 LowerBound.get(), E->getColonLocFirst(),
13425 E->isOMPArraySection() ? E->getColonLocSecond() :
SourceLocation{},
13426 Length.get(), Stride.get(), E->getRBracketLoc());
13429template <
typename Derived>
13433 if (
Base.isInvalid())
13437 bool ErrorFound =
false;
13438 for (
Expr *
Dim : E->getDimensions()) {
13440 if (DimRes.isInvalid()) {
13444 Dims.push_back(DimRes.get());
13449 return getDerived().RebuildOMPArrayShapingExpr(
Base.get(), E->getLParenLoc(),
13450 E->getRParenLoc(), Dims,
13451 E->getBracketsRanges());
13454template <
typename Derived>
13457 unsigned NumIterators = E->numOfIterators();
13460 bool ErrorFound =
false;
13461 bool NeedToRebuild = getDerived().AlwaysRebuild();
13462 for (
unsigned I = 0; I < NumIterators; ++I) {
13464 Data[I].DeclIdent = D->getIdentifier();
13465 Data[I].DeclIdentLoc = D->getLocation();
13466 if (D->getLocation() == D->getBeginLoc()) {
13468 "Implicit type must be int.");
13470 TypeSourceInfo *TSI = getDerived().TransformType(D->getTypeSourceInfo());
13478 ErrorFound = ErrorFound ||
13479 !(!D->getTypeSourceInfo() || (
Data[I].
Type.getAsOpaquePtr() &&
13480 !
Data[I].Type.get().isNull())) ||
13481 Begin.isInvalid() || End.isInvalid() || Step.isInvalid();
13484 Data[I].Range.Begin = Begin.get();
13485 Data[I].Range.End = End.get();
13486 Data[I].Range.Step = Step.get();
13487 Data[I].AssignLoc = E->getAssignLoc(I);
13488 Data[I].ColonLoc = E->getColonLoc(I);
13489 Data[I].SecColonLoc = E->getSecondColonLoc(I);
13492 (D->getTypeSourceInfo() &&
Data[I].
Type.get().getTypePtrOrNull() !=
13493 D->getType().getTypePtrOrNull()) ||
13499 if (!NeedToRebuild)
13502 ExprResult Res = getDerived().RebuildOMPIteratorExpr(
13503 E->getIteratorKwLoc(), E->getLParenLoc(), E->getRParenLoc(),
Data);
13504 if (!Res.isUsable())
13507 for (
unsigned I = 0; I < NumIterators; ++I)
13508 getDerived().transformedLocalDecl(E->getIteratorDecl(I),
13509 IE->getIteratorDecl(I));
13513template<
typename Derived>
13522 bool ArgChanged =
false;
13524 if (getDerived().TransformExprs(E->getArgs(), E->getNumArgs(),
true, Args,
13528 if (!getDerived().AlwaysRebuild() &&
13529 Callee.get() == E->getCallee() &&
13535 = ((
Expr *)
Callee.get())->getSourceRange().getBegin();
13538 if (E->hasStoredFPFeatures()) {
13540 getSema().CurFPFeatures =
13542 getSema().FpPragmaStack.CurrentValue = NewOverrides;
13545 return getDerived().RebuildCallExpr(
Callee.get(), FakeLParenLoc,
13547 E->getRParenLoc());
13550template<
typename Derived>
13554 if (
Base.isInvalid())
13558 if (E->hasQualifier()) {
13560 = getDerived().TransformNestedNameSpecifierLoc(E->getQualifierLoc());
13568 = cast_or_null<ValueDecl>(getDerived().TransformDecl(E->getMemberLoc(),
13569 E->getMemberDecl()));
13573 NamedDecl *FoundDecl = E->getFoundDecl();
13574 if (FoundDecl == E->getMemberDecl()) {
13577 FoundDecl = cast_or_null<NamedDecl>(
13578 getDerived().TransformDecl(E->getMemberLoc(), FoundDecl));
13583 if (!getDerived().AlwaysRebuild() &&
13584 Base.get() == E->getBase() &&
13585 QualifierLoc == E->getQualifierLoc() &&
13586 Member == E->getMemberDecl() &&
13587 FoundDecl == E->getFoundDecl() &&
13588 !E->hasExplicitTemplateArgs()) {
13593 getSema().OpenMP().isOpenMPRebuildMemberExpr(
13603 if (E->hasExplicitTemplateArgs()) {
13604 TransArgs.setLAngleLoc(E->getLAngleLoc());
13605 TransArgs.setRAngleLoc(E->getRAngleLoc());
13606 if (getDerived().TransformTemplateArguments(E->getTemplateArgs(),
13607 E->getNumTemplateArgs(),
13620 NamedDecl *FirstQualifierInScope =
nullptr;
13622 if (MemberNameInfo.getName()) {
13623 MemberNameInfo = getDerived().TransformDeclarationNameInfo(MemberNameInfo);
13624 if (!MemberNameInfo.getName())
13628 return getDerived().RebuildMemberExpr(
Base.get(), FakeOperatorLoc,
13635 (E->hasExplicitTemplateArgs()
13636 ? &TransArgs :
nullptr),
13637 FirstQualifierInScope);
13640template<
typename Derived>
13643 ExprResult LHS = getDerived().TransformExpr(E->getLHS());
13644 if (LHS.isInvalid())
13648 getDerived().TransformInitializer(E->getRHS(),
false);
13649 if (RHS.isInvalid())
13652 if (!getDerived().AlwaysRebuild() &&
13653 LHS.get() == E->getLHS() &&
13654 RHS.get() == E->getRHS())
13657 if (E->isCompoundAssignmentOp())
13659 return getDerived().RebuildBinaryOperator(
13660 E->getOperatorLoc(), E->getOpcode(), LHS.get(), RHS.get());
13663 getSema().CurFPFeatures =
13664 NewOverrides.applyOverrides(getSema().getLangOpts());
13665 getSema().FpPragmaStack.CurrentValue = NewOverrides;
13666 return getDerived().RebuildBinaryOperator(E->getOperatorLoc(), E->getOpcode(),
13667 LHS.get(), RHS.get());
13670template <
typename Derived>
13675 ExprResult LHS = getDerived().TransformExpr(
const_cast<Expr*
>(Decomp.LHS));
13676 if (LHS.isInvalid())
13679 ExprResult RHS = getDerived().TransformExpr(
const_cast<Expr*
>(Decomp.RHS));
13680 if (RHS.isInvalid())
13686 bool ChangedAnyLookups =
false;
13687 Expr *PossibleBinOps[] = {E->getSemanticForm(),
13688 const_cast<Expr *
>(Decomp.InnerBinOp)};
13689 for (
Expr *PossibleBinOp : PossibleBinOps) {
13690 auto *Op = dyn_cast<CXXOperatorCallExpr>(PossibleBinOp->IgnoreImplicit());
13693 auto *
Callee = dyn_cast<DeclRefExpr>(Op->getCallee()->IgnoreImplicit());
13699 NamedDecl *
Found = cast_or_null<NamedDecl>(getDerived().TransformDecl(
13700 E->getOperatorLoc(),
Callee->getFoundDecl()));
13704 ChangedAnyLookups =
true;
13705 UnqualLookups.addDecl(
Found);
13708 if (!getDerived().AlwaysRebuild() && !ChangedAnyLookups &&
13709 LHS.get() == Decomp.LHS && RHS.get() == Decomp.RHS) {
13715 const Expr *StopAt[] = {Decomp.LHS, Decomp.RHS};
13720 return getDerived().RebuildCXXRewrittenBinaryOperator(
13721 E->getOperatorLoc(), Decomp.Opcode, UnqualLookups, LHS.get(), RHS.get());
13724template<
typename Derived>
13730 getSema().CurFPFeatures =
13731 NewOverrides.applyOverrides(getSema().getLangOpts());
13732 getSema().FpPragmaStack.CurrentValue = NewOverrides;
13733 return getDerived().TransformBinaryOperator(E);
13736template<
typename Derived>
13742 ExprResult commonExpr = getDerived().TransformExpr(e->getCommon());
13743 if (commonExpr.isInvalid())
13746 ExprResult rhs = getDerived().TransformExpr(e->getFalseExpr());
13747 if (rhs.isInvalid())
13750 if (!getDerived().AlwaysRebuild() &&
13751 commonExpr.get() == e->getCommon() &&
13752 rhs.get() == e->getFalseExpr())
13755 return getDerived().RebuildConditionalOperator(commonExpr.get(),
13756 e->getQuestionLoc(),
13762template<
typename Derived>
13766 if (
Cond.isInvalid())
13769 ExprResult LHS = getDerived().TransformExpr(E->getLHS());
13770 if (LHS.isInvalid())
13773 ExprResult RHS = getDerived().TransformExpr(E->getRHS());
13774 if (RHS.isInvalid())
13777 if (!getDerived().AlwaysRebuild() &&
13778 Cond.get() == E->getCond() &&
13779 LHS.get() == E->getLHS() &&
13780 RHS.get() == E->getRHS())
13783 return getDerived().RebuildConditionalOperator(
Cond.get(),
13784 E->getQuestionLoc(),
13790template<
typename Derived>
13795 return getDerived().
TransformExpr(E->getSubExprAsWritten());
13798template<
typename Derived>
13806 = getDerived().TransformExpr(E->getSubExprAsWritten());
13807 if (SubExpr.isInvalid())
13810 if (!getDerived().AlwaysRebuild() &&
13811 Type == E->getTypeInfoAsWritten() &&
13812 SubExpr.get() == E->getSubExpr())
13815 return getDerived().RebuildCStyleCastExpr(E->getLParenLoc(),
13821template<
typename Derived>
13829 ExprResult Init = getDerived().TransformExpr(E->getInitializer());
13830 if (
Init.isInvalid())
13833 if (!getDerived().AlwaysRebuild() &&
13835 Init.get() == E->getInitializer())
13842 return getDerived().RebuildCompoundLiteralExpr(
13843 E->getLParenLoc(), NewT,
13844 E->getInitializer()->getEndLoc(),
Init.get());
13847template<
typename Derived>
13851 if (
Base.isInvalid())
13854 if (!getDerived().AlwaysRebuild() &&
13855 Base.get() == E->getBase())
13861 return getDerived().RebuildExtVectorElementExpr(
13862 Base.get(), FakeOperatorLoc, E->isArrow(), E->getAccessorLoc(),
13866template<
typename Derived>
13872 bool InitChanged =
false;
13878 if (getDerived().TransformExprs(E->getInits(), E->getNumInits(),
false,
13879 Inits, &InitChanged))
13882 if (!getDerived().AlwaysRebuild() && !InitChanged) {
13889 return getDerived().RebuildInitList(E->getLBraceLoc(), Inits,
13890 E->getRBraceLoc());
13893template<
typename Derived>
13900 if (
Init.isInvalid())
13905 bool ExprChanged =
false;
13907 if (D.isFieldDesignator()) {
13908 if (D.getFieldDecl()) {
13910 getDerived().TransformDecl(D.getFieldLoc(), D.getFieldDecl()));
13911 if (Field != D.getFieldDecl())
13914 ExprChanged =
true;
13915 if (
Field->isAnonymousStructOrUnion())
13921 ExprChanged =
true;
13924 D.getFieldName(), D.getDotLoc(), D.getFieldLoc()));
13928 if (D.isArrayDesignator()) {
13929 ExprResult Index = getDerived().TransformExpr(E->getArrayIndex(D));
13930 if (Index.isInvalid())
13933 Desig.AddDesignator(
13936 ExprChanged = ExprChanged || Index.get() != E->getArrayIndex(D);
13937 ArrayExprs.push_back(Index.get());
13941 assert(D.isArrayRangeDesignator() &&
"New kind of designator?");
13943 = getDerived().TransformExpr(E->getArrayRangeStart(D));
13944 if (Start.isInvalid())
13947 ExprResult End = getDerived().TransformExpr(E->getArrayRangeEnd(D));
13948 if (End.isInvalid())
13952 Start.get(), End.get(), D.getLBracketLoc(), D.getEllipsisLoc()));
13954 ExprChanged = ExprChanged || Start.get() != E->getArrayRangeStart(D) ||
13955 End.get() != E->getArrayRangeEnd(D);
13957 ArrayExprs.push_back(Start.get());
13958 ArrayExprs.push_back(End.get());
13961 if (!getDerived().AlwaysRebuild() &&
13962 Init.get() == E->getInit() &&
13966 return getDerived().RebuildDesignatedInitExpr(Desig, ArrayExprs,
13967 E->getEqualOrColonLoc(),
13968 E->usesGNUSyntax(),
Init.get());
13973template<
typename Derived>
13977 llvm_unreachable(
"Unexpected DesignatedInitUpdateExpr in syntactic form of "
13982template<
typename Derived>
13986 llvm_unreachable(
"Unexpected NoInitExpr in syntactic form of initializer");
13990template<
typename Derived>
13993 llvm_unreachable(
"Unexpected ArrayInitLoopExpr outside of initializer");
13997template<
typename Derived>
14000 llvm_unreachable(
"Unexpected ArrayInitIndexExpr outside of initializer");
14004template<
typename Derived>
14012 QualType T = getDerived().TransformType(E->getType());
14016 if (!getDerived().AlwaysRebuild() &&
14020 return getDerived().RebuildImplicitValueInitExpr(
T);
14023template<
typename Derived>
14026 TypeSourceInfo *TInfo = getDerived().TransformType(E->getWrittenTypeInfo());
14030 ExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
14031 if (SubExpr.isInvalid())
14034 if (!getDerived().AlwaysRebuild() &&
14035 TInfo == E->getWrittenTypeInfo() &&
14036 SubExpr.get() == E->getSubExpr())
14039 return getDerived().RebuildVAArgExpr(E->getBuiltinLoc(), SubExpr.get(),
14040 TInfo, E->getRParenLoc());
14043template<
typename Derived>
14046 bool ArgumentChanged =
false;
14048 if (TransformExprs(E->getExprs(), E->getNumExprs(),
true, Inits,
14052 return getDerived().RebuildParenListExpr(E->getLParenLoc(),
14054 E->getRParenLoc());
14062template<
typename Derived>
14065 Decl *LD = getDerived().TransformDecl(E->getLabel()->getLocation(),
14070 return getDerived().RebuildAddrLabelExpr(E->getAmpAmpLoc(), E->getLabelLoc(),
14074template<
typename Derived>
14079 = getDerived().TransformCompoundStmt(E->getSubStmt(),
true);
14080 if (SubStmt.isInvalid()) {
14085 unsigned OldDepth = E->getTemplateDepth();
14086 unsigned NewDepth = getDerived().TransformTemplateDepth(OldDepth);
14088 if (!getDerived().AlwaysRebuild() && OldDepth == NewDepth &&
14089 SubStmt.get() == E->getSubStmt()) {
14095 return getDerived().RebuildStmtExpr(E->getLParenLoc(), SubStmt.get(),
14096 E->getRParenLoc(), NewDepth);
14099template<
typename Derived>
14103 if (
Cond.isInvalid())
14106 ExprResult LHS = getDerived().TransformExpr(E->getLHS());
14107 if (LHS.isInvalid())
14110 ExprResult RHS = getDerived().TransformExpr(E->getRHS());
14111 if (RHS.isInvalid())
14114 if (!getDerived().AlwaysRebuild() &&
14115 Cond.get() == E->getCond() &&
14116 LHS.get() == E->getLHS() &&
14117 RHS.get() == E->getRHS())
14120 return getDerived().RebuildChooseExpr(E->getBuiltinLoc(),
14121 Cond.get(), LHS.get(), RHS.get(),
14122 E->getRParenLoc());
14125template<
typename Derived>
14131template<
typename Derived>
14134 switch (E->getOperator()) {
14138 case OO_Array_Delete:
14139 llvm_unreachable(
"new and delete operators cannot use CXXOperatorCallExpr");
14144 assert(E->getNumArgs() >= 1 &&
"Object call is missing arguments");
14157 if (FakeLParenLoc.isInvalid() && EndLoc.isValid())
14158 FakeLParenLoc = EndLoc;
14162 if (getDerived().TransformExprs(E->getArgs() + 1, E->getNumArgs() - 1,
true,
14166 if (E->getOperator() == OO_Subscript)
14167 return getDerived().RebuildCxxSubscriptExpr(
Object.get(), FakeLParenLoc,
14168 Args, E->getEndLoc());
14170 return getDerived().RebuildCallExpr(
Object.get(), FakeLParenLoc, Args,
14174#define OVERLOADED_OPERATOR(Name, Spelling, Token, Unary, Binary, MemberOnly) \
14178#define OVERLOADED_OPERATOR_MULTI(Name,Spelling,Unary,Binary,MemberOnly)
14179#include "clang/Basic/OperatorKinds.def"
14181 case OO_Conditional:
14182 llvm_unreachable(
"conditional operator is not actually overloadable");
14186 llvm_unreachable(
"not an overloaded operator?");
14190 if (E->getNumArgs() == 1 && E->getOperator() == OO_Amp)
14191 First = getDerived().TransformAddressOfOperand(E->getArg(0));
14193 First = getDerived().TransformExpr(E->getArg(0));
14194 if (
First.isInvalid())
14198 if (E->getNumArgs() == 2) {
14200 getDerived().TransformInitializer(E->getArg(1),
false);
14201 if (Second.isInvalid())
14207 getSema().CurFPFeatures =
14208 NewOverrides.applyOverrides(getSema().getLangOpts());
14209 getSema().FpPragmaStack.CurrentValue = NewOverrides;
14213 LookupResult R(SemaRef, ULE->getName(), ULE->getNameLoc(),
14215 if (getDerived().TransformOverloadExprDecls(ULE, ULE->requiresADL(), R))
14218 return getDerived().RebuildCXXOperatorCallExpr(
14219 E->getOperator(), E->getOperatorLoc(),
Callee->getBeginLoc(),
14220 ULE->requiresADL(), R.asUnresolvedSet(),
First.get(), Second.get());
14225 Callee = ICE->getSubExprAsWritten();
14227 ValueDecl *VD = cast_or_null<ValueDecl>(
14228 getDerived().TransformDecl(DR->getLocation(), DR));
14233 Functions.addDecl(VD);
14235 return getDerived().RebuildCXXOperatorCallExpr(
14236 E->getOperator(), E->getOperatorLoc(),
Callee->getBeginLoc(),
14237 false, Functions,
First.get(), Second.get());
14240template<
typename Derived>
14243 return getDerived().TransformCallExpr(E);
14246template <
typename Derived>
14249 getSema().CurContext != E->getParentContext();
14251 if (!getDerived().AlwaysRebuild() && !NeedRebuildFunc)
14254 return getDerived().RebuildSourceLocExpr(E->getIdentKind(), E->getType(),
14255 E->getBeginLoc(), E->getEndLoc(),
14256 getSema().CurContext);
14259template <
typename Derived>
14264template<
typename Derived>
14273 ExprResult EC = getDerived().TransformCallExpr(E->getConfig());
14274 if (EC.isInvalid())
14278 bool ArgChanged =
false;
14280 if (getDerived().TransformExprs(E->getArgs(), E->getNumArgs(),
true, Args,
14284 if (!getDerived().AlwaysRebuild() &&
14285 Callee.get() == E->getCallee() &&
14291 = ((
Expr *)
Callee.get())->getSourceRange().getBegin();
14292 return getDerived().RebuildCallExpr(
Callee.get(), FakeLParenLoc,
14294 E->getRParenLoc(), EC.get());
14297template<
typename Derived>
14313 return getDerived().RebuildCXXNamedCastExpr(
14320template<
typename Derived>
14329 if (Sub.isInvalid())
14332 return getDerived().RebuildBuiltinBitCastExpr(BCE->
getBeginLoc(), TSI,
14336template<
typename Derived>
14338TreeTransform<Derived>::TransformCXXStaticCastExpr(CXXStaticCastExpr *E) {
14339 return getDerived().TransformCXXNamedCastExpr(E);
14342template<
typename Derived>
14348template<
typename Derived>
14355template<
typename Derived>
14361template<
typename Derived>
14367template<
typename Derived>
14372 getDerived().TransformTypeWithDeducedTST(E->getTypeInfoAsWritten());
14377 = getDerived().TransformExpr(E->getSubExprAsWritten());
14378 if (SubExpr.isInvalid())
14381 if (!getDerived().AlwaysRebuild() &&
14382 Type == E->getTypeInfoAsWritten() &&
14383 SubExpr.get() == E->getSubExpr())
14386 return getDerived().RebuildCXXFunctionalCastExpr(
Type,
14390 E->isListInitialization());
14393template<
typename Derived>
14396 if (E->isTypeOperand()) {
14398 = getDerived().TransformType(E->getTypeOperandSourceInfo());
14402 if (!getDerived().AlwaysRebuild() &&
14403 TInfo == E->getTypeOperandSourceInfo())
14406 return getDerived().RebuildCXXTypeidExpr(E->getType(), E->getBeginLoc(),
14407 TInfo, E->getEndLoc());
14413 Expr *Op = E->getExprOperand();
14415 if (E->isGLValue())
14416 if (
auto *RD = Op->getType()->getAsCXXRecordDecl();
14417 RD && RD->isPolymorphic())
14423 ExprResult SubExpr = getDerived().TransformExpr(Op);
14424 if (SubExpr.isInvalid())
14427 if (!getDerived().AlwaysRebuild() &&
14428 SubExpr.get() == E->getExprOperand())
14431 return getDerived().RebuildCXXTypeidExpr(E->getType(), E->getBeginLoc(),
14432 SubExpr.get(), E->getEndLoc());
14435template<
typename Derived>
14438 if (E->isTypeOperand()) {
14440 = getDerived().TransformType(E->getTypeOperandSourceInfo());
14444 if (!getDerived().AlwaysRebuild() &&
14445 TInfo == E->getTypeOperandSourceInfo())
14448 return getDerived().RebuildCXXUuidofExpr(E->getType(), E->getBeginLoc(),
14449 TInfo, E->getEndLoc());
14455 ExprResult SubExpr = getDerived().TransformExpr(E->getExprOperand());
14456 if (SubExpr.isInvalid())
14459 if (!getDerived().AlwaysRebuild() &&
14460 SubExpr.get() == E->getExprOperand())
14463 return getDerived().RebuildCXXUuidofExpr(E->getType(), E->getBeginLoc(),
14464 SubExpr.get(), E->getEndLoc());
14467template<
typename Derived>
14473template<
typename Derived>
14480template<
typename Derived>
14496 auto &S = getSema();
14497 if (E->isCapturedByCopyInLambdaWithExplicitObjectParameter())
14498 return S.getCurrentThisType();
14499 if (S.getCurLambda())
14500 return getDerived().TransformType(E->getType());
14501 return S.getCurrentThisType();
14504 if (!getDerived().AlwaysRebuild() &&
T == E->getType() &&
14505 !E->isCapturedByCopyInLambdaWithExplicitObjectParameter()) {
14508 getSema().MarkThisReferenced(E);
14512 return getDerived().RebuildCXXThisExpr(E->getBeginLoc(),
T, E->isImplicit());
14515template<
typename Derived>
14518 ExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
14519 if (SubExpr.isInvalid())
14522 getSema().DiagnoseExceptionUse(E->getThrowLoc(),
false);
14524 if (!getDerived().AlwaysRebuild() &&
14525 SubExpr.get() == E->getSubExpr())
14528 return getDerived().RebuildCXXThrowExpr(E->getThrowLoc(), SubExpr.get(),
14529 E->isThrownVariableInScope());
14532template<
typename Derived>
14536 getDerived().TransformDecl(E->getBeginLoc(), E->getParam()));
14541 if (E->hasRewrittenInit()) {
14542 InitRes = getDerived().TransformExpr(E->getRewrittenExpr());
14543 if (InitRes.isInvalid())
14547 if (!getDerived().AlwaysRebuild() && Param == E->getParam() &&
14548 E->getUsedContext() == SemaRef.
CurContext &&
14549 InitRes.get() == E->getRewrittenExpr())
14552 return getDerived().RebuildCXXDefaultArgExpr(E->getUsedLocation(), Param,
14556template<
typename Derived>
14560 getDerived().TransformDecl(E->getBeginLoc(), E->getField()));
14564 if (!getDerived().AlwaysRebuild() && Field == E->getField() &&
14568 return getDerived().RebuildCXXDefaultInitExpr(E->getExprLoc(), Field);
14571template<
typename Derived>
14575 TypeSourceInfo *
T = getDerived().TransformType(E->getTypeSourceInfo());
14579 if (!getDerived().AlwaysRebuild() &&
14580 T == E->getTypeSourceInfo())
14583 return getDerived().RebuildCXXScalarValueInitExpr(
T,
14584 T->getTypeLoc().getEndLoc(),
14585 E->getRParenLoc());
14588template<
typename Derived>
14593 getDerived().TransformTypeWithDeducedTST(E->getAllocatedTypeSourceInfo());
14594 if (!AllocTypeInfo)
14598 std::optional<Expr *> ArraySize;
14599 if (E->isArray()) {
14601 if (std::optional<Expr *> OldArraySize = E->getArraySize()) {
14602 NewArraySize = getDerived().TransformExpr(*OldArraySize);
14603 if (NewArraySize.isInvalid())
14606 ArraySize = NewArraySize.get();
14610 bool ArgumentChanged =
false;
14612 if (getDerived().TransformExprs(E->getPlacementArgs(),
14613 E->getNumPlacementArgs(),
true,
14614 PlacementArgs, &ArgumentChanged))
14618 Expr *OldInit = E->getInitializer();
14621 NewInit = getDerived().TransformInitializer(OldInit,
true);
14622 if (NewInit.isInvalid())
14627 if (E->getOperatorNew()) {
14628 OperatorNew = cast_or_null<FunctionDecl>(
14629 getDerived().TransformDecl(E->getBeginLoc(), E->getOperatorNew()));
14635 if (E->getOperatorDelete()) {
14636 OperatorDelete = cast_or_null<FunctionDecl>(
14637 getDerived().TransformDecl(E->getBeginLoc(), E->getOperatorDelete()));
14638 if (!OperatorDelete)
14642 if (!getDerived().AlwaysRebuild() &&
14643 AllocTypeInfo == E->getAllocatedTypeSourceInfo() &&
14644 ArraySize == E->getArraySize() &&
14645 NewInit.get() == OldInit &&
14646 OperatorNew == E->getOperatorNew() &&
14647 OperatorDelete == E->getOperatorDelete() &&
14648 !ArgumentChanged) {
14653 if (OperatorDelete)
14656 if (E->isArray() && !E->getAllocatedType()->isDependentType()) {
14668 QualType AllocType = AllocTypeInfo->getType();
14679 = dyn_cast<ConstantArrayType>(ArrayT)) {
14683 AllocType = ConsArrayT->getElementType();
14685 = dyn_cast<DependentSizedArrayType>(ArrayT)) {
14686 if (DepArrayT->getSizeExpr()) {
14687 ArraySize = DepArrayT->getSizeExpr();
14688 AllocType = DepArrayT->getElementType();
14693 return getDerived().RebuildCXXNewExpr(
14694 E->getBeginLoc(), E->isGlobalNew(),
14695 E->getBeginLoc(), PlacementArgs,
14696 E->getBeginLoc(), E->getTypeIdParens(), AllocType,
14697 AllocTypeInfo, ArraySize, E->getDirectInitRange(), NewInit.get());
14700template<
typename Derived>
14709 if (E->getOperatorDelete()) {
14710 OperatorDelete = cast_or_null<FunctionDecl>(
14711 getDerived().TransformDecl(E->getBeginLoc(), E->getOperatorDelete()));
14712 if (!OperatorDelete)
14716 if (!getDerived().AlwaysRebuild() &&
14717 Operand.get() == E->getArgument() &&
14718 OperatorDelete == E->getOperatorDelete()) {
14721 if (OperatorDelete)
14724 if (!E->getArgument()->isTypeDependent()) {
14726 E->getDestroyedType());
14727 if (
auto *
Record = Destroyed->getAsCXXRecordDecl())
14735 return getDerived().RebuildCXXDeleteExpr(
14736 E->getBeginLoc(), E->isGlobalDelete(), E->isArrayForm(),
Operand.get());
14739template<
typename Derived>
14744 if (
Base.isInvalid())
14748 bool MayBePseudoDestructor =
false;
14750 E->getOperatorLoc(),
14751 E->isArrow()? tok::arrow : tok::period,
14753 MayBePseudoDestructor);
14754 if (
Base.isInvalid())
14757 QualType ObjectType = ObjectTypePtr.get();
14759 if (QualifierLoc) {
14761 = getDerived().TransformNestedNameSpecifierLoc(QualifierLoc, ObjectType);
14766 SS.
Adopt(QualifierLoc);
14769 if (E->getDestroyedTypeInfo()) {
14770 TypeSourceInfo *DestroyedTypeInfo = getDerived().TransformTypeInObjectScope(
14771 E->getDestroyedTypeInfo(), ObjectType,
14773 if (!DestroyedTypeInfo)
14775 Destroyed = DestroyedTypeInfo;
14776 }
else if (!ObjectType.isNull() && ObjectType->isDependentType()) {
14780 E->getDestroyedTypeLoc());
14784 *E->getDestroyedTypeIdentifier(), E->getDestroyedTypeLoc(),
14785 nullptr, SS, ObjectTypePtr,
false);
14791 E->getDestroyedTypeLoc());
14795 if (E->getScopeTypeInfo()) {
14796 ScopeTypeInfo = getDerived().TransformTypeInObjectScope(
14797 E->getScopeTypeInfo(), ObjectType,
nullptr);
14798 if (!ScopeTypeInfo)
14802 return getDerived().RebuildCXXPseudoDestructorExpr(
Base.get(),
14803 E->getOperatorLoc(),
14807 E->getColonColonLoc(),
14812template <
typename Derived>
14817 bool AllEmptyPacks =
true;
14818 for (
auto *OldD : Old->
decls()) {
14834 if (
auto *UPD = dyn_cast<UsingPackDecl>(InstD))
14835 Decls = UPD->expansions();
14838 for (
auto *D : Decls) {
14839 if (
auto *UD = dyn_cast<UsingDecl>(D)) {
14840 for (
auto *SD : UD->shadows())
14847 AllEmptyPacks &= Decls.empty();
14856 if (AllEmptyPacks && !RequiresADL) {
14868 getSema().FilterAcceptableTemplateNames(R,
14875 diag::err_template_kw_refers_to_non_template)
14879 diag::note_template_kw_refers_to_non_template)
14888template <
typename Derived>
14894template <
typename Derived>
14897 bool IsAddressOfOperand) {
14902 if (TransformOverloadExprDecls(Old, Old->
requiresADL(), R))
14909 = getDerived().TransformNestedNameSpecifierLoc(Old->
getQualifierLoc());
14913 SS.
Adopt(QualifierLoc);
14917 CXXRecordDecl *NamingClass
14918 = cast_or_null<CXXRecordDecl>(getDerived().TransformDecl(
14921 if (!NamingClass) {
14926 R.setNamingClass(NamingClass);
14947 SS, TemplateKWLoc, R,
14954 return getDerived().RebuildDeclarationNameExpr(SS, R, Old->
requiresADL());
14957 return getDerived().RebuildTemplateIdExpr(SS, TemplateKWLoc, R,
14961template<
typename Derived>
14964 bool ArgChanged =
false;
14966 for (
unsigned I = 0, N = E->getNumArgs(); I != N; ++I) {
14968 TypeLoc FromTL = From->getTypeLoc();
14971 TLB.
reserve(FromTL.getFullDataSize());
14972 QualType To = getDerived().TransformType(TLB, FromTL);
14976 if (To == From->getType())
14977 Args.push_back(From);
14979 Args.push_back(TLB.getTypeSourceInfo(SemaRef.
Context, To));
14989 TypeLoc PatternTL = ExpansionTL.getPatternLoc();
14995 bool Expand =
true;
14996 bool RetainExpansion =
false;
14998 ExpansionTL.getTypePtr()->getNumExpansions();
15000 if (getDerived().TryExpandParameterPacks(
15001 ExpansionTL.getEllipsisLoc(), PatternTL.getSourceRange(),
15002 Unexpanded,
true, Expand,
15003 RetainExpansion, NumExpansions))
15013 TLB.
reserve(From->getTypeLoc().getFullDataSize());
15015 QualType To = getDerived().TransformType(TLB, PatternTL);
15019 To = getDerived().RebuildPackExpansionType(To,
15020 PatternTL.getSourceRange(),
15021 ExpansionTL.getEllipsisLoc(),
15029 Args.push_back(TLB.getTypeSourceInfo(SemaRef.
Context, To));
15035 for (
unsigned I = 0; I != *NumExpansions; ++I) {
15038 TLB.
reserve(PatternTL.getFullDataSize());
15039 QualType To = getDerived().TransformType(TLB, PatternTL);
15043 if (To->containsUnexpandedParameterPack()) {
15044 To = getDerived().RebuildPackExpansionType(To,
15045 PatternTL.getSourceRange(),
15046 ExpansionTL.getEllipsisLoc(),
15056 Args.push_back(TLB.getTypeSourceInfo(SemaRef.
Context, To));
15059 if (!RetainExpansion)
15064 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
15067 TLB.
reserve(From->getTypeLoc().getFullDataSize());
15069 QualType To = getDerived().TransformType(TLB, PatternTL);
15073 To = getDerived().RebuildPackExpansionType(To,
15074 PatternTL.getSourceRange(),
15075 ExpansionTL.getEllipsisLoc(),
15083 Args.push_back(TLB.getTypeSourceInfo(SemaRef.
Context, To));
15086 if (!getDerived().AlwaysRebuild() && !ArgChanged)
15089 return getDerived().RebuildTypeTrait(E->getTrait(), E->getBeginLoc(), Args,
15093template<
typename Derived>
15099 if (getDerived().TransformTemplateArguments(Old->getTemplateArgs(),
15100 Old->NumTemplateArgs, TransArgs))
15103 return getDerived().RebuildConceptSpecializationExpr(
15104 E->getNestedNameSpecifierLoc(), E->getTemplateKWLoc(),
15105 E->getConceptNameInfo(), E->getFoundDecl(), E->getNamedConcept(),
15109template<
typename Derived>
15123 getSema().Context, getSema().CurContext,
15124 E->getBody()->getBeginLoc());
15128 ExprResult TypeParamResult = getDerived().TransformRequiresTypeParams(
15129 E->getRequiresKWLoc(), E->getRBraceLoc(), E, Body,
15130 E->getLocalParameters(), TransParamTypes, TransParams, ExtParamInfos);
15134 Param->setDeclContext(Body);
15140 if (!TypeParamResult.isUnset())
15141 return TypeParamResult;
15144 if (getDerived().TransformRequiresExprRequirements(E->getRequirements(),
15149 if (
auto *ER = dyn_cast<concepts::ExprRequirement>(Req)) {
15150 if (ER->getReturnTypeRequirement().isTypeConstraint()) {
15151 ER->getReturnTypeRequirement()
15152 .getTypeConstraintTemplateParameterList()->getParam(0)
15153 ->setDeclContext(Body);
15158 return getDerived().RebuildRequiresExpr(
15159 E->getRequiresKWLoc(), Body, E->getLParenLoc(), TransParams,
15160 E->getRParenLoc(), TransReqs, E->getRBraceLoc());
15163template<
typename Derived>
15169 if (
auto *TypeReq = dyn_cast<concepts::TypeRequirement>(Req))
15170 TransReq =
getDerived().TransformTypeRequirement(TypeReq);
15171 else if (
auto *ExprReq = dyn_cast<concepts::ExprRequirement>(Req))
15172 TransReq =
getDerived().TransformExprRequirement(ExprReq);
15174 TransReq =
getDerived().TransformNestedRequirement(
15178 Transformed.push_back(TransReq);
15183template<
typename Derived>
15196 return getDerived().RebuildTypeRequirement(TransType);
15199template<
typename Derived>
15202 llvm::PointerUnion<Expr *, concepts::Requirement::SubstitutionDiagnostic *> TransExpr;
15208 TransExprRes =
SemaRef.CheckPlaceholderExpr(TransExprRes.
get());
15211 TransExpr = TransExprRes.
get();
15214 std::optional<concepts::ExprRequirement::ReturnTypeRequirement> TransRetReq;
15216 if (RetReq.isEmpty())
15217 TransRetReq.emplace();
15218 else if (RetReq.isSubstitutionFailure())
15219 TransRetReq.emplace(RetReq.getSubstitutionDiagnostic());
15220 else if (RetReq.isTypeConstraint()) {
15222 RetReq.getTypeConstraintTemplateParameterList();
15224 getDerived().TransformTemplateParameterList(OrigTPL);
15227 TransRetReq.emplace(TPL);
15229 assert(TransRetReq &&
"All code paths leading here must set TransRetReq");
15230 if (
Expr *E = dyn_cast<Expr *>(TransExpr))
15233 std::move(*TransRetReq));
15239template<
typename Derived>
15245 return getDerived().RebuildNestedRequirement(
15253 return getDerived().RebuildNestedRequirement(TransConstraint.
get());
15256template<
typename Derived>
15263 if (!getDerived().AlwaysRebuild() &&
15280template<
typename Derived>
15287 SubExpr = getDerived().TransformExpr(E->getQueriedExpression());
15288 if (SubExpr.isInvalid())
15291 if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getQueriedExpression())
15295 return getDerived().RebuildExpressionTrait(E->getTrait(), E->getBeginLoc(),
15296 SubExpr.get(), E->getEndLoc());
15299template <
typename Derived>
15304 DRE, AddrTaken, RecoveryTSI);
15317template <
typename Derived>
15324template <
typename Derived>
15340 getDerived().TransformDeclarationNameInfo(E->
getNameInfo());
15345 if (!getDerived().AlwaysRebuild() && QualifierLoc == E->
getQualifierLoc() &&
15351 return getDerived().RebuildDependentScopeDeclRefExpr(
15352 QualifierLoc, TemplateKWLoc, NameInfo,
nullptr,
15353 IsAddressOfOperand, RecoveryTSI);
15357 if (getDerived().TransformTemplateArguments(
15361 return getDerived().RebuildDependentScopeDeclRefExpr(
15362 QualifierLoc, TemplateKWLoc, NameInfo, &TransArgs, IsAddressOfOperand,
15366template<
typename Derived>
15372 if (getDerived().AllowSkippingCXXConstructExpr() &&
15373 ((E->getNumArgs() == 1 ||
15374 (E->getNumArgs() > 1 && getDerived().DropCallArgument(E->getArg(1)))) &&
15375 (!getDerived().DropCallArgument(E->getArg(0))) &&
15376 !E->isListInitialization()))
15382 QualType T = getDerived().TransformType(E->getType());
15387 getDerived().TransformDecl(E->getBeginLoc(), E->getConstructor()));
15391 bool ArgumentChanged =
false;
15396 E->isListInitialization());
15397 if (getDerived().TransformExprs(E->getArgs(), E->getNumArgs(),
true, Args,
15402 if (!getDerived().AlwaysRebuild() &&
15403 T == E->getType() &&
15405 !ArgumentChanged) {
15412 return getDerived().RebuildCXXConstructExpr(
15413 T, E->getBeginLoc(),
Constructor, E->isElidable(), Args,
15414 E->hadMultipleCandidates(), E->isListInitialization(),
15415 E->isStdInitListInitialization(), E->requiresZeroInitialization(),
15416 E->getConstructionKind(), E->getParenOrBraceRange());
15419template<
typename Derived>
15422 QualType T = getDerived().TransformType(E->getType());
15427 getDerived().TransformDecl(E->getBeginLoc(), E->getConstructor()));
15431 if (!getDerived().AlwaysRebuild() &&
15432 T == E->getType() &&
15440 return getDerived().RebuildCXXInheritedCtorInitExpr(
15442 E->constructsVBase(), E->inheritedFromVBase());
15449template<
typename Derived>
15452 if (
auto *Dtor = E->getTemporary()->getDestructor())
15455 return getDerived().TransformExpr(E->getSubExpr());
15463template<
typename Derived>
15469template<
typename Derived>
15474 getDerived().TransformTypeWithDeducedTST(E->getTypeSourceInfo());
15479 getDerived().TransformDecl(E->getBeginLoc(), E->getConstructor()));
15483 bool ArgumentChanged =
false;
15485 Args.reserve(E->getNumArgs());
15489 E->isListInitialization());
15490 if (TransformExprs(E->getArgs(), E->getNumArgs(),
true, Args,
15494 if (E->isListInitialization() && !E->isStdInitListInitialization()) {
15495 ExprResult Res = RebuildInitList(E->getBeginLoc(), Args, E->getEndLoc());
15496 if (Res.isInvalid())
15498 Args = {Res.get()};
15502 if (!getDerived().AlwaysRebuild() &&
15503 T == E->getTypeSourceInfo() &&
15505 !ArgumentChanged) {
15512 return getDerived().RebuildCXXTemporaryObjectExpr(
15513 T, LParenLoc, Args, E->getEndLoc(), E->isListInitialization());
15516template<
typename Derived>
15521 typedef std::pair<ExprResult, QualType> InitCaptureInfoTy;
15522 struct TransformedInitCapture {
15524 SourceLocation EllipsisLoc;
15526 SmallVector<InitCaptureInfoTy, 4> Expansions;
15529 InitCaptures.resize(E->explicit_capture_end() - E->explicit_capture_begin());
15531 CEnd = E->capture_end();
15533 if (!E->isInitCapture(
C))
15536 TransformedInitCapture &
Result = InitCaptures[
C - E->capture_begin()];
15541 ExprResult NewExprInitResult = getDerived().TransformInitializer(
15544 if (NewExprInitResult.isInvalid()) {
15548 Expr *NewExprInit = NewExprInitResult.get();
15551 getSema().buildLambdaInitCaptureInitialization(
15552 C->getLocation(),
C->getCaptureKind() ==
LCK_ByRef,
15553 EllipsisLoc, NumExpansions, OldVD->getIdentifier(),
15557 Result.Expansions.push_back(
15558 InitCaptureInfoTy(NewExprInit, NewInitCaptureType));
15562 if (OldVD->isParameterPack()) {
15571 bool Expand =
true;
15572 bool RetainExpansion =
false;
15574 ExpansionTL.getTypePtr()->getNumExpansions();
15576 if (getDerived().TryExpandParameterPacks(
15577 ExpansionTL.getEllipsisLoc(), OldVD->getInit()->getSourceRange(),
15578 Unexpanded,
true, Expand,
15579 RetainExpansion, NumExpansions))
15581 assert(!RetainExpansion &&
"Should not need to retain expansion after a "
15582 "capture since it cannot be extended");
15584 for (
unsigned I = 0; I != *NumExpansions; ++I) {
15589 SubstInitCapture(ExpansionTL.getEllipsisLoc(), NumExpansions);
15590 Result.EllipsisLoc = ExpansionTL.getEllipsisLoc();
15627 while (DC->isRequiresExprBody())
15629 if ((getSema().isUnevaluatedContext() ||
15630 getSema().isConstantEvaluatedContext()) &&
15631 (DC->isFileContext() || !DC->getParent()->isDependentContext()))
15636 E->getIntroducerRange(),
nullptr, DependencyKind,
15637 E->getCaptureDefault());
15638 getDerived().transformedLocalDecl(OldClass, {
Class});
15641 getSema().CreateLambdaCallOperator(E->getIntroducerRange(),
Class);
15644 getSema().buildLambdaScope(LSI, NewCallOperator, E->getIntroducerRange(),
15645 E->getCaptureDefault(), E->getCaptureDefaultLoc(),
15646 E->hasExplicitParameters(), E->isMutable());
15656 CEnd = E->capture_end();
15660 if (
C->isImplicit())
15664 if (
C->capturesThis()) {
15672 dyn_cast_if_present<CXXRecordDecl>(
15673 getSema().getFunctionLevelDeclContext()),
15675 getSema().CheckCXXThisCapture(
C->getLocation(),
C->isExplicit(),
15682 if (
C->capturesVLAType())
15686 if (E->isInitCapture(
C)) {
15687 TransformedInitCapture &NewC = InitCaptures[
C - E->capture_begin()];
15692 for (InitCaptureInfoTy &Info : NewC.Expansions) {
15694 QualType InitQualType = Info.second;
15695 if (
Init.isInvalid() || InitQualType.isNull()) {
15699 VarDecl *NewVD = getSema().createLambdaInitCaptureVarDecl(
15700 OldVD->getLocation(), InitQualType, NewC.EllipsisLoc,
15701 OldVD->getIdentifier(), OldVD->getInitStyle(),
Init.get(),
15702 getSema().CurContext);
15707 NewVDs.push_back(NewVD);
15708 getSema().addInitCapture(LSI, NewVD,
C->getCaptureKind() ==
LCK_ByRef);
15713 if (NewC.EllipsisLoc.isInvalid())
15714 LSI->ContainsUnexpandedParameterPack |=
15715 Init.get()->containsUnexpandedParameterPack();
15721 getDerived().transformedLocalDecl(OldVD, NewVDs);
15725 assert(
C->capturesVariable() &&
"unexpected kind of lambda capture");
15733 if (
C->isPackExpansion()) {
15735 bool ShouldExpand =
false;
15736 bool RetainExpansion =
false;
15738 if (getDerived().TryExpandParameterPacks(
15739 C->getEllipsisLoc(),
C->getLocation(), Unexpanded,
15740 true, ShouldExpand,
15741 RetainExpansion, NumExpansions)) {
15746 if (ShouldExpand) {
15751 for (
unsigned I = 0; I != *NumExpansions; ++I) {
15753 ValueDecl *CapturedVar = cast_if_present<ValueDecl>(
15754 getDerived().TransformDecl(
C->getLocation(), Pack));
15755 if (!CapturedVar) {
15761 getSema().tryCaptureVariable(CapturedVar,
C->getLocation(), Kind);
15769 EllipsisLoc =
C->getEllipsisLoc();
15773 auto *CapturedVar = cast_or_null<ValueDecl>(
15774 getDerived().TransformDecl(
C->getLocation(),
C->getCapturedVar()));
15775 if (!CapturedVar || CapturedVar->isInvalidDecl()) {
15782 if (
auto *VD = dyn_cast<VarDecl>(CapturedVar); VD && !
C->isPackExpansion())
15783 LSI->ContainsUnexpandedParameterPack |= VD->isParameterPack();
15786 getSema().tryCaptureVariable(CapturedVar,
C->getLocation(), Kind,
15789 getSema().finishLambdaExplicitCaptures(LSI);
15793 auto TPL = getDerived().TransformTemplateParameterList(
15794 E->getTemplateParameterList());
15795 LSI->GLTemplateParameterList = TPL;
15797 getSema().AddTemplateParametersToLambdaCallOperator(NewCallOperator,
Class,
15799 LSI->ContainsUnexpandedParameterPack |=
15800 TPL->containsUnexpandedParameterPack();
15805 E->getCallOperator()->getTypeSourceInfo()->getTypeLoc();
15807 getDerived().TransformType(NewCallOpTLBuilder, OldCallOpTypeLoc);
15808 if (NewCallOpType.isNull())
15810 LSI->ContainsUnexpandedParameterPack |=
15811 NewCallOpType->containsUnexpandedParameterPack();
15813 NewCallOpTLBuilder.getTypeSourceInfo(getSema().Context, NewCallOpType);
15818 assert(FPTL &&
"Not a FunctionProtoType?");
15821 if (!TRC.ArgPackSubstIndex)
15824 getSema().CompleteLambdaCallOperator(
15825 NewCallOperator, E->getCallOperator()->getLocation(),
15826 E->getCallOperator()->getInnerLocStart(), TRC, NewCallOpTSI,
15827 E->getCallOperator()->getConstexprKind(),
15828 E->getCallOperator()->getStorageClass(), FPTL.getParams(),
15829 E->hasExplicitResultType());
15831 getDerived().transformAttrs(E->getCallOperator(), NewCallOperator);
15832 getDerived().transformedLocalDecl(E->getCallOperator(), {NewCallOperator});
15838 std::optional<CXXRecordDecl::LambdaNumbering> Numbering;
15839 if (getDerived().ReplacingOriginal()) {
15840 Numbering = OldClass->getLambdaNumbering();
15843 getSema().handleLambdaNumbering(
Class, NewCallOperator, Numbering);
15848 getSema().PushExpressionEvaluationContextForFunction(
15850 E->getCallOperator());
15857 C.PointOfInstantiation = E->getBody()->getBeginLoc();
15858 getSema().pushCodeSynthesisContext(
C);
15862 : getDerived().TransformLambdaBody(E, E->getBody());
15864 getSema().popCodeSynthesisContext();
15868 FuncScopeCleanup.disable();
15870 if (Body.isInvalid()) {
15871 SavedContext.pop();
15872 getSema().ActOnLambdaError(E->getBeginLoc(),
nullptr,
15877 getSema().ActOnFinishFunctionBody(NewCallOperator, Body.get(),
15880 SavedContext.pop();
15915 DependencyKind = getDerived().ComputeLambdaDependency(LSI);
15916 Class->setLambdaDependencyKind(DependencyKind);
15918 return getDerived().RebuildLambdaExpr(E->getBeginLoc(),
15919 Body.get()->getEndLoc(), LSI);
15922template<
typename Derived>
15928template<
typename Derived>
15937 if (!
C->isImplicit())
15941 if (
C->capturesThis()) {
15942 getSema().CheckCXXThisCapture(
C->getLocation(),
C->isExplicit(),
15949 if (
C->capturesVLAType())
15952 assert(
C->capturesVariable() &&
"unexpected kind of lambda capture");
15956 VarDecl *CapturedVar = cast_or_null<VarDecl>(
15962 getSema().tryCaptureVariable(CapturedVar,
C->getLocation());
15968template<
typename Derived>
15977 bool ArgumentChanged =
false;
15989 if (!getDerived().AlwaysRebuild() &&
15995 return getDerived().RebuildCXXUnresolvedConstructExpr(
15999template<
typename Derived>
16008 if (!E->isImplicitAccess()) {
16009 OldBase = E->getBase();
16010 Base = getDerived().TransformExpr(OldBase);
16011 if (
Base.isInvalid())
16016 bool MayBePseudoDestructor =
false;
16018 E->getOperatorLoc(),
16019 E->isArrow()? tok::arrow : tok::period,
16021 MayBePseudoDestructor);
16022 if (
Base.isInvalid())
16025 ObjectType = ObjectTy.get();
16026 BaseType = ((
Expr*)
Base.get())->getType();
16029 BaseType = getDerived().TransformType(E->getBaseType());
16036 = getDerived().TransformFirstQualifierInScope(
16037 E->getFirstQualifierFoundInScope(),
16038 E->getQualifierLoc().getBeginLoc());
16041 if (E->getQualifier()) {
16043 = getDerived().TransformNestedNameSpecifierLoc(E->getQualifierLoc(),
16045 FirstQualifierInScope);
16057 = getDerived().TransformDeclarationNameInfo(E->getMemberNameInfo());
16058 if (!NameInfo.getName())
16061 if (!E->hasExplicitTemplateArgs()) {
16064 if (!getDerived().AlwaysRebuild() &&
16065 Base.get() == OldBase &&
16066 BaseType == E->getBaseType() &&
16067 QualifierLoc == E->getQualifierLoc() &&
16068 NameInfo.getName() == E->getMember() &&
16069 FirstQualifierInScope == E->getFirstQualifierFoundInScope())
16072 return getDerived().RebuildCXXDependentScopeMemberExpr(
Base.get(),
16075 E->getOperatorLoc(),
16078 FirstQualifierInScope,
16084 if (getDerived().TransformTemplateArguments(E->getTemplateArgs(),
16085 E->getNumTemplateArgs(),
16089 return getDerived().RebuildCXXDependentScopeMemberExpr(
Base.get(),
16092 E->getOperatorLoc(),
16095 FirstQualifierInScope,
16100template <
typename Derived>
16106 if (!Old->isImplicitAccess()) {
16107 Base = getDerived().TransformExpr(Old->getBase());
16108 if (
Base.isInvalid())
16111 getSema().PerformMemberExprBaseConversion(
Base.get(), Old->isArrow());
16112 if (
Base.isInvalid())
16114 BaseType =
Base.get()->getType();
16116 BaseType = getDerived().TransformType(Old->getBaseType());
16120 if (Old->getQualifierLoc()) {
16122 getDerived().TransformNestedNameSpecifierLoc(Old->getQualifierLoc());
16132 if (TransformOverloadExprDecls(Old,
false, R))
16136 if (Old->getNamingClass()) {
16138 getDerived().TransformDecl(Old->getMemberLoc(), Old->getNamingClass()));
16142 R.setNamingClass(NamingClass);
16146 if (Old->hasExplicitTemplateArgs()) {
16147 TransArgs.setLAngleLoc(Old->getLAngleLoc());
16148 TransArgs.setRAngleLoc(Old->getRAngleLoc());
16149 if (getDerived().TransformTemplateArguments(
16150 Old->getTemplateArgs(), Old->getNumTemplateArgs(), TransArgs))
16158 NamedDecl *FirstQualifierInScope =
nullptr;
16160 return getDerived().RebuildUnresolvedMemberExpr(
16161 Base.get(), BaseType, Old->getOperatorLoc(), Old->isArrow(), QualifierLoc,
16162 TemplateKWLoc, FirstQualifierInScope, R,
16163 (Old->hasExplicitTemplateArgs() ? &TransArgs :
nullptr));
16166template<
typename Derived>
16171 ExprResult SubExpr = getDerived().TransformExpr(E->getOperand());
16172 if (SubExpr.isInvalid())
16175 if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getOperand())
16178 return getDerived().RebuildCXXNoexceptExpr(E->getSourceRange(),SubExpr.get());
16181template<
typename Derived>
16184 ExprResult Pattern = getDerived().TransformExpr(E->getPattern());
16185 if (Pattern.isInvalid())
16188 if (!getDerived().AlwaysRebuild() && Pattern.get() == E->getPattern())
16191 return getDerived().RebuildPackExpansion(Pattern.get(), E->getEllipsisLoc(),
16192 E->getNumExpansions());
16195template <
typename Derived>
16200 if (!Arg.isPackExpansion()) {
16212 getSema().getTemplateArgumentPackExpansionPattern(ArgLoc, Ellipsis,
16213 OrigNumExpansions);
16225 if (!NumExpansions) {
16237template<
typename Derived>
16256 bool ShouldExpand =
false;
16257 bool RetainExpansion =
false;
16258 UnsignedOrNone NumExpansions = std::nullopt;
16259 if (getDerived().TryExpandParameterPacks(
16261 true, ShouldExpand,
16262 RetainExpansion, NumExpansions))
16267 if (ShouldExpand) {
16269 if (
auto *TTPD = dyn_cast<TemplateTypeParmDecl>(Pack)) {
16270 ArgStorage = getSema().Context.getPackExpansionType(
16271 getSema().Context.getTypeDeclType(TTPD), std::nullopt);
16272 }
else if (
auto *TTPD = dyn_cast<TemplateTemplateParmDecl>(Pack)) {
16276 ExprResult DRE = getSema().BuildDeclRefExpr(
16277 VD, VD->getType().getNonLValueExprType(getSema().Context),
16280 if (DRE.isInvalid())
16283 new (getSema().Context)
16287 PackArgs = ArgStorage;
16292 if (!PackArgs.size()) {
16293 auto *Pack = cast_or_null<NamedDecl>(
16297 return getDerived().RebuildSizeOfPackExpr(
16304 getDerived().ComputeSizeOfPackExprWithoutSubstitution(PackArgs);
16316 TemporaryBase Rebase(*
this, E->
getPackLoc(), getBaseEntity());
16319 if (TransformTemplateArguments(PackLocIterator(*
this, PackArgs.begin()),
16320 PackLocIterator(*
this, PackArgs.end()),
16321 TransformedPackArgs,
true))
16328 bool PartialSubstitution =
false;
16329 for (
auto &Loc : TransformedPackArgs.arguments()) {
16330 Args.push_back(Loc.getArgument());
16331 if (Loc.getArgument().isPackExpansion())
16332 PartialSubstitution =
true;
16335 if (PartialSubstitution)
16336 return getDerived().RebuildSizeOfPackExpr(
16338 std::nullopt, Args);
16340 return getDerived().RebuildSizeOfPackExpr(
16342 static_cast<unsigned>(Args.size()),
16346template <
typename Derived>
16349 if (!E->isValueDependent())
16357 IndexExpr = getDerived().TransformExpr(E->getIndexExpr());
16358 if (IndexExpr.isInvalid())
16363 bool FullySubstituted =
true;
16364 if (!E->expandsToEmptyPack() && E->getExpressions().empty()) {
16365 Expr *Pattern = E->getPackIdExpression();
16367 getSema().collectUnexpandedParameterPacks(E->getPackIdExpression(),
16369 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
16373 bool ShouldExpand =
true;
16374 bool RetainExpansion =
false;
16376 NumExpansions = std::nullopt;
16377 if (getDerived().TryExpandParameterPacks(
16378 E->getEllipsisLoc(), Pattern->getSourceRange(), Unexpanded,
16379 true, ShouldExpand,
16380 RetainExpansion, NumExpansions))
16382 if (!ShouldExpand) {
16384 ExprResult Pack = getDerived().TransformExpr(Pattern);
16385 if (Pack.isInvalid())
16387 return getDerived().RebuildPackIndexingExpr(
16388 E->getEllipsisLoc(), E->getRSquareLoc(), Pack.get(), IndexExpr.get(),
16391 for (
unsigned I = 0; I != *NumExpansions; ++I) {
16394 if (
Out.isInvalid())
16396 if (
Out.get()->containsUnexpandedParameterPack()) {
16397 Out = getDerived().RebuildPackExpansion(
Out.get(), E->getEllipsisLoc(),
16398 OrigNumExpansions);
16399 if (
Out.isInvalid())
16401 FullySubstituted =
false;
16403 ExpandedExprs.push_back(
Out.get());
16407 if (RetainExpansion) {
16408 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
16411 if (
Out.isInvalid())
16414 Out = getDerived().RebuildPackExpansion(
Out.get(), E->getEllipsisLoc(),
16415 OrigNumExpansions);
16416 if (
Out.isInvalid())
16418 FullySubstituted =
false;
16419 ExpandedExprs.push_back(
Out.get());
16421 }
else if (!E->expandsToEmptyPack()) {
16422 if (getDerived().TransformExprs(E->getExpressions().data(),
16423 E->getExpressions().size(),
false,
16428 return getDerived().RebuildPackIndexingExpr(
16429 E->getEllipsisLoc(), E->getRSquareLoc(), E->getPackIdExpression(),
16430 IndexExpr.get(), ExpandedExprs, FullySubstituted);
16433template <
typename Derived>
16436 if (!getSema().ArgPackSubstIndex)
16443 E->getAssociatedDecl(), E->getParameterPack(),
16444 E->getParameterPackLocation(), Arg, SemaRef.
getPackIndex(Pack),
16448template <
typename Derived>
16452 ExprResult Replacement = getDerived().TransformExpr(OrigReplacement);
16453 if (Replacement.isInvalid())
16456 Decl *AssociatedDecl =
16457 getDerived().TransformDecl(E->getNameLoc(), E->getAssociatedDecl());
16458 if (!AssociatedDecl)
16461 if (Replacement.get() == OrigReplacement &&
16462 AssociatedDecl == E->getAssociatedDecl())
16465 auto getParamAndType = [E](
Decl *AssociatedDecl)
16466 -> std::tuple<NonTypeTemplateParmDecl *, QualType> {
16467 auto [PDecl, Arg] =
16471 return {Param, Param->getType()};
16473 Arg = Arg.getPackAsArray()[*PackIndex];
16474 return {Param, Arg.getNonTypeTemplateArgumentType()};
16480 if (
auto [Param, ParamType] = getParamAndType(AssociatedDecl);
16482 ParamType, std::get<1>(getParamAndType(E->getAssociatedDecl()))) ||
16483 Replacement.get() != OrigReplacement) {
16490 Param, ParamType, Replacement.get(), SugaredConverted,
16491 CanonicalConverted,
16493 if (Replacement.isInvalid())
16497 Replacement = E->getReplacement();
16501 Replacement.get()->getType(), Replacement.get()->getValueKind(),
16502 E->getNameLoc(), Replacement.get(), AssociatedDecl, E->getIndex(),
16503 E->getPackIndex(), E->isReferenceParameter(), E->getFinal());
16506template<
typename Derived>
16513template<
typename Derived>
16520template<
typename Derived>
16524 if (
Expr *OldCallee = E->getCallee()) {
16525 ExprResult CalleeResult = getDerived().TransformExpr(OldCallee);
16526 if (CalleeResult.isInvalid())
16531 Expr *Pattern = E->getPattern();
16534 getSema().collectUnexpandedParameterPacks(Pattern, Unexpanded);
16535 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
16539 bool Expand =
true;
16540 bool RetainExpansion =
false;
16542 NumExpansions = OrigNumExpansions;
16543 if (getDerived().TryExpandParameterPacks(
16544 E->getEllipsisLoc(), Pattern->getSourceRange(), Unexpanded,
16545 true, Expand, RetainExpansion,
16555 E->getLHS() ? getDerived().TransformExpr(E->getLHS()) :
ExprResult();
16556 if (LHS.isInvalid())
16560 E->getRHS() ? getDerived().TransformExpr(E->getRHS()) :
ExprResult();
16561 if (RHS.isInvalid())
16564 if (!getDerived().AlwaysRebuild() &&
16565 LHS.get() == E->getLHS() && RHS.get() == E->getRHS())
16568 return getDerived().RebuildCXXFoldExpr(
16569 Callee, E->getBeginLoc(), LHS.get(), E->getOperator(),
16570 E->getEllipsisLoc(), RHS.get(), E->getEndLoc(), NumExpansions);
16576 if (NumExpansions && SemaRef.
getLangOpts().BracketDepth < *NumExpansions) {
16577 SemaRef.
Diag(E->getEllipsisLoc(),
16578 clang::diag::err_fold_expression_limit_exceeded)
16579 << *NumExpansions << SemaRef.
getLangOpts().BracketDepth
16580 << E->getSourceRange();
16581 SemaRef.
Diag(E->getEllipsisLoc(), diag::note_bracket_depth);
16590 bool LeftFold = E->isLeftFold();
16594 if (!LeftFold && RetainExpansion) {
16595 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
16598 if (
Out.isInvalid())
16601 Result = getDerived().RebuildCXXFoldExpr(
16602 Callee, E->getBeginLoc(),
Out.get(), E->getOperator(),
16603 E->getEllipsisLoc(),
Result.get(), E->getEndLoc(), OrigNumExpansions);
16608 bool WarnedOnComparison =
false;
16609 for (
unsigned I = 0; I != *NumExpansions; ++I) {
16611 getSema(), LeftFold ? I : *NumExpansions - I - 1);
16613 if (
Out.isInvalid())
16616 if (
Out.get()->containsUnexpandedParameterPack()) {
16618 Result = getDerived().RebuildCXXFoldExpr(
16619 Callee, E->getBeginLoc(), LeftFold ?
Result.get() :
Out.get(),
16620 E->getOperator(), E->getEllipsisLoc(),
16621 LeftFold ?
Out.get() :
Result.get(), E->getEndLoc(),
16622 OrigNumExpansions);
16623 }
else if (
Result.isUsable()) {
16630 Result = getDerived().RebuildCXXOperatorCallExpr(
16632 E->getEllipsisLoc(),
Callee->getBeginLoc(),
Callee->requiresADL(),
16633 Functions, LHS, RHS);
16635 Result = getDerived().RebuildBinaryOperator(E->getEllipsisLoc(),
16636 E->getOperator(), LHS, RHS,
16638 if (!WarnedOnComparison &&
Result.isUsable()) {
16639 if (
auto *BO = dyn_cast<BinaryOperator>(
Result.get());
16640 BO && BO->isComparisonOp()) {
16641 WarnedOnComparison =
true;
16642 SemaRef.
Diag(BO->getBeginLoc(),
16643 diag::warn_comparison_in_fold_expression)
16644 << BO->getOpcodeStr();
16657 if (LeftFold && RetainExpansion) {
16658 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
16661 if (
Out.isInvalid())
16664 Result = getDerived().RebuildCXXFoldExpr(
16665 Callee, E->getBeginLoc(),
Result.get(), E->getOperator(),
16666 E->getEllipsisLoc(),
Out.get(), E->getEndLoc(), OrigNumExpansions);
16672 PE->setIsProducedByFoldExpansion();
16677 return getDerived().RebuildEmptyCXXFoldExpr(E->getEllipsisLoc(),
16682template <
typename Derived>
16688 QualType T = getDerived().TransformType(E->getType());
16690 bool ArgChanged =
false;
16692 if (getDerived().TransformExprs(InitExprs.data(), InitExprs.size(),
true,
16693 TransformedInits, &ArgChanged))
16696 if (!getDerived().AlwaysRebuild() && !ArgChanged &&
T == E->getType())
16699 return getDerived().RebuildCXXParenListInitExpr(
16700 TransformedInits,
T, E->getUserSpecifiedInitExprs().size(),
16701 E->getInitLoc(), E->getBeginLoc(), E->getEndLoc());
16704template<
typename Derived>
16711template<
typename Derived>
16717template<
typename Derived>
16723template<
typename Derived>
16726 ExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
16727 if (SubExpr.isInvalid())
16730 if (!getDerived().AlwaysRebuild() &&
16731 SubExpr.get() == E->getSubExpr())
16734 return getDerived().RebuildObjCBoxedExpr(E->getSourceRange(), SubExpr.get());
16737template<
typename Derived>
16742 bool ArgChanged =
false;
16743 if (getDerived().TransformExprs(E->getElements(), E->getNumElements(),
16744 false, Elements, &ArgChanged))
16747 if (!getDerived().AlwaysRebuild() && !ArgChanged)
16750 return getDerived().RebuildObjCArrayLiteral(E->getSourceRange(),
16755template<
typename Derived>
16761 bool ArgChanged =
false;
16762 for (
unsigned I = 0, N = E->getNumElements(); I != N; ++I) {
16765 if (OrigElement.isPackExpansion()) {
16768 getSema().collectUnexpandedParameterPacks(OrigElement.Key, Unexpanded);
16769 getSema().collectUnexpandedParameterPacks(OrigElement.Value, Unexpanded);
16770 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
16774 bool Expand =
true;
16775 bool RetainExpansion =
false;
16778 SourceRange PatternRange(OrigElement.Key->getBeginLoc(),
16779 OrigElement.Value->getEndLoc());
16780 if (getDerived().TryExpandParameterPacks(
16781 OrigElement.EllipsisLoc, PatternRange, Unexpanded,
16782 true, Expand, RetainExpansion,
16791 ExprResult Key = getDerived().TransformExpr(OrigElement.Key);
16792 if (Key.isInvalid())
16795 if (Key.get() != OrigElement.Key)
16799 if (
Value.isInvalid())
16806 Key.get(),
Value.get(), OrigElement.EllipsisLoc, NumExpansions
16808 Elements.push_back(Expansion);
16818 for (
unsigned I = 0; I != *NumExpansions; ++I) {
16820 ExprResult Key = getDerived().TransformExpr(OrigElement.Key);
16821 if (Key.isInvalid())
16825 if (
Value.isInvalid())
16835 if (Key.get()->containsUnexpandedParameterPack() ||
16836 Value.get()->containsUnexpandedParameterPack())
16837 Element.EllipsisLoc = OrigElement.EllipsisLoc;
16839 Elements.push_back(Element);
16849 ExprResult Key = getDerived().TransformExpr(OrigElement.Key);
16850 if (Key.isInvalid())
16853 if (Key.get() != OrigElement.Key)
16858 = getDerived().TransformExpr(OrigElement.Value);
16859 if (
Value.isInvalid())
16867 Elements.push_back(Element);
16870 if (!getDerived().AlwaysRebuild() && !ArgChanged)
16873 return getDerived().RebuildObjCDictionaryLiteral(E->getSourceRange(),
16877template<
typename Derived>
16881 = getDerived().TransformType(E->getEncodedTypeSourceInfo());
16882 if (!EncodedTypeInfo)
16885 if (!getDerived().AlwaysRebuild() &&
16886 EncodedTypeInfo == E->getEncodedTypeSourceInfo())
16889 return getDerived().RebuildObjCEncodeExpr(E->getAtLoc(),
16891 E->getRParenLoc());
16894template<
typename Derived>
16904template<
typename Derived>
16908 = getDerived().TransformType(E->getTypeInfoAsWritten());
16916 if (!getDerived().AlwaysRebuild() &&
16917 TSInfo == E->getTypeInfoAsWritten() &&
16918 Result.get() == E->getSubExpr())
16922 E->getLParenLoc(), E->getBridgeKind(), E->getBridgeKeywordLoc(), TSInfo,
16926template <
typename Derived>
16932template<
typename Derived>
16936 bool ArgChanged =
false;
16938 Args.reserve(E->getNumArgs());
16939 if (getDerived().TransformExprs(E->getArgs(), E->getNumArgs(),
false, Args,
16946 = getDerived().TransformType(E->getClassReceiverTypeInfo());
16947 if (!ReceiverTypeInfo)
16951 if (!getDerived().AlwaysRebuild() &&
16952 ReceiverTypeInfo == E->getClassReceiverTypeInfo() && !ArgChanged)
16957 E->getSelectorLocs(SelLocs);
16958 return getDerived().RebuildObjCMessageExpr(ReceiverTypeInfo,
16961 E->getMethodDecl(),
16968 if (!E->getMethodDecl())
16973 E->getSelectorLocs(SelLocs);
16974 return getDerived().RebuildObjCMessageExpr(E->getSuperLoc(),
16977 E->getReceiverType(),
16978 E->getMethodDecl(),
16986 "Only class and instance messages may be instantiated");
16988 = getDerived().TransformExpr(E->getInstanceReceiver());
16989 if (Receiver.isInvalid())
16993 if (!getDerived().AlwaysRebuild() &&
16994 Receiver.get() == E->getInstanceReceiver() && !ArgChanged)
16999 E->getSelectorLocs(SelLocs);
17000 return getDerived().RebuildObjCMessageExpr(Receiver.get(),
17003 E->getMethodDecl(),
17009template<
typename Derived>
17015template<
typename Derived>
17021template<
typename Derived>
17026 if (
Base.isInvalid())
17032 if (!getDerived().AlwaysRebuild() &&
17033 Base.get() == E->getBase())
17036 return getDerived().RebuildObjCIvarRefExpr(
Base.get(), E->getDecl(),
17038 E->isArrow(), E->isFreeIvar());
17041template<
typename Derived>
17046 if (!E->isObjectReceiver())
17051 if (
Base.isInvalid())
17057 if (!getDerived().AlwaysRebuild() &&
17058 Base.get() == E->getBase())
17061 if (E->isExplicitProperty())
17062 return getDerived().RebuildObjCPropertyRefExpr(
Base.get(),
17063 E->getExplicitProperty(),
17066 return getDerived().RebuildObjCPropertyRefExpr(
Base.get(),
17068 E->getImplicitPropertyGetter(),
17069 E->getImplicitPropertySetter(),
17073template<
typename Derived>
17078 if (
Base.isInvalid())
17082 ExprResult Key = getDerived().TransformExpr(E->getKeyExpr());
17083 if (Key.isInvalid())
17087 if (!getDerived().AlwaysRebuild() &&
17088 Key.get() == E->getKeyExpr() &&
Base.get() == E->getBaseExpr())
17091 return getDerived().RebuildObjCSubscriptRefExpr(E->getRBracket(),
17092 Base.get(), Key.get(),
17093 E->getAtIndexMethodDecl(),
17094 E->setAtIndexMethodDecl());
17097template<
typename Derived>
17102 if (
Base.isInvalid())
17106 if (!getDerived().AlwaysRebuild() &&
17107 Base.get() == E->getBase())
17110 return getDerived().RebuildObjCIsaExpr(
Base.get(), E->getIsaMemberLoc(),
17115template<
typename Derived>
17118 bool ArgumentChanged =
false;
17120 SubExprs.reserve(E->getNumSubExprs());
17121 if (getDerived().TransformExprs(E->getSubExprs(), E->getNumSubExprs(),
false,
17122 SubExprs, &ArgumentChanged))
17125 if (!getDerived().AlwaysRebuild() &&
17129 return getDerived().RebuildShuffleVectorExpr(E->getBuiltinLoc(),
17131 E->getRParenLoc());
17134template<
typename Derived>
17137 ExprResult SrcExpr = getDerived().TransformExpr(E->getSrcExpr());
17138 if (SrcExpr.isInvalid())
17145 if (!getDerived().AlwaysRebuild() &&
17146 Type == E->getTypeSourceInfo() &&
17147 SrcExpr.get() == E->getSrcExpr())
17150 return getDerived().RebuildConvertVectorExpr(E->getBuiltinLoc(),
17151 SrcExpr.get(),
Type,
17152 E->getRParenLoc());
17155template<
typename Derived>
17158 BlockDecl *oldBlock = E->getBlockDecl();
17164 blockScope->TheDecl->setBlockMissingReturnType(
17165 oldBlock->blockMissingReturnType());
17174 if (getDerived().TransformFunctionTypeParams(
17175 E->getCaretLocation(), oldBlock->parameters(),
nullptr,
17176 exprFunctionType->getExtParameterInfosOrNull(), paramTypes, ¶ms,
17178 getSema().ActOnBlockError(E->getCaretLocation(),
nullptr);
17183 getDerived().TransformType(exprFunctionType->getReturnType());
17185 auto epi = exprFunctionType->getExtProtoInfo();
17186 epi.ExtParameterInfos = extParamInfos.getPointerOrNull(paramTypes.size());
17189 getDerived().RebuildFunctionProtoType(exprResultType, paramTypes, epi);
17193 if (!params.empty())
17194 blockScope->TheDecl->setParams(params);
17196 if (!oldBlock->blockMissingReturnType()) {
17197 blockScope->HasImplicitReturnType =
false;
17198 blockScope->ReturnType = exprResultType;
17202 StmtResult body = getDerived().TransformStmt(E->getBody());
17203 if (body.isInvalid()) {
17204 getSema().ActOnBlockError(E->getCaretLocation(),
nullptr);
17212 for (
const auto &I : oldBlock->captures()) {
17213 VarDecl *oldCapture = I.getVariable();
17216 if (oldCapture->isParameterPack())
17220 cast<VarDecl>(getDerived().TransformDecl(E->getCaretLocation(),
17222 assert(blockScope->CaptureMap.count(newCapture));
17228 assert((!blockScope->isCXXThisCaptured() || oldBlock->capturesCXXThis()) &&
17229 "this pointer isn't captured in the old block");
17237template<
typename Derived>
17240 ExprResult SrcExpr = getDerived().TransformExpr(E->getSrcExpr());
17241 if (SrcExpr.isInvalid())
17244 QualType Type = getDerived().TransformType(E->getType());
17247 E->getRParenLoc());
17250template<
typename Derived>
17253 bool ArgumentChanged =
false;
17255 SubExprs.reserve(E->getNumSubExprs());
17256 if (getDerived().TransformExprs(E->getSubExprs(), E->getNumSubExprs(),
false,
17257 SubExprs, &ArgumentChanged))
17260 if (!getDerived().AlwaysRebuild() &&
17264 return getDerived().RebuildAtomicExpr(E->getBuiltinLoc(), SubExprs,
17265 E->getOp(), E->getRParenLoc());
17272template<
typename Derived>
17275 return SemaRef.BuildPointerType(PointeeType,
Star,
17279template<
typename Derived>
17282 return SemaRef.BuildBlockPointerType(PointeeType,
Star,
17286template<
typename Derived>
17289 bool WrittenAsLValue,
17291 return SemaRef.BuildReferenceType(ReferentType, WrittenAsLValue,
17295template <
typename Derived>
17299 return SemaRef.BuildMemberPointerType(PointeeType, SS, Cls, Sigil,
17303template<
typename Derived>
17310 return SemaRef.ObjC().BuildObjCTypeParamType(
17311 Decl, ProtocolLAngleLoc, Protocols, ProtocolLocs, ProtocolRAngleLoc,
17315template<
typename Derived>
17326 return SemaRef.ObjC().BuildObjCObjectType(
17327 BaseType, Loc, TypeArgsLAngleLoc, TypeArgs, TypeArgsRAngleLoc,
17328 ProtocolLAngleLoc, Protocols, ProtocolLocs, ProtocolRAngleLoc,
17333template<
typename Derived>
17337 return SemaRef.Context.getObjCObjectPointerType(PointeeType);
17340template <
typename Derived>
17343 Expr *SizeExpr,
unsigned IndexTypeQuals,
SourceRange BracketsRange) {
17344 if (SizeExpr || !Size)
17345 return SemaRef.BuildArrayType(ElementType, SizeMod, SizeExpr,
17346 IndexTypeQuals, BracketsRange,
17350 SemaRef.Context.UnsignedCharTy,
SemaRef.Context.UnsignedShortTy,
17352 SemaRef.Context.UnsignedLongLongTy,
SemaRef.Context.UnsignedInt128Ty
17355 for (
const auto &
T : Types)
17356 if (Size->getBitWidth() ==
SemaRef.Context.getIntWidth(
T)) {
17366 return SemaRef.BuildArrayType(ElementType, SizeMod, ArraySize,
17367 IndexTypeQuals, BracketsRange,
17371template <
typename Derived>
17374 Expr *SizeExpr,
unsigned IndexTypeQuals,
SourceRange BracketsRange) {
17375 return getDerived().RebuildArrayType(ElementType, SizeMod, &Size, SizeExpr,
17376 IndexTypeQuals, BracketsRange);
17379template <
typename Derived>
17383 return getDerived().RebuildArrayType(ElementType, SizeMod,
nullptr,
nullptr,
17384 IndexTypeQuals, BracketsRange);
17387template <
typename Derived>
17390 unsigned IndexTypeQuals,
SourceRange BracketsRange) {
17391 return getDerived().RebuildArrayType(ElementType, SizeMod,
nullptr,
17393 IndexTypeQuals, BracketsRange);
17396template <
typename Derived>
17399 unsigned IndexTypeQuals,
SourceRange BracketsRange) {
17400 return getDerived().RebuildArrayType(ElementType, SizeMod,
nullptr,
17402 IndexTypeQuals, BracketsRange);
17405template <
typename Derived>
17408 return SemaRef.BuildAddressSpaceAttr(PointeeType, AddrSpaceExpr,
17412template <
typename Derived>
17414 unsigned NumElements,
17417 return SemaRef.Context.getVectorType(ElementType, NumElements, VecKind);
17420template <
typename Derived>
17424 return SemaRef.BuildVectorType(ElementType, SizeExpr, AttributeLoc);
17427template<
typename Derived>
17429 unsigned NumElements,
17431 llvm::APInt numElements(
SemaRef.Context.getIntWidth(
SemaRef.Context.IntTy),
17432 NumElements,
true);
17436 return SemaRef.BuildExtVectorType(ElementType, VectorSize, AttributeLoc);
17439template<
typename Derived>
17444 return SemaRef.BuildExtVectorType(ElementType, SizeExpr, AttributeLoc);
17447template <
typename Derived>
17449 QualType ElementType,
unsigned NumRows,
unsigned NumColumns) {
17450 return SemaRef.Context.getConstantMatrixType(ElementType, NumRows,
17454template <
typename Derived>
17458 return SemaRef.BuildMatrixType(ElementType, RowExpr, ColumnExpr,
17462template <
typename Derived>
17466 return SemaRef.BuildFunctionType(
T, ParamTypes,
17472template<
typename Derived>
17474 return SemaRef.Context.getFunctionNoProtoType(
T);
17477template <
typename Derived>
17481 assert(D &&
"no decl found");
17485 if (
auto *UPD = dyn_cast<UsingPackDecl>(D)) {
17489 if (UPD->expansions().empty()) {
17490 getSema().Diag(NameLoc, diag::err_using_pack_expansion_empty)
17491 << UPD->isCXXClassMember() << UPD;
17500 for (
auto *E : UPD->expansions()) {
17507 else if (
T.isNull())
17510 assert(
getSema().Context.hasSameType(ThisT,
T) &&
17511 "mismatched resolved types in using pack expansion");
17513 return T.isNull() ? FallbackT :
T;
17515 if (
auto *Using = dyn_cast<UsingDecl>(D)) {
17516 assert(Using->hasTypename() &&
17517 "UnresolvedUsingTypenameDecl transformed to non-typename using");
17520 assert(++Using->shadow_begin() == Using->shadow_end());
17525 return SemaRef.Context.getUsingType(
Keyword, Qualifier, Shadow);
17528 "UnresolvedUsingTypenameDecl transformed to non-using decl");
17529 return SemaRef.Context.getUnresolvedUsingType(
17533template <
typename Derived>
17536 return SemaRef.BuildTypeofExprType(E, Kind);
17539template<
typename Derived>
17542 return SemaRef.Context.getTypeOfType(Underlying, Kind);
17545template <
typename Derived>
17547 return SemaRef.BuildDecltypeType(E);
17550template <
typename Derived>
17555 return SemaRef.BuildPackIndexingType(Pattern, IndexExpr, Loc, EllipsisLoc,
17556 FullySubstituted, Expansions);
17559template<
typename Derived>
17561 UnaryTransformType::UTTKind UKind,
17563 return SemaRef.BuildUnaryTransformType(BaseType, UKind, Loc);
17566template <
typename Derived>
17570 return SemaRef.CheckTemplateIdType(
17575template<
typename Derived>
17578 return SemaRef.BuildAtomicType(ValueType, KWLoc);
17581template<
typename Derived>
17585 return isReadPipe ?
SemaRef.BuildReadPipeType(ValueType, KWLoc)
17586 :
SemaRef.BuildWritePipeType(ValueType, KWLoc);
17589template <
typename Derived>
17593 llvm::APInt NumBitsAP(
SemaRef.Context.getIntWidth(
SemaRef.Context.IntTy),
17597 return SemaRef.BuildBitIntType(IsUnsigned, Bits, Loc);
17600template <
typename Derived>
17603 return SemaRef.BuildBitIntType(IsUnsigned, NumBitsExpr, Loc);
17606template <
typename Derived>
17614template <
typename Derived>
17621 getSema().ActOnTemplateName(
nullptr, SS, TemplateKWLoc,
17624 AllowInjectedClassName);
17628template<
typename Derived>
17635 bool AllowInjectedClassName) {
17638 SourceLocation SymbolLocations[3] = { NameLoc, NameLoc, NameLoc };
17643 false,
Template, AllowInjectedClassName);
17647template <
typename Derived>
17652 bool isPostIncDec = Second && (Op == OO_PlusPlus || Op == OO_MinusMinus);
17657 return SemaRef.PseudoObject().checkAssignment(
nullptr, OpLoc,
17658 Opc,
First, Second);
17673 if (Op == OO_Subscript) {
17674 if (!
First->getType()->isOverloadableType() &&
17676 return getSema().CreateBuiltinArraySubscriptExpr(
First, CalleeLoc, Second,
17678 }
else if (Op == OO_Arrow) {
17681 if (
First->getType()->isDependentType())
17684 return SemaRef.BuildOverloadedArrowExpr(
nullptr,
First, OpLoc);
17685 }
else if (Second ==
nullptr || isPostIncDec) {
17686 if (!
First->getType()->isOverloadableType() ||
17687 (Op == OO_Amp &&
getSema().isQualifiedMemberAccess(
First))) {
17694 return getSema().CreateBuiltinUnaryOp(OpLoc, Opc,
First);
17698 !
First->getType()->isOverloadableType() &&
17704 =
SemaRef.CreateBuiltinBinOp(OpLoc, Opc,
First, Second);
17713 if (!Second || isPostIncDec) {
17716 return SemaRef.CreateOverloadedUnaryOp(OpLoc, Opc, Functions,
First,
17723 First, Second, RequiresADL);
17730template<
typename Derived>
17740 QualType CanonicalBaseType =
Base->getType().getCanonicalType();
17746 ->getAsCanonical<RecordType>())) {
17748 return SemaRef.BuildPseudoDestructorExpr(
17749 Base, OperatorLoc, isArrow ? tok::arrow : tok::period, SS, ScopeType,
17750 CCLoc, TildeLoc, Destroyed);
17762 if (!
isa<TagType>(ScopeType->getType().getCanonicalType())) {
17763 getSema().Diag(ScopeType->getTypeLoc().getBeginLoc(),
17764 diag::err_expected_class_or_namespace)
17765 << ScopeType->getType() <<
getSema().getLangOpts().CPlusPlus;
17769 SS.
Make(
SemaRef.Context, ScopeType->getTypeLoc(), CCLoc);
17773 return getSema().BuildMemberReferenceExpr(
17774 Base,
Base->getType(), OperatorLoc, isArrow, SS, TemplateKWLoc,
17780template<
typename Derived>
17788 for (
unsigned I = 0; I < NumParams; ++I) {
17789 if (I != ContextParamPos) {
17795 Params.push_back(std::make_pair(StringRef(), QualType()));
17798 getSema().ActOnCapturedRegionStart(Loc,
nullptr,
17806 if (Body.isInvalid()) {
17807 getSema().ActOnCapturedRegionError();
17811 return getSema().ActOnCapturedRegionEnd(Body.get());
17814template <
typename Derived>
17820 llvm_unreachable(
"SYCL kernel call statement cannot appear in dependent "
17824template <
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 * ActOnOpenMPToClause(ArrayRef< OpenMPMotionModifierKind > MotionModifiers, ArrayRef< SourceLocation > MotionModifiersLoc, CXXScopeSpec &MapperIdScopeSpec, DeclarationNameInfo &MapperId, SourceLocation ColonLoc, ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs, ArrayRef< Expr * > UnresolvedMappers={})
Called on well-formed 'to' clause.
OMPClause * ActOnOpenMPPrivateClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'private' clause.
OMPClause * ActOnOpenMPOrderedClause(SourceLocation StartLoc, SourceLocation EndLoc, SourceLocation LParenLoc=SourceLocation(), Expr *NumForLoops=nullptr)
Called on well-formed 'ordered' clause.
OMPClause * ActOnOpenMPIsDevicePtrClause(ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs)
Called on well-formed 'is_device_ptr' clause.
OMPClause * ActOnOpenMPHasDeviceAddrClause(ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs)
Called on well-formed 'has_device_addr' clause.
OMPClause * ActOnOpenMPPartialClause(Expr *FactorExpr, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-form 'partial' clauses.
OMPClause * ActOnOpenMPLastprivateClause(ArrayRef< Expr * > VarList, OpenMPLastprivateModifier LPKind, SourceLocation LPKindLoc, SourceLocation ColonLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'lastprivate' clause.
OMPClause * ActOnOpenMPFirstprivateClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'firstprivate' clause.
OMPClause * ActOnOpenMPPriorityClause(Expr *Priority, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'priority' clause.
OMPClause * ActOnOpenMPDistScheduleClause(OpenMPDistScheduleClauseKind Kind, Expr *ChunkSize, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation KindLoc, SourceLocation CommaLoc, SourceLocation EndLoc)
Called on well-formed 'dist_schedule' clause.
OMPClause * ActOnOpenMPLoopRangeClause(Expr *First, Expr *Count, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation FirstLoc, SourceLocation CountLoc, SourceLocation EndLoc)
Called on well-form 'looprange' clause after parsing its arguments.
OMPClause * ActOnOpenMPPermutationClause(ArrayRef< Expr * > PermExprs, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-form 'permutation' clause after parsing its arguments.
OMPClause * ActOnOpenMPNontemporalClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'nontemporal' clause.
OMPClause * ActOnOpenMPFromClause(ArrayRef< OpenMPMotionModifierKind > MotionModifiers, ArrayRef< SourceLocation > MotionModifiersLoc, CXXScopeSpec &MapperIdScopeSpec, DeclarationNameInfo &MapperId, SourceLocation ColonLoc, ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs, ArrayRef< Expr * > UnresolvedMappers={})
Called on well-formed 'from' clause.
OMPClause * ActOnOpenMPBindClause(OpenMPBindClauseKind Kind, SourceLocation KindLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on a well-formed 'bind' clause.
OMPClause * ActOnOpenMPThreadLimitClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'thread_limit' clause.
OMPClause * ActOnOpenMPSharedClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'shared' clause.
OMPClause * ActOnOpenMPCopyinClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'copyin' clause.
OMPClause * ActOnOpenMPDestroyClause(Expr *InteropVar, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation VarLoc, SourceLocation EndLoc)
Called on well-formed 'destroy' clause.
OMPClause * ActOnOpenMPAffinityClause(SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc, Expr *Modifier, ArrayRef< Expr * > Locators)
Called on well-formed 'affinity' clause.
OMPClause * ActOnOpenMPNumTeamsClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'num_teams' clause.
OMPClause * ActOnOpenMPDependClause(const OMPDependClause::DependDataTy &Data, Expr *DepModifier, ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'depend' clause.
OMPClause * ActOnOpenMPDoacrossClause(OpenMPDoacrossClauseModifier DepType, SourceLocation DepLoc, SourceLocation ColonLoc, ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'doacross' clause.
OMPClause * ActOnOpenMPGrainsizeClause(OpenMPGrainsizeClauseModifier Modifier, Expr *Size, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ModifierLoc, SourceLocation EndLoc)
Called on well-formed 'grainsize' clause.
ExprResult ActOnOMPArraySectionExpr(Expr *Base, SourceLocation LBLoc, Expr *LowerBound, SourceLocation ColonLocFirst, SourceLocation ColonLocSecond, Expr *Length, Expr *Stride, SourceLocation RBLoc)
ExprResult ActOnOMPIteratorExpr(Scope *S, SourceLocation IteratorKwLoc, SourceLocation LLoc, SourceLocation RLoc, ArrayRef< OMPIteratorData > Data)
OMPClause * ActOnOpenMPUsesAllocatorClause(SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc, ArrayRef< UsesAllocatorsData > Data)
Called on well-formed 'uses_allocators' clause.
OMPClause * ActOnOpenMPAllocatorClause(Expr *Allocator, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'allocator' clause.
OMPClause * ActOnOpenMPInclusiveClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'inclusive' clause.
OMPClause * ActOnOpenMPTaskReductionClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc, CXXScopeSpec &ReductionIdScopeSpec, const DeclarationNameInfo &ReductionId, ArrayRef< Expr * > UnresolvedReductions={})
Called on well-formed 'task_reduction' clause.
OMPClause * ActOnOpenMPNowaitClause(SourceLocation StartLoc, SourceLocation EndLoc, SourceLocation LParenLoc, Expr *Condition)
Called on well-formed 'nowait' clause.
OMPClause * ActOnOpenMPOrderClause(OpenMPOrderClauseModifier Modifier, OpenMPOrderClauseKind Kind, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation MLoc, SourceLocation KindLoc, SourceLocation EndLoc)
Called on well-formed 'order' clause.
OMPClause * ActOnOpenMPSizesClause(ArrayRef< Expr * > SizeExprs, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-form 'sizes' clause.
OMPClause * ActOnOpenMPDeviceClause(OpenMPDeviceClauseModifier Modifier, Expr *Device, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ModifierLoc, SourceLocation EndLoc)
Called on well-formed 'device' clause.
OMPClause * ActOnOpenMPInReductionClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc, CXXScopeSpec &ReductionIdScopeSpec, const DeclarationNameInfo &ReductionId, ArrayRef< Expr * > UnresolvedReductions={})
Called on well-formed 'in_reduction' clause.
OMPClause * ActOnOpenMPFlushClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'flush' pseudo clause.
StmtResult ActOnOpenMPExecutableDirective(OpenMPDirectiveKind Kind, const DeclarationNameInfo &DirName, OpenMPDirectiveKind CancelRegion, ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
OMPClause * ActOnOpenMPMessageClause(Expr *MS, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'message' clause.
OMPClause * ActOnOpenMPScheduleClause(OpenMPScheduleClauseModifier M1, OpenMPScheduleClauseModifier M2, OpenMPScheduleClauseKind Kind, Expr *ChunkSize, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation M1Loc, SourceLocation M2Loc, SourceLocation KindLoc, SourceLocation CommaLoc, SourceLocation EndLoc)
Called on well-formed 'schedule' clause.
OMPClause * ActOnOpenMPSimdlenClause(Expr *Length, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'simdlen' clause.
OMPClause * ActOnOpenMPUseDevicePtrClause(ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs)
Called on well-formed 'use_device_ptr' clause.
OMPClause * ActOnOpenMPProcBindClause(llvm::omp::ProcBindKind Kind, SourceLocation KindLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'proc_bind' clause.
OMPClause * ActOnOpenMPXBareClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on a well-formed 'ompx_bare' clause.
StmtResult ActOnOpenMPInformationalDirective(OpenMPDirectiveKind Kind, const DeclarationNameInfo &DirName, ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Process an OpenMP informational directive.
StmtResult ActOnOpenMPCanonicalLoop(Stmt *AStmt)
Called for syntactical loops (ForStmt or CXXForRangeStmt) associated to an OpenMP loop directive.
OMPClause * ActOnOpenMPHintClause(Expr *Hint, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'hint' clause.
ExprResult ActOnOMPArrayShapingExpr(Expr *Base, SourceLocation LParenLoc, SourceLocation RParenLoc, ArrayRef< Expr * > Dims, ArrayRef< SourceRange > Brackets)
OMPClause * ActOnOpenMPNumThreadsClause(OpenMPNumThreadsClauseModifier Modifier, Expr *NumThreads, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ModifierLoc, SourceLocation EndLoc)
Called on well-formed 'num_threads' clause.
OMPClause * ActOnOpenMPAtClause(OpenMPAtClauseKind Kind, SourceLocation KindLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'at' clause.
OMPClause * ActOnOpenMPInitClause(Expr *InteropVar, OMPInteropInfo &InteropInfo, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation VarLoc, SourceLocation EndLoc)
Called on well-formed 'init' clause.
OMPClause * ActOnOpenMPUseDeviceAddrClause(ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs)
Called on well-formed 'use_device_addr' clause.
OMPClause * ActOnOpenMPAllocateClause(Expr *Allocator, Expr *Alignment, OpenMPAllocateClauseModifier FirstModifier, SourceLocation FirstModifierLoc, OpenMPAllocateClauseModifier SecondModifier, SourceLocation SecondModifierLoc, ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation ColonLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'allocate' clause.
OMPClause * ActOnOpenMPFinalClause(Expr *Condition, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'final' clause.
OMPClause * ActOnOpenMPMapClause(Expr *IteratorModifier, ArrayRef< OpenMPMapModifierKind > MapTypeModifiers, ArrayRef< SourceLocation > MapTypeModifiersLoc, CXXScopeSpec &MapperIdScopeSpec, DeclarationNameInfo &MapperId, OpenMPMapClauseKind MapType, bool IsMapTypeImplicit, SourceLocation MapLoc, SourceLocation ColonLoc, ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs, bool NoDiagnose=false, ArrayRef< Expr * > UnresolvedMappers={})
Called on well-formed 'map' clause.
OMPClause * ActOnOpenMPNumTasksClause(OpenMPNumTasksClauseModifier Modifier, Expr *NumTasks, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ModifierLoc, SourceLocation EndLoc)
Called on well-formed 'num_tasks' clause.
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 * 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