13#ifndef LLVM_CLANG_LIB_SEMA_TREETRANSFORM_H
14#define LLVM_CLANG_LIB_SEMA_TREETRANSFORM_H
50#include "llvm/ADT/ArrayRef.h"
51#include "llvm/Support/ErrorHandling.h"
55using namespace llvm::omp;
122template<
typename Derived>
127 class ForgetPartiallySubstitutedPackRAII {
135 ForgetPartiallySubstitutedPackRAII(Derived &
Self)
136 :
Self(
Self), ResetPackSubstIndex(
Self.getSema(), std::nullopt) {
137 Old =
Self.ForgetPartiallySubstitutedPack();
140 ~ForgetPartiallySubstitutedPackRAII() {
141 Self.RememberPartiallySubstitutedPack(Old);
143 ForgetPartiallySubstitutedPackRAII(
144 const ForgetPartiallySubstitutedPackRAII &) =
delete;
145 ForgetPartiallySubstitutedPackRAII &
146 operator=(
const ForgetPartiallySubstitutedPackRAII &) =
delete;
162 Derived &
getDerived() {
return static_cast<Derived&
>(*this); }
166 return static_cast<const Derived&
>(*this);
234 if (Location.isValid())
235 Self.getDerived().setBase(Location, Entity);
239 Self.getDerived().setBase(OldLocation, OldEntity);
314 bool FailOnPackProducingTemplates,
315 bool &ShouldExpand,
bool &RetainExpansion,
317 ShouldExpand =
false;
345 struct ForgetSubstitutionRAII {
351 Old =
Self.ForgetSubstitution();
354 ~ForgetSubstitutionRAII() {
Self.RememberSubstitution(std::move(Old)); }
454 const X##Attr *Transform##X##Attr(const X##Attr *R) { return R; }
455#include "clang/Basic/AttrList.inc"
465 const X##Attr *TransformStmt##X##Attr(const Stmt *, const Stmt *, \
466 const X##Attr *A) { \
467 return getDerived().Transform##X##Attr(A); \
469#include "clang/Basic/AttrList.inc"
515 bool *ArgChanged =
nullptr);
524 llvm::DenseMap<Decl *, Decl *>::iterator Known
527 return Known->second;
555 assert(
New.size() == 1 &&
556 "must override transformedLocalDecl if performing pack expansion");
594 NamedDecl *FirstQualifierInScope =
nullptr);
639 NamedDecl *FirstQualifierInScope =
nullptr,
640 bool AllowInjectedClassName =
false);
652 bool Uneval =
false);
679 bool Uneval =
false) {
698 template<
typename InputIterator>
702 bool Uneval =
false);
704 template <
typename InputIterator>
708 bool Uneval =
false);
729 return SemaRef.Context.getTrivialTypeSourceInfo(T,
733#define ABSTRACT_TYPELOC(CLASS, PARENT)
734#define TYPELOC(CLASS, PARENT) \
735 QualType Transform##CLASS##Type(TypeLocBuilder &TLB, CLASS##TypeLoc T);
736#include "clang/AST/TypeLocNodes.def"
740 bool SuppressObjCLifetime);
744 bool SuppressObjCLifetime);
746 template<
typename Fn>
764 bool AllowInjectedClassName);
792 return getDerived().TransformFunctionTypeParams(
793 Loc, Params, ParamTypes, ParamInfos, PTypes, PVars, PInfos,
nullptr);
811 KWLoc, Params,
nullptr,
812 nullptr, PTypes, &TransParams, PInfos))
826 bool ExpectParameterPack);
853 bool IsAddressOfOperand,
861 bool IsAddressOfOperand);
869#define STMT(Node, Parent) \
870 LLVM_ATTRIBUTE_NOINLINE \
871 StmtResult Transform##Node(Node *S);
872#define VALUESTMT(Node, Parent) \
873 LLVM_ATTRIBUTE_NOINLINE \
874 StmtResult Transform##Node(Node *S, StmtDiscardKind SDK);
875#define EXPR(Node, Parent) \
876 LLVM_ATTRIBUTE_NOINLINE \
877 ExprResult Transform##Node(Node *E);
878#define ABSTRACT_STMT(Stmt)
879#include "clang/AST/StmtNodes.inc"
881#define GEN_CLANG_CLAUSE_CLASS
882#define CLAUSE_CLASS(Enum, Str, Class) \
883 LLVM_ATTRIBUTE_NOINLINE \
884 OMPClause *Transform##Class(Class *S);
885#include "llvm/Frontend/OpenMP/OMP.inc"
963 const llvm::APInt *Size,
Expr *SizeExpr,
964 unsigned IndexTypeQuals,
SourceRange BracketsRange);
973 const llvm::APInt &Size,
Expr *SizeExpr,
974 unsigned IndexTypeQuals,
984 unsigned IndexTypeQuals,
994 unsigned IndexTypeQuals,
1005 unsigned IndexTypeQuals,
1043 unsigned NumColumns);
1060 Expr *AddrSpaceExpr,
1084 return SemaRef.Context.getUsingType(
Keyword, Qualifier, D, UnderlyingType);
1097 return SemaRef.Context.getMacroQualifiedType(T, MacroII);
1107 return SemaRef.Context.getCanonicalTagType(Tag);
1124 UnaryTransformType::UTTKind UKind,
1136 bool FullySubstituted,
1146 return SemaRef.Context.getAutoType(
1147 DK, DeducedAsType,
Keyword, TypeConstraintConcept, TypeConstraintArgs);
1155 return SemaRef.Context.getDeducedTemplateSpecializationType(
1174 return SemaRef.BuildParenType(InnerType);
1187 bool DeducedTSTContext) {
1189 SS.
Adopt(QualifierLoc);
1193 if (!
SemaRef.computeDeclContext(SS))
1201 return SemaRef.CheckTypenameType(
Keyword, KeywordLoc, QualifierLoc,
1202 *Id, IdLoc, DeducedTSTContext);
1215 if (
SemaRef.RequireCompleteDeclContext(SS, DC))
1220 switch (
Result.getResultKind()) {
1231 llvm_unreachable(
"Tag lookup cannot find non-tags");
1243 switch (
Result.getResultKind()) {
1249 SemaRef.Diag(IdLoc, diag::err_tag_reference_non_tag)
1250 << SomeDecl << NTK << Kind;
1255 SemaRef.Diag(IdLoc, diag::err_not_tag_in_scope)
1261 if (!
SemaRef.isAcceptableTagRedeclaration(Tag, Kind,
false,
1263 SemaRef.Diag(KeywordLoc, diag::err_use_with_wrong_tag) << Id;
1264 SemaRef.Diag(Tag->getLocation(), diag::note_previous_use);
1320 bool AllowInjectedClassName);
1333 bool AllowInjectedClassName);
1339 bool AllowInjectedClassName);
1349 Decl *AssociatedDecl,
unsigned Index,
1352 ArgPack, AssociatedDecl, Index, Final);
1406 return SemaRef.ActOnLabelStmt(IdentLoc, L, ColonLoc, SubStmt);
1416 if (
SemaRef.CheckRebuiltStmtAttributes(Attrs))
1418 return SemaRef.BuildAttributedStmt(AttrLoc, Attrs, SubStmt);
1430 Then, ElseLoc, Else);
1484 Inc, RParenLoc, Body);
1529 bool IsVolatile,
unsigned NumOutputs,
1536 NumInputs, Names, Constraints, Exprs,
1537 AsmString, Clobbers, NumLabels, RParenLoc);
1546 StringRef AsmString,
1547 unsigned NumOutputs,
unsigned NumInputs,
1553 NumOutputs, NumInputs,
1554 Constraints, Clobbers, Exprs, EndLoc);
1583 CoawaitLoc, Operand, OpCoawaitLookup);
1587 Suspend.
get(),
true);
1688 Kind, DirName, CancelRegion, Clauses, AStmt, StartLoc, EndLoc);
1700 Kind, DirName, Clauses, AStmt, StartLoc, EndLoc);
1714 NameModifier,
Condition, StartLoc, LParenLoc, NameModifierLoc, ColonLoc,
1740 Modifier, NumThreads, StartLoc, LParenLoc, ModifierLoc, EndLoc);
1777 std::optional<unsigned> FillIdx,
1779 unsigned FillCount = FillIdx ? 1 : 0;
1781 Counts, StartLoc, LParenLoc, EndLoc, FillIdx, FillLoc, FillCount);
1812 First, Count, StartLoc, LParenLoc, FirstLoc, CountLoc, EndLoc);
1848 Kind, KindKwLoc, VCKind, VCLoc, StartLoc, LParenLoc, EndLoc);
1861 Kind, KindKwLoc, StartLoc, LParenLoc, EndLoc);
1868 ImpexTypeArg, StartLoc, LParenLoc, EndLoc);
1881 M1, M2, Kind, ChunkSize, StartLoc, LParenLoc, M1Loc, M2Loc, KindLoc,
1943 VarList, LPKind, LPKindLoc, ColonLoc, StartLoc, LParenLoc, EndLoc);
1971 VarList, {Modifier, OriginalSharingModifier}, StartLoc, LParenLoc,
1972 ModifierLoc, ColonLoc, EndLoc, ReductionIdScopeSpec, ReductionId,
1973 UnresolvedReductions);
1987 VarList, StartLoc, LParenLoc, ColonLoc, EndLoc, ReductionIdScopeSpec,
1988 ReductionId, UnresolvedReductions);
2003 VarList, StartLoc, LParenLoc, ColonLoc, EndLoc, ReductionIdScopeSpec,
2004 ReductionId, UnresolvedReductions);
2017 VarList, Step, StartLoc, LParenLoc, Modifier, ModifierLoc, ColonLoc,
2018 StepModifierLoc, EndLoc);
2031 VarList, Alignment, StartLoc, LParenLoc, ColonLoc, EndLoc);
2091 Data, DepModifier, VarList, StartLoc, LParenLoc, EndLoc);
2104 Modifier,
Device, StartLoc, LParenLoc, ModifierLoc, EndLoc);
2119 IteratorModifier, MapTypeModifiers, MapTypeModifiersLoc,
2120 MapperIdScopeSpec, MapperId, MapType, IsMapTypeImplicit, MapLoc,
2121 ColonLoc, VarList, Locs,
2122 false, UnresolvedMappers);
2139 Allocate, Alignment, FirstModifier, FirstModifierLoc, SecondModifier,
2140 SecondModifierLoc, VarList, StartLoc, LParenLoc, ColonLoc, EndLoc);
2188 Modifier,
Device, StartLoc, LParenLoc, ModifierLoc, EndLoc);
2201 Modifier, NumTasks, StartLoc, LParenLoc, ModifierLoc, EndLoc);
2236 Kind, ChunkSize, StartLoc, LParenLoc, KindLoc, CommaLoc, EndLoc);
2251 MotionModifiers, MotionModifiersLoc, IteratorModifier,
2252 MapperIdScopeSpec, MapperId, ColonLoc, VarList, Locs,
2268 MotionModifiers, MotionModifiersLoc, IteratorModifier,
2269 MapperIdScopeSpec, MapperId, ColonLoc, VarList, Locs,
2282 VarList, Locs, FallbackModifier, FallbackModifierLoc);
2324 M, Kind, StartLoc, LParenLoc, MLoc, KindLoc, EndLoc);
2371 StartLoc, LParenLoc, EndLoc,
Data);
2384 StartLoc, LParenLoc, ColonLoc, EndLoc, Modifier, Locators);
2396 Modifier, Kind, StartLoc, LParenLoc, ModifierKwLoc, KindKwLoc, EndLoc);
2409 InteropVar, InteropInfo, StartLoc, LParenLoc, VarLoc, EndLoc);
2420 LParenLoc, VarLoc, EndLoc);
2432 InteropVar, StartLoc, LParenLoc, VarLoc, EndLoc);
2503 M1, M2, Size, StartLoc, LParenLoc, M1Loc, M2Loc, EndLoc);
2584 DepType, DepLoc, ColonLoc, VarList, StartLoc, LParenLoc, EndLoc);
2632 ForLoc, Element, Collection, RParenLoc);
2650 StartLoc, IdLoc, Id);
2687 if (
DeclStmt *RangeStmt = dyn_cast<DeclStmt>(Range)) {
2688 if (RangeStmt->isSingleDecl()) {
2689 if (
VarDecl *RangeVar = dyn_cast<VarDecl>(RangeStmt->getSingleDecl())) {
2690 if (RangeVar->isInvalidDecl())
2693 Expr *RangeExpr = RangeVar->getInit();
2700 diag::err_objc_for_range_init_stmt)
2701 <<
Init->getSourceRange();
2704 ForLoc, LoopVar, RangeExpr, RParenLoc);
2711 ForLoc, CoawaitLoc,
Init, ColonLoc, Range, Begin, End,
Cond, Inc,
2725 QualifierLoc, NameInfo, Nested);
2787 SS.
Adopt(QualifierLoc);
2909 if (IsOMPArraySection)
2911 Base, LBracketLoc, LowerBound, ColonLocFirst, ColonLocSecond, Length,
2912 Stride, RBracketLoc);
2914 assert(Stride ==
nullptr && !ColonLocSecond.
isValid() &&
2915 "Stride/second colon not allowed for OpenACC");
2918 Base, LBracketLoc, LowerBound, ColonLocFirst, Length, RBracketLoc);
2930 Base, LParenLoc, RParenLoc, Dims, BracketsRanges);
2942 nullptr, IteratorKwLoc, LLoc, RLoc,
Data);
2952 Expr *ExecConfig =
nullptr) {
2954 nullptr, Callee, LParenLoc, Args, RParenLoc, ExecConfig);
2961 nullptr, Callee, LParenLoc, Args, RParenLoc);
2979 if (!
Member->getDeclName()) {
2983 assert(
Member->getType()->isRecordType() &&
2984 "unnamed member not of record type?");
2997 if (!isArrow &&
Base->isPRValue()) {
3012 SS.
Adopt(QualifierLoc);
3015 if (
Base->containsErrors())
3020 if (isArrow && !BaseType->isPointerType())
3026 R.addDecl(FoundDecl);
3029 if (
getSema().isUnevaluatedContext() &&
Base->isImplicitCXXThis() &&
3034 ->getAsCXXRecordDecl()) {
3038 if (!ThisClass->Equals(
Class) && !ThisClass->isDerivedFrom(
Class))
3046 FirstQualifierInScope,
3047 R, ExplicitTemplateArgs,
3057 bool ForFoldExpression =
false) {
3135 return SemaRef.BuildInitList(LBraceLoc,
Inits, RBraceLoc, IsExplicit);
3148 =
SemaRef.ActOnDesignatedInitializer(Desig, EqualOrColonLoc, GNUSyntax,
3188 unsigned NumUserSpecifiedExprs,
3193 InitLoc, LParenLoc, RParenLoc);
3223 return SemaRef.ActOnChooseExpr(BuiltinLoc,
3235 Expr *ControllingExpr,
3240 ControllingExpr, Types, Exprs);
3255 ControllingType, Types, Exprs);
3288 case Stmt::CXXStaticCastExprClass:
3289 return getDerived().RebuildCXXStaticCastExpr(OpLoc, LAngleLoc, TInfo,
3290 RAngleLoc, LParenLoc,
3291 SubExpr, RParenLoc);
3293 case Stmt::CXXDynamicCastExprClass:
3294 return getDerived().RebuildCXXDynamicCastExpr(OpLoc, LAngleLoc, TInfo,
3295 RAngleLoc, LParenLoc,
3296 SubExpr, RParenLoc);
3298 case Stmt::CXXReinterpretCastExprClass:
3299 return getDerived().RebuildCXXReinterpretCastExpr(OpLoc, LAngleLoc, TInfo,
3300 RAngleLoc, LParenLoc,
3304 case Stmt::CXXConstCastExprClass:
3305 return getDerived().RebuildCXXConstCastExpr(OpLoc, LAngleLoc, TInfo,
3306 RAngleLoc, LParenLoc,
3307 SubExpr, RParenLoc);
3309 case Stmt::CXXAddrspaceCastExprClass:
3310 return getDerived().RebuildCXXAddrspaceCastExpr(
3311 OpLoc, LAngleLoc, TInfo, RAngleLoc, LParenLoc, SubExpr, RParenLoc);
3314 llvm_unreachable(
"Invalid C++ named cast");
3392 OpLoc, tok::kw_addrspace_cast, TInfo, SubExpr,
3404 bool ListInitialization) {
3408 if (
auto *PLE = dyn_cast<ParenListExpr>(Sub))
3410 TInfo, LParenLoc,
MultiExprArg(PLE->getExprs(), PLE->getNumExprs()),
3411 RParenLoc, ListInitialization);
3413 if (
auto *PLE = dyn_cast<CXXParenListInitExpr>(Sub))
3415 TInfo, LParenLoc, PLE->getInitExprs(), RParenLoc, ListInitialization);
3419 ListInitialization);
3483 if (
getSema().CheckCXXThisType(ThisLoc, ThisType))
3493 bool IsThrownVariableInScope) {
3503 Expr *RewrittenExpr) {
3505 RewrittenExpr,
getSema().CurContext);
3539 std::optional<Expr *> ArraySize,
3558 bool IsGlobalDelete,
3609 bool IsAddressOfOperand,
3612 SS.
Adopt(QualifierLoc);
3614 if (TemplateArgs || TemplateKWLoc.
isValid())
3616 SS, TemplateKWLoc, NameInfo, TemplateArgs, IsAddressOfOperand);
3619 SS, NameInfo, IsAddressOfOperand, RecoveryTSI);
3641 bool IsElidable,
MultiExprArg Args,
bool HadMultipleCandidates,
3642 bool ListInitialization,
bool StdInitListInitialization,
3649 FoundCtor =
Constructor->getInheritedConstructor().getConstructor();
3652 if (
getSema().CompleteConstructorCall(FoundCtor, T, Args, Loc,
3659 HadMultipleCandidates,
3661 StdInitListInitialization,
3662 RequiresZeroInit, ConstructKind,
3670 bool ConstructsVBase,
3671 bool InheritedFromVBase) {
3673 Loc, T,
Constructor, ConstructsVBase, InheritedFromVBase);
3684 bool ListInitialization) {
3686 TSInfo, LParenOrBraceLoc, Args, RParenOrBraceLoc, ListInitialization);
3697 bool ListInitialization) {
3699 RParenLoc, ListInitialization);
3716 SS.
Adopt(QualifierLoc);
3718 return SemaRef.BuildMemberReferenceExpr(BaseE, BaseType,
3719 OperatorLoc, IsArrow,
3721 FirstQualifierInScope,
3723 TemplateArgs,
nullptr);
3739 SS.
Adopt(QualifierLoc);
3741 return SemaRef.BuildMemberReferenceExpr(BaseE, BaseType,
3742 OperatorLoc, IsArrow,
3744 FirstQualifierInScope,
3745 R, TemplateArgs,
nullptr);
3753 return SemaRef.BuildCXXNoexceptExpr(Range.getBegin(), Arg, Range.getEnd());
3766 RParenLoc, Length, PartialArgs);
3771 Expr *PackIdExpression,
Expr *IndexExpr,
3773 bool FullySubstituted =
false) {
3775 IndexExpr, RSquareLoc, ExpandedExprs,
3801 NamedConcept, TALI);
3819 LocalParameters, RParenLoc, Requirements,
3826 return SemaRef.BuildTypeRequirement(SubstDiag);
3830 return SemaRef.BuildTypeRequirement(T);
3838 return SemaRef.BuildExprRequirement(SubstDiag, IsSimple, NoexceptLoc,
3845 return SemaRef.BuildExprRequirement(E, IsSimple, NoexceptLoc,
3852 return SemaRef.BuildNestedRequirement(InvalidConstraintEntity,
3857 return SemaRef.BuildNestedRequirement(Constraint);
3873 Expr **Elements,
unsigned NumElements) {
3883 RB,
Base, Key, getterMethod, setterMethod);
3902 return SemaRef.ObjC().BuildObjCEncodeExpression(AtLoc, EncodeTypeInfo,
3914 return SemaRef.ObjC().BuildClassMessage(
3915 ReceiverTypeInfo, ReceiverTypeInfo->
getType(),
3928 return SemaRef.ObjC().BuildInstanceMessage(Receiver, Receiver->
getType(),
3931 SelectorLocs, RBracLoc, Args);
3943 return Method->isInstanceMethod()
3944 ?
SemaRef.ObjC().BuildInstanceMessage(
3945 nullptr, SuperType, SuperLoc, Sel,
Method, LBracLoc,
3946 SelectorLocs, RBracLoc, Args)
3947 :
SemaRef.ObjC().BuildClassMessage(
nullptr, SuperType, SuperLoc,
3949 SelectorLocs, RBracLoc, Args);
3958 bool IsArrow,
bool IsFreeIvar) {
3967 if (IsFreeIvar &&
Result.isUsable())
4004 PropertyLoc,
Base));
4033 =
SemaRef.Context.Idents.get(
"__builtin_shufflevector");
4036 assert(!Lookup.
empty() &&
"No __builtin_shufflevector?");
4044 Callee =
SemaRef.ImpCastExprToType(Callee, CalleePtrTy,
4045 CK_BuiltinFnToFnPtr).get();
4061 return SemaRef.ConvertVectorExpr(SrcExpr, DstTInfo, BuiltinLoc, RParenLoc);
4076 EllipsisLoc, NumExpansions);
4100 llvm_unreachable(
"Pack expansion pattern has no parameter packs");
4136 EllipsisLoc, RHS, RParenLoc,
4145 Init->containsUnexpandedParameterPack();
4146 else if (PVD->hasUninstantiatedDefaultArg())
4148 PVD->getUninstantiatedDefaultArg()
4149 ->containsUnexpandedParameterPack();
4303 Exprs.push_back(DevNumExpr);
4304 llvm::append_range(Exprs, QueueIdExprs);
4341 AssociatedDecl, Index, ParamType, Loc, Arg, PackIndex, Final);
4365 ObjectType, FirstQualifierInScope);
4371 QualType TransformDependentNameType(TypeLocBuilder &TLB,
4372 DependentNameTypeLoc TL,
4373 bool DeducibleTSTContext,
4374 QualType ObjectType = QualType(),
4375 NamedDecl *UnqualLookup =
nullptr);
4378 TransformOpenACCClauseList(OpenACCDirectiveKind DirKind,
4383 OpenACCDirectiveKind DirKind,
4384 const OpenACCClause *OldClause);
4387template <
typename Derived>
4397#define STMT(Node, Parent) \
4398 case Stmt::Node##Class: return getDerived().Transform##Node(cast<Node>(S));
4399#define VALUESTMT(Node, Parent) \
4400 case Stmt::Node##Class: \
4401 return getDerived().Transform##Node(cast<Node>(S), SDK);
4402#define ABSTRACT_STMT(Node)
4403#define EXPR(Node, Parent)
4404#include "clang/AST/StmtNodes.inc"
4407#define STMT(Node, Parent)
4408#define ABSTRACT_STMT(Stmt)
4409#define EXPR(Node, Parent) case Stmt::Node##Class:
4410#include "clang/AST/StmtNodes.inc"
4415 E =
getSema().ActOnStmtExprResult(E);
4423template<
typename Derived>
4431#define GEN_CLANG_CLAUSE_CLASS
4432#define CLAUSE_CLASS(Enum, Str, Class) \
4434 return getDerived().Transform##Class(cast<Class>(S));
4435#include "llvm/Frontend/OpenMP/OMP.inc"
4442template<
typename Derived>
4449#define STMT(Node, Parent) case Stmt::Node##Class: break;
4450#define ABSTRACT_STMT(Stmt)
4451#define EXPR(Node, Parent) \
4452 case Stmt::Node##Class: return getDerived().Transform##Node(cast<Node>(E));
4453#include "clang/AST/StmtNodes.inc"
4459template<
typename Derived>
4467 if (
auto *FE = dyn_cast<FullExpr>(
Init))
4468 Init = FE->getSubExpr();
4470 if (
auto *AIL = dyn_cast<ArrayInitLoopExpr>(
Init)) {
4476 Init = MTE->getSubExpr();
4479 Init = Binder->getSubExpr();
4482 Init = ICE->getSubExprAsWritten();
4485 dyn_cast<CXXStdInitializerListExpr>(
Init))
4522 getSema().currentEvaluationContext().InLifetimeExtendingContext =
4523 getSema().parentEvaluationContext().InLifetimeExtendingContext;
4524 getSema().currentEvaluationContext().RebuildDefaultArgOrDefaultInit =
4525 getSema().parentEvaluationContext().RebuildDefaultArgOrDefaultInit;
4527 bool ArgChanged =
false;
4529 true, NewArgs, &ArgChanged))
4540 if (
Parens.isInvalid()) {
4543 assert(NewArgs.empty() &&
4544 "no parens or braces but have direct init with arguments?");
4551template<
typename Derived>
4557 for (
unsigned I = 0; I != NumInputs; ++I) {
4567 Expr *Pattern = Expansion->getPattern();
4570 getSema().collectUnexpandedParameterPacks(Pattern, Unexpanded);
4571 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
4576 bool RetainExpansion =
false;
4577 UnsignedOrNone OrigNumExpansions = Expansion->getNumExpansions();
4581 Unexpanded,
true, Expand,
4582 RetainExpansion, NumExpansions))
4595 Expansion->getEllipsisLoc(),
4597 if (Out.isInvalid())
4602 Outputs.push_back(Out.get());
4608 if (ArgChanged) *ArgChanged =
true;
4612 for (
unsigned I = 0; I != *NumExpansions; ++I) {
4615 if (Out.isInvalid())
4618 if (Out.get()->containsUnexpandedParameterPack()) {
4620 Out.get(), Expansion->getEllipsisLoc(), OrigNumExpansions);
4621 if (Out.isInvalid())
4625 Outputs.push_back(Out.get());
4630 if (RetainExpansion) {
4631 ForgetPartiallySubstitutedPackRAII Forget(
getDerived());
4634 if (Out.isInvalid())
4638 Out.get(), Expansion->getEllipsisLoc(), OrigNumExpansions);
4639 if (Out.isInvalid())
4642 Outputs.push_back(Out.get());
4649 IsCall ?
getDerived().TransformInitializer(Inputs[I],
false)
4654 if (
Result.get() != Inputs[I] && ArgChanged)
4657 Outputs.push_back(
Result.get());
4663template <
typename Derived>
4674 VarDecl *ConditionVar = cast_or_null<VarDecl>(
4680 return getSema().ActOnConditionVariable(ConditionVar, Loc, Kind);
4689 return getSema().ActOnCondition(
nullptr, Loc, CondExpr.
get(), Kind,
4696template <
typename Derived>
4704 Qualifier = Qualifier.getAsNamespaceAndPrefix().Prefix)
4716 llvm_unreachable(
"unexpected null nested name specifier");
4747 QualifierLoc =
getDerived().TransformNestedNameSpecifierLoc(
4748 QualifierLoc, ObjectType, FirstQualifierInScope);
4752 FirstQualifierInScope =
nullptr;
4754 SS.
Adopt(QualifierLoc);
4758 if (
SemaRef.BuildCXXNestedNameSpecifier(
nullptr, IdInfo,
4760 FirstQualifierInScope,
false))
4768 T = TransformTypeInObjectScope(TLB, TL, ObjectType,
4769 FirstQualifierInScope);
4775 if (T->isDependentType() || T->isRecordType() ||
4776 (
SemaRef.getLangOpts().CPlusPlus11 && T->isEnumeralType())) {
4777 if (T->isEnumeralType())
4779 diag::warn_cxx98_compat_enum_nested_name_spec);
4786 if (!TTL || !TTL.
getDecl()->isInvalidDecl()) {
4810template<
typename Derived>
4830 TemplateDecl *NewTemplate = cast_or_null<TemplateDecl>(
4837 SemaRef.Context.DeclarationNames.getCXXDeductionGuideName(NewTemplate));
4847 NewTInfo =
getDerived().TransformType(OldTInfo);
4850 NewCanTy =
SemaRef.Context.getCanonicalType(NewTInfo->
getType());
4858 NewCanTy =
SemaRef.Context.getCanonicalType(NewT);
4871 llvm_unreachable(
"Unknown name kind.");
4874template <
typename Derived>
4878 QualType ObjectType,
bool AllowInjectedClassName) {
4880 return getDerived().RebuildTemplateName(SS, TemplateKWLoc, *II, NameLoc,
4881 ObjectType, AllowInjectedClassName);
4883 NameLoc, ObjectType,
4884 AllowInjectedClassName);
4887template <
typename Derived>
4891 NamedDecl *FirstQualifierInScope,
bool AllowInjectedClassName) {
4893 TemplateName UnderlyingName = QTN->getUnderlyingTemplate();
4896 QualifierLoc =
getDerived().TransformNestedNameSpecifierLoc(
4897 QualifierLoc, ObjectType, FirstQualifierInScope);
4904 UnderlyingQualifier, TemplateKWLoc, UnderlyingName, NameLoc, ObjectType,
4905 FirstQualifierInScope, AllowInjectedClassName);
4906 if (NewUnderlyingName.
isNull())
4908 assert(!UnderlyingQualifier &&
"unexpected qualifier");
4912 NewUnderlyingName == UnderlyingName)
4915 SS.
Adopt(QualifierLoc);
4916 return getDerived().RebuildTemplateName(SS, QTN->hasTemplateKeyword(),
4922 QualifierLoc =
getDerived().TransformNestedNameSpecifierLoc(
4923 QualifierLoc, ObjectType, FirstQualifierInScope);
4937 SS.
Adopt(QualifierLoc);
4938 return getDerived().RebuildTemplateName(SS, TemplateKWLoc, DTN->getName(),
4939 NameLoc, ObjectType,
4940 AllowInjectedClassName);
4945 assert(!QualifierLoc &&
"Unexpected qualified SubstTemplateTemplateParm");
4952 ReplacementQualifierLoc = Builder.getWithLocInContext(
SemaRef.Context);
4956 ReplacementQualifierLoc, TemplateKWLoc, ReplacementName, NameLoc,
4957 ObjectType, FirstQualifierInScope, AllowInjectedClassName);
4960 Decl *AssociatedDecl =
4961 getDerived().TransformDecl(NameLoc, S->getAssociatedDecl());
4963 AssociatedDecl == S->getAssociatedDecl())
4965 return SemaRef.Context.getSubstTemplateTemplateParm(
4966 NewName, AssociatedDecl, S->getIndex(), S->getPackIndex(),
4971 "DeducedTemplateName should not escape partial ordering");
4975 assert(!QualifierLoc &&
"Unexpected qualifier");
4982 assert(!QualifierLoc &&
4983 "Unexpected qualified SubstTemplateTemplateParmPack");
4985 SubstPack->getArgumentPack(), SubstPack->getAssociatedDecl(),
4986 SubstPack->getIndex(), SubstPack->getFinal());
4990 llvm_unreachable(
"overloaded function decl survived to here");
4993template <
typename Derived>
4998 QualifierLoc, TemplateKeywordLoc, Name, NameLoc);
5004template<
typename Derived>
5008 Output =
getSema().getTrivialTemplateArgumentLoc(
5012template <
typename Derived>
5020 llvm_unreachable(
"Unexpected TemplateArgument");
5043 if (NewT == T && D == NewD)
5060 llvm_unreachable(
"unexpected template argument kind");
5092 llvm_unreachable(
"Caller should expand pack expansions");
5108 E =
SemaRef.ActOnConstantExpression(E);
5123template<
typename Derived,
typename InputIterator>
5131 typedef typename std::iterator_traits<InputIterator>::difference_type
5146 : Self(Self), Iter(Iter) { }
5161 Self.InventTemplateArgumentLoc(*Iter,
Result);
5169 return X.Iter == Y.Iter;
5174 return X.Iter != Y.Iter;
5178template<
typename Derived>
5179template<
typename InputIterator>
5199 PackLocIterator(*
this, In.getArgument().pack_begin()),
5200 PackLocIterator(*
this, In.getArgument().pack_end()), *PackOutput,
5207 if (In.getArgument().isPackExpansion()) {
5219 std::optional<ForgetSubstitutionRAII> ForgetSubst;
5229 if (Out.getArgument().containsUnexpandedParameterPack()) {
5232 if (Out.getArgument().isNull())
5242 ForgetPartiallySubstitutedPackRAII Forget(
getDerived());
5250 if (Out.getArgument().isNull())
5269template <
typename Derived>
5270template <
typename InputIterator>
5279 return !Arg.isDependent() && Arg.isConceptOrConceptTemplateParameter();
5291 PackLocIterator(*
this, In.getArgument().pack_begin()),
5292 PackLocIterator(*
this, In.getArgument().pack_end()), Outputs,
5298 if (!isNonDependentConceptArgument(In.getArgument())) {
5313template <
typename Derived>
5324 Pattern =
getSema().getTemplateArgumentPackExpansionPattern(
5327 getSema().collectUnexpandedParameterPacks(Pattern, Unexpanded);
5328 if (IsLateExpansionAttempt) {
5333 return P.first.dyn_cast<
const SubstBuiltinTemplatePackType *>();
5335 if (!SawPackTypes) {
5340 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
5348 Info.
Ellipsis, Pattern.getSourceRange(), Unexpanded,
5354 if (ComputeInfo(In,
false, Info, Pattern))
5366 std::optional<Sema::ArgPackSubstIndexRAII> SubstIndex(
5367 std::in_place,
getSema(), std::nullopt);
5373 if (Out.getArgument().isNull())
5410 ForgetSubstitutionRAII ForgetSubst(
getDerived());
5411 if (ComputeInfo(Out,
true, Info, OutPattern))
5424template<
typename Derived>
5442template <
typename Derived>
5462template<
typename Derived>
5465 switch (T.getTypeLocClass()) {
5466#define ABSTRACT_TYPELOC(CLASS, PARENT)
5467#define TYPELOC(CLASS, PARENT) \
5468 case TypeLoc::CLASS: \
5469 return getDerived().Transform##CLASS##Type(TLB, \
5470 T.castAs<CLASS##TypeLoc>());
5471#include "clang/AST/TypeLocNodes.def"
5474 llvm_unreachable(
"unhandled type loc!");
5477template<
typename Derived>
5490template <
typename Derived>
5528template<
typename Derived>
5534 auto SuppressObjCLifetime =
5537 Result = getDerived().TransformTemplateTypeParmType(TLB, TTP,
5538 SuppressObjCLifetime);
5539 }
else if (
auto STTP = UnqualTL.
getAs<SubstTemplateTypeParmPackTypeLoc>()) {
5540 Result = getDerived().TransformSubstTemplateTypeParmPackType(
5541 TLB, STTP, SuppressObjCLifetime);
5543 Result = getDerived().TransformType(TLB, UnqualTL);
5562template <
typename Derived>
5572 SemaRef.Diag(Loc, diag::err_address_space_mismatch_templ_inst)
5579 if (T.getPointerAuth().isPresent()) {
5580 SemaRef.Diag(Loc, diag::err_ptrauth_qualifier_redundant) << TL.
getType();
5583 if (!T->isDependentType()) {
5584 if (!T->isSignableType(
SemaRef.getASTContext())) {
5585 SemaRef.Diag(Loc, diag::err_ptrauth_qualifier_invalid_target) << T;
5593 if (T->isFunctionType()) {
5594 T =
SemaRef.getASTContext().getAddrSpaceQualType(T,
5604 if (T->isReferenceType()) {
5614 if (!T->isObjCLifetimeType() && !T->isDependentType())
5616 else if (T.getObjCLifetime()) {
5620 const AutoType *AutoTy;
5621 if ((AutoTy = dyn_cast<AutoType>(T)) && AutoTy->isDeduced()) {
5627 SemaRef.Context.getQualifiedType(
Deduced.getUnqualifiedType(), Qs);
5628 T =
SemaRef.Context.getAutoType(AutoTy->getDeducedKind(),
Deduced,
5629 AutoTy->getKeyword(),
5630 AutoTy->getTypeConstraintConcept(),
5631 AutoTy->getTypeConstraintArguments());
5636 SemaRef.Diag(Loc, diag::err_attr_objc_ownership_redundant) << T;
5642 return SemaRef.BuildQualifiedType(T, Loc, Quals);
5645template <
typename Derived>
5646QualType TreeTransform<Derived>::TransformTypeInObjectScope(
5649 assert(!getDerived().AlreadyTransformed(TL.
getType()));
5652 case TypeLoc::TemplateSpecialization:
5653 return getDerived().TransformTemplateSpecializationType(
5655 FirstQualifierInScope,
true);
5656 case TypeLoc::DependentName:
5657 return getDerived().TransformDependentNameType(
5659 ObjectType, FirstQualifierInScope);
5663 return getDerived().TransformType(TLB, TL);
5667template <
class TyLoc>
static inline
5669 TyLoc NewT = TLB.
push<TyLoc>(T.getType());
5670 NewT.setNameLoc(T.getNameLoc());
5674template<
typename Derived>
5675QualType TreeTransform<Derived>::TransformBuiltinType(TypeLocBuilder &TLB,
5677 BuiltinTypeLoc NewT = TLB.push<BuiltinTypeLoc>(T.getType());
5678 NewT.setBuiltinLoc(T.getBuiltinLoc());
5679 if (T.needsExtraLocalData())
5680 NewT.getWrittenBuiltinSpecs() = T.getWrittenBuiltinSpecs();
5684template<
typename Derived>
5691template <
typename Derived>
5695 return getDerived().
TransformType(TLB, TL.getOriginalLoc());
5698template<
typename Derived>
5701 QualType OriginalType = getDerived().TransformType(TLB, TL.getOriginalLoc());
5702 if (OriginalType.isNull())
5706 if (getDerived().AlwaysRebuild() ||
5707 OriginalType != TL.getOriginalLoc().getType())
5714template <
typename Derived>
5718 QualType OriginalType = getDerived().TransformType(TLB, TL.getElementLoc());
5719 if (OriginalType.isNull())
5723 if (getDerived().AlwaysRebuild() ||
5724 OriginalType != TL.getElementLoc().getType())
5731template<
typename Derived>
5735 = getDerived().TransformType(TLB, TL.getPointeeLoc());
5736 if (PointeeType.isNull())
5740 if (PointeeType->getAs<ObjCObjectType>()) {
5752 if (getDerived().AlwaysRebuild() ||
5753 PointeeType != TL.getPointeeLoc().getType()) {
5754 Result = getDerived().RebuildPointerType(PointeeType, TL.getSigilLoc());
5761 TLB.TypeWasModifiedSafely(
Result->getPointeeType());
5768template<
typename Derived>
5773 = getDerived().TransformType(TLB, TL.getPointeeLoc());
5774 if (PointeeType.isNull())
5778 if (getDerived().AlwaysRebuild() ||
5779 PointeeType != TL.getPointeeLoc().getType()) {
5780 Result = getDerived().RebuildBlockPointerType(PointeeType,
5795template<
typename Derived>
5803 if (PointeeType.
isNull())
5808 PointeeType != T->getPointeeTypeAsWritten()) {
5810 T->isSpelledAsLValue(),
5832template<
typename Derived>
5836 return TransformReferenceType(TLB, TL);
5839template<
typename Derived>
5841TreeTransform<Derived>::TransformRValueReferenceType(TypeLocBuilder &TLB,
5842 RValueReferenceTypeLoc TL) {
5843 return TransformReferenceType(TLB, TL);
5846template<
typename Derived>
5850 QualType PointeeType = getDerived().TransformType(TLB, TL.getPointeeLoc());
5851 if (PointeeType.isNull())
5858 getDerived().TransformNestedNameSpecifierLoc(OldQualifierLoc);
5859 if (!NewQualifierLoc)
5862 CXXRecordDecl *OldCls = T->getMostRecentCXXRecordDecl(), *NewCls =
nullptr;
5864 NewCls = cast_or_null<CXXRecordDecl>(
5865 getDerived().TransformDecl(TL.getStarLoc(), OldCls));
5871 if (getDerived().AlwaysRebuild() || PointeeType != T->getPointeeType() ||
5872 NewQualifierLoc.getNestedNameSpecifier() !=
5873 OldQualifierLoc.getNestedNameSpecifier() ||
5876 SS.
Adopt(NewQualifierLoc);
5877 Result = getDerived().RebuildMemberPointerType(PointeeType, SS, NewCls,
5886 if (MPT && PointeeType != MPT->getPointeeType()) {
5893 NewTL.setQualifierLoc(NewQualifierLoc);
5898template<
typename Derived>
5903 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
5904 if (ElementType.isNull())
5908 Expr *OldSize = TL.getSizeExpr();
5910 OldSize =
const_cast<Expr*
>(T->getSizeExpr());
5911 Expr *NewSize =
nullptr;
5915 NewSize = getDerived().TransformExpr(OldSize).template getAs<Expr>();
5920 if (getDerived().AlwaysRebuild() ||
5921 ElementType != T->getElementType() ||
5922 (T->getSizeExpr() && NewSize != OldSize)) {
5923 Result = getDerived().RebuildConstantArrayType(ElementType,
5924 T->getSizeModifier(),
5925 T->getSize(), NewSize,
5926 T->getIndexTypeCVRQualifiers(),
5927 TL.getBracketsRange());
5938 NewTL.setRBracketLoc(TL.getRBracketLoc());
5939 NewTL.setSizeExpr(NewSize);
5944template<
typename Derived>
5949 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
5950 if (ElementType.isNull())
5954 if (getDerived().AlwaysRebuild() ||
5955 ElementType != T->getElementType()) {
5956 Result = getDerived().RebuildIncompleteArrayType(ElementType,
5957 T->getSizeModifier(),
5958 T->getIndexTypeCVRQualifiers(),
5959 TL.getBracketsRange());
5966 NewTL.setRBracketLoc(TL.getRBracketLoc());
5967 NewTL.setSizeExpr(
nullptr);
5972template<
typename Derived>
5977 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
5978 if (ElementType.isNull())
5985 SizeResult = getDerived().TransformExpr(T->getSizeExpr());
5987 if (SizeResult.isInvalid())
5991 if (SizeResult.isInvalid())
5997 if (getDerived().AlwaysRebuild() ||
5998 ElementType != T->getElementType() ||
5999 Size != T->getSizeExpr()) {
6000 Result = getDerived().RebuildVariableArrayType(ElementType,
6001 T->getSizeModifier(),
6003 T->getIndexTypeCVRQualifiers(),
6004 TL.getBracketsRange());
6013 NewTL.setRBracketLoc(TL.getRBracketLoc());
6014 NewTL.setSizeExpr(Size);
6019template<
typename Derived>
6024 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
6025 if (ElementType.isNull())
6033 SemaRef.
ExprEvalContexts.back().InConditionallyConstantEvaluateContext =
true;
6036 Expr *origSize = TL.getSizeExpr();
6037 if (!origSize) origSize = T->getSizeExpr();
6040 = getDerived().TransformExpr(origSize);
6042 if (sizeResult.isInvalid())
6045 Expr *size = sizeResult.get();
6048 if (getDerived().AlwaysRebuild() ||
6049 ElementType != T->getElementType() ||
6051 Result = getDerived().RebuildDependentSizedArrayType(ElementType,
6052 T->getSizeModifier(),
6054 T->getIndexTypeCVRQualifiers(),
6055 TL.getBracketsRange());
6064 NewTL.setRBracketLoc(TL.getRBracketLoc());
6065 NewTL.setSizeExpr(size);
6070template <
typename Derived>
6074 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
6075 if (ElementType.isNull())
6083 if (
Size.isInvalid())
6087 if (getDerived().AlwaysRebuild() || ElementType != T->getElementType() ||
6088 Size.get() != T->getSizeExpr()) {
6089 Result = getDerived().RebuildDependentVectorType(
6090 ElementType,
Size.get(), T->getAttributeLoc(), T->getVectorKind());
6108template<
typename Derived>
6115 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
6116 if (ElementType.isNull())
6125 if (
Size.isInvalid())
6129 if (getDerived().AlwaysRebuild() ||
6130 ElementType != T->getElementType() ||
6131 Size.get() != T->getSizeExpr()) {
6132 Result = getDerived().RebuildDependentSizedExtVectorType(ElementType,
6134 T->getAttributeLoc());
6152template <
typename Derived>
6157 QualType ElementType = getDerived().TransformType(T->getElementType());
6158 if (ElementType.isNull())
6162 if (getDerived().AlwaysRebuild() || ElementType != T->getElementType()) {
6163 Result = getDerived().RebuildConstantMatrixType(
6164 ElementType, T->getNumRows(), T->getNumColumns());
6171 NewTL.setAttrOperandParensRange(TL.getAttrOperandParensRange());
6172 NewTL.setAttrRowOperand(TL.getAttrRowOperand());
6173 NewTL.setAttrColumnOperand(TL.getAttrColumnOperand());
6178template <
typename Derived>
6183 QualType ElementType = getDerived().TransformType(T->getElementType());
6184 if (ElementType.isNull()) {
6192 Expr *origRows = TL.getAttrRowOperand();
6194 origRows = T->getRowExpr();
6195 Expr *origColumns = TL.getAttrColumnOperand();
6197 origColumns = T->getColumnExpr();
6199 ExprResult rowResult = getDerived().TransformExpr(origRows);
6201 if (rowResult.isInvalid())
6204 ExprResult columnResult = getDerived().TransformExpr(origColumns);
6206 if (columnResult.isInvalid())
6209 Expr *rows = rowResult.get();
6210 Expr *columns = columnResult.get();
6213 if (getDerived().AlwaysRebuild() || ElementType != T->getElementType() ||
6214 rows != origRows || columns != origColumns) {
6215 Result = getDerived().RebuildDependentSizedMatrixType(
6216 ElementType, rows, columns, T->getAttributeLoc());
6226 NewTL.setAttrOperandParensRange(TL.getAttrOperandParensRange());
6227 NewTL.setAttrRowOperand(rows);
6228 NewTL.setAttrColumnOperand(columns);
6232template <
typename Derived>
6238 getDerived().TransformType(TLB, TL.getPointeeTypeLoc());
6240 if (pointeeType.isNull())
6247 ExprResult AddrSpace = getDerived().TransformExpr(T->getAddrSpaceExpr());
6249 if (AddrSpace.isInvalid())
6253 if (getDerived().AlwaysRebuild() || pointeeType != T->getPointeeType() ||
6254 AddrSpace.get() != T->getAddrSpaceExpr()) {
6255 Result = getDerived().RebuildDependentAddressSpaceType(
6256 pointeeType, AddrSpace.get(), T->getAttributeLoc());
6267 NewTL.setAttrExprOperand(TL.getAttrExprOperand());
6268 NewTL.setAttrNameLoc(TL.getAttrNameLoc());
6271 TLB.TypeWasModifiedSafely(
Result);
6277template <
typename Derived>
6281 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
6282 if (ElementType.isNull())
6286 if (getDerived().AlwaysRebuild() ||
6287 ElementType != T->getElementType()) {
6288 Result = getDerived().RebuildVectorType(ElementType, T->getNumElements(),
6289 T->getVectorKind());
6300template<
typename Derived>
6304 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
6305 if (ElementType.isNull())
6309 if (getDerived().AlwaysRebuild() ||
6310 ElementType != T->getElementType()) {
6311 Result = getDerived().RebuildExtVectorType(ElementType,
6312 T->getNumElements(),
6324template <
typename Derived>
6327 bool ExpectParameterPack) {
6362 if (NewTSI == OldTSI && indexAdjustment == 0)
6372 getDerived().transformedLocalDecl(OldParm, {newParm});
6376template <
typename Derived>
6384 unsigned *LastParamTransformed) {
6385 int indexAdjustment = 0;
6387 unsigned NumParams = Params.size();
6388 for (
unsigned i = 0; i != NumParams; ++i) {
6389 if (LastParamTransformed)
6390 *LastParamTransformed = i;
6392 assert(OldParm->getFunctionScopeIndex() == i);
6396 if (OldParm->isParameterPack()) {
6401 TypeLoc TL = OldParm->getTypeSourceInfo()->getTypeLoc();
6404 SemaRef.collectUnexpandedParameterPacks(Pattern, Unexpanded);
6407 bool ShouldExpand =
false;
6408 bool RetainExpansion =
false;
6410 if (Unexpanded.size() > 0) {
6411 OrigNumExpansions = ExpansionTL.
getTypePtr()->getNumExpansions();
6412 NumExpansions = OrigNumExpansions;
6416 ShouldExpand, RetainExpansion, NumExpansions)) {
6421 const AutoType *AT =
6422 Pattern.getType().getTypePtr()->getContainedAutoType();
6423 assert((AT && (!AT->isDeduced() || AT->getDeducedType().isNull())) &&
6424 "Could not find parameter packs or undeduced auto type!");
6431 getDerived().ExpandingFunctionParameterPack(OldParm);
6432 for (
unsigned I = 0; I != *NumExpansions; ++I) {
6435 =
getDerived().TransformFunctionTypeParam(OldParm,
6443 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6444 OutParamTypes.push_back(NewParm->
getType());
6446 PVars->push_back(NewParm);
6451 if (RetainExpansion) {
6452 ForgetPartiallySubstitutedPackRAII Forget(
getDerived());
6454 =
getDerived().TransformFunctionTypeParam(OldParm,
6462 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6463 OutParamTypes.push_back(NewParm->
getType());
6465 PVars->push_back(NewParm);
6481 NewParm =
getDerived().TransformFunctionTypeParam(OldParm,
6486 "Parameter pack no longer a parameter pack after "
6489 NewParm =
getDerived().TransformFunctionTypeParam(
6490 OldParm, indexAdjustment, std::nullopt,
6498 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6499 OutParamTypes.push_back(NewParm->
getType());
6501 PVars->push_back(NewParm);
6509 bool IsPackExpansion =
false;
6512 if (
const PackExpansionType *Expansion
6513 = dyn_cast<PackExpansionType>(OldType)) {
6515 QualType Pattern = Expansion->getPattern();
6517 getSema().collectUnexpandedParameterPacks(Pattern, Unexpanded);
6520 bool ShouldExpand =
false;
6521 bool RetainExpansion =
false;
6525 RetainExpansion, NumExpansions)) {
6532 for (
unsigned I = 0; I != *NumExpansions; ++I) {
6539 NewType =
getSema().getASTContext().getPackExpansionType(
6540 NewType, std::nullopt);
6547 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6548 OutParamTypes.push_back(NewType);
6550 PVars->push_back(
nullptr);
6559 if (RetainExpansion) {
6560 ForgetPartiallySubstitutedPackRAII Forget(
getDerived());
6566 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6567 OutParamTypes.push_back(NewType);
6569 PVars->push_back(
nullptr);
6574 OldType = Expansion->getPattern();
6575 IsPackExpansion =
true;
6577 NewType =
getDerived().TransformType(OldType);
6579 NewType =
getDerived().TransformType(OldType);
6585 if (IsPackExpansion)
6586 NewType =
getSema().Context.getPackExpansionType(NewType,
6590 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6591 OutParamTypes.push_back(NewType);
6593 PVars->push_back(
nullptr);
6598 for (
unsigned i = 0, e = PVars->size(); i != e; ++i)
6600 assert(parm->getFunctionScopeIndex() == i);
6607template<
typename Derived>
6612 return getDerived().TransformFunctionProtoType(
6616 ExceptionStorage, Changed);
6620template<
typename Derived>
template<
typename Fn>
6639 if (T->hasTrailingReturn()) {
6643 T->getExtParameterInfosOrNull(),
6644 ParamTypes, &ParamDecls, ExtParamInfos))
6654 auto *RD = dyn_cast<CXXRecordDecl>(
SemaRef.getCurLexicalContext());
6656 SemaRef, !ThisContext && RD ? RD : ThisContext, ThisTypeQuals);
6671 T->getExtParameterInfosOrNull(),
6672 ParamTypes, &ParamDecls, ExtParamInfos))
6678 bool EPIChanged =
false;
6683 if (
auto NewExtParamInfos =
6699 std::optional<FunctionEffectSet> NewFX;
6711 std::optional<FunctionEffectMode> Mode =
6731 "FunctionEffectMode::None shouldn't be possible here");
6734 if (!
SemaRef.diagnoseConflictingFunctionEffect(*NewFX, NewEC,
6737 NewFX->insert(NewEC, Errs);
6738 assert(Errs.empty());
6747 T->getParamTypes() !=
llvm::ArrayRef(ParamTypes) || EPIChanged) {
6748 Result =
getDerived().RebuildFunctionProtoType(ResultType, ParamTypes, EPI);
6759 for (
unsigned i = 0, e = NewTL.
getNumParams(); i != e; ++i)
6765template<
typename Derived>
6788 getSema().ActOnNoexceptSpec(NoexceptExpr.
get(), EST);
6803 if (
const PackExpansionType *PackExpansion =
6804 T->getAs<PackExpansionType>()) {
6809 SemaRef.collectUnexpandedParameterPacks(PackExpansion->getPattern(),
6811 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
6816 bool Expand =
false;
6817 bool RetainExpansion =
false;
6818 UnsignedOrNone NumExpansions = PackExpansion->getNumExpansions();
6823 true, Expand, RetainExpansion,
6836 U =
SemaRef.Context.getPackExpansionType(
U, NumExpansions);
6837 Exceptions.push_back(
U);
6843 for (
unsigned ArgIdx = 0; ArgIdx != *NumExpansions; ++ArgIdx) {
6847 if (
U.isNull() ||
SemaRef.CheckSpecifiedExceptionType(
U, Loc))
6850 Exceptions.push_back(
U);
6854 if (
U.isNull() ||
SemaRef.CheckSpecifiedExceptionType(
U, Loc))
6859 Exceptions.push_back(
U);
6869template<
typename Derived>
6879 if (getDerived().AlwaysRebuild() || ResultType != T->getReturnType())
6880 Result = getDerived().RebuildFunctionNoProtoType(ResultType);
6891template <
typename Derived>
6892QualType TreeTransform<Derived>::TransformUnresolvedUsingType(
6893 TypeLocBuilder &TLB, UnresolvedUsingTypeLoc TL) {
6895 const UnresolvedUsingType *T = TL.getTypePtr();
6896 bool Changed =
false;
6898 NestedNameSpecifierLoc QualifierLoc = TL.getQualifierLoc();
6899 if (NestedNameSpecifierLoc OldQualifierLoc = QualifierLoc) {
6900 QualifierLoc = getDerived().TransformNestedNameSpecifierLoc(QualifierLoc);
6903 Changed |= QualifierLoc != OldQualifierLoc;
6906 auto *D = getDerived().TransformDecl(TL.getNameLoc(), T->getDecl());
6912 if (getDerived().AlwaysRebuild() || Changed) {
6913 Result = getDerived().RebuildUnresolvedUsingType(
6914 T->getKeyword(), QualifierLoc.getNestedNameSpecifier(), TL.getNameLoc(),
6922 QualifierLoc, TL.getNameLoc());
6925 QualifierLoc, TL.getNameLoc());
6929template <
typename Derived>
6937 QualifierLoc = getDerived().TransformNestedNameSpecifierLoc(QualifierLoc);
6940 Changed |= QualifierLoc != OldQualifierLoc;
6943 auto *D = cast_or_null<UsingShadowDecl>(
6944 getDerived().TransformDecl(TL.getNameLoc(), T->getDecl()));
6949 QualType UnderlyingType = getDerived().TransformType(T->desugar());
6950 if (UnderlyingType.isNull())
6952 Changed |= UnderlyingType != T->desugar();
6955 if (getDerived().AlwaysRebuild() || Changed) {
6956 Result = getDerived().RebuildUsingType(
6957 T->getKeyword(), QualifierLoc.getNestedNameSpecifier(), D,
6967template<
typename Derived>
6975 QualifierLoc = getDerived().TransformNestedNameSpecifierLoc(QualifierLoc);
6978 Changed |= QualifierLoc != OldQualifierLoc;
6981 auto *
Typedef = cast_or_null<TypedefNameDecl>(
6982 getDerived().TransformDecl(TL.getNameLoc(), T->getDecl()));
6990 if (getDerived().AlwaysRebuild() || Changed) {
6991 Result = getDerived().RebuildTypedefType(
6992 T->getKeyword(), QualifierLoc.getNestedNameSpecifier(),
Typedef);
6998 QualifierLoc, TL.getNameLoc());
7002template<
typename Derived>
7010 ExprResult E = getDerived().TransformExpr(TL.getUnderlyingExpr());
7020 if (getDerived().AlwaysRebuild() || E.get() != TL.getUnderlyingExpr()) {
7022 getDerived().RebuildTypeOfExprType(E.get(), TL.getTypeofLoc(), Kind);
7029 NewTL.setLParenLoc(TL.getLParenLoc());
7030 NewTL.setRParenLoc(TL.getRParenLoc());
7035template<
typename Derived>
7039 TypeSourceInfo* New_Under_TI = getDerived().TransformType(Old_Under_TI);
7045 if (getDerived().AlwaysRebuild() || New_Under_TI != Old_Under_TI) {
7046 Result = getDerived().RebuildTypeOfType(New_Under_TI->getType(), Kind);
7053 NewTL.setLParenLoc(TL.getLParenLoc());
7054 NewTL.setRParenLoc(TL.getRParenLoc());
7055 NewTL.setUnmodifiedTInfo(New_Under_TI);
7060template<
typename Derived>
7063 const DecltypeType *T = TL.getTypePtr();
7070 ExprResult E = getDerived().TransformExpr(T->getUnderlyingExpr());
7074 E = getSema().ActOnDecltypeExpression(E.get());
7079 if (getDerived().AlwaysRebuild() ||
7080 E.get() != T->getUnderlyingExpr()) {
7081 Result = getDerived().RebuildDecltypeType(E.get(), TL.getDecltypeLoc());
7089 NewTL.setRParenLoc(TL.getRParenLoc());
7093template <
typename Derived>
7103 IndexExpr = getDerived().TransformExpr(TL.getIndexExpr());
7104 if (IndexExpr.isInvalid())
7107 QualType Pattern = TL.getPattern();
7109 const PackIndexingType *PIT = TL.
getTypePtr();
7113 bool NotYetExpanded = Types.empty();
7114 bool FullySubstituted =
true;
7116 if (Types.empty() && !PIT->expandsToEmptyPack())
7120 if (!T->containsUnexpandedParameterPack()) {
7121 QualType Transformed = getDerived().TransformType(T);
7122 if (Transformed.isNull())
7124 SubtitutedTypes.push_back(Transformed);
7129 getSema().collectUnexpandedParameterPacks(T, Unexpanded);
7130 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
7133 bool ShouldExpand =
true;
7134 bool RetainExpansion =
false;
7136 if (getDerived().TryExpandParameterPacks(
7139 RetainExpansion, NumExpansions))
7141 if (!ShouldExpand) {
7147 QualType Pack = getDerived().TransformType(TLB, TI->getTypeLoc());
7150 if (NotYetExpanded) {
7151 FullySubstituted =
false;
7152 QualType Out = getDerived().RebuildPackIndexingType(
7162 SubtitutedTypes.push_back(Pack);
7165 for (
unsigned I = 0; I != *NumExpansions; ++I) {
7170 SubtitutedTypes.push_back(Out);
7171 FullySubstituted &= !
Out->containsUnexpandedParameterPack();
7175 if (RetainExpansion) {
7176 FullySubstituted =
false;
7177 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
7181 SubtitutedTypes.push_back(Out);
7189 QualType Result = getDerived().TransformType(TLB, TL.getPatternLoc());
7191 QualType Out = getDerived().RebuildPackIndexingType(
7193 FullySubstituted, SubtitutedTypes);
7202template<
typename Derived>
7208 if (
Result->isDependentType()) {
7209 const UnaryTransformType *T = TL.getTypePtr();
7211 NewBaseTSI = getDerived().TransformType(TL.getUnderlyingTInfo());
7214 QualType NewBase = NewBaseTSI->getType();
7216 Result = getDerived().RebuildUnaryTransformType(NewBase,
7225 NewTL.setParensRange(TL.getParensRange());
7226 NewTL.setUnderlyingTInfo(NewBaseTSI);
7230template<
typename Derived>
7233 const DeducedTemplateSpecializationType *T = TL.getTypePtr();
7238 TL.getTemplateNameLoc());
7242 QualType OldDeduced = T->getDeducedType();
7244 if (!OldDeduced.isNull()) {
7245 NewDeduced = getDerived().TransformType(OldDeduced);
7246 if (NewDeduced.isNull())
7250 QualType Result = getDerived().RebuildDeducedTemplateSpecializationType(
7258 NewTL.setTemplateNameLoc(TL.getTemplateNameLoc());
7259 NewTL.setQualifierLoc(QualifierLoc);
7263template <
typename Derived>
7270 QualifierLoc =
getDerived().TransformNestedNameSpecifierLoc(QualifierLoc);
7275 auto *TD = cast_or_null<TagDecl>(
7282 TD != T->getDecl()) {
7283 if (T->isCanonicalUnqualified())
7300template <
typename Derived>
7306template <
typename Derived>
7307QualType TreeTransform<Derived>::TransformRecordType(TypeLocBuilder &TLB,
7309 return getDerived().TransformTagType(TLB, TL);
7312template<
typename Derived>
7319template<
typename Derived>
7323 return getDerived().TransformTemplateTypeParmType(
7328template <
typename Derived>
7334template<
typename Derived>
7335QualType TreeTransform<Derived>::TransformSubstTemplateTypeParmType(
7336 TypeLocBuilder &TLB,
7337 SubstTemplateTypeParmTypeLoc TL) {
7338 const SubstTemplateTypeParmType *T = TL.getTypePtr();
7341 getDerived().TransformDecl(TL.getNameLoc(), T->getAssociatedDecl());
7346 TemporaryBase Rebase(*
this, TL.getNameLoc(), DeclarationName());
7347 QualType Replacement = getDerived().TransformType(T->getReplacementType());
7348 if (Replacement.isNull())
7352 Replacement, NewReplaced, T->getIndex(), T->getPackIndex(),
7356 SubstTemplateTypeParmTypeLoc NewTL
7357 = TLB.push<SubstTemplateTypeParmTypeLoc>(
Result);
7358 NewTL.setNameLoc(TL.getNameLoc());
7362template <
typename Derived>
7368template<
typename Derived>
7372 return getDerived().TransformSubstTemplateTypeParmPackType(
7376template <
typename Derived>
7382template<
typename Derived>
7383QualType TreeTransform<Derived>::TransformAtomicType(TypeLocBuilder &TLB,
7385 QualType ValueType = getDerived().TransformType(TLB, TL.getValueLoc());
7386 if (ValueType.isNull())
7389 QualType
Result = TL.getType();
7390 if (getDerived().AlwaysRebuild() ||
7391 ValueType != TL.getValueLoc().getType()) {
7392 Result = getDerived().RebuildAtomicType(ValueType, TL.getKWLoc());
7399 NewTL.setLParenLoc(TL.getLParenLoc());
7400 NewTL.setRParenLoc(TL.getRParenLoc());
7405template <
typename Derived>
7408 QualType ValueType = getDerived().TransformType(TLB, TL.getValueLoc());
7409 if (ValueType.isNull())
7413 if (getDerived().AlwaysRebuild() || ValueType != TL.getValueLoc().getType()) {
7416 Result = getDerived().RebuildPipeType(ValueType, TL.getKWLoc(), isReadPipe);
7427template <
typename Derived>
7433 if (getDerived().AlwaysRebuild()) {
7434 Result = getDerived().RebuildBitIntType(EIT->isUnsigned(),
7435 EIT->getNumBits(), TL.getNameLoc());
7445template <
typename Derived>
7452 ExprResult BitsExpr = getDerived().TransformExpr(EIT->getNumBitsExpr());
7455 if (BitsExpr.isInvalid())
7460 if (getDerived().AlwaysRebuild() || BitsExpr.get() != EIT->getNumBitsExpr()) {
7461 Result = getDerived().RebuildDependentBitIntType(
7462 EIT->isUnsigned(), BitsExpr.get(), TL.getNameLoc());
7478template <
typename Derived>
7481 llvm_unreachable(
"This type does not need to be transformed.");
7489 template<
typename ArgLocContainer>
7491 ArgLocContainer *Container;
7516 : Container(&Container), Index(Index) { }
7530 return Container->getArgLoc(Index);
7534 return pointer(Container->getArgLoc(Index));
7539 return X.Container == Y.Container &&
X.Index == Y.Index;
7548template<
typename Derived>
7549QualType TreeTransform<Derived>::TransformAutoType(TypeLocBuilder &TLB,
7551 const AutoType *T = TL.getTypePtr();
7552 QualType OldDeduced = T->getDeducedType();
7553 QualType NewDeduced;
7554 if (!OldDeduced.isNull()) {
7555 NewDeduced = getDerived().TransformType(OldDeduced);
7556 if (NewDeduced.isNull())
7563 if (T->isConstrained()) {
7564 assert(TL.getConceptReference());
7565 NewCD = cast_or_null<ConceptDecl>(getDerived().TransformDecl(
7566 TL.getConceptNameLoc(), T->getTypeConstraintConcept()));
7568 NewTemplateArgs.setLAngleLoc(TL.getLAngleLoc());
7569 NewTemplateArgs.setRAngleLoc(TL.getRAngleLoc());
7571 if (getDerived().TransformTemplateArguments(
7572 ArgIterator(TL, 0), ArgIterator(TL, TL.getNumArgs()),
7576 if (TL.getNestedNameSpecifierLoc()) {
7578 = getDerived().TransformNestedNameSpecifierLoc(
7579 TL.getNestedNameSpecifierLoc());
7580 if (!NewNestedNameSpec)
7586 if (getDerived().AlwaysRebuild() || NewDeduced != OldDeduced ||
7587 T->isDependentType() || T->isConstrained()) {
7590 NewArgList.reserve(NewTemplateArgs.size());
7591 for (
const auto &ArgLoc : NewTemplateArgs.arguments())
7592 NewArgList.push_back(ArgLoc.getArgument());
7593 Result = getDerived().RebuildAutoType(
7595 NewDeduced, T->getKeyword(), NewCD, NewArgList);
7602 NewTL.setRParenLoc(TL.getRParenLoc());
7603 NewTL.setConceptReference(
nullptr);
7605 if (T->isConstrained()) {
7607 TL.getTypePtr()->getTypeConstraintConcept()->getDeclName(),
7608 TL.getConceptNameLoc(),
7609 TL.getTypePtr()->getTypeConstraintConcept()->getDeclName());
7611 SemaRef.
Context, NewNestedNameSpec, TL.getTemplateKWLoc(), DNI,
7612 TL.getFoundDecl(), TL.getTypePtr()->getTypeConstraintConcept(),
7614 NewTL.setConceptReference(CR);
7620template <
typename Derived>
7623 return getDerived().TransformTemplateSpecializationType(
7628template <
typename Derived>
7631 NamedDecl *FirstQualifierInScope,
bool AllowInjectedClassName) {
7632 const TemplateSpecializationType *T = TL.
getTypePtr();
7638 AllowInjectedClassName);
7647 if (getDerived().TransformTemplateArguments(ArgIterator(TL, 0),
7656 QualType Result = getDerived().RebuildTemplateSpecializationType(
7669template <
typename Derived>
7673 QualType modifiedType = getDerived().TransformType(TLB, TL.getModifiedLoc());
7674 if (modifiedType.isNull())
7681 oldType->getAttrKind(), modifiedType,
7682 TL.getAttr() ? TL.getAttr()->getLocation()
7683 : TL.getModifiedLoc().getBeginLoc()))
7687 const Attr *oldAttr = TL.getAttr();
7688 const Attr *newAttr = oldAttr ? getDerived().TransformAttr(oldAttr) :
nullptr;
7689 if (oldAttr && !newAttr)
7695 if (getDerived().AlwaysRebuild() ||
7696 modifiedType != oldType->getModifiedType()) {
7709 QualType equivalentType = modifiedType;
7710 if (TL.getModifiedLoc().getType() != TL.getEquivalentTypeLoc().getType()) {
7712 AuxiliaryTLB.
reserve(TL.getFullDataSize());
7714 getDerived().TransformType(AuxiliaryTLB, TL.getEquivalentTypeLoc());
7715 if (equivalentType.isNull())
7721 if (
auto nullability = oldType->getImmediateNullability()) {
7722 if (!modifiedType->canHaveNullability()) {
7723 SemaRef.
Diag((TL.getAttr() ? TL.getAttr()->getLocation()
7724 : TL.getModifiedLoc().getBeginLoc()),
7725 diag::err_nullability_nonpointer)
7742template <
typename Derived>
7746 QualType InnerTy = getDerived().TransformType(TLB, TL.getInnerLoc());
7747 if (InnerTy.isNull())
7750 Expr *OldCount = TL.getCountExpr();
7751 Expr *NewCount =
nullptr;
7753 ExprResult CountResult = getDerived().TransformExpr(OldCount);
7754 if (CountResult.isInvalid())
7756 NewCount = CountResult.get();
7760 if (getDerived().AlwaysRebuild() || InnerTy != OldTy->desugar() ||
7761 OldCount != NewCount) {
7764 InnerTy, NewCount, OldTy->isCountInBytes(), OldTy->isOrNull());
7771template <
typename Derived>
7775 llvm_unreachable(
"Unexpected TreeTransform for BTFTagAttributedType");
7778template <
typename Derived>
7781 const OverflowBehaviorType *OldTy = TL.getTypePtr();
7782 QualType InnerTy = getDerived().TransformType(TLB, TL.getWrappedLoc());
7783 if (InnerTy.isNull())
7787 if (getDerived().AlwaysRebuild() || InnerTy != OldTy->getUnderlyingType()) {
7799template <
typename Derived>
7803 const HLSLAttributedResourceType *oldType = TL.getTypePtr();
7805 QualType WrappedTy = getDerived().TransformType(TLB, TL.getWrappedLoc());
7806 if (WrappedTy.isNull())
7810 QualType OldContainedTy = oldType->getContainedType();
7812 if (!OldContainedTy.isNull()) {
7813 TypeSourceInfo *oldContainedTSI = TL.getContainedTypeSourceInfo();
7814 if (!oldContainedTSI)
7815 oldContainedTSI = getSema().getASTContext().getTrivialTypeSourceInfo(
7817 ContainedTSI = getDerived().TransformType(oldContainedTSI);
7820 ContainedTy = ContainedTSI->getType();
7824 if (getDerived().AlwaysRebuild() || WrappedTy != oldType->getWrappedType() ||
7825 ContainedTy != oldType->getContainedType()) {
7827 WrappedTy, ContainedTy, oldType->getAttrs());
7833 NewTL.setContainedTypeSourceInfo(ContainedTSI);
7837template <
typename Derived>
7841 return TL.getType();
7844template<
typename Derived>
7848 QualType Inner = getDerived().TransformType(TLB, TL.getInnerLoc());
7853 if (getDerived().AlwaysRebuild() ||
7854 Inner != TL.getInnerLoc().getType()) {
7855 Result = getDerived().RebuildParenType(Inner);
7862 NewTL.setRParenLoc(TL.getRParenLoc());
7866template <
typename Derived>
7870 QualType Inner = getDerived().TransformType(TLB, TL.getInnerLoc());
7875 if (getDerived().AlwaysRebuild() || Inner != TL.getInnerLoc().getType()) {
7877 getDerived().RebuildMacroQualifiedType(Inner, TL.getMacroIdentifier());
7887template<
typename Derived>
7888QualType TreeTransform<Derived>::TransformDependentNameType(
7890 return TransformDependentNameType(TLB, TL,
false);
7893template <
typename Derived>
7894QualType TreeTransform<Derived>::TransformDependentNameType(
7897 const DependentNameType *T = TL.
getTypePtr();
7901 QualifierLoc = getDerived().TransformNestedNameSpecifierLoc(
7902 QualifierLoc, ObjectType, UnqualLookup);
7906 assert((ObjectType.isNull() && !UnqualLookup) &&
7907 "must be transformed by TransformNestedNameSpecifierLoc");
7911 = getDerived().RebuildDependentNameType(T->getKeyword(),
7912 TL.getElaboratedKeywordLoc(),
7923 NewTL.setQualifierLoc(QualifierLoc);
7924 NewTL.setNameLoc(TL.getNameLoc());
7928 NewTL.setTemplateNameLoc(TL.getNameLoc());
7929 NewTL.setQualifierLoc(QualifierLoc);
7932 QualifierLoc, TL.getNameLoc());
7935 NewTL.
set(TL.getElaboratedKeywordLoc(), QualifierLoc, TL.getNameLoc());
7939 NewTL.setQualifierLoc(QualifierLoc);
7940 NewTL.setNameLoc(TL.getNameLoc());
7945template<
typename Derived>
7949 = getDerived().TransformType(TLB, TL.getPatternLoc());
7950 if (Pattern.isNull())
7954 if (getDerived().AlwaysRebuild() ||
7955 Pattern != TL.getPatternLoc().getType()) {
7956 Result = getDerived().RebuildPackExpansionType(Pattern,
7957 TL.getPatternLoc().getSourceRange(),
7958 TL.getEllipsisLoc(),
7959 TL.getTypePtr()->getNumExpansions());
7969template<
typename Derived>
7974 TLB.pushFullCopy(TL);
7975 return TL.getType();
7978template<
typename Derived>
7982 const ObjCTypeParamType *T = TL.getTypePtr();
7984 getDerived().TransformDecl(T->getDecl()->getLocation(), T->getDecl()));
7989 if (getDerived().AlwaysRebuild() ||
7990 OTP != T->getDecl()) {
7991 Result = getDerived().RebuildObjCTypeParamType(
7992 OTP, TL.getProtocolLAngleLoc(),
7993 llvm::ArrayRef(TL.getTypePtr()->qual_begin(), TL.getNumProtocols()),
7994 TL.getProtocolLocs(), TL.getProtocolRAngleLoc());
8000 if (TL.getNumProtocols()) {
8001 NewTL.setProtocolLAngleLoc(TL.getProtocolLAngleLoc());
8002 for (
unsigned i = 0, n = TL.getNumProtocols(); i != n; ++i)
8003 NewTL.setProtocolLoc(i, TL.getProtocolLoc(i));
8004 NewTL.setProtocolRAngleLoc(TL.getProtocolRAngleLoc());
8009template<
typename Derived>
8014 QualType BaseType = getDerived().TransformType(TLB, TL.getBaseLoc());
8015 if (BaseType.isNull())
8018 bool AnyChanged = BaseType != TL.getBaseLoc().getType();
8022 for (
unsigned i = 0, n = TL.getNumTypeArgs(); i != n; ++i) {
8024 TypeLoc TypeArgLoc = TypeArgInfo->getTypeLoc();
8025 QualType TypeArg = TypeArgInfo->getType();
8030 const auto *PackExpansion = PackExpansionLoc.getType()
8031 ->castAs<PackExpansionType>();
8035 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
8039 TypeLoc PatternLoc = PackExpansionLoc.getPatternLoc();
8040 bool Expand =
false;
8041 bool RetainExpansion =
false;
8042 UnsignedOrNone NumExpansions = PackExpansion->getNumExpansions();
8043 if (getDerived().TryExpandParameterPacks(
8044 PackExpansionLoc.getEllipsisLoc(), PatternLoc.getSourceRange(),
8045 Unexpanded,
true, Expand,
8046 RetainExpansion, NumExpansions))
8056 TypeArgBuilder.
reserve(PatternLoc.getFullDataSize());
8057 QualType NewPatternType = getDerived().TransformType(TypeArgBuilder,
8059 if (NewPatternType.isNull())
8063 NewPatternType, NumExpansions);
8065 NewExpansionLoc.
setEllipsisLoc(PackExpansionLoc.getEllipsisLoc());
8066 NewTypeArgInfos.push_back(
8067 TypeArgBuilder.getTypeSourceInfo(SemaRef.
Context, NewExpansionType));
8073 for (
unsigned ArgIdx = 0; ArgIdx != *NumExpansions; ++ArgIdx) {
8077 TypeArgBuilder.
reserve(PatternLoc.getFullDataSize());
8079 QualType NewTypeArg = getDerived().TransformType(TypeArgBuilder,
8081 if (NewTypeArg.isNull())
8084 NewTypeArgInfos.push_back(
8085 TypeArgBuilder.getTypeSourceInfo(SemaRef.
Context, NewTypeArg));
8092 TypeArgBuilder.
reserve(TypeArgLoc.getFullDataSize());
8094 getDerived().TransformType(TypeArgBuilder, TypeArgLoc);
8095 if (NewTypeArg.isNull())
8099 if (NewTypeArg == TypeArg) {
8100 NewTypeArgInfos.push_back(TypeArgInfo);
8104 NewTypeArgInfos.push_back(
8105 TypeArgBuilder.getTypeSourceInfo(SemaRef.
Context, NewTypeArg));
8110 if (getDerived().AlwaysRebuild() || AnyChanged) {
8112 Result = getDerived().RebuildObjCObjectType(
8113 BaseType, TL.getBeginLoc(), TL.getTypeArgsLAngleLoc(), NewTypeArgInfos,
8114 TL.getTypeArgsRAngleLoc(), TL.getProtocolLAngleLoc(),
8115 llvm::ArrayRef(TL.getTypePtr()->qual_begin(), TL.getNumProtocols()),
8116 TL.getProtocolLocs(), TL.getProtocolRAngleLoc());
8124 NewT.setTypeArgsLAngleLoc(TL.getTypeArgsLAngleLoc());
8125 for (
unsigned i = 0, n = TL.getNumTypeArgs(); i != n; ++i)
8126 NewT.setTypeArgTInfo(i, NewTypeArgInfos[i]);
8127 NewT.setTypeArgsRAngleLoc(TL.getTypeArgsRAngleLoc());
8128 NewT.setProtocolLAngleLoc(TL.getProtocolLAngleLoc());
8129 for (
unsigned i = 0, n = TL.getNumProtocols(); i != n; ++i)
8130 NewT.setProtocolLoc(i, TL.getProtocolLoc(i));
8131 NewT.setProtocolRAngleLoc(TL.getProtocolRAngleLoc());
8135template<
typename Derived>
8139 QualType PointeeType = getDerived().TransformType(TLB, TL.getPointeeLoc());
8140 if (PointeeType.isNull())
8144 if (getDerived().AlwaysRebuild() ||
8145 PointeeType != TL.getPointeeLoc().getType()) {
8146 Result = getDerived().RebuildObjCObjectPointerType(PointeeType,
8160template<
typename Derived>
8166template<
typename Derived>
8169 return getDerived().TransformCompoundStmt(S,
false);
8172template<
typename Derived>
8179 getSema().resetFPOptions(
8182 bool SubStmtInvalid =
false;
8183 bool SubStmtChanged =
false;
8185 for (
auto *B : S->
body()) {
8187 B, IsStmtExpr && B == S->
body_back() ? StmtDiscardKind::StmtExprResult
8188 : StmtDiscardKind::Discarded);
8190 if (
Result.isInvalid()) {
8197 SubStmtInvalid =
true;
8201 SubStmtChanged = SubStmtChanged ||
Result.get() != B;
8202 Statements.push_back(
Result.getAs<Stmt>());
8208 if (!getDerived().AlwaysRebuild() &&
8212 return getDerived().RebuildCompoundStmt(S->
getLBracLoc(),
8218template<
typename Derived>
8227 LHS = getDerived().TransformExpr(S->getLHS());
8229 if (LHS.isInvalid())
8233 RHS = getDerived().TransformExpr(S->getRHS());
8235 if (RHS.isInvalid())
8242 StmtResult Case = getDerived().RebuildCaseStmt(S->getCaseLoc(),
8244 S->getEllipsisLoc(),
8247 if (Case.isInvalid())
8252 getDerived().TransformStmt(S->getSubStmt());
8253 if (SubStmt.isInvalid())
8257 return getDerived().RebuildCaseStmtBody(Case.get(), SubStmt.get());
8260template <
typename Derived>
8264 getDerived().TransformStmt(S->getSubStmt());
8265 if (SubStmt.isInvalid())
8269 return getDerived().RebuildDefaultStmt(S->getDefaultLoc(), S->getColonLoc(),
8273template<
typename Derived>
8276 StmtResult SubStmt = getDerived().TransformStmt(S->getSubStmt(), SDK);
8277 if (SubStmt.isInvalid())
8280 Decl *LD = getDerived().TransformDecl(S->getDecl()->getLocation(),
8288 if (LD == S->getDecl())
8289 S->getDecl()->setStmt(
nullptr);
8292 return getDerived().RebuildLabelStmt(S->getIdentLoc(),
8297template <
typename Derived>
8302 switch (R->getKind()) {
8306 return getDerived().Transform##X##Attr(cast<X##Attr>(R));
8307#include "clang/Basic/AttrList.inc"
8312template <
typename Derived>
8319 switch (R->getKind()) {
8323 return getDerived().TransformStmt##X##Attr(OrigS, InstS, cast<X##Attr>(R));
8324#include "clang/Basic/AttrList.inc"
8329template <
typename Derived>
8332 StmtDiscardKind SDK) {
8337 bool AttrsChanged =
false;
8341 for (
const auto *I : S->
getAttrs()) {
8343 getDerived().TransformStmtAttr(S->
getSubStmt(), SubStmt.
get(), I);
8344 AttrsChanged |= (I != R);
8357 return getDerived().RebuildAttributedStmt(S->
getAttrLoc(), Attrs,
8361template<
typename Derived>
8366 if (
Init.isInvalid())
8370 if (!S->isConsteval()) {
8372 Cond = getDerived().TransformCondition(
8373 S->getIfLoc(), S->getConditionVariable(), S->getCond(),
8376 if (
Cond.isInvalid())
8381 std::optional<bool> ConstexprConditionValue;
8382 if (S->isConstexpr())
8383 ConstexprConditionValue =
Cond.getKnownValue();
8387 if (!ConstexprConditionValue || *ConstexprConditionValue) {
8391 S->isNonNegatedConsteval());
8393 Then = getDerived().TransformStmt(S->getThen());
8394 if (Then.isInvalid())
8400 Then =
new (getSema().Context)
8401 CompoundStmt(S->getThen()->getBeginLoc(), S->getThen()->getEndLoc());
8406 if (!ConstexprConditionValue || !*ConstexprConditionValue) {
8410 S->isNegatedConsteval());
8412 Else = getDerived().TransformStmt(S->getElse());
8413 if (Else.isInvalid())
8415 }
else if (S->getElse() && ConstexprConditionValue &&
8416 *ConstexprConditionValue) {
8420 Else =
new (getSema().Context)
8421 CompoundStmt(S->getElse()->getBeginLoc(), S->getElse()->getEndLoc());
8424 if (!getDerived().AlwaysRebuild() &&
8425 Init.get() == S->getInit() &&
8426 Cond.get() == std::make_pair(S->getConditionVariable(), S->getCond()) &&
8427 Then.get() == S->getThen() &&
8428 Else.get() == S->getElse())
8431 return getDerived().RebuildIfStmt(
8432 S->getIfLoc(), S->getStatementKind(), S->getLParenLoc(),
Cond,
8433 S->getRParenLoc(),
Init.get(), Then.get(), S->getElseLoc(), Else.get());
8436template<
typename Derived>
8441 if (
Init.isInvalid())
8446 S->getSwitchLoc(), S->getConditionVariable(), S->getCond(),
8448 if (
Cond.isInvalid())
8453 getDerived().RebuildSwitchStmtStart(S->getSwitchLoc(), S->getLParenLoc(),
8454 Init.get(),
Cond, S->getRParenLoc());
8459 StmtResult Body = getDerived().TransformStmt(S->getBody());
8460 if (Body.isInvalid())
8464 return getDerived().RebuildSwitchStmtBody(S->getSwitchLoc(),
Switch.get(),
8468template<
typename Derived>
8473 S->getWhileLoc(), S->getConditionVariable(), S->getCond(),
8475 if (
Cond.isInvalid())
8484 StmtResult Body = getDerived().TransformStmt(S->getBody());
8485 if (Body.isInvalid())
8488 if (!getDerived().AlwaysRebuild() &&
8489 Cond.get() == std::make_pair(S->getConditionVariable(), S->getCond()) &&
8490 Body.get() == S->getBody())
8493 return getDerived().RebuildWhileStmt(S->getWhileLoc(), S->getLParenLoc(),
8494 Cond, S->getRParenLoc(), Body.get());
8497template<
typename Derived>
8506 StmtResult Body = getDerived().TransformStmt(S->getBody());
8507 if (Body.isInvalid())
8512 if (
Cond.isInvalid())
8515 if (!getDerived().AlwaysRebuild() &&
8516 Cond.get() == S->getCond() &&
8517 Body.get() == S->getBody())
8520 return getDerived().RebuildDoStmt(S->getDoLoc(), Body.get(), S->getWhileLoc(),
8521 S->getWhileLoc(),
Cond.get(),
8525template<
typename Derived>
8528 if (getSema().getLangOpts().OpenMP)
8529 getSema().OpenMP().startOpenMPLoop();
8533 if (
Init.isInvalid())
8538 if (getSema().getLangOpts().OpenMP &&
Init.isUsable())
8539 getSema().OpenMP().ActOnOpenMPLoopInitialization(S->getForLoc(),
8544 S->getForLoc(), S->getConditionVariable(), S->getCond(),
8546 if (
Cond.isInvalid())
8551 if (
Inc.isInvalid())
8555 if (S->getInc() && !FullInc.get())
8562 S->getBeginLoc(), S->getInit(),
Init.get(), S->getCond(),
8563 Cond.get().second, S->getInc(),
Inc.get());
8566 StmtResult Body = getDerived().TransformStmt(S->getBody());
8567 if (Body.isInvalid())
8572 if (!getDerived().AlwaysRebuild() &&
8573 Init.get() == S->getInit() &&
8574 Cond.get() == std::make_pair(S->getConditionVariable(), S->getCond()) &&
8575 Inc.get() == S->getInc() &&
8576 Body.get() == S->getBody())
8579 return getDerived().RebuildForStmt(S->getForLoc(), S->getLParenLoc(),
8581 S->getRParenLoc(), Body.get());
8584template<
typename Derived>
8587 Decl *LD = getDerived().TransformDecl(S->getLabel()->getLocation(),
8593 return getDerived().RebuildGotoStmt(S->getGotoLoc(), S->getLabelLoc(),
8597template<
typename Derived>
8605 if (!getDerived().AlwaysRebuild() &&
8606 Target.get() == S->getTarget())
8609 return getDerived().RebuildIndirectGotoStmt(S->getGotoLoc(), S->getStarLoc(),
8613template<
typename Derived>
8616 if (!S->hasLabelTarget())
8619 Decl *LD = getDerived().TransformDecl(S->getLabelDecl()->getLocation(),
8628template<
typename Derived>
8631 if (!S->hasLabelTarget())
8634 Decl *LD = getDerived().TransformDecl(S->getLabelDecl()->getLocation(),
8643template <
typename Derived>
8651template<
typename Derived>
8661 return getDerived().RebuildReturnStmt(S->getReturnLoc(),
Result.get());
8664template<
typename Derived>
8667 bool DeclChanged =
false;
8670 for (
auto *D : S->decls()) {
8671 Decl *Transformed = getDerived().TransformDefinition(D->getLocation(), D);
8675 if (Transformed != D)
8679 if (
auto *TD = dyn_cast<TypeDecl>(Transformed)) {
8680 if (
auto *TN = dyn_cast<TypedefNameDecl>(TD)) {
8681 LSI->ContainsUnexpandedParameterPack |=
8682 TN->getUnderlyingType()->containsUnexpandedParameterPack();
8684 LSI->ContainsUnexpandedParameterPack |=
8687 .getTypeDeclType(TD)
8688 ->containsUnexpandedParameterPack();
8691 if (
auto *VD = dyn_cast<VarDecl>(Transformed))
8692 LSI->ContainsUnexpandedParameterPack |=
8693 VD->getType()->containsUnexpandedParameterPack();
8696 Decls.push_back(Transformed);
8699 if (!getDerived().AlwaysRebuild() && !DeclChanged)
8702 return getDerived().RebuildDeclStmt(Decls, S->getBeginLoc(), S->getEndLoc());
8705template<
typename Derived>
8715 bool ExprsChanged =
false;
8717 auto RebuildString = [&](
Expr *E) {
8722 ExprsChanged =
true;
8729 for (
unsigned I = 0, E = S->getNumOutputs(); I != E; ++I) {
8730 Names.push_back(S->getOutputIdentifier(I));
8736 Constraints.push_back(
Result.get());
8739 Expr *OutputExpr = S->getOutputExpr(I);
8740 Result = getDerived().TransformExpr(OutputExpr);
8744 ExprsChanged |=
Result.get() != OutputExpr;
8746 Exprs.push_back(
Result.get());
8750 for (
unsigned I = 0, E = S->getNumInputs(); I != E; ++I) {
8751 Names.push_back(S->getInputIdentifier(I));
8757 Constraints.push_back(
Result.get());
8760 Expr *InputExpr = S->getInputExpr(I);
8761 Result = getDerived().TransformExpr(InputExpr);
8765 ExprsChanged |=
Result.get() != InputExpr;
8767 Exprs.push_back(
Result.get());
8771 for (
unsigned I = 0, E = S->getNumLabels(); I != E; ++I) {
8772 Names.push_back(S->getLabelIdentifier(I));
8777 ExprsChanged |=
Result.get() != S->getLabelExpr(I);
8778 Exprs.push_back(
Result.get());
8782 for (
unsigned I = 0, E = S->getNumClobbers(); I != E; ++I) {
8786 Clobbers.push_back(
Result.get());
8789 ExprResult AsmString = RebuildString(S->getAsmStringExpr());
8790 if (AsmString.isInvalid())
8793 if (!getDerived().AlwaysRebuild() && !ExprsChanged)
8796 return getDerived().RebuildGCCAsmStmt(S->getAsmLoc(), S->isSimple(),
8797 S->isVolatile(), S->getNumOutputs(),
8798 S->getNumInputs(), Names.data(),
8799 Constraints, Exprs, AsmString.get(),
8800 Clobbers, S->getNumLabels(),
8804template<
typename Derived>
8809 bool HadError =
false, HadChange =
false;
8813 TransformedExprs.reserve(SrcExprs.size());
8814 for (
unsigned i = 0, e = SrcExprs.size(); i != e; ++i) {
8816 if (!
Result.isUsable()) {
8819 HadChange |= (
Result.get() != SrcExprs[i]);
8820 TransformedExprs.push_back(
Result.get());
8825 if (!HadChange && !getDerived().AlwaysRebuild())
8828 return getDerived().RebuildMSAsmStmt(S->getAsmLoc(), S->getLBraceLoc(),
8829 AsmToks, S->getAsmString(),
8830 S->getNumOutputs(), S->getNumInputs(),
8831 S->getAllConstraints(), S->getClobbers(),
8832 TransformedExprs, S->getEndLoc());
8836template<
typename Derived>
8841 assert(FD && ScopeInfo && !ScopeInfo->CoroutinePromise &&
8842 ScopeInfo->NeedsCoroutineSuspends &&
8843 ScopeInfo->CoroutineSuspends.first ==
nullptr &&
8844 ScopeInfo->CoroutineSuspends.second ==
nullptr &&
8845 "expected clean scope info");
8849 ScopeInfo->setNeedsCoroutineSuspends(
false);
8862 getDerived().transformedLocalDecl(S->getPromiseDecl(), {Promise});
8863 ScopeInfo->CoroutinePromise = Promise;
8868 StmtResult InitSuspend = getDerived().TransformStmt(S->getInitSuspendStmt());
8869 if (InitSuspend.isInvalid())
8872 getDerived().TransformStmt(S->getFinalSuspendStmt());
8873 if (FinalSuspend.isInvalid() ||
8876 ScopeInfo->setCoroutineSuspends(InitSuspend.get(), FinalSuspend.get());
8879 StmtResult BodyRes = getDerived().TransformStmt(S->getBody());
8880 if (BodyRes.isInvalid())
8884 if (Builder.isInvalid())
8887 Expr *ReturnObject = S->getReturnValueInit();
8888 assert(ReturnObject &&
"the return object is expected to be valid");
8889 ExprResult Res = getDerived().TransformInitializer(ReturnObject,
8891 if (Res.isInvalid())
8893 Builder.ReturnValue = Res.get();
8898 if (S->hasDependentPromiseType()) {
8901 if (!Promise->getType()->isDependentType()) {
8902 assert(!S->getFallthroughHandler() && !S->getExceptionHandler() &&
8903 !S->getReturnStmtOnAllocFailure() && !S->getDeallocate() &&
8904 "these nodes should not have been built yet");
8905 if (!Builder.buildDependentStatements())
8909 if (
auto *OnFallthrough = S->getFallthroughHandler()) {
8910 StmtResult Res = getDerived().TransformStmt(OnFallthrough);
8911 if (Res.isInvalid())
8913 Builder.OnFallthrough = Res.get();
8916 if (
auto *OnException = S->getExceptionHandler()) {
8917 StmtResult Res = getDerived().TransformStmt(OnException);
8918 if (Res.isInvalid())
8920 Builder.OnException = Res.get();
8923 if (
auto *OnAllocFailure = S->getReturnStmtOnAllocFailure()) {
8924 StmtResult Res = getDerived().TransformStmt(OnAllocFailure);
8925 if (Res.isInvalid())
8927 Builder.ReturnStmtOnAllocFailure = Res.get();
8931 assert(S->getAllocate() && S->getDeallocate() &&
8932 "allocation and deallocation calls must already be built");
8933 ExprResult AllocRes = getDerived().TransformExpr(S->getAllocate());
8934 if (AllocRes.isInvalid())
8936 Builder.Allocate = AllocRes.get();
8938 ExprResult DeallocRes = getDerived().TransformExpr(S->getDeallocate());
8939 if (DeallocRes.isInvalid())
8941 Builder.Deallocate = DeallocRes.get();
8943 if (
auto *ResultDecl = S->getResultDecl()) {
8944 StmtResult Res = getDerived().TransformStmt(ResultDecl);
8945 if (Res.isInvalid())
8947 Builder.ResultDecl = Res.get();
8952 if (Res.isInvalid())
8954 Builder.ReturnStmt = Res.get();
8958 return getDerived().RebuildCoroutineBodyStmt(Builder);
8961template<
typename Derived>
8971 return getDerived().RebuildCoreturnStmt(S->getKeywordLoc(),
Result.get(),
8975template <
typename Derived>
8988 ExprResult Lookup = getSema().BuildOperatorCoawaitLookupExpr(
8989 getSema().getCurScope(), E->getKeywordLoc());
8993 return getDerived().RebuildCoawaitExpr(
8994 E->getKeywordLoc(),
Operand.get(),
8998template <
typename Derived>
9001 ExprResult OperandResult = getDerived().TransformInitializer(E->getOperand(),
9003 if (OperandResult.isInvalid())
9007 E->getOperatorCoawaitLookup());
9014 return getDerived().RebuildDependentCoawaitExpr(
9015 E->getKeywordLoc(), OperandResult.get(),
9019template<
typename Derived>
9029 return getDerived().RebuildCoyieldExpr(E->getKeywordLoc(),
Result.get());
9034template<
typename Derived>
9038 StmtResult TryBody = getDerived().TransformStmt(S->getTryBody());
9039 if (TryBody.isInvalid())
9043 bool AnyCatchChanged =
false;
9045 for (
unsigned I = 0, N = S->getNumCatchStmts(); I != N; ++I) {
9046 StmtResult Catch = getDerived().TransformStmt(S->getCatchStmt(I));
9047 if (Catch.isInvalid())
9049 if (Catch.get() != S->getCatchStmt(I))
9050 AnyCatchChanged =
true;
9051 CatchStmts.push_back(Catch.get());
9056 if (S->getFinallyStmt()) {
9057 Finally = getDerived().TransformStmt(S->getFinallyStmt());
9058 if (Finally.isInvalid())
9063 if (!getDerived().AlwaysRebuild() &&
9064 TryBody.get() == S->getTryBody() &&
9066 Finally.get() == S->getFinallyStmt())
9070 return getDerived().RebuildObjCAtTryStmt(S->getAtTryLoc(), TryBody.get(),
9071 CatchStmts, Finally.get());
9074template<
typename Derived>
9079 if (
VarDecl *FromVar = S->getCatchParamDecl()) {
9081 if (FromVar->getTypeSourceInfo()) {
9082 TSInfo = getDerived().TransformType(FromVar->getTypeSourceInfo());
9089 T = TSInfo->getType();
9091 T = getDerived().TransformType(FromVar->getType());
9096 Var = getDerived().RebuildObjCExceptionDecl(FromVar, TSInfo, T);
9101 StmtResult Body = getDerived().TransformStmt(S->getCatchBody());
9102 if (Body.isInvalid())
9105 return getDerived().RebuildObjCAtCatchStmt(S->getAtCatchLoc(),
9110template<
typename Derived>
9114 StmtResult Body = getDerived().TransformStmt(S->getFinallyBody());
9115 if (Body.isInvalid())
9119 if (!getDerived().AlwaysRebuild() &&
9120 Body.get() == S->getFinallyBody())
9124 return getDerived().RebuildObjCAtFinallyStmt(S->getAtFinallyLoc(),
9128template<
typename Derived>
9132 if (S->getThrowExpr()) {
9133 Operand = getDerived().TransformExpr(S->getThrowExpr());
9138 if (!getDerived().AlwaysRebuild() &&
9139 Operand.get() == S->getThrowExpr())
9142 return getDerived().RebuildObjCAtThrowStmt(S->getThrowLoc(),
Operand.get());
9145template<
typename Derived>
9154 getDerived().RebuildObjCAtSynchronizedOperand(S->getAtSynchronizedLoc(),
9160 StmtResult Body = getDerived().TransformStmt(S->getSynchBody());
9161 if (Body.isInvalid())
9165 if (!getDerived().AlwaysRebuild() &&
9166 Object.get() == S->getSynchExpr() &&
9167 Body.get() == S->getSynchBody())
9171 return getDerived().RebuildObjCAtSynchronizedStmt(S->getAtSynchronizedLoc(),
9172 Object.get(), Body.get());
9175template<
typename Derived>
9180 StmtResult Body = getDerived().TransformStmt(S->getSubStmt());
9181 if (Body.isInvalid())
9185 if (!getDerived().AlwaysRebuild() &&
9186 Body.get() == S->getSubStmt())
9190 return getDerived().RebuildObjCAutoreleasePoolStmt(
9191 S->getAtLoc(), Body.get());
9194template<
typename Derived>
9199 StmtResult Element = getDerived().TransformStmt(
9200 S->getElement(), StmtDiscardKind::NotDiscarded);
9201 if (Element.isInvalid())
9205 ExprResult Collection = getDerived().TransformExpr(S->getCollection());
9206 if (Collection.isInvalid())
9210 StmtResult Body = getDerived().TransformStmt(S->getBody());
9211 if (Body.isInvalid())
9215 if (!getDerived().AlwaysRebuild() &&
9216 Element.get() == S->getElement() &&
9217 Collection.get() == S->getCollection() &&
9218 Body.get() == S->getBody())
9222 return getDerived().RebuildObjCForCollectionStmt(S->getForLoc(),
9229template <
typename Derived>
9233 if (
VarDecl *ExceptionDecl = S->getExceptionDecl()) {
9235 getDerived().TransformType(ExceptionDecl->getTypeSourceInfo());
9239 Var = getDerived().RebuildExceptionDecl(
9240 ExceptionDecl, T, ExceptionDecl->getInnerLocStart(),
9241 ExceptionDecl->getLocation(), ExceptionDecl->getIdentifier());
9242 if (!Var || Var->isInvalidDecl())
9247 StmtResult Handler = getDerived().TransformStmt(S->getHandlerBlock());
9248 if (Handler.isInvalid())
9251 if (!getDerived().AlwaysRebuild() && !Var &&
9252 Handler.get() == S->getHandlerBlock())
9255 return getDerived().RebuildCXXCatchStmt(S->getCatchLoc(), Var, Handler.get());
9258template <
typename Derived>
9261 StmtResult TryBlock = getDerived().TransformCompoundStmt(S->getTryBlock());
9262 if (TryBlock.isInvalid())
9266 bool HandlerChanged =
false;
9268 for (
unsigned I = 0, N = S->getNumHandlers(); I != N; ++I) {
9269 StmtResult Handler = getDerived().TransformCXXCatchStmt(S->getHandler(I));
9270 if (Handler.isInvalid())
9273 HandlerChanged = HandlerChanged || Handler.get() != S->getHandler(I);
9274 Handlers.push_back(Handler.getAs<
Stmt>());
9277 getSema().DiagnoseExceptionUse(S->getTryLoc(),
true);
9279 if (!getDerived().AlwaysRebuild() && TryBlock.get() == S->getTryBlock() &&
9283 return getDerived().RebuildCXXTryStmt(S->getTryLoc(), TryBlock.get(),
9287template<
typename Derived>
9298 auto &LastRecord = getSema().currentEvaluationContext();
9299 LastRecord.InLifetimeExtendingContext =
true;
9300 LastRecord.RebuildDefaultArgOrDefaultInit =
true;
9303 S->getInit() ? getDerived().TransformStmt(S->getInit()) :
StmtResult();
9304 if (
Init.isInvalid())
9308 if (
Range.isInvalid())
9313 getSema().ExprEvalContexts.back().ForRangeLifetimeExtendTemps.empty());
9314 auto ForRangeLifetimeExtendTemps =
9315 getSema().ExprEvalContexts.back().ForRangeLifetimeExtendTemps;
9317 StmtResult Begin = getDerived().TransformStmt(S->getBeginStmt());
9318 if (Begin.isInvalid())
9320 StmtResult End = getDerived().TransformStmt(S->getEndStmt());
9321 if (End.isInvalid())
9325 if (
Cond.isInvalid())
9329 if (
Cond.isInvalid())
9335 if (
Inc.isInvalid())
9340 StmtResult LoopVar = getDerived().TransformStmt(S->getLoopVarStmt());
9341 if (LoopVar.isInvalid())
9345 if (getDerived().AlwaysRebuild() ||
9346 Init.get() != S->getInit() ||
9347 Range.get() != S->getRangeStmt() ||
9348 Begin.get() != S->getBeginStmt() ||
9349 End.get() != S->getEndStmt() ||
9350 Cond.get() != S->getCond() ||
9351 Inc.get() != S->getInc() ||
9352 LoopVar.get() != S->getLoopVarStmt()) {
9353 NewStmt = getDerived().RebuildCXXForRangeStmt(
9354 S->getForLoc(), S->getCoawaitLoc(),
Init.get(), S->getColonLoc(),
9355 Range.get(), Begin.get(), End.get(),
Cond.get(),
Inc.get(),
9356 LoopVar.get(), S->getRParenLoc(), ForRangeLifetimeExtendTemps);
9357 if (NewStmt.isInvalid() && LoopVar.get() != S->getLoopVarStmt()) {
9359 getSema().ActOnInitializerError(
9370 StmtResult Body = getDerived().TransformStmt(S->getBody());
9371 if (Body.isInvalid())
9378 if (Body.get() != S->getBody() && NewStmt.get() == S) {
9379 NewStmt = getDerived().RebuildCXXForRangeStmt(
9380 S->getForLoc(), S->getCoawaitLoc(),
Init.get(), S->getColonLoc(),
9381 Range.get(), Begin.get(), End.get(),
Cond.get(),
Inc.get(),
9382 LoopVar.get(), S->getRParenLoc(), ForRangeLifetimeExtendTemps);
9383 if (NewStmt.isInvalid())
9387 if (NewStmt.get() == S)
9390 return FinishCXXForRangeStmt(NewStmt.get(), Body.get());
9393template<
typename Derived>
9399 if (S->getQualifierLoc()) {
9401 = getDerived().TransformNestedNameSpecifierLoc(S->getQualifierLoc());
9408 if (NameInfo.getName()) {
9409 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
9410 if (!NameInfo.getName())
9415 if (!getDerived().AlwaysRebuild() &&
9416 QualifierLoc == S->getQualifierLoc() &&
9417 NameInfo.getName() == S->getNameInfo().getName())
9422 SS.
Adopt(QualifierLoc);
9424 switch (getSema().CheckMicrosoftIfExistsSymbol(
nullptr, SS, NameInfo)) {
9426 if (S->isIfExists())
9429 return new (getSema().Context)
NullStmt(S->getKeywordLoc());
9432 if (S->isIfNotExists())
9435 return new (getSema().Context)
NullStmt(S->getKeywordLoc());
9446 StmtResult SubStmt = getDerived().TransformCompoundStmt(S->getSubStmt());
9447 if (SubStmt.isInvalid())
9455 return getDerived().RebuildMSDependentExistsStmt(S->getKeywordLoc(),
9462template<
typename Derived>
9466 if (E->getQualifierLoc()) {
9468 = getDerived().TransformNestedNameSpecifierLoc(E->getQualifierLoc());
9474 getDerived().TransformDecl(E->getMemberLoc(), E->getPropertyDecl()));
9479 if (
Base.isInvalid())
9485 QualifierLoc, E->getMemberLoc());
9488template <
typename Derived>
9492 if (BaseRes.isInvalid())
9494 auto IdxRes = getDerived().TransformExpr(E->getIdx());
9495 if (IdxRes.isInvalid())
9498 if (!getDerived().AlwaysRebuild() &&
9499 BaseRes.get() == E->getBase() &&
9500 IdxRes.get() == E->getIdx())
9503 return getDerived().RebuildArraySubscriptExpr(
9504 BaseRes.get(),
SourceLocation(), IdxRes.get(), E->getRBracketLoc());
9507template <
typename Derived>
9509 StmtResult TryBlock = getDerived().TransformCompoundStmt(S->getTryBlock());
9510 if (TryBlock.isInvalid())
9513 StmtResult Handler = getDerived().TransformSEHHandler(S->getHandler());
9514 if (Handler.isInvalid())
9517 if (!getDerived().AlwaysRebuild() && TryBlock.get() == S->getTryBlock() &&
9518 Handler.get() == S->getHandler())
9521 return getDerived().RebuildSEHTryStmt(S->getIsCXXTry(), S->getTryLoc(),
9522 TryBlock.get(), Handler.get());
9525template <
typename Derived>
9528 if (
Block.isInvalid())
9531 return getDerived().RebuildSEHFinallyStmt(S->getFinallyLoc(),
Block.get());
9534template <
typename Derived>
9536 ExprResult FilterExpr = getDerived().TransformExpr(S->getFilterExpr());
9537 if (FilterExpr.isInvalid())
9541 if (
Block.isInvalid())
9544 return getDerived().RebuildSEHExceptStmt(S->getExceptLoc(), FilterExpr.get(),
9548template <
typename Derived>
9556template<
typename Derived>
9566template <
typename Derived>
9568TreeTransform<Derived>::TransformOMPCanonicalLoop(OMPCanonicalLoop *L) {
9572 return getDerived().TransformStmt(L->getLoopStmt());
9575template <
typename Derived>
9582 TClauses.reserve(Clauses.size());
9586 getDerived().getSema().OpenMP().StartOpenMPClause((*I)->getClauseKind());
9588 getDerived().getSema().OpenMP().EndOpenMPClause();
9590 TClauses.push_back(Clause);
9592 TClauses.push_back(
nullptr);
9596 if (D->hasAssociatedStmt() && D->getAssociatedStmt()) {
9597 getDerived().getSema().OpenMP().ActOnOpenMPRegionStart(
9598 D->getDirectiveKind(),
9604 if (D->getDirectiveKind() == OMPD_atomic ||
9605 D->getDirectiveKind() == OMPD_critical ||
9606 D->getDirectiveKind() == OMPD_section ||
9607 D->getDirectiveKind() == OMPD_master)
9608 CS = D->getAssociatedStmt();
9610 CS = D->getRawStmt();
9613 getSema().getLangOpts().OpenMPIRBuilder)
9617 getDerived().getSema().OpenMP().ActOnOpenMPRegionEnd(Body, TClauses);
9622 if (TClauses.size() != Clauses.size()) {
9628 if (D->getDirectiveKind() == OMPD_critical) {
9630 DirName =
getDerived().TransformDeclarationNameInfo(DirName);
9633 if (D->getDirectiveKind() == OMPD_cancellation_point) {
9635 }
else if (D->getDirectiveKind() == OMPD_cancel) {
9639 return getDerived().RebuildOMPExecutableDirective(
9640 D->getDirectiveKind(), DirName, CancelRegion, TClauses,
9641 AssociatedStmt.
get(), D->getBeginLoc(), D->getEndLoc());
9649template <
typename Derived>
9656 TClauses.reserve(Clauses.size());
9659 getDerived().getSema().OpenMP().StartOpenMPClause(
C->getClauseKind());
9661 getDerived().getSema().OpenMP().EndOpenMPClause();
9663 TClauses.push_back(Clause);
9665 TClauses.push_back(
nullptr);
9669 if (D->hasAssociatedStmt() && D->getAssociatedStmt()) {
9670 getDerived().getSema().OpenMP().ActOnOpenMPRegionStart(
9671 D->getDirectiveKind(),
9676 assert(D->getDirectiveKind() == OMPD_assume &&
9677 "Unexpected informational directive");
9678 Stmt *CS = D->getAssociatedStmt();
9682 getDerived().getSema().OpenMP().ActOnOpenMPRegionEnd(Body, TClauses);
9686 if (TClauses.size() != Clauses.size())
9691 return getDerived().RebuildOMPInformationalDirective(
9692 D->getDirectiveKind(), DirName, TClauses, AssociatedStmt.
get(),
9693 D->getBeginLoc(), D->getEndLoc());
9696template <
typename Derived>
9701 SemaRef.
Diag(D->getBeginLoc(), diag::err_omp_instantiation_not_supported)
9702 << getOpenMPDirectiveName(D->getDirectiveKind(), OMPVersion);
9706template <
typename Derived>
9708TreeTransform<Derived>::TransformOMPParallelDirective(OMPParallelDirective *D) {
9709 DeclarationNameInfo DirName;
9710 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9711 OMPD_parallel, DirName,
nullptr, D->getBeginLoc());
9712 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9713 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9717template <
typename Derived>
9721 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9722 OMPD_simd, DirName,
nullptr, D->getBeginLoc());
9723 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9724 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9728template <
typename Derived>
9732 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9733 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
9734 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9735 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9739template <
typename Derived>
9743 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9744 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
9745 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9746 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9750template <
typename Derived>
9754 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9755 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
9756 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9757 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9761template <
typename Derived>
9765 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9766 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
9767 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9768 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9772template <
typename Derived>
9774 OMPInterchangeDirective *D) {
9776 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9777 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
9778 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9779 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9783template <
typename Derived>
9787 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9788 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
9789 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9790 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9794template <
typename Derived>
9798 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9799 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
9800 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9801 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9805template <
typename Derived>
9809 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9810 OMPD_for, DirName,
nullptr, D->getBeginLoc());
9811 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9812 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9816template <
typename Derived>
9820 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9821 OMPD_for_simd, DirName,
nullptr, D->getBeginLoc());
9822 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9823 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9827template <
typename Derived>
9831 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9832 OMPD_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_section, DirName,
nullptr, D->getBeginLoc());
9844 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9845 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9849template <
typename Derived>
9853 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9854 OMPD_scope, 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_single, 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_master, DirName,
nullptr, D->getBeginLoc());
9877 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9878 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9882template <
typename Derived>
9886 OMPD_critical, D->getDirectiveName(),
nullptr, D->getBeginLoc());
9887 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9888 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9892template <
typename Derived>
9894 OMPParallelForDirective *D) {
9896 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9897 OMPD_parallel_for, DirName,
nullptr, D->getBeginLoc());
9898 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9899 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9903template <
typename Derived>
9905 OMPParallelForSimdDirective *D) {
9907 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9908 OMPD_parallel_for_simd, DirName,
nullptr, D->getBeginLoc());
9909 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9910 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9914template <
typename Derived>
9916 OMPParallelMasterDirective *D) {
9918 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9919 OMPD_parallel_master, DirName,
nullptr, D->getBeginLoc());
9920 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9921 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9925template <
typename Derived>
9927 OMPParallelMaskedDirective *D) {
9929 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9930 OMPD_parallel_masked, DirName,
nullptr, D->getBeginLoc());
9931 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9932 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9936template <
typename Derived>
9938 OMPParallelSectionsDirective *D) {
9940 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9941 OMPD_parallel_sections, DirName,
nullptr, D->getBeginLoc());
9942 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9943 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9947template <
typename Derived>
9951 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9952 OMPD_task, DirName,
nullptr, D->getBeginLoc());
9953 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9954 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9958template <
typename Derived>
9960 OMPTaskyieldDirective *D) {
9962 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9963 OMPD_taskyield, DirName,
nullptr, D->getBeginLoc());
9964 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9965 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9969template <
typename Derived>
9973 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9974 OMPD_barrier, DirName,
nullptr, D->getBeginLoc());
9975 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9976 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9980template <
typename Derived>
9984 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9985 OMPD_taskwait, DirName,
nullptr, D->getBeginLoc());
9986 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9987 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9991template <
typename Derived>
9995 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9996 OMPD_assume, DirName,
nullptr, D->getBeginLoc());
9997 StmtResult Res = getDerived().TransformOMPInformationalDirective(D);
9998 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10002template <
typename Derived>
10006 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10007 OMPD_error, DirName,
nullptr, D->getBeginLoc());
10008 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10009 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10013template <
typename Derived>
10015 OMPTaskgroupDirective *D) {
10017 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10018 OMPD_taskgroup, DirName,
nullptr, D->getBeginLoc());
10019 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10020 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10024template <
typename Derived>
10028 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10029 OMPD_flush, DirName,
nullptr, D->getBeginLoc());
10030 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10031 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10035template <
typename Derived>
10039 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10040 OMPD_depobj, DirName,
nullptr, D->getBeginLoc());
10041 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10042 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10046template <
typename Derived>
10050 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10051 OMPD_scan, DirName,
nullptr, D->getBeginLoc());
10052 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10053 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10057template <
typename Derived>
10061 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10062 OMPD_ordered, DirName,
nullptr, D->getBeginLoc());
10063 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10064 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10068template <
typename Derived>
10072 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10073 OMPD_atomic, DirName,
nullptr, D->getBeginLoc());
10074 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10075 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10079template <
typename Derived>
10083 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10084 OMPD_target, DirName,
nullptr, D->getBeginLoc());
10085 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10086 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10090template <
typename Derived>
10092 OMPTargetDataDirective *D) {
10094 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10095 OMPD_target_data, DirName,
nullptr, D->getBeginLoc());
10096 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10097 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10101template <
typename Derived>
10103 OMPTargetEnterDataDirective *D) {
10105 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10106 OMPD_target_enter_data, DirName,
nullptr, D->getBeginLoc());
10107 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10108 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10112template <
typename Derived>
10114 OMPTargetExitDataDirective *D) {
10116 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10117 OMPD_target_exit_data, DirName,
nullptr, D->getBeginLoc());
10118 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10119 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10123template <
typename Derived>
10125 OMPTargetParallelDirective *D) {
10127 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10128 OMPD_target_parallel, DirName,
nullptr, D->getBeginLoc());
10129 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10130 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10134template <
typename Derived>
10136 OMPTargetParallelForDirective *D) {
10138 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10139 OMPD_target_parallel_for, DirName,
nullptr, D->getBeginLoc());
10140 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10141 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10145template <
typename Derived>
10147 OMPTargetUpdateDirective *D) {
10149 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10150 OMPD_target_update, DirName,
nullptr, D->getBeginLoc());
10151 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10152 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10156template <
typename Derived>
10160 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10161 OMPD_teams, DirName,
nullptr, D->getBeginLoc());
10162 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10163 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10167template <
typename Derived>
10169 OMPCancellationPointDirective *D) {
10171 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10172 OMPD_cancellation_point, DirName,
nullptr, D->getBeginLoc());
10173 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10174 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10178template <
typename Derived>
10182 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10183 OMPD_cancel, DirName,
nullptr, D->getBeginLoc());
10184 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10185 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10189template <
typename Derived>
10193 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10194 OMPD_taskloop, DirName,
nullptr, D->getBeginLoc());
10195 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10196 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10200template <
typename Derived>
10202 OMPTaskLoopSimdDirective *D) {
10204 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10205 OMPD_taskloop_simd, DirName,
nullptr, D->getBeginLoc());
10206 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10207 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10211template <
typename Derived>
10213 OMPMasterTaskLoopDirective *D) {
10215 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10216 OMPD_master_taskloop, DirName,
nullptr, D->getBeginLoc());
10217 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10218 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10222template <
typename Derived>
10224 OMPMaskedTaskLoopDirective *D) {
10226 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10227 OMPD_masked_taskloop, DirName,
nullptr, D->getBeginLoc());
10228 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10229 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10233template <
typename Derived>
10235 OMPMasterTaskLoopSimdDirective *D) {
10237 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10238 OMPD_master_taskloop_simd, DirName,
nullptr, D->getBeginLoc());
10239 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10240 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10244template <
typename Derived>
10246 OMPMaskedTaskLoopSimdDirective *D) {
10248 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10249 OMPD_masked_taskloop_simd, DirName,
nullptr, D->getBeginLoc());
10250 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10251 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10255template <
typename Derived>
10257 OMPParallelMasterTaskLoopDirective *D) {
10259 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10260 OMPD_parallel_master_taskloop, DirName,
nullptr, D->getBeginLoc());
10261 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10262 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10266template <
typename Derived>
10268 OMPParallelMaskedTaskLoopDirective *D) {
10270 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10271 OMPD_parallel_masked_taskloop, DirName,
nullptr, D->getBeginLoc());
10272 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10273 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10277template <
typename Derived>
10280 OMPParallelMasterTaskLoopSimdDirective *D) {
10282 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10283 OMPD_parallel_master_taskloop_simd, DirName,
nullptr, D->getBeginLoc());
10284 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10285 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10289template <
typename Derived>
10292 OMPParallelMaskedTaskLoopSimdDirective *D) {
10294 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10295 OMPD_parallel_masked_taskloop_simd, DirName,
nullptr, D->getBeginLoc());
10296 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10297 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10301template <
typename Derived>
10303 OMPDistributeDirective *D) {
10305 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10306 OMPD_distribute, DirName,
nullptr, D->getBeginLoc());
10307 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10308 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10312template <
typename Derived>
10314 OMPDistributeParallelForDirective *D) {
10316 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10317 OMPD_distribute_parallel_for, DirName,
nullptr, D->getBeginLoc());
10318 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10319 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10323template <
typename Derived>
10326 OMPDistributeParallelForSimdDirective *D) {
10328 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10329 OMPD_distribute_parallel_for_simd, DirName,
nullptr, D->getBeginLoc());
10330 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10331 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10335template <
typename Derived>
10337 OMPDistributeSimdDirective *D) {
10339 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10340 OMPD_distribute_simd, DirName,
nullptr, D->getBeginLoc());
10341 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10342 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10346template <
typename Derived>
10348 OMPTargetParallelForSimdDirective *D) {
10350 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10351 OMPD_target_parallel_for_simd, DirName,
nullptr, D->getBeginLoc());
10352 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10353 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10357template <
typename Derived>
10359 OMPTargetSimdDirective *D) {
10361 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10362 OMPD_target_simd, DirName,
nullptr, D->getBeginLoc());
10363 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10364 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10368template <
typename Derived>
10370 OMPTeamsDistributeDirective *D) {
10372 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10373 OMPD_teams_distribute, DirName,
nullptr, D->getBeginLoc());
10374 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10375 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10379template <
typename Derived>
10381 OMPTeamsDistributeSimdDirective *D) {
10383 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10384 OMPD_teams_distribute_simd, DirName,
nullptr, D->getBeginLoc());
10385 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10386 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10390template <
typename Derived>
10392 OMPTeamsDistributeParallelForSimdDirective *D) {
10394 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10395 OMPD_teams_distribute_parallel_for_simd, DirName,
nullptr,
10397 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10398 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10402template <
typename Derived>
10404 OMPTeamsDistributeParallelForDirective *D) {
10406 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10407 OMPD_teams_distribute_parallel_for, DirName,
nullptr, D->getBeginLoc());
10408 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10409 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10413template <
typename Derived>
10415 OMPTargetTeamsDirective *D) {
10417 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10418 OMPD_target_teams, DirName,
nullptr, D->getBeginLoc());
10419 auto Res = getDerived().TransformOMPExecutableDirective(D);
10420 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10424template <
typename Derived>
10426 OMPTargetTeamsDistributeDirective *D) {
10428 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10429 OMPD_target_teams_distribute, DirName,
nullptr, D->getBeginLoc());
10430 auto Res = getDerived().TransformOMPExecutableDirective(D);
10431 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10435template <
typename Derived>
10438 OMPTargetTeamsDistributeParallelForDirective *D) {
10440 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10441 OMPD_target_teams_distribute_parallel_for, DirName,
nullptr,
10443 auto Res = getDerived().TransformOMPExecutableDirective(D);
10444 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10448template <
typename Derived>
10451 OMPTargetTeamsDistributeParallelForSimdDirective *D) {
10453 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10454 OMPD_target_teams_distribute_parallel_for_simd, DirName,
nullptr,
10456 auto Res = getDerived().TransformOMPExecutableDirective(D);
10457 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10461template <
typename Derived>
10464 OMPTargetTeamsDistributeSimdDirective *D) {
10466 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10467 OMPD_target_teams_distribute_simd, DirName,
nullptr, D->getBeginLoc());
10468 auto Res = getDerived().TransformOMPExecutableDirective(D);
10469 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10473template <
typename Derived>
10477 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10478 OMPD_interop, DirName,
nullptr, D->getBeginLoc());
10479 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10480 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10484template <
typename Derived>
10488 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10489 OMPD_dispatch, DirName,
nullptr, D->getBeginLoc());
10490 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10491 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10495template <
typename Derived>
10499 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10500 OMPD_masked, DirName,
nullptr, D->getBeginLoc());
10501 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10502 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10506template <
typename Derived>
10508 OMPGenericLoopDirective *D) {
10510 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10511 OMPD_loop, DirName,
nullptr, D->getBeginLoc());
10512 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10513 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10517template <
typename Derived>
10519 OMPTeamsGenericLoopDirective *D) {
10521 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10522 OMPD_teams_loop, DirName,
nullptr, D->getBeginLoc());
10523 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10524 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10528template <
typename Derived>
10530 OMPTargetTeamsGenericLoopDirective *D) {
10532 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10533 OMPD_target_teams_loop, DirName,
nullptr, D->getBeginLoc());
10534 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10535 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10539template <
typename Derived>
10541 OMPParallelGenericLoopDirective *D) {
10543 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10544 OMPD_parallel_loop, DirName,
nullptr, D->getBeginLoc());
10545 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10546 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10550template <
typename Derived>
10553 OMPTargetParallelGenericLoopDirective *D) {
10555 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10556 OMPD_target_parallel_loop, DirName,
nullptr, D->getBeginLoc());
10557 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10558 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10565template <
typename Derived>
10568 if (
Cond.isInvalid())
10570 return getDerived().RebuildOMPIfClause(
10571 C->getNameModifier(),
Cond.get(),
C->getBeginLoc(),
C->getLParenLoc(),
10572 C->getNameModifierLoc(),
C->getColonLoc(),
C->getEndLoc());
10575template <
typename Derived>
10578 if (
Cond.isInvalid())
10580 return getDerived().RebuildOMPFinalClause(
Cond.get(),
C->getBeginLoc(),
10581 C->getLParenLoc(),
C->getEndLoc());
10584template <
typename Derived>
10587 ExprResult NumThreads = getDerived().TransformExpr(
C->getNumThreads());
10588 if (NumThreads.isInvalid())
10590 return getDerived().RebuildOMPNumThreadsClause(
10591 C->getModifier(), NumThreads.get(),
C->getBeginLoc(),
C->getLParenLoc(),
10592 C->getModifierLoc(),
C->getEndLoc());
10595template <
typename Derived>
10598 ExprResult E = getDerived().TransformExpr(
C->getSafelen());
10601 return getDerived().RebuildOMPSafelenClause(
10602 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10605template <
typename Derived>
10608 ExprResult E = getDerived().TransformExpr(
C->getAllocator());
10611 return getDerived().RebuildOMPAllocatorClause(
10612 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10615template <
typename Derived>
10618 ExprResult E = getDerived().TransformExpr(
C->getSimdlen());
10621 return getDerived().RebuildOMPSimdlenClause(
10622 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10625template <
typename Derived>
10628 TransformedSizes.reserve(
C->getNumSizes());
10630 for (
Expr *E :
C->getSizesRefs()) {
10632 TransformedSizes.push_back(
nullptr);
10636 ExprResult T = getDerived().TransformExpr(E);
10641 TransformedSizes.push_back(T.get());
10644 if (!Changed && !getDerived().AlwaysRebuild())
10646 return RebuildOMPSizesClause(TransformedSizes,
C->getBeginLoc(),
10647 C->getLParenLoc(),
C->getEndLoc());
10650template <
typename Derived>
10654 TransformedCounts.reserve(
C->getNumCounts());
10655 for (
Expr *E :
C->getCountsRefs()) {
10657 TransformedCounts.push_back(
nullptr);
10661 ExprResult T = getDerived().TransformExpr(E);
10664 TransformedCounts.push_back(T.get());
10667 return RebuildOMPCountsClause(TransformedCounts,
C->getBeginLoc(),
10668 C->getLParenLoc(),
C->getEndLoc(),
10669 C->getOmpFillIndex(),
C->getOmpFillLoc());
10672template <
typename Derived>
10676 TransformedArgs.reserve(
C->getNumLoops());
10678 for (
Expr *E :
C->getArgsRefs()) {
10680 TransformedArgs.push_back(
nullptr);
10684 ExprResult T = getDerived().TransformExpr(E);
10689 TransformedArgs.push_back(T.get());
10692 if (!Changed && !getDerived().AlwaysRebuild())
10694 return RebuildOMPPermutationClause(TransformedArgs,
C->getBeginLoc(),
10695 C->getLParenLoc(),
C->getEndLoc());
10698template <
typename Derived>
10700 if (!getDerived().AlwaysRebuild())
10702 return RebuildOMPFullClause(
C->getBeginLoc(),
C->getEndLoc());
10705template <
typename Derived>
10708 ExprResult T = getDerived().TransformExpr(
C->getFactor());
10711 Expr *Factor = T.get();
10712 bool Changed = Factor !=
C->getFactor();
10714 if (!Changed && !getDerived().AlwaysRebuild())
10716 return RebuildOMPPartialClause(Factor,
C->getBeginLoc(),
C->getLParenLoc(),
10720template <
typename Derived>
10723 ExprResult F = getDerived().TransformExpr(
C->getFirst());
10727 ExprResult Cn = getDerived().TransformExpr(
C->getCount());
10728 if (Cn.isInvalid())
10732 Expr *Count = Cn.get();
10734 bool Changed = (
First !=
C->getFirst()) || (Count !=
C->getCount());
10737 if (!Changed && !getDerived().AlwaysRebuild())
10740 return RebuildOMPLoopRangeClause(
First, Count,
C->getBeginLoc(),
10741 C->getLParenLoc(),
C->getFirstLoc(),
10742 C->getCountLoc(),
C->getEndLoc());
10745template <
typename Derived>
10748 ExprResult E = getDerived().TransformExpr(
C->getNumForLoops());
10751 return getDerived().RebuildOMPCollapseClause(
10752 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10755template <
typename Derived>
10759 C->getDefaultKind(),
C->getDefaultKindKwLoc(),
C->getDefaultVC(),
10760 C->getDefaultVCLoc(),
C->getBeginLoc(),
C->getLParenLoc(),
10764template <
typename Derived>
10771template <
typename Derived>
10774 Expr *Impex =
C->getImpexType();
10775 ExprResult TransformedImpex = getDerived().TransformExpr(Impex);
10777 if (TransformedImpex.isInvalid())
10780 return getDerived().RebuildOMPTransparentClause(
10781 TransformedImpex.get(),
C->getBeginLoc(),
C->getLParenLoc(),
10785template <
typename Derived>
10789 C->getProcBindKind(),
C->getProcBindKindKwLoc(),
C->getBeginLoc(),
10790 C->getLParenLoc(),
C->getEndLoc());
10793template <
typename Derived>
10796 ExprResult E = getDerived().TransformExpr(
C->getChunkSize());
10799 return getDerived().RebuildOMPScheduleClause(
10800 C->getFirstScheduleModifier(),
C->getSecondScheduleModifier(),
10801 C->getScheduleKind(), E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
10802 C->getFirstScheduleModifierLoc(),
C->getSecondScheduleModifierLoc(),
10803 C->getScheduleKindLoc(),
C->getCommaLoc(),
C->getEndLoc());
10806template <
typename Derived>
10810 if (
auto *
Num =
C->getNumForLoops()) {
10811 E = getDerived().TransformExpr(
Num);
10815 return getDerived().RebuildOMPOrderedClause(
C->getBeginLoc(),
C->getEndLoc(),
10816 C->getLParenLoc(), E.get());
10819template <
typename Derived>
10823 if (
Expr *Evt =
C->getEventHandler()) {
10824 E = getDerived().TransformExpr(Evt);
10828 return getDerived().RebuildOMPDetachClause(E.get(),
C->getBeginLoc(),
10829 C->getLParenLoc(),
C->getEndLoc());
10832template <
typename Derived>
10838 if (
Cond.isInvalid())
10841 return getDerived().RebuildOMPNowaitClause(
Cond.get(),
C->getBeginLoc(),
10842 C->getLParenLoc(),
C->getEndLoc());
10845template <
typename Derived>
10852template <
typename Derived>
10859template <
typename Derived>
10865template <
typename Derived>
10871template <
typename Derived>
10878template <
typename Derived>
10885template <
typename Derived>
10892template <
typename Derived>
10898template <
typename Derived>
10904template <
typename Derived>
10906 ExprResult E = getDerived().TransformExpr(
C->getExpr());
10909 return getDerived().RebuildOMPHoldsClause(E.get(),
C->getBeginLoc(),
10910 C->getLParenLoc(),
C->getEndLoc());
10913template <
typename Derived>
10919template <
typename Derived>
10924template <
typename Derived>
10926 OMPNoOpenMPRoutinesClause *
C) {
10929template <
typename Derived>
10931 OMPNoOpenMPConstructsClause *
C) {
10934template <
typename Derived>
10936 OMPNoParallelismClause *
C) {
10940template <
typename Derived>
10947template <
typename Derived>
10954template <
typename Derived>
10961template <
typename Derived>
10968template <
typename Derived>
10975template <
typename Derived>
10981template <
typename Derived>
10988template <
typename Derived>
10994template <
typename Derived>
11001template <
typename Derived>
11003 ExprResult IVR = getDerived().TransformExpr(
C->getInteropVar());
11004 if (IVR.isInvalid())
11008 InteropInfo.PreferTypes.reserve(
C->varlist_size() - 1);
11009 for (
Expr *E : llvm::drop_begin(
C->varlist())) {
11011 if (ER.isInvalid())
11013 InteropInfo.PreferTypes.push_back(ER.get());
11015 return getDerived().RebuildOMPInitClause(IVR.get(), InteropInfo,
11016 C->getBeginLoc(),
C->getLParenLoc(),
11017 C->getVarLoc(),
C->getEndLoc());
11020template <
typename Derived>
11022 ExprResult ER = getDerived().TransformExpr(
C->getInteropVar());
11023 if (ER.isInvalid())
11025 return getDerived().RebuildOMPUseClause(ER.get(),
C->getBeginLoc(),
11026 C->getLParenLoc(),
C->getVarLoc(),
11030template <
typename Derived>
11034 if (
Expr *IV =
C->getInteropVar()) {
11035 ER = getDerived().TransformExpr(IV);
11036 if (ER.isInvalid())
11039 return getDerived().RebuildOMPDestroyClause(ER.get(),
C->getBeginLoc(),
11040 C->getLParenLoc(),
C->getVarLoc(),
11044template <
typename Derived>
11048 if (
Cond.isInvalid())
11050 return getDerived().RebuildOMPNovariantsClause(
11051 Cond.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11054template <
typename Derived>
11058 if (
Cond.isInvalid())
11060 return getDerived().RebuildOMPNocontextClause(
11061 Cond.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11064template <
typename Derived>
11067 ExprResult ThreadID = getDerived().TransformExpr(
C->getThreadID());
11068 if (ThreadID.isInvalid())
11070 return getDerived().RebuildOMPFilterClause(ThreadID.get(),
C->getBeginLoc(),
11071 C->getLParenLoc(),
C->getEndLoc());
11074template <
typename Derived>
11076 ExprResult E = getDerived().TransformExpr(
C->getAlignment());
11079 return getDerived().RebuildOMPAlignClause(E.get(),
C->getBeginLoc(),
11080 C->getLParenLoc(),
C->getEndLoc());
11083template <
typename Derived>
11085 OMPUnifiedAddressClause *
C) {
11086 llvm_unreachable(
"unified_address clause cannot appear in dependent context");
11089template <
typename Derived>
11091 OMPUnifiedSharedMemoryClause *
C) {
11093 "unified_shared_memory clause cannot appear in dependent context");
11096template <
typename Derived>
11098 OMPReverseOffloadClause *
C) {
11099 llvm_unreachable(
"reverse_offload clause cannot appear in dependent context");
11102template <
typename Derived>
11104 OMPDynamicAllocatorsClause *
C) {
11106 "dynamic_allocators clause cannot appear in dependent context");
11109template <
typename Derived>
11111 OMPAtomicDefaultMemOrderClause *
C) {
11113 "atomic_default_mem_order clause cannot appear in dependent context");
11116template <
typename Derived>
11119 llvm_unreachable(
"self_maps clause cannot appear in dependent context");
11122template <
typename Derived>
11125 C->getBeginLoc(),
C->getLParenLoc(),
11129template <
typename Derived>
11133 C->getSeverityKind(),
C->getSeverityKindKwLoc(),
C->getBeginLoc(),
11134 C->getLParenLoc(),
C->getEndLoc());
11137template <
typename Derived>
11140 ExprResult E = getDerived().TransformExpr(
C->getMessageString());
11143 return getDerived().RebuildOMPMessageClause(
11144 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11147template <
typename Derived>
11151 Vars.reserve(
C->varlist_size());
11152 for (
auto *
VE :
C->varlist()) {
11154 if (EVar.isInvalid())
11156 Vars.push_back(EVar.get());
11158 return getDerived().RebuildOMPPrivateClause(
11159 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11162template <
typename Derived>
11164 OMPFirstprivateClause *
C) {
11166 Vars.reserve(
C->varlist_size());
11167 for (
auto *
VE :
C->varlist()) {
11169 if (EVar.isInvalid())
11171 Vars.push_back(EVar.get());
11173 return getDerived().RebuildOMPFirstprivateClause(
11174 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11177template <
typename Derived>
11181 Vars.reserve(
C->varlist_size());
11182 for (
auto *
VE :
C->varlist()) {
11184 if (EVar.isInvalid())
11186 Vars.push_back(EVar.get());
11188 return getDerived().RebuildOMPLastprivateClause(
11189 Vars,
C->getKind(),
C->getKindLoc(),
C->getColonLoc(),
C->getBeginLoc(),
11190 C->getLParenLoc(),
C->getEndLoc());
11193template <
typename Derived>
11197 Vars.reserve(
C->varlist_size());
11198 for (
auto *
VE :
C->varlist()) {
11200 if (EVar.isInvalid())
11202 Vars.push_back(EVar.get());
11204 return getDerived().RebuildOMPSharedClause(Vars,
C->getBeginLoc(),
11205 C->getLParenLoc(),
C->getEndLoc());
11208template <
typename Derived>
11212 Vars.reserve(
C->varlist_size());
11213 for (
auto *
VE :
C->varlist()) {
11215 if (EVar.isInvalid())
11217 Vars.push_back(EVar.get());
11220 ReductionIdScopeSpec.
Adopt(
C->getQualifierLoc());
11223 if (NameInfo.getName()) {
11224 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
11225 if (!NameInfo.getName())
11231 for (
auto *E :
C->reduction_ops()) {
11236 for (
auto *D : ULE->decls()) {
11239 Decls.addDecl(InstD, InstD->getAccess());
11243 ReductionIdScopeSpec.getWithLocInContext(SemaRef.
Context), NameInfo,
11244 true, Decls.begin(), Decls.end(),
11247 UnresolvedReductions.push_back(
nullptr);
11249 return getDerived().RebuildOMPReductionClause(
11250 Vars,
C->getModifier(),
C->getOriginalSharingModifier(),
C->getBeginLoc(),
11251 C->getLParenLoc(),
C->getModifierLoc(),
C->getColonLoc(),
C->getEndLoc(),
11252 ReductionIdScopeSpec, NameInfo, UnresolvedReductions);
11255template <
typename Derived>
11257 OMPTaskReductionClause *
C) {
11259 Vars.reserve(
C->varlist_size());
11260 for (
auto *
VE :
C->varlist()) {
11262 if (EVar.isInvalid())
11264 Vars.push_back(EVar.get());
11267 ReductionIdScopeSpec.
Adopt(
C->getQualifierLoc());
11270 if (NameInfo.getName()) {
11271 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
11272 if (!NameInfo.getName())
11278 for (
auto *E :
C->reduction_ops()) {
11283 for (
auto *D : ULE->decls()) {
11286 Decls.addDecl(InstD, InstD->getAccess());
11290 ReductionIdScopeSpec.getWithLocInContext(SemaRef.
Context), NameInfo,
11291 true, Decls.begin(), Decls.end(),
11294 UnresolvedReductions.push_back(
nullptr);
11296 return getDerived().RebuildOMPTaskReductionClause(
11297 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getColonLoc(),
11298 C->getEndLoc(), ReductionIdScopeSpec, NameInfo, UnresolvedReductions);
11301template <
typename Derived>
11305 Vars.reserve(
C->varlist_size());
11306 for (
auto *
VE :
C->varlist()) {
11308 if (EVar.isInvalid())
11310 Vars.push_back(EVar.get());
11313 ReductionIdScopeSpec.
Adopt(
C->getQualifierLoc());
11316 if (NameInfo.getName()) {
11317 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
11318 if (!NameInfo.getName())
11324 for (
auto *E :
C->reduction_ops()) {
11329 for (
auto *D : ULE->decls()) {
11332 Decls.addDecl(InstD, InstD->getAccess());
11336 ReductionIdScopeSpec.getWithLocInContext(SemaRef.
Context), NameInfo,
11337 true, Decls.begin(), Decls.end(),
11340 UnresolvedReductions.push_back(
nullptr);
11342 return getDerived().RebuildOMPInReductionClause(
11343 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getColonLoc(),
11344 C->getEndLoc(), ReductionIdScopeSpec, NameInfo, UnresolvedReductions);
11347template <
typename Derived>
11351 Vars.reserve(
C->varlist_size());
11352 for (
auto *
VE :
C->varlist()) {
11354 if (EVar.isInvalid())
11356 Vars.push_back(EVar.get());
11358 ExprResult Step = getDerived().TransformExpr(
C->getStep());
11359 if (Step.isInvalid())
11361 return getDerived().RebuildOMPLinearClause(
11362 Vars, Step.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getModifier(),
11363 C->getModifierLoc(),
C->getColonLoc(),
C->getStepModifierLoc(),
11367template <
typename Derived>
11371 Vars.reserve(
C->varlist_size());
11372 for (
auto *
VE :
C->varlist()) {
11374 if (EVar.isInvalid())
11376 Vars.push_back(EVar.get());
11378 ExprResult Alignment = getDerived().TransformExpr(
C->getAlignment());
11379 if (Alignment.isInvalid())
11381 return getDerived().RebuildOMPAlignedClause(
11382 Vars, Alignment.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11383 C->getColonLoc(),
C->getEndLoc());
11386template <
typename Derived>
11390 Vars.reserve(
C->varlist_size());
11391 for (
auto *
VE :
C->varlist()) {
11393 if (EVar.isInvalid())
11395 Vars.push_back(EVar.get());
11397 return getDerived().RebuildOMPCopyinClause(Vars,
C->getBeginLoc(),
11398 C->getLParenLoc(),
C->getEndLoc());
11401template <
typename Derived>
11405 Vars.reserve(
C->varlist_size());
11406 for (
auto *
VE :
C->varlist()) {
11408 if (EVar.isInvalid())
11410 Vars.push_back(EVar.get());
11412 return getDerived().RebuildOMPCopyprivateClause(
11413 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11416template <
typename Derived>
11419 Vars.reserve(
C->varlist_size());
11420 for (
auto *
VE :
C->varlist()) {
11422 if (EVar.isInvalid())
11424 Vars.push_back(EVar.get());
11426 return getDerived().RebuildOMPFlushClause(Vars,
C->getBeginLoc(),
11427 C->getLParenLoc(),
C->getEndLoc());
11430template <
typename Derived>
11433 ExprResult E = getDerived().TransformExpr(
C->getDepobj());
11436 return getDerived().RebuildOMPDepobjClause(E.get(),
C->getBeginLoc(),
11437 C->getLParenLoc(),
C->getEndLoc());
11440template <
typename Derived>
11444 Expr *DepModifier =
C->getModifier();
11446 ExprResult DepModRes = getDerived().TransformExpr(DepModifier);
11447 if (DepModRes.isInvalid())
11449 DepModifier = DepModRes.get();
11451 Vars.reserve(
C->varlist_size());
11452 for (
auto *
VE :
C->varlist()) {
11454 if (EVar.isInvalid())
11456 Vars.push_back(EVar.get());
11458 return getDerived().RebuildOMPDependClause(
11459 {
C->getDependencyKind(),
C->getDependencyLoc(),
C->getColonLoc(),
11460 C->getOmpAllMemoryLoc()},
11461 DepModifier, Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11464template <
typename Derived>
11467 ExprResult E = getDerived().TransformExpr(
C->getDevice());
11470 return getDerived().RebuildOMPDeviceClause(
11471 C->getModifier(), E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11472 C->getModifierLoc(),
C->getEndLoc());
11475template <
typename Derived,
class T>
11482 Vars.reserve(
C->varlist_size());
11483 for (
auto *
VE :
C->varlist()) {
11487 Vars.push_back(EVar.
get());
11491 if (
C->getMapperQualifierLoc()) {
11492 QualifierLoc = TT.
getDerived().TransformNestedNameSpecifierLoc(
11493 C->getMapperQualifierLoc());
11497 MapperIdScopeSpec.
Adopt(QualifierLoc);
11498 MapperIdInfo =
C->getMapperIdInfo();
11499 if (MapperIdInfo.
getName()) {
11500 MapperIdInfo = TT.
getDerived().TransformDeclarationNameInfo(MapperIdInfo);
11506 for (
auto *E :
C->mapperlists()) {
11511 for (
auto *D : ULE->decls()) {
11514 Decls.addDecl(InstD, InstD->
getAccess());
11519 MapperIdInfo,
true, Decls.begin(), Decls.end(),
11522 UnresolvedMappers.push_back(
nullptr);
11528template <
typename Derived>
11530 OMPVarListLocTy Locs(
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11532 Expr *IteratorModifier =
C->getIteratorModifier();
11533 if (IteratorModifier) {
11534 ExprResult MapModRes = getDerived().TransformExpr(IteratorModifier);
11535 if (MapModRes.isInvalid())
11537 IteratorModifier = MapModRes.
get();
11543 *
this,
C, Vars, MapperIdScopeSpec, MapperIdInfo, UnresolvedMappers))
11545 return getDerived().RebuildOMPMapClause(
11546 IteratorModifier,
C->getMapTypeModifiers(),
C->getMapTypeModifiersLoc(),
11547 MapperIdScopeSpec, MapperIdInfo,
C->getMapType(),
C->isImplicitMapType(),
11548 C->getMapLoc(),
C->getColonLoc(), Vars, Locs, UnresolvedMappers);
11551template <
typename Derived>
11554 Expr *Allocator =
C->getAllocator();
11556 ExprResult AllocatorRes = getDerived().TransformExpr(Allocator);
11557 if (AllocatorRes.isInvalid())
11559 Allocator = AllocatorRes.get();
11561 Expr *Alignment =
C->getAlignment();
11563 ExprResult AlignmentRes = getDerived().TransformExpr(Alignment);
11564 if (AlignmentRes.isInvalid())
11566 Alignment = AlignmentRes.get();
11569 Vars.reserve(
C->varlist_size());
11570 for (
auto *
VE :
C->varlist()) {
11572 if (EVar.isInvalid())
11574 Vars.push_back(EVar.get());
11576 return getDerived().RebuildOMPAllocateClause(
11577 Allocator, Alignment,
C->getFirstAllocateModifier(),
11578 C->getFirstAllocateModifierLoc(),
C->getSecondAllocateModifier(),
11579 C->getSecondAllocateModifierLoc(), Vars,
C->getBeginLoc(),
11580 C->getLParenLoc(),
C->getColonLoc(),
C->getEndLoc());
11583template <
typename Derived>
11587 Vars.reserve(
C->varlist_size());
11588 for (
auto *
VE :
C->varlist()) {
11590 if (EVar.isInvalid())
11592 Vars.push_back(EVar.get());
11594 return getDerived().RebuildOMPNumTeamsClause(
11595 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11598template <
typename Derived>
11602 Vars.reserve(
C->varlist_size());
11603 for (
auto *
VE :
C->varlist()) {
11605 if (EVar.isInvalid())
11607 Vars.push_back(EVar.get());
11609 return getDerived().RebuildOMPThreadLimitClause(
11610 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11613template <
typename Derived>
11616 ExprResult E = getDerived().TransformExpr(
C->getPriority());
11619 return getDerived().RebuildOMPPriorityClause(
11620 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11623template <
typename Derived>
11626 ExprResult E = getDerived().TransformExpr(
C->getGrainsize());
11629 return getDerived().RebuildOMPGrainsizeClause(
11630 C->getModifier(), E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11631 C->getModifierLoc(),
C->getEndLoc());
11634template <
typename Derived>
11637 ExprResult E = getDerived().TransformExpr(
C->getNumTasks());
11640 return getDerived().RebuildOMPNumTasksClause(
11641 C->getModifier(), E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11642 C->getModifierLoc(),
C->getEndLoc());
11645template <
typename Derived>
11647 ExprResult E = getDerived().TransformExpr(
C->getHint());
11650 return getDerived().RebuildOMPHintClause(E.get(),
C->getBeginLoc(),
11651 C->getLParenLoc(),
C->getEndLoc());
11654template <
typename Derived>
11656 OMPDistScheduleClause *
C) {
11657 ExprResult E = getDerived().TransformExpr(
C->getChunkSize());
11660 return getDerived().RebuildOMPDistScheduleClause(
11661 C->getDistScheduleKind(), E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11662 C->getDistScheduleKindLoc(),
C->getCommaLoc(),
C->getEndLoc());
11665template <
typename Derived>
11671 C->getDefaultmapKind(),
11674 C->getDefaultmapModifierLoc(),
11675 C->getDefaultmapKindLoc(),
11679template <
typename Derived>
11683 Expr *IteratorModifier =
C->getIteratorModifier();
11684 if (IteratorModifier) {
11685 ExprResult MapModRes = getDerived().TransformExpr(IteratorModifier);
11686 if (MapModRes.isInvalid())
11688 IteratorModifier = MapModRes.get();
11694 *
this,
C, Vars, MapperIdScopeSpec, MapperIdInfo, UnresolvedMappers))
11696 return getDerived().RebuildOMPToClause(
11697 C->getMotionModifiers(),
C->getMotionModifiersLoc(), IteratorModifier,
11698 MapperIdScopeSpec, MapperIdInfo,
C->getColonLoc(), Vars, Locs,
11699 UnresolvedMappers);
11702template <
typename Derived>
11706 Expr *IteratorModifier =
C->getIteratorModifier();
11707 if (IteratorModifier) {
11708 ExprResult MapModRes = getDerived().TransformExpr(IteratorModifier);
11709 if (MapModRes.isInvalid())
11711 IteratorModifier = MapModRes.get();
11717 *
this,
C, Vars, MapperIdScopeSpec, MapperIdInfo, UnresolvedMappers))
11719 return getDerived().RebuildOMPFromClause(
11720 C->getMotionModifiers(),
C->getMotionModifiersLoc(), IteratorModifier,
11721 MapperIdScopeSpec, MapperIdInfo,
C->getColonLoc(), Vars, Locs,
11722 UnresolvedMappers);
11725template <
typename Derived>
11727 OMPUseDevicePtrClause *
C) {
11729 Vars.reserve(
C->varlist_size());
11730 for (
auto *
VE :
C->varlist()) {
11732 if (EVar.isInvalid())
11734 Vars.push_back(EVar.get());
11737 return getDerived().RebuildOMPUseDevicePtrClause(
11738 Vars, Locs,
C->getFallbackModifier(),
C->getFallbackModifierLoc());
11741template <
typename Derived>
11743 OMPUseDeviceAddrClause *
C) {
11745 Vars.reserve(
C->varlist_size());
11746 for (
auto *
VE :
C->varlist()) {
11748 if (EVar.isInvalid())
11750 Vars.push_back(EVar.get());
11753 return getDerived().RebuildOMPUseDeviceAddrClause(Vars, Locs);
11756template <
typename Derived>
11760 Vars.reserve(
C->varlist_size());
11761 for (
auto *
VE :
C->varlist()) {
11763 if (EVar.isInvalid())
11765 Vars.push_back(EVar.get());
11768 return getDerived().RebuildOMPIsDevicePtrClause(Vars, Locs);
11771template <
typename Derived>
11773 OMPHasDeviceAddrClause *
C) {
11775 Vars.reserve(
C->varlist_size());
11776 for (
auto *
VE :
C->varlist()) {
11778 if (EVar.isInvalid())
11780 Vars.push_back(EVar.get());
11783 return getDerived().RebuildOMPHasDeviceAddrClause(Vars, Locs);
11786template <
typename Derived>
11790 Vars.reserve(
C->varlist_size());
11791 for (
auto *
VE :
C->varlist()) {
11793 if (EVar.isInvalid())
11795 Vars.push_back(EVar.get());
11797 return getDerived().RebuildOMPNontemporalClause(
11798 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11801template <
typename Derived>
11805 Vars.reserve(
C->varlist_size());
11806 for (
auto *
VE :
C->varlist()) {
11808 if (EVar.isInvalid())
11810 Vars.push_back(EVar.get());
11812 return getDerived().RebuildOMPInclusiveClause(
11813 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11816template <
typename Derived>
11820 Vars.reserve(
C->varlist_size());
11821 for (
auto *
VE :
C->varlist()) {
11823 if (EVar.isInvalid())
11825 Vars.push_back(EVar.get());
11827 return getDerived().RebuildOMPExclusiveClause(
11828 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11831template <
typename Derived>
11833 OMPUsesAllocatorsClause *
C) {
11835 Data.reserve(
C->getNumberOfAllocators());
11836 for (
unsigned I = 0, E =
C->getNumberOfAllocators(); I < E; ++I) {
11837 OMPUsesAllocatorsClause::Data D =
C->getAllocatorData(I);
11839 if (Allocator.isInvalid())
11843 AllocatorTraits = getDerived().TransformExpr(AT);
11844 if (AllocatorTraits.isInvalid())
11848 NewD.Allocator = Allocator.get();
11849 NewD.AllocatorTraits = AllocatorTraits.get();
11853 return getDerived().RebuildOMPUsesAllocatorsClause(
11854 Data,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11857template <
typename Derived>
11861 Locators.reserve(
C->varlist_size());
11863 if (
Expr *Modifier =
C->getModifier()) {
11864 ModifierRes = getDerived().TransformExpr(Modifier);
11865 if (ModifierRes.isInvalid())
11868 for (
Expr *E :
C->varlist()) {
11869 ExprResult Locator = getDerived().TransformExpr(E);
11870 if (Locator.isInvalid())
11872 Locators.push_back(Locator.get());
11874 return getDerived().RebuildOMPAffinityClause(
11875 C->getBeginLoc(),
C->getLParenLoc(),
C->getColonLoc(),
C->getEndLoc(),
11876 ModifierRes.get(), Locators);
11879template <
typename Derived>
11882 C->getKind(),
C->getKindKwLoc(),
C->getBeginLoc(),
C->getLParenLoc(),
11883 C->getEndLoc(),
C->getModifier(),
C->getModifierKwLoc());
11886template <
typename Derived>
11889 C->getBindKind(),
C->getBindKindLoc(),
C->getBeginLoc(),
11890 C->getLParenLoc(),
C->getEndLoc());
11893template <
typename Derived>
11895 OMPXDynCGroupMemClause *
C) {
11897 if (
Size.isInvalid())
11899 return getDerived().RebuildOMPXDynCGroupMemClause(
11900 Size.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11903template <
typename Derived>
11905 OMPDynGroupprivateClause *
C) {
11907 if (
Size.isInvalid())
11909 return getDerived().RebuildOMPDynGroupprivateClause(
11910 C->getDynGroupprivateModifier(),
C->getDynGroupprivateFallbackModifier(),
11911 Size.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11912 C->getDynGroupprivateModifierLoc(),
11913 C->getDynGroupprivateFallbackModifierLoc(),
C->getEndLoc());
11916template <
typename Derived>
11920 Vars.reserve(
C->varlist_size());
11921 for (
auto *
VE :
C->varlist()) {
11923 if (EVar.isInvalid())
11925 Vars.push_back(EVar.get());
11927 return getDerived().RebuildOMPDoacrossClause(
11928 C->getDependenceType(),
C->getDependenceLoc(),
C->getColonLoc(), Vars,
11929 C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11932template <
typename Derived>
11936 for (
auto *A :
C->getAttrs())
11937 NewAttrs.push_back(getDerived().TransformAttr(A));
11938 return getDerived().RebuildOMPXAttributeClause(
11939 NewAttrs,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11942template <
typename Derived>
11951template <
typename Derived>
11952class OpenACCClauseTransform final
11954 TreeTransform<Derived> &Self;
11955 ArrayRef<const OpenACCClause *> ExistingClauses;
11956 SemaOpenACC::OpenACCParsedClause &ParsedClause;
11957 OpenACCClause *NewClause =
nullptr;
11960 ExprResult Res = Self.TransformExpr(VarRef);
11962 if (!Res.isUsable())
11965 Res = Self.getSema().OpenACC().ActOnVar(ParsedClause.getDirectiveKind(),
11966 ParsedClause.getClauseKind(),
11972 llvm::SmallVector<Expr *> VisitVarList(ArrayRef<Expr *> VarList) {
11973 llvm::SmallVector<Expr *> InstantiatedVarList;
11974 for (Expr *CurVar : VarList) {
11977 if (VarRef.isUsable())
11978 InstantiatedVarList.push_back(VarRef.get());
11981 return InstantiatedVarList;
11985 OpenACCClauseTransform(TreeTransform<Derived> &Self,
11986 ArrayRef<const OpenACCClause *> ExistingClauses,
11987 SemaOpenACC::OpenACCParsedClause &PC)
11988 : Self(Self), ExistingClauses(ExistingClauses), ParsedClause(PC) {}
11990 OpenACCClause *CreatedClause()
const {
return NewClause; }
11992#define VISIT_CLAUSE(CLAUSE_NAME) \
11993 void Visit##CLAUSE_NAME##Clause(const OpenACC##CLAUSE_NAME##Clause &Clause);
11994#include "clang/Basic/OpenACCClauses.def"
11997template <
typename Derived>
11998void OpenACCClauseTransform<Derived>::VisitDefaultClause(
12000 ParsedClause.setDefaultDetails(
C.getDefaultClauseKind());
12003 Self.getSema().getASTContext(), ParsedClause.getDefaultClauseKind(),
12004 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12005 ParsedClause.getEndLoc());
12008template <
typename Derived>
12009void OpenACCClauseTransform<Derived>::VisitIfClause(
const OpenACCIfClause &
C) {
12011 assert(
Cond &&
"If constructed with invalid Condition");
12015 if (Res.isInvalid() || !Res.get().second)
12018 ParsedClause.setConditionDetails(Res.get().second);
12021 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12022 ParsedClause.getLParenLoc(), ParsedClause.getConditionExpr(),
12023 ParsedClause.getEndLoc());
12026template <
typename Derived>
12027void OpenACCClauseTransform<Derived>::VisitSelfClause(
12033 for (
Expr *CurVar :
C.getVarList()) {
12036 if (!Res.isUsable())
12039 Res =
Self.getSema().OpenACC().ActOnVar(ParsedClause.getDirectiveKind(),
12040 ParsedClause.getClauseKind(),
12043 if (Res.isUsable())
12044 InstantiatedVarList.push_back(Res.get());
12047 ParsedClause.setVarListDetails(InstantiatedVarList,
12051 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12052 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12053 ParsedClause.getEndLoc());
12056 if (
C.hasConditionExpr()) {
12059 Self.TransformCondition(
Cond->getExprLoc(),
nullptr,
Cond,
12062 if (Res.isInvalid() || !Res.get().second)
12065 ParsedClause.setConditionDetails(Res.get().second);
12069 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12070 ParsedClause.getLParenLoc(), ParsedClause.getConditionExpr(),
12071 ParsedClause.getEndLoc());
12075template <
typename Derived>
12076void OpenACCClauseTransform<Derived>::VisitNumGangsClause(
12080 for (
Expr *CurIntExpr :
C.getIntExprs()) {
12083 if (!Res.isUsable())
12088 C.getBeginLoc(), Res.get());
12089 if (!Res.isUsable())
12092 InstantiatedIntExprs.push_back(Res.get());
12095 ParsedClause.setIntExprDetails(InstantiatedIntExprs);
12097 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12098 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs(),
12099 ParsedClause.getEndLoc());
12102template <
typename Derived>
12103void OpenACCClauseTransform<Derived>::VisitPrivateClause(
12108 for (
const auto [RefExpr, InitRecipe] :
12109 llvm::zip(
C.getVarList(),
C.getInitRecipes())) {
12112 if (VarRef.isUsable()) {
12113 InstantiatedVarList.push_back(VarRef.get());
12117 if (InitRecipe.isSet())
12118 InitRecipes.push_back(InitRecipe);
12120 InitRecipes.push_back(
12121 Self.getSema().OpenACC().CreatePrivateInitRecipe(VarRef.get()));
12124 ParsedClause.setVarListDetails(InstantiatedVarList,
12128 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12129 ParsedClause.getLParenLoc(), ParsedClause.getVarList(), InitRecipes,
12130 ParsedClause.getEndLoc());
12133template <
typename Derived>
12134void OpenACCClauseTransform<Derived>::VisitHostClause(
12136 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12140 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12141 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12142 ParsedClause.getEndLoc());
12145template <
typename Derived>
12146void OpenACCClauseTransform<Derived>::VisitDeviceClause(
12148 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12152 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12153 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12154 ParsedClause.getEndLoc());
12157template <
typename Derived>
12158void OpenACCClauseTransform<Derived>::VisitFirstPrivateClause(
12163 for (
const auto [RefExpr, InitRecipe] :
12164 llvm::zip(
C.getVarList(),
C.getInitRecipes())) {
12167 if (VarRef.isUsable()) {
12168 InstantiatedVarList.push_back(VarRef.get());
12172 if (InitRecipe.isSet())
12173 InitRecipes.push_back(InitRecipe);
12175 InitRecipes.push_back(
12176 Self.getSema().OpenACC().CreateFirstPrivateInitRecipe(
12180 ParsedClause.setVarListDetails(InstantiatedVarList,
12184 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12185 ParsedClause.getLParenLoc(), ParsedClause.getVarList(), InitRecipes,
12186 ParsedClause.getEndLoc());
12189template <
typename Derived>
12190void OpenACCClauseTransform<Derived>::VisitNoCreateClause(
12192 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12196 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12197 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12198 ParsedClause.getEndLoc());
12201template <
typename Derived>
12202void OpenACCClauseTransform<Derived>::VisitPresentClause(
12204 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12208 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12209 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12210 ParsedClause.getEndLoc());
12213template <
typename Derived>
12214void OpenACCClauseTransform<Derived>::VisitCopyClause(
12216 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12217 C.getModifierList());
12220 Self.getSema().getASTContext(), ParsedClause.getClauseKind(),
12221 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12222 ParsedClause.getModifierList(), ParsedClause.getVarList(),
12223 ParsedClause.getEndLoc());
12226template <
typename Derived>
12227void OpenACCClauseTransform<Derived>::VisitLinkClause(
12229 llvm_unreachable(
"link clause not valid unless a decl transform");
12232template <
typename Derived>
12233void OpenACCClauseTransform<Derived>::VisitDeviceResidentClause(
12235 llvm_unreachable(
"device_resident clause not valid unless a decl transform");
12237template <
typename Derived>
12238void OpenACCClauseTransform<Derived>::VisitNoHostClause(
12240 llvm_unreachable(
"nohost clause not valid unless a decl transform");
12242template <
typename Derived>
12243void OpenACCClauseTransform<Derived>::VisitBindClause(
12245 llvm_unreachable(
"bind clause not valid unless a decl transform");
12248template <
typename Derived>
12249void OpenACCClauseTransform<Derived>::VisitCopyInClause(
12251 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12252 C.getModifierList());
12255 Self.getSema().getASTContext(), ParsedClause.getClauseKind(),
12256 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12257 ParsedClause.getModifierList(), ParsedClause.getVarList(),
12258 ParsedClause.getEndLoc());
12261template <
typename Derived>
12262void OpenACCClauseTransform<Derived>::VisitCopyOutClause(
12264 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12265 C.getModifierList());
12268 Self.getSema().getASTContext(), ParsedClause.getClauseKind(),
12269 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12270 ParsedClause.getModifierList(), ParsedClause.getVarList(),
12271 ParsedClause.getEndLoc());
12274template <
typename Derived>
12275void OpenACCClauseTransform<Derived>::VisitCreateClause(
12277 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12278 C.getModifierList());
12281 Self.getSema().getASTContext(), ParsedClause.getClauseKind(),
12282 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12283 ParsedClause.getModifierList(), ParsedClause.getVarList(),
12284 ParsedClause.getEndLoc());
12286template <
typename Derived>
12287void OpenACCClauseTransform<Derived>::VisitAttachClause(
12292 llvm::erase_if(VarList, [&](
Expr *E) {
12293 return Self.getSema().OpenACC().CheckVarIsPointerType(
12299 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12300 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12301 ParsedClause.getEndLoc());
12304template <
typename Derived>
12305void OpenACCClauseTransform<Derived>::VisitDetachClause(
12310 llvm::erase_if(VarList, [&](
Expr *E) {
12311 return Self.getSema().OpenACC().CheckVarIsPointerType(
12317 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12318 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12319 ParsedClause.getEndLoc());
12322template <
typename Derived>
12323void OpenACCClauseTransform<Derived>::VisitDeleteClause(
12325 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12328 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12329 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12330 ParsedClause.getEndLoc());
12333template <
typename Derived>
12334void OpenACCClauseTransform<Derived>::VisitUseDeviceClause(
12336 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12339 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12340 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12341 ParsedClause.getEndLoc());
12344template <
typename Derived>
12345void OpenACCClauseTransform<Derived>::VisitDevicePtrClause(
12350 llvm::erase_if(VarList, [&](
Expr *E) {
12351 return Self.getSema().OpenACC().CheckVarIsPointerType(
12357 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12358 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12359 ParsedClause.getEndLoc());
12362template <
typename Derived>
12363void OpenACCClauseTransform<Derived>::VisitNumWorkersClause(
12365 Expr *IntExpr =
const_cast<Expr *
>(
C.getIntExpr());
12366 assert(IntExpr &&
"num_workers clause constructed with invalid int expr");
12369 if (!Res.isUsable())
12374 C.getBeginLoc(), Res.get());
12375 if (!Res.isUsable())
12378 ParsedClause.setIntExprDetails(Res.get());
12380 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12381 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs()[0],
12382 ParsedClause.getEndLoc());
12385template <
typename Derived>
12386void OpenACCClauseTransform<Derived>::VisitDeviceNumClause (
12388 Expr *IntExpr =
const_cast<Expr *
>(
C.getIntExpr());
12389 assert(IntExpr &&
"device_num clause constructed with invalid int expr");
12392 if (!Res.isUsable())
12397 C.getBeginLoc(), Res.get());
12398 if (!Res.isUsable())
12401 ParsedClause.setIntExprDetails(Res.get());
12403 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12404 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs()[0],
12405 ParsedClause.getEndLoc());
12408template <
typename Derived>
12409void OpenACCClauseTransform<Derived>::VisitDefaultAsyncClause(
12411 Expr *IntExpr =
const_cast<Expr *
>(
C.getIntExpr());
12412 assert(IntExpr &&
"default_async clause constructed with invalid int expr");
12415 if (!Res.isUsable())
12420 C.getBeginLoc(), Res.get());
12421 if (!Res.isUsable())
12424 ParsedClause.setIntExprDetails(Res.get());
12426 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12427 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs()[0],
12428 ParsedClause.getEndLoc());
12431template <
typename Derived>
12432void OpenACCClauseTransform<Derived>::VisitVectorLengthClause(
12434 Expr *IntExpr =
const_cast<Expr *
>(
C.getIntExpr());
12435 assert(IntExpr &&
"vector_length clause constructed with invalid int expr");
12438 if (!Res.isUsable())
12443 C.getBeginLoc(), Res.get());
12444 if (!Res.isUsable())
12447 ParsedClause.setIntExprDetails(Res.get());
12449 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12450 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs()[0],
12451 ParsedClause.getEndLoc());
12454template <
typename Derived>
12455void OpenACCClauseTransform<Derived>::VisitAsyncClause(
12457 if (
C.hasIntExpr()) {
12459 if (!Res.isUsable())
12464 C.getBeginLoc(), Res.get());
12465 if (!Res.isUsable())
12467 ParsedClause.setIntExprDetails(Res.get());
12471 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12472 ParsedClause.getLParenLoc(),
12473 ParsedClause.getNumIntExprs() != 0 ? ParsedClause.getIntExprs()[0]
12475 ParsedClause.getEndLoc());
12478template <
typename Derived>
12479void OpenACCClauseTransform<Derived>::VisitWorkerClause(
12481 if (
C.hasIntExpr()) {
12486 if (!Res.isUsable())
12491 C.getBeginLoc(), Res.get());
12492 if (!Res.isUsable())
12494 ParsedClause.setIntExprDetails(Res.get());
12498 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12499 ParsedClause.getLParenLoc(),
12500 ParsedClause.getNumIntExprs() != 0 ? ParsedClause.getIntExprs()[0]
12502 ParsedClause.getEndLoc());
12505template <
typename Derived>
12506void OpenACCClauseTransform<Derived>::VisitVectorClause(
12508 if (
C.hasIntExpr()) {
12513 if (!Res.isUsable())
12518 C.getBeginLoc(), Res.get());
12519 if (!Res.isUsable())
12521 ParsedClause.setIntExprDetails(Res.get());
12525 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12526 ParsedClause.getLParenLoc(),
12527 ParsedClause.getNumIntExprs() != 0 ? ParsedClause.getIntExprs()[0]
12529 ParsedClause.getEndLoc());
12532template <
typename Derived>
12533void OpenACCClauseTransform<Derived>::VisitWaitClause(
12535 if (
C.hasExprs()) {
12536 Expr *DevNumExpr =
nullptr;
12540 if (
C.getDevNumExpr()) {
12542 if (!Res.isUsable())
12546 C.getBeginLoc(), Res.get());
12547 if (!Res.isUsable())
12550 DevNumExpr = Res.get();
12554 for (
Expr *CurQueueIdExpr :
C.getQueueIdExprs()) {
12556 if (!Res.isUsable())
12560 C.getBeginLoc(), Res.get());
12561 if (!Res.isUsable())
12564 InstantiatedQueueIdExprs.push_back(Res.get());
12567 ParsedClause.setWaitDetails(DevNumExpr,
C.getQueuesLoc(),
12568 std::move(InstantiatedQueueIdExprs));
12572 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12573 ParsedClause.getLParenLoc(), ParsedClause.getDevNumExpr(),
12574 ParsedClause.getQueuesLoc(), ParsedClause.getQueueIdExprs(),
12575 ParsedClause.getEndLoc());
12578template <
typename Derived>
12579void OpenACCClauseTransform<Derived>::VisitDeviceTypeClause(
12583 Self.getSema().getASTContext(),
C.getClauseKind(),
12584 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12585 C.getArchitectures(), ParsedClause.getEndLoc());
12588template <
typename Derived>
12589void OpenACCClauseTransform<Derived>::VisitAutoClause(
12593 ParsedClause.getBeginLoc(),
12594 ParsedClause.getEndLoc());
12597template <
typename Derived>
12598void OpenACCClauseTransform<Derived>::VisitIndependentClause(
12601 ParsedClause.getBeginLoc(),
12602 ParsedClause.getEndLoc());
12605template <
typename Derived>
12606void OpenACCClauseTransform<Derived>::VisitSeqClause(
12609 ParsedClause.getBeginLoc(),
12610 ParsedClause.getEndLoc());
12612template <
typename Derived>
12613void OpenACCClauseTransform<Derived>::VisitFinalizeClause(
12616 ParsedClause.getBeginLoc(),
12617 ParsedClause.getEndLoc());
12620template <
typename Derived>
12621void OpenACCClauseTransform<Derived>::VisitIfPresentClause(
12624 ParsedClause.getBeginLoc(),
12625 ParsedClause.getEndLoc());
12628template <
typename Derived>
12629void OpenACCClauseTransform<Derived>::VisitReductionClause(
12635 for (
const auto [Var, OrigRecipe] :
12636 llvm::zip(TransformedVars,
C.getRecipes())) {
12638 ParsedClause.getDirectiveKind(),
C.getReductionOp(), Var);
12639 if (Res.isUsable()) {
12640 ValidVars.push_back(Res.get());
12642 if (OrigRecipe.isSet())
12643 Recipes.emplace_back(OrigRecipe.AllocaDecl, OrigRecipe.CombinerRecipes);
12645 Recipes.push_back(
Self.getSema().OpenACC().CreateReductionInitRecipe(
12646 C.getReductionOp(), Res.get()));
12650 NewClause =
Self.getSema().OpenACC().CheckReductionClause(
12651 ExistingClauses, ParsedClause.getDirectiveKind(),
12652 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12653 C.getReductionOp(), ValidVars, Recipes, ParsedClause.getEndLoc());
12656template <
typename Derived>
12657void OpenACCClauseTransform<Derived>::VisitCollapseClause(
12659 Expr *LoopCount =
const_cast<Expr *
>(
C.getLoopCount());
12660 assert(LoopCount &&
"collapse clause constructed with invalid loop count");
12664 if (!NewLoopCount.isUsable())
12667 NewLoopCount =
Self.getSema().OpenACC().ActOnIntExpr(
12669 NewLoopCount.get()->getBeginLoc(), NewLoopCount.get());
12673 if (!NewLoopCount.isUsable())
12677 Self.getSema().OpenACC().CheckCollapseLoopCount(NewLoopCount.get());
12681 if (!NewLoopCount.isUsable())
12684 ParsedClause.setCollapseDetails(
C.hasForce(), NewLoopCount.get());
12686 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12687 ParsedClause.getLParenLoc(), ParsedClause.isForce(),
12688 ParsedClause.getLoopCount(), ParsedClause.getEndLoc());
12691template <
typename Derived>
12692void OpenACCClauseTransform<Derived>::VisitTileClause(
12697 for (
Expr *E :
C.getSizeExprs()) {
12700 if (!NewSizeExpr.isUsable())
12703 NewSizeExpr =
Self.getSema().OpenACC().ActOnIntExpr(
12705 NewSizeExpr.get()->getBeginLoc(), NewSizeExpr.get());
12709 if (!NewSizeExpr.isUsable())
12712 NewSizeExpr =
Self.getSema().OpenACC().CheckTileSizeExpr(NewSizeExpr.get());
12714 if (!NewSizeExpr.isUsable())
12716 TransformedExprs.push_back(NewSizeExpr.get());
12719 ParsedClause.setIntExprDetails(TransformedExprs);
12721 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12722 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs(),
12723 ParsedClause.getEndLoc());
12725template <
typename Derived>
12726void OpenACCClauseTransform<Derived>::VisitGangClause(
12731 for (
unsigned I = 0; I <
C.getNumExprs(); ++I) {
12733 if (!ER.isUsable())
12736 ER =
Self.getSema().OpenACC().CheckGangExpr(ExistingClauses,
12737 ParsedClause.getDirectiveKind(),
12738 C.getExpr(I).first, ER.get());
12739 if (!ER.isUsable())
12741 TransformedGangKinds.push_back(
C.getExpr(I).first);
12742 TransformedIntExprs.push_back(ER.get());
12745 NewClause =
Self.getSema().OpenACC().CheckGangClause(
12746 ParsedClause.getDirectiveKind(), ExistingClauses,
12747 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12748 TransformedGangKinds, TransformedIntExprs, ParsedClause.getEndLoc());
12751template <
typename Derived>
12752OpenACCClause *TreeTransform<Derived>::TransformOpenACCClause(
12757 DirKind, OldClause->getClauseKind(), OldClause->getBeginLoc());
12758 ParsedClause.setEndLoc(OldClause->getEndLoc());
12760 if (
const auto *WithParms = dyn_cast<OpenACCClauseWithParams>(OldClause))
12761 ParsedClause.setLParenLoc(WithParms->getLParenLoc());
12763 OpenACCClauseTransform<Derived> Transform{*
this, ExistingClauses,
12765 Transform.Visit(OldClause);
12767 return Transform.CreatedClause();
12770template <
typename Derived>
12772TreeTransform<Derived>::TransformOpenACCClauseList(
12775 for (
const auto *Clause : OldClauses) {
12776 if (
OpenACCClause *TransformedClause = getDerived().TransformOpenACCClause(
12777 TransformedClauses, DirKind, Clause))
12778 TransformedClauses.push_back(TransformedClause);
12780 return TransformedClauses;
12783template <
typename Derived>
12786 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12789 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12792 if (getSema().OpenACC().ActOnStartStmtDirective(
12793 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12798 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
12799 C->clauses(), TransformedClauses);
12800 StmtResult StrBlock = getDerived().TransformStmt(
C->getStructuredBlock());
12801 StrBlock = getSema().OpenACC().ActOnAssociatedStmt(
12802 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses, StrBlock);
12804 return getDerived().RebuildOpenACCComputeConstruct(
12805 C->getDirectiveKind(),
C->getBeginLoc(),
C->getDirectiveLoc(),
12806 C->getEndLoc(), TransformedClauses, StrBlock);
12809template <
typename Derived>
12813 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12816 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12819 if (getSema().OpenACC().ActOnStartStmtDirective(
12820 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12825 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
12826 C->clauses(), TransformedClauses);
12828 Loop = getSema().OpenACC().ActOnAssociatedStmt(
12829 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses,
Loop);
12831 return getDerived().RebuildOpenACCLoopConstruct(
12832 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12833 TransformedClauses,
Loop);
12836template <
typename Derived>
12838 OpenACCCombinedConstruct *
C) {
12839 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12842 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12845 if (getSema().OpenACC().ActOnStartStmtDirective(
12846 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12851 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
12852 C->clauses(), TransformedClauses);
12854 Loop = getSema().OpenACC().ActOnAssociatedStmt(
12855 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses,
Loop);
12857 return getDerived().RebuildOpenACCCombinedConstruct(
12858 C->getDirectiveKind(),
C->getBeginLoc(),
C->getDirectiveLoc(),
12859 C->getEndLoc(), TransformedClauses,
Loop);
12862template <
typename Derived>
12865 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12868 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12870 if (getSema().OpenACC().ActOnStartStmtDirective(
12871 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12875 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
12876 C->clauses(), TransformedClauses);
12877 StmtResult StrBlock = getDerived().TransformStmt(
C->getStructuredBlock());
12878 StrBlock = getSema().OpenACC().ActOnAssociatedStmt(
12879 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses, StrBlock);
12881 return getDerived().RebuildOpenACCDataConstruct(
12882 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12883 TransformedClauses, StrBlock);
12886template <
typename Derived>
12888 OpenACCEnterDataConstruct *
C) {
12889 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12892 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12894 if (getSema().OpenACC().ActOnStartStmtDirective(
12895 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12898 return getDerived().RebuildOpenACCEnterDataConstruct(
12899 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12900 TransformedClauses);
12903template <
typename Derived>
12905 OpenACCExitDataConstruct *
C) {
12906 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12909 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12911 if (getSema().OpenACC().ActOnStartStmtDirective(
12912 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12915 return getDerived().RebuildOpenACCExitDataConstruct(
12916 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12917 TransformedClauses);
12920template <
typename Derived>
12922 OpenACCHostDataConstruct *
C) {
12923 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12926 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12928 if (getSema().OpenACC().ActOnStartStmtDirective(
12929 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12933 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
12934 C->clauses(), TransformedClauses);
12935 StmtResult StrBlock = getDerived().TransformStmt(
C->getStructuredBlock());
12936 StrBlock = getSema().OpenACC().ActOnAssociatedStmt(
12937 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses, StrBlock);
12939 return getDerived().RebuildOpenACCHostDataConstruct(
12940 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12941 TransformedClauses, StrBlock);
12944template <
typename Derived>
12947 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12950 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12952 if (getSema().OpenACC().ActOnStartStmtDirective(
12953 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12956 return getDerived().RebuildOpenACCInitConstruct(
12957 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12958 TransformedClauses);
12961template <
typename Derived>
12963 OpenACCShutdownConstruct *
C) {
12964 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12967 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12969 if (getSema().OpenACC().ActOnStartStmtDirective(
12970 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12973 return getDerived().RebuildOpenACCShutdownConstruct(
12974 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12975 TransformedClauses);
12977template <
typename Derived>
12980 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12983 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12985 if (getSema().OpenACC().ActOnStartStmtDirective(
12986 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12989 return getDerived().RebuildOpenACCSetConstruct(
12990 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12991 TransformedClauses);
12994template <
typename Derived>
12996 OpenACCUpdateConstruct *
C) {
12997 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13000 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
13002 if (getSema().OpenACC().ActOnStartStmtDirective(
13003 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
13006 return getDerived().RebuildOpenACCUpdateConstruct(
13007 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
13008 TransformedClauses);
13011template <
typename Derived>
13014 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13017 if (
C->hasDevNumExpr()) {
13018 DevNumExpr = getDerived().TransformExpr(
C->getDevNumExpr());
13020 if (DevNumExpr.isUsable())
13021 DevNumExpr = getSema().OpenACC().ActOnIntExpr(
13023 C->getBeginLoc(), DevNumExpr.get());
13028 for (
Expr *QE :
C->getQueueIdExprs()) {
13029 assert(QE &&
"Null queue id expr?");
13030 ExprResult NewEQ = getDerived().TransformExpr(QE);
13032 if (!NewEQ.isUsable())
13036 C->getBeginLoc(), NewEQ.get());
13037 if (NewEQ.isUsable())
13038 QueueIdExprs.push_back(NewEQ.get());
13042 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
13045 if (getSema().OpenACC().ActOnStartStmtDirective(
13046 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
13049 return getDerived().RebuildOpenACCWaitConstruct(
13050 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getLParenLoc(),
13051 DevNumExpr.isUsable() ? DevNumExpr.get() :
nullptr,
C->getQueuesLoc(),
13052 QueueIdExprs,
C->getRParenLoc(),
C->getEndLoc(), TransformedClauses);
13054template <
typename Derived>
13056 OpenACCCacheConstruct *
C) {
13057 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13060 for (
Expr *Var :
C->getVarList()) {
13061 assert(Var &&
"Null var listexpr?");
13063 ExprResult NewVar = getDerived().TransformExpr(Var);
13065 if (!NewVar.isUsable())
13068 NewVar = getSema().OpenACC().ActOnVar(
13070 if (!NewVar.isUsable())
13073 TransformedVarList.push_back(NewVar.get());
13076 if (getSema().OpenACC().ActOnStartStmtDirective(
C->getDirectiveKind(),
13077 C->getBeginLoc(), {}))
13080 return getDerived().RebuildOpenACCCacheConstruct(
13081 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getLParenLoc(),
13082 C->getReadOnlyLoc(), TransformedVarList,
C->getRParenLoc(),
13086template <
typename Derived>
13088 OpenACCAtomicConstruct *
C) {
13089 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13092 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
13095 if (getSema().OpenACC().ActOnStartStmtDirective(
C->getDirectiveKind(),
13096 C->getBeginLoc(), {}))
13101 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(), {}, {});
13103 StmtResult AssocStmt = getDerived().TransformStmt(
C->getAssociatedStmt());
13104 AssocStmt = getSema().OpenACC().ActOnAssociatedStmt(
13105 C->getBeginLoc(),
C->getDirectiveKind(),
C->getAtomicKind(), {},
13108 return getDerived().RebuildOpenACCAtomicConstruct(
13109 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getAtomicKind(),
13110 C->getEndLoc(), TransformedClauses, AssocStmt);
13113template <
typename Derived>
13116 if (getDerived().AlwaysRebuild())
13125template<
typename Derived>
13128 return TransformExpr(E->getSubExpr());
13131template <
typename Derived>
13134 if (!E->isTypeDependent())
13137 TypeSourceInfo *NewT = getDerived().TransformType(E->getTypeSourceInfo());
13142 if (!getDerived().AlwaysRebuild() && E->getTypeSourceInfo() == NewT)
13145 return getDerived().RebuildSYCLUniqueStableNameExpr(
13146 E->getLocation(), E->getLParenLocation(), E->getRParenLocation(), NewT);
13149template <
typename Derived>
13153 const auto *SKEPAttr = FD->template getAttr<SYCLKernelEntryPointAttr>();
13154 if (!SKEPAttr || SKEPAttr->isInvalidAttr())
13157 ExprResult IdExpr = getDerived().TransformExpr(S->getKernelLaunchIdExpr());
13158 if (IdExpr.isInvalid())
13161 StmtResult Body = getDerived().TransformStmt(S->getOriginalStmt());
13162 if (Body.isInvalid())
13168 if (SR.isInvalid())
13174template <
typename Derived>
13177 assert(
false &&
"not implemented yet");
13181template<
typename Derived>
13184 if (!E->isTypeDependent())
13188 E->getIdentKind());
13191template<
typename Derived>
13195 if (E->getQualifierLoc()) {
13197 = getDerived().TransformNestedNameSpecifierLoc(E->getQualifierLoc());
13203 = cast_or_null<ValueDecl>(getDerived().TransformDecl(E->getLocation(),
13205 if (!ND || ND->isInvalidDecl())
13209 if (E->getFoundDecl() != E->getDecl()) {
13210 Found = cast_or_null<NamedDecl>(
13211 getDerived().TransformDecl(E->getLocation(), E->getFoundDecl()));
13217 if (NameInfo.getName()) {
13218 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
13219 if (!NameInfo.getName())
13223 if (!getDerived().AlwaysRebuild() &&
13224 !E->isCapturedByCopyInLambdaWithExplicitObjectParameter() &&
13225 QualifierLoc == E->getQualifierLoc() && ND == E->getDecl() &&
13226 Found == E->getFoundDecl() &&
13227 NameInfo.getName() == E->getDecl()->getDeclName() &&
13228 !E->hasExplicitTemplateArgs()) {
13238 if (E->hasExplicitTemplateArgs()) {
13239 TemplateArgs = &TransArgs;
13240 TransArgs.setLAngleLoc(E->getLAngleLoc());
13241 TransArgs.setRAngleLoc(E->getRAngleLoc());
13242 if (getDerived().TransformTemplateArguments(E->getTemplateArgs(),
13243 E->getNumTemplateArgs(),
13248 return getDerived().RebuildDeclRefExpr(QualifierLoc, ND, NameInfo,
13249 Found, TemplateArgs);
13252template<
typename Derived>
13258template <
typename Derived>
13264template<
typename Derived>
13270template<
typename Derived>
13276template<
typename Derived>
13282template<
typename Derived>
13288template<
typename Derived>
13291 return getDerived().TransformCallExpr(E);
13294template<
typename Derived>
13299 if (E->isExprPredicate())
13300 ControllingExpr = getDerived().TransformExpr(E->getControllingExpr());
13302 ControllingType = getDerived().TransformType(E->getControllingType());
13304 if (ControllingExpr.isInvalid() && !ControllingType)
13315 AssocTypes.push_back(AssocType);
13317 AssocTypes.push_back(
nullptr);
13321 getDerived().TransformExpr(Assoc.getAssociationExpr());
13322 if (AssocExpr.isInvalid())
13324 AssocExprs.push_back(AssocExpr.get());
13327 if (!ControllingType)
13328 return getDerived().RebuildGenericSelectionExpr(E->getGenericLoc(),
13329 E->getDefaultLoc(),
13331 ControllingExpr.get(),
13334 return getDerived().RebuildGenericSelectionExpr(
13335 E->getGenericLoc(), E->getDefaultLoc(), E->getRParenLoc(),
13336 ControllingType, AssocTypes, AssocExprs);
13339template<
typename Derived>
13342 ExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
13343 if (SubExpr.isInvalid())
13346 if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getSubExpr())
13349 return getDerived().RebuildParenExpr(SubExpr.get(), E->getLParen(),
13356template<
typename Derived>
13360 return getDerived().TransformDependentScopeDeclRefExpr(
13361 DRE,
true,
nullptr);
13363 return getDerived().TransformUnresolvedLookupExpr(
13369template<
typename Derived>
13374 SubExpr = TransformAddressOfOperand(E->
getSubExpr());
13380 if (!getDerived().AlwaysRebuild() && SubExpr.
get() == E->
getSubExpr())
13388template<
typename Derived>
13390TreeTransform<Derived>::TransformOffsetOfExpr(OffsetOfExpr *E) {
13392 TypeSourceInfo *Type = getDerived().TransformType(E->getTypeSourceInfo());
13402 bool ExprChanged =
false;
13403 typedef Sema::OffsetOfComponent Component;
13405 for (
unsigned I = 0, N = E->getNumComponents(); I != N; ++I) {
13406 const OffsetOfNode &ON = E->getComponent(I);
13408 Comp.isBrackets =
true;
13409 Comp.LocStart = ON.getSourceRange().getBegin();
13410 Comp.LocEnd = ON.getSourceRange().getEnd();
13411 switch (ON.getKind()) {
13413 Expr *FromIndex = E->getIndexExpr(ON.getArrayExprIndex());
13414 ExprResult Index = getDerived().TransformExpr(FromIndex);
13415 if (Index.isInvalid())
13418 ExprChanged = ExprChanged || Index.get() != FromIndex;
13419 Comp.isBrackets =
true;
13420 Comp.U.E = Index.get();
13426 Comp.isBrackets =
false;
13427 Comp.U.IdentInfo = ON.getFieldName();
13428 if (!
Comp.U.IdentInfo)
13438 Components.push_back(Comp);
13442 if (!getDerived().AlwaysRebuild() &&
13443 Type == E->getTypeSourceInfo() &&
13448 return getDerived().RebuildOffsetOfExpr(E->getOperatorLoc(),
Type,
13449 Components, E->getRParenLoc());
13452template<
typename Derived>
13455 assert((!E->getSourceExpr() || getDerived().AlreadyTransformed(E->getType())) &&
13456 "opaque value expression requires transformation");
13460template <
typename Derived>
13464 for (
Expr *
C : E->subExpressions()) {
13466 if (NewC.isInvalid())
13472 if (!getDerived().AlwaysRebuild() && !Changed)
13474 return getDerived().RebuildRecoveryExpr(E->getBeginLoc(), E->getEndLoc(),
13478template<
typename Derived>
13488 ExprResult result = getDerived().TransformExpr(newSyntacticForm);
13489 if (result.isInvalid())
return ExprError();
13494 if (result.get()->hasPlaceholderType(BuiltinType::PseudoObject))
13500template<
typename Derived>
13504 if (E->isArgumentType()) {
13511 if (!getDerived().AlwaysRebuild() && OldT == NewT)
13514 return getDerived().RebuildUnaryExprOrTypeTrait(NewT, E->getOperatorLoc(),
13516 E->getSourceRange());
13530 auto *PE = dyn_cast<ParenExpr>(E->getArgumentExpr());
13532 PE ? dyn_cast<DependentScopeDeclRefExpr>(PE->getSubExpr()) :
nullptr)
13533 SubExpr = getDerived().TransformParenDependentScopeDeclRefExpr(
13534 PE, DRE,
false, &RecoveryTSI);
13536 SubExpr = getDerived().TransformExpr(E->getArgumentExpr());
13539 return getDerived().RebuildUnaryExprOrTypeTrait(
13540 RecoveryTSI, E->getOperatorLoc(), E->getKind(), E->getSourceRange());
13541 }
else if (SubExpr.isInvalid())
13544 if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getArgumentExpr())
13547 return getDerived().RebuildUnaryExprOrTypeTrait(SubExpr.get(),
13548 E->getOperatorLoc(),
13550 E->getSourceRange());
13553template<
typename Derived>
13556 ExprResult LHS = getDerived().TransformExpr(E->getLHS());
13557 if (LHS.isInvalid())
13560 ExprResult RHS = getDerived().TransformExpr(E->getRHS());
13561 if (RHS.isInvalid())
13565 if (!getDerived().AlwaysRebuild() &&
13566 LHS.get() == E->getLHS() &&
13567 RHS.get() == E->getRHS())
13570 return getDerived().RebuildArraySubscriptExpr(
13572 E->getLHS()->getBeginLoc(), RHS.get(), E->getRBracketLoc());
13575template <
typename Derived>
13579 if (
Base.isInvalid())
13582 ExprResult RowIdx = getDerived().TransformExpr(E->getRowIdx());
13583 if (RowIdx.isInvalid())
13586 if (!getDerived().AlwaysRebuild() &&
Base.get() == E->getBase() &&
13587 RowIdx.get() == E->getRowIdx())
13590 return getDerived().RebuildMatrixSingleSubscriptExpr(
Base.get(), RowIdx.get(),
13591 E->getRBracketLoc());
13594template <
typename Derived>
13598 if (
Base.isInvalid())
13601 ExprResult RowIdx = getDerived().TransformExpr(E->getRowIdx());
13602 if (RowIdx.isInvalid())
13605 ExprResult ColumnIdx = getDerived().TransformExpr(E->getColumnIdx());
13606 if (ColumnIdx.isInvalid())
13609 if (!getDerived().AlwaysRebuild() &&
Base.get() == E->getBase() &&
13610 RowIdx.get() == E->getRowIdx() && ColumnIdx.get() == E->getColumnIdx())
13613 return getDerived().RebuildMatrixSubscriptExpr(
13614 Base.get(), RowIdx.get(), ColumnIdx.get(), E->getRBracketLoc());
13617template <
typename Derived>
13621 if (
Base.isInvalid())
13625 if (E->getLowerBound()) {
13626 LowerBound = getDerived().TransformExpr(E->getLowerBound());
13627 if (LowerBound.isInvalid())
13632 if (E->getLength()) {
13633 Length = getDerived().TransformExpr(E->getLength());
13634 if (Length.isInvalid())
13639 if (E->isOMPArraySection()) {
13640 if (
Expr *Str = E->getStride()) {
13641 Stride = getDerived().TransformExpr(Str);
13642 if (Stride.isInvalid())
13647 if (!getDerived().AlwaysRebuild() &&
Base.get() == E->getBase() &&
13648 LowerBound.get() == E->getLowerBound() &&
13649 Length.get() == E->getLength() &&
13650 (E->isOpenACCArraySection() || Stride.get() == E->getStride()))
13653 return getDerived().RebuildArraySectionExpr(
13654 E->isOMPArraySection(),
Base.get(), E->getBase()->getEndLoc(),
13655 LowerBound.get(), E->getColonLocFirst(),
13656 E->isOMPArraySection() ? E->getColonLocSecond() :
SourceLocation{},
13657 Length.get(), Stride.get(), E->getRBracketLoc());
13660template <
typename Derived>
13664 if (
Base.isInvalid())
13668 bool ErrorFound =
false;
13669 for (
Expr *
Dim : E->getDimensions()) {
13671 if (DimRes.isInvalid()) {
13675 Dims.push_back(DimRes.get());
13680 return getDerived().RebuildOMPArrayShapingExpr(
Base.get(), E->getLParenLoc(),
13681 E->getRParenLoc(), Dims,
13682 E->getBracketsRanges());
13685template <
typename Derived>
13688 unsigned NumIterators = E->numOfIterators();
13691 bool ErrorFound =
false;
13692 bool NeedToRebuild = getDerived().AlwaysRebuild();
13693 for (
unsigned I = 0; I < NumIterators; ++I) {
13695 Data[I].DeclIdent = D->getIdentifier();
13696 Data[I].DeclIdentLoc = D->getLocation();
13697 if (D->getLocation() == D->getBeginLoc()) {
13699 "Implicit type must be int.");
13701 TypeSourceInfo *TSI = getDerived().TransformType(D->getTypeSourceInfo());
13709 ErrorFound = ErrorFound ||
13710 !(!D->getTypeSourceInfo() || (
Data[I].
Type.getAsOpaquePtr() &&
13711 !
Data[I].Type.get().isNull())) ||
13712 Begin.isInvalid() || End.isInvalid() || Step.isInvalid();
13715 Data[I].Range.Begin = Begin.get();
13716 Data[I].Range.End = End.get();
13717 Data[I].Range.Step = Step.get();
13718 Data[I].AssignLoc = E->getAssignLoc(I);
13719 Data[I].ColonLoc = E->getColonLoc(I);
13720 Data[I].SecColonLoc = E->getSecondColonLoc(I);
13723 (D->getTypeSourceInfo() &&
Data[I].
Type.get().getTypePtrOrNull() !=
13724 D->getType().getTypePtrOrNull()) ||
13730 if (!NeedToRebuild)
13733 ExprResult Res = getDerived().RebuildOMPIteratorExpr(
13734 E->getIteratorKwLoc(), E->getLParenLoc(), E->getRParenLoc(),
Data);
13735 if (!Res.isUsable())
13738 for (
unsigned I = 0; I < NumIterators; ++I)
13739 getDerived().transformedLocalDecl(E->getIteratorDecl(I),
13740 IE->getIteratorDecl(I));
13744template<
typename Derived>
13753 bool ArgChanged =
false;
13755 if (getDerived().TransformExprs(E->getArgs(), E->getNumArgs(),
true, Args,
13759 if (!getDerived().AlwaysRebuild() &&
13760 Callee.get() == E->getCallee() &&
13766 = ((
Expr *)
Callee.get())->getSourceRange().getBegin();
13769 if (E->hasStoredFPFeatures()) {
13771 getSema().CurFPFeatures =
13773 getSema().FpPragmaStack.CurrentValue = NewOverrides;
13776 return getDerived().RebuildCallExpr(
Callee.get(), FakeLParenLoc,
13778 E->getRParenLoc());
13781template<
typename Derived>
13785 if (
Base.isInvalid())
13789 if (E->hasQualifier()) {
13791 = getDerived().TransformNestedNameSpecifierLoc(E->getQualifierLoc());
13799 = cast_or_null<ValueDecl>(getDerived().TransformDecl(E->getMemberLoc(),
13800 E->getMemberDecl()));
13804 NamedDecl *FoundDecl = E->getFoundDecl();
13805 if (FoundDecl == E->getMemberDecl()) {
13808 FoundDecl = cast_or_null<NamedDecl>(
13809 getDerived().TransformDecl(E->getMemberLoc(), FoundDecl));
13814 if (!getDerived().AlwaysRebuild() &&
13815 Base.get() == E->getBase() &&
13816 QualifierLoc == E->getQualifierLoc() &&
13817 Member == E->getMemberDecl() &&
13818 FoundDecl == E->getFoundDecl() &&
13819 !E->hasExplicitTemplateArgs()) {
13824 getSema().OpenMP().isOpenMPRebuildMemberExpr(
13834 if (E->hasExplicitTemplateArgs()) {
13835 TransArgs.setLAngleLoc(E->getLAngleLoc());
13836 TransArgs.setRAngleLoc(E->getRAngleLoc());
13837 if (getDerived().TransformTemplateArguments(E->getTemplateArgs(),
13838 E->getNumTemplateArgs(),
13851 NamedDecl *FirstQualifierInScope =
nullptr;
13853 if (MemberNameInfo.getName()) {
13854 MemberNameInfo = getDerived().TransformDeclarationNameInfo(MemberNameInfo);
13855 if (!MemberNameInfo.getName())
13859 return getDerived().RebuildMemberExpr(
Base.get(), FakeOperatorLoc,
13866 (E->hasExplicitTemplateArgs()
13867 ? &TransArgs :
nullptr),
13868 FirstQualifierInScope);
13871template<
typename Derived>
13874 ExprResult LHS = getDerived().TransformExpr(E->getLHS());
13875 if (LHS.isInvalid())
13879 getDerived().TransformInitializer(E->getRHS(),
false);
13880 if (RHS.isInvalid())
13883 if (!getDerived().AlwaysRebuild() &&
13884 LHS.get() == E->getLHS() &&
13885 RHS.get() == E->getRHS())
13888 if (E->isCompoundAssignmentOp())
13890 return getDerived().RebuildBinaryOperator(
13891 E->getOperatorLoc(), E->getOpcode(), LHS.get(), RHS.get());
13894 getSema().CurFPFeatures =
13895 NewOverrides.applyOverrides(getSema().getLangOpts());
13896 getSema().FpPragmaStack.CurrentValue = NewOverrides;
13897 return getDerived().RebuildBinaryOperator(E->getOperatorLoc(), E->getOpcode(),
13898 LHS.get(), RHS.get());
13901template <
typename Derived>
13906 ExprResult LHS = getDerived().TransformExpr(
const_cast<Expr*
>(Decomp.LHS));
13907 if (LHS.isInvalid())
13910 ExprResult RHS = getDerived().TransformExpr(
const_cast<Expr*
>(Decomp.RHS));
13911 if (RHS.isInvalid())
13917 bool ChangedAnyLookups =
false;
13918 Expr *PossibleBinOps[] = {E->getSemanticForm(),
13919 const_cast<Expr *
>(Decomp.InnerBinOp)};
13920 for (
Expr *PossibleBinOp : PossibleBinOps) {
13921 auto *Op = dyn_cast<CXXOperatorCallExpr>(PossibleBinOp->IgnoreImplicit());
13924 auto *
Callee = dyn_cast<DeclRefExpr>(Op->getCallee()->IgnoreImplicit());
13930 NamedDecl *
Found = cast_or_null<NamedDecl>(getDerived().TransformDecl(
13931 E->getOperatorLoc(),
Callee->getFoundDecl()));
13935 ChangedAnyLookups =
true;
13936 UnqualLookups.addDecl(
Found);
13939 if (!getDerived().AlwaysRebuild() && !ChangedAnyLookups &&
13940 LHS.get() == Decomp.LHS && RHS.get() == Decomp.RHS) {
13946 const Expr *StopAt[] = {Decomp.LHS, Decomp.RHS};
13951 return getDerived().RebuildCXXRewrittenBinaryOperator(
13952 E->getOperatorLoc(), Decomp.Opcode, UnqualLookups, LHS.get(), RHS.get());
13955template<
typename Derived>
13961 getSema().CurFPFeatures =
13962 NewOverrides.applyOverrides(getSema().getLangOpts());
13963 getSema().FpPragmaStack.CurrentValue = NewOverrides;
13964 return getDerived().TransformBinaryOperator(E);
13967template<
typename Derived>
13973 ExprResult commonExpr = getDerived().TransformExpr(e->getCommon());
13974 if (commonExpr.isInvalid())
13977 ExprResult rhs = getDerived().TransformExpr(e->getFalseExpr());
13978 if (rhs.isInvalid())
13981 if (!getDerived().AlwaysRebuild() &&
13982 commonExpr.get() == e->getCommon() &&
13983 rhs.get() == e->getFalseExpr())
13986 return getDerived().RebuildConditionalOperator(commonExpr.get(),
13987 e->getQuestionLoc(),
13993template<
typename Derived>
13997 if (
Cond.isInvalid())
14000 ExprResult LHS = getDerived().TransformExpr(E->getLHS());
14001 if (LHS.isInvalid())
14004 ExprResult RHS = getDerived().TransformExpr(E->getRHS());
14005 if (RHS.isInvalid())
14008 if (!getDerived().AlwaysRebuild() &&
14009 Cond.get() == E->getCond() &&
14010 LHS.get() == E->getLHS() &&
14011 RHS.get() == E->getRHS())
14014 return getDerived().RebuildConditionalOperator(
Cond.get(),
14015 E->getQuestionLoc(),
14021template<
typename Derived>
14026 return getDerived().
TransformExpr(E->getSubExprAsWritten());
14029template<
typename Derived>
14037 = getDerived().TransformExpr(E->getSubExprAsWritten());
14038 if (SubExpr.isInvalid())
14041 if (!getDerived().AlwaysRebuild() &&
14042 Type == E->getTypeInfoAsWritten() &&
14043 SubExpr.get() == E->getSubExpr())
14046 return getDerived().RebuildCStyleCastExpr(E->getLParenLoc(),
14052template<
typename Derived>
14060 ExprResult Init = getDerived().TransformExpr(E->getInitializer());
14061 if (
Init.isInvalid())
14064 if (!getDerived().AlwaysRebuild() &&
14066 Init.get() == E->getInitializer())
14073 return getDerived().RebuildCompoundLiteralExpr(
14074 E->getLParenLoc(), NewT,
14075 E->getInitializer()->getEndLoc(),
Init.get());
14078template<
typename Derived>
14082 if (
Base.isInvalid())
14085 if (!getDerived().AlwaysRebuild() &&
14086 Base.get() == E->getBase())
14092 return getDerived().RebuildExtVectorOrMatrixElementExpr(
14093 Base.get(), FakeOperatorLoc, E->isArrow(), E->getAccessorLoc(),
14097template <
typename Derived>
14101 if (
Base.isInvalid())
14104 if (!getDerived().AlwaysRebuild() &&
Base.get() == E->getBase())
14110 return getDerived().RebuildExtVectorOrMatrixElementExpr(
14111 Base.get(), FakeOperatorLoc,
false, E->getAccessorLoc(),
14115template<
typename Derived>
14121 bool InitChanged =
false;
14127 if (getDerived().TransformExprs(E->getInits(), E->getNumInits(),
false,
14128 Inits, &InitChanged))
14131 if (!getDerived().AlwaysRebuild() && !InitChanged) {
14138 return getDerived().RebuildInitList(E->getLBraceLoc(),
Inits,
14139 E->getRBraceLoc(), E->isExplicit());
14142template<
typename Derived>
14149 if (
Init.isInvalid())
14154 bool ExprChanged =
false;
14156 if (D.isFieldDesignator()) {
14157 if (D.getFieldDecl()) {
14159 getDerived().TransformDecl(D.getFieldLoc(), D.getFieldDecl()));
14160 if (Field != D.getFieldDecl())
14163 ExprChanged =
true;
14164 if (
Field->isAnonymousStructOrUnion())
14170 ExprChanged =
true;
14173 D.getFieldName(), D.getDotLoc(), D.getFieldLoc()));
14177 if (D.isArrayDesignator()) {
14178 ExprResult Index = getDerived().TransformExpr(E->getArrayIndex(D));
14179 if (Index.isInvalid())
14182 Desig.AddDesignator(
14185 ExprChanged = ExprChanged || Index.get() != E->getArrayIndex(D);
14186 ArrayExprs.push_back(Index.get());
14190 assert(D.isArrayRangeDesignator() &&
"New kind of designator?");
14192 = getDerived().TransformExpr(E->getArrayRangeStart(D));
14193 if (Start.isInvalid())
14196 ExprResult End = getDerived().TransformExpr(E->getArrayRangeEnd(D));
14197 if (End.isInvalid())
14201 Start.get(), End.get(), D.getLBracketLoc(), D.getEllipsisLoc()));
14203 ExprChanged = ExprChanged || Start.get() != E->getArrayRangeStart(D) ||
14204 End.get() != E->getArrayRangeEnd(D);
14206 ArrayExprs.push_back(Start.get());
14207 ArrayExprs.push_back(End.get());
14210 if (!getDerived().AlwaysRebuild() &&
14211 Init.get() == E->getInit() &&
14215 return getDerived().RebuildDesignatedInitExpr(Desig, ArrayExprs,
14216 E->getEqualOrColonLoc(),
14217 E->usesGNUSyntax(),
Init.get());
14222template<
typename Derived>
14226 llvm_unreachable(
"Unexpected DesignatedInitUpdateExpr in syntactic form of "
14231template<
typename Derived>
14235 llvm_unreachable(
"Unexpected NoInitExpr in syntactic form of initializer");
14239template<
typename Derived>
14242 llvm_unreachable(
"Unexpected ArrayInitLoopExpr outside of initializer");
14246template<
typename Derived>
14249 llvm_unreachable(
"Unexpected ArrayInitIndexExpr outside of initializer");
14253template<
typename Derived>
14261 QualType T = getDerived().TransformType(E->getType());
14265 if (!getDerived().AlwaysRebuild() &&
14269 return getDerived().RebuildImplicitValueInitExpr(T);
14272template<
typename Derived>
14275 TypeSourceInfo *TInfo = getDerived().TransformType(E->getWrittenTypeInfo());
14279 ExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
14280 if (SubExpr.isInvalid())
14283 if (!getDerived().AlwaysRebuild() &&
14284 TInfo == E->getWrittenTypeInfo() &&
14285 SubExpr.get() == E->getSubExpr())
14288 return getDerived().RebuildVAArgExpr(E->getBuiltinLoc(), SubExpr.get(),
14289 TInfo, E->getRParenLoc());
14292template<
typename Derived>
14295 bool ArgumentChanged =
false;
14297 if (TransformExprs(E->getExprs(), E->getNumExprs(),
true,
Inits,
14301 return getDerived().RebuildParenListExpr(E->getLParenLoc(),
14303 E->getRParenLoc());
14311template<
typename Derived>
14314 Decl *LD = getDerived().TransformDecl(E->getLabel()->getLocation(),
14319 return getDerived().RebuildAddrLabelExpr(E->getAmpAmpLoc(), E->getLabelLoc(),
14323template<
typename Derived>
14328 = getDerived().TransformCompoundStmt(E->getSubStmt(),
true);
14329 if (SubStmt.isInvalid()) {
14334 unsigned OldDepth = E->getTemplateDepth();
14335 unsigned NewDepth = getDerived().TransformTemplateDepth(OldDepth);
14337 if (!getDerived().AlwaysRebuild() && OldDepth == NewDepth &&
14338 SubStmt.get() == E->getSubStmt()) {
14344 return getDerived().RebuildStmtExpr(E->getLParenLoc(), SubStmt.get(),
14345 E->getRParenLoc(), NewDepth);
14348template<
typename Derived>
14352 if (
Cond.isInvalid())
14355 ExprResult LHS = getDerived().TransformExpr(E->getLHS());
14356 if (LHS.isInvalid())
14359 ExprResult RHS = getDerived().TransformExpr(E->getRHS());
14360 if (RHS.isInvalid())
14363 if (!getDerived().AlwaysRebuild() &&
14364 Cond.get() == E->getCond() &&
14365 LHS.get() == E->getLHS() &&
14366 RHS.get() == E->getRHS())
14369 return getDerived().RebuildChooseExpr(E->getBuiltinLoc(),
14370 Cond.get(), LHS.get(), RHS.get(),
14371 E->getRParenLoc());
14374template<
typename Derived>
14380template<
typename Derived>
14383 switch (E->getOperator()) {
14387 case OO_Array_Delete:
14388 llvm_unreachable(
"new and delete operators cannot use CXXOperatorCallExpr");
14393 assert(E->getNumArgs() >= 1 &&
"Object call is missing arguments");
14406 if (FakeLParenLoc.isInvalid() && EndLoc.isValid())
14407 FakeLParenLoc = EndLoc;
14411 if (getDerived().TransformExprs(E->getArgs() + 1, E->getNumArgs() - 1,
true,
14415 if (E->getOperator() == OO_Subscript)
14416 return getDerived().RebuildCxxSubscriptExpr(
Object.get(), FakeLParenLoc,
14417 Args, E->getEndLoc());
14419 return getDerived().RebuildCallExpr(
Object.get(), FakeLParenLoc, Args,
14423#define OVERLOADED_OPERATOR(Name, Spelling, Token, Unary, Binary, MemberOnly) \
14427#define OVERLOADED_OPERATOR_MULTI(Name,Spelling,Unary,Binary,MemberOnly)
14428#include "clang/Basic/OperatorKinds.def"
14430 case OO_Conditional:
14431 llvm_unreachable(
"conditional operator is not actually overloadable");
14435 llvm_unreachable(
"not an overloaded operator?");
14439 if (E->getNumArgs() == 1 && E->getOperator() == OO_Amp)
14440 First = getDerived().TransformAddressOfOperand(E->getArg(0));
14442 First = getDerived().TransformExpr(E->getArg(0));
14443 if (
First.isInvalid())
14447 if (E->getNumArgs() == 2) {
14449 getDerived().TransformInitializer(E->getArg(1),
false);
14450 if (Second.isInvalid())
14456 getSema().CurFPFeatures =
14457 NewOverrides.applyOverrides(getSema().getLangOpts());
14458 getSema().FpPragmaStack.CurrentValue = NewOverrides;
14464 if (getDerived().TransformOverloadExprDecls(ULE, ULE->requiresADL(), R))
14467 return getDerived().RebuildCXXOperatorCallExpr(
14468 E->getOperator(), E->getOperatorLoc(),
Callee->getBeginLoc(),
14469 ULE->requiresADL(),
R.asUnresolvedSet(),
First.get(), Second.get());
14474 Callee = ICE->getSubExprAsWritten();
14476 ValueDecl *VD = cast_or_null<ValueDecl>(
14477 getDerived().TransformDecl(DR->getLocation(), DR));
14482 Functions.addDecl(VD);
14484 return getDerived().RebuildCXXOperatorCallExpr(
14485 E->getOperator(), E->getOperatorLoc(),
Callee->getBeginLoc(),
14486 false, Functions,
First.get(), Second.get());
14489template<
typename Derived>
14492 return getDerived().TransformCallExpr(E);
14495template <
typename Derived>
14498 getSema().CurContext != E->getParentContext();
14500 if (!getDerived().AlwaysRebuild() && !NeedRebuildFunc)
14503 return getDerived().RebuildSourceLocExpr(E->getIdentKind(), E->getType(),
14504 E->getBeginLoc(), E->getEndLoc(),
14505 getSema().CurContext);
14508template <
typename Derived>
14513template<
typename Derived>
14522 ExprResult EC = getDerived().TransformCallExpr(E->getConfig());
14523 if (EC.isInvalid())
14527 bool ArgChanged =
false;
14529 if (getDerived().TransformExprs(E->getArgs(), E->getNumArgs(),
true, Args,
14533 if (!getDerived().AlwaysRebuild() &&
14534 Callee.get() == E->getCallee() &&
14540 = ((
Expr *)
Callee.get())->getSourceRange().getBegin();
14541 return getDerived().RebuildCallExpr(
Callee.get(), FakeLParenLoc,
14543 E->getRParenLoc(), EC.get());
14546template<
typename Derived>
14562 return getDerived().RebuildCXXNamedCastExpr(
14569template<
typename Derived>
14578 if (Sub.isInvalid())
14581 return getDerived().RebuildBuiltinBitCastExpr(BCE->
getBeginLoc(), TSI,
14585template<
typename Derived>
14587TreeTransform<Derived>::TransformCXXStaticCastExpr(CXXStaticCastExpr *E) {
14588 return getDerived().TransformCXXNamedCastExpr(E);
14591template<
typename Derived>
14597template<
typename Derived>
14604template<
typename Derived>
14610template<
typename Derived>
14616template<
typename Derived>
14621 getDerived().TransformTypeWithDeducedTST(E->getTypeInfoAsWritten());
14626 = getDerived().TransformExpr(E->getSubExprAsWritten());
14627 if (SubExpr.isInvalid())
14630 if (!getDerived().AlwaysRebuild() &&
14631 Type == E->getTypeInfoAsWritten() &&
14632 SubExpr.get() == E->getSubExpr())
14635 return getDerived().RebuildCXXFunctionalCastExpr(
Type,
14639 E->isListInitialization());
14642template<
typename Derived>
14645 if (E->isTypeOperand()) {
14647 = getDerived().TransformType(E->getTypeOperandSourceInfo());
14651 if (!getDerived().AlwaysRebuild() &&
14652 TInfo == E->getTypeOperandSourceInfo())
14655 return getDerived().RebuildCXXTypeidExpr(E->getType(), E->getBeginLoc(),
14656 TInfo, E->getEndLoc());
14662 Expr *Op = E->getExprOperand();
14664 if (E->isGLValue()) {
14666 if (
auto *RD = OpType->getAsCXXRecordDecl()) {
14668 diag::err_incomplete_typeid))
14671 if (RD->isPolymorphic())
14679 ExprResult SubExpr = getDerived().TransformExpr(Op);
14680 if (SubExpr.isInvalid())
14683 if (!getDerived().AlwaysRebuild() &&
14684 SubExpr.get() == E->getExprOperand())
14687 return getDerived().RebuildCXXTypeidExpr(E->getType(), E->getBeginLoc(),
14688 SubExpr.get(), E->getEndLoc());
14691template<
typename Derived>
14694 if (E->isTypeOperand()) {
14696 = getDerived().TransformType(E->getTypeOperandSourceInfo());
14700 if (!getDerived().AlwaysRebuild() &&
14701 TInfo == E->getTypeOperandSourceInfo())
14704 return getDerived().RebuildCXXUuidofExpr(E->getType(), E->getBeginLoc(),
14705 TInfo, E->getEndLoc());
14711 ExprResult SubExpr = getDerived().TransformExpr(E->getExprOperand());
14712 if (SubExpr.isInvalid())
14715 if (!getDerived().AlwaysRebuild() &&
14716 SubExpr.get() == E->getExprOperand())
14719 return getDerived().RebuildCXXUuidofExpr(E->getType(), E->getBeginLoc(),
14720 SubExpr.get(), E->getEndLoc());
14723template<
typename Derived>
14729template<
typename Derived>
14736template<
typename Derived>
14752 auto &S = getSema();
14753 if (E->isCapturedByCopyInLambdaWithExplicitObjectParameter())
14754 return S.getCurrentThisType();
14755 if (S.getCurLambda())
14756 return getDerived().TransformType(E->getType());
14757 return S.getCurrentThisType();
14760 if (!getDerived().AlwaysRebuild() && T == E->getType() &&
14761 !E->isCapturedByCopyInLambdaWithExplicitObjectParameter()) {
14764 getSema().MarkThisReferenced(E);
14768 return getDerived().RebuildCXXThisExpr(E->getBeginLoc(), T, E->isImplicit());
14771template<
typename Derived>
14774 ExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
14775 if (SubExpr.isInvalid())
14778 getSema().DiagnoseExceptionUse(E->getThrowLoc(),
false);
14780 if (!getDerived().AlwaysRebuild() &&
14781 SubExpr.get() == E->getSubExpr())
14784 return getDerived().RebuildCXXThrowExpr(E->getThrowLoc(), SubExpr.get(),
14785 E->isThrownVariableInScope());
14788template<
typename Derived>
14792 getDerived().TransformDecl(E->getBeginLoc(), E->getParam()));
14797 if (E->hasRewrittenInit()) {
14798 InitRes = getDerived().TransformExpr(E->getRewrittenExpr());
14799 if (InitRes.isInvalid())
14803 if (!getDerived().AlwaysRebuild() && Param == E->getParam() &&
14804 E->getUsedContext() == SemaRef.
CurContext &&
14805 InitRes.get() == E->getRewrittenExpr())
14808 return getDerived().RebuildCXXDefaultArgExpr(E->getUsedLocation(), Param,
14812template<
typename Derived>
14816 getDerived().TransformDecl(E->getBeginLoc(), E->getField()));
14820 if (!getDerived().AlwaysRebuild() && Field == E->getField() &&
14824 return getDerived().RebuildCXXDefaultInitExpr(E->getExprLoc(), Field);
14827template<
typename Derived>
14831 TypeSourceInfo *T = getDerived().TransformType(E->getTypeSourceInfo());
14835 if (!getDerived().AlwaysRebuild() &&
14836 T == E->getTypeSourceInfo())
14839 return getDerived().RebuildCXXScalarValueInitExpr(T,
14840 T->getTypeLoc().getEndLoc(),
14841 E->getRParenLoc());
14844template<
typename Derived>
14849 getDerived().TransformTypeWithDeducedTST(E->getAllocatedTypeSourceInfo());
14850 if (!AllocTypeInfo)
14854 std::optional<Expr *> ArraySize;
14855 if (E->isArray()) {
14857 if (std::optional<Expr *> OldArraySize = E->getArraySize()) {
14858 NewArraySize = getDerived().TransformExpr(*OldArraySize);
14859 if (NewArraySize.isInvalid())
14862 ArraySize = NewArraySize.get();
14866 bool ArgumentChanged =
false;
14868 if (getDerived().TransformExprs(E->getPlacementArgs(),
14869 E->getNumPlacementArgs(),
true,
14870 PlacementArgs, &ArgumentChanged))
14874 Expr *OldInit = E->getInitializer();
14877 NewInit = getDerived().TransformInitializer(OldInit,
true);
14878 if (NewInit.isInvalid())
14883 if (E->getOperatorNew()) {
14884 OperatorNew = cast_or_null<FunctionDecl>(
14885 getDerived().TransformDecl(E->getBeginLoc(), E->getOperatorNew()));
14891 if (E->getOperatorDelete()) {
14892 OperatorDelete = cast_or_null<FunctionDecl>(
14893 getDerived().TransformDecl(E->getBeginLoc(), E->getOperatorDelete()));
14894 if (!OperatorDelete)
14898 if (!getDerived().AlwaysRebuild() &&
14899 AllocTypeInfo == E->getAllocatedTypeSourceInfo() &&
14900 ArraySize == E->getArraySize() &&
14901 NewInit.get() == OldInit &&
14902 OperatorNew == E->getOperatorNew() &&
14903 OperatorDelete == E->getOperatorDelete() &&
14904 !ArgumentChanged) {
14909 if (OperatorDelete)
14912 if (E->isArray() && !E->getAllocatedType()->isDependentType()) {
14924 QualType AllocType = AllocTypeInfo->getType();
14935 = dyn_cast<ConstantArrayType>(ArrayT)) {
14939 AllocType = ConsArrayT->getElementType();
14941 = dyn_cast<DependentSizedArrayType>(ArrayT)) {
14942 if (DepArrayT->getSizeExpr()) {
14943 ArraySize = DepArrayT->getSizeExpr();
14944 AllocType = DepArrayT->getElementType();
14949 return getDerived().RebuildCXXNewExpr(
14950 E->getBeginLoc(), E->isGlobalNew(),
14951 E->getBeginLoc(), PlacementArgs,
14952 E->getBeginLoc(), E->getTypeIdParens(), AllocType,
14953 AllocTypeInfo, ArraySize, E->getDirectInitRange(), NewInit.get());
14956template<
typename Derived>
14965 if (E->getOperatorDelete()) {
14966 OperatorDelete = cast_or_null<FunctionDecl>(
14967 getDerived().TransformDecl(E->getBeginLoc(), E->getOperatorDelete()));
14968 if (!OperatorDelete)
14972 if (!getDerived().AlwaysRebuild() &&
14973 Operand.get() == E->getArgument() &&
14974 OperatorDelete == E->getOperatorDelete()) {
14977 if (OperatorDelete)
14980 if (!E->getArgument()->isTypeDependent()) {
14982 E->getDestroyedType());
14991 return getDerived().RebuildCXXDeleteExpr(
14992 E->getBeginLoc(), E->isGlobalDelete(), E->isArrayForm(),
Operand.get());
14995template<
typename Derived>
15000 if (
Base.isInvalid())
15004 bool MayBePseudoDestructor =
false;
15006 E->getOperatorLoc(),
15007 E->isArrow()? tok::arrow : tok::period,
15009 MayBePseudoDestructor);
15010 if (
Base.isInvalid())
15013 QualType ObjectType = ObjectTypePtr.get();
15015 if (QualifierLoc) {
15017 = getDerived().TransformNestedNameSpecifierLoc(QualifierLoc, ObjectType);
15022 SS.
Adopt(QualifierLoc);
15025 if (E->getDestroyedTypeInfo()) {
15026 TypeSourceInfo *DestroyedTypeInfo = getDerived().TransformTypeInObjectScope(
15027 E->getDestroyedTypeInfo(), ObjectType,
15029 if (!DestroyedTypeInfo)
15032 }
else if (!ObjectType.isNull() && ObjectType->isDependentType()) {
15036 E->getDestroyedTypeLoc());
15040 *E->getDestroyedTypeIdentifier(), E->getDestroyedTypeLoc(),
15041 nullptr, SS, ObjectTypePtr,
false);
15047 E->getDestroyedTypeLoc());
15051 if (E->getScopeTypeInfo()) {
15052 ScopeTypeInfo = getDerived().TransformTypeInObjectScope(
15053 E->getScopeTypeInfo(), ObjectType,
nullptr);
15054 if (!ScopeTypeInfo)
15058 return getDerived().RebuildCXXPseudoDestructorExpr(
Base.get(),
15059 E->getOperatorLoc(),
15063 E->getColonColonLoc(),
15068template <
typename Derived>
15073 bool AllEmptyPacks =
true;
15074 for (
auto *OldD : Old->
decls()) {
15090 if (
auto *UPD = dyn_cast<UsingPackDecl>(InstD))
15091 Decls = UPD->expansions();
15094 for (
auto *D : Decls) {
15095 if (
auto *UD = dyn_cast<UsingDecl>(D)) {
15096 for (
auto *SD : UD->shadows())
15103 AllEmptyPacks &= Decls.empty();
15112 if (AllEmptyPacks && !RequiresADL) {
15123 NamedDecl *FoundDecl = R.getRepresentativeDecl()->getUnderlyingDecl();
15124 getSema().FilterAcceptableTemplateNames(R,
15130 getSema().Diag(R.getNameLoc(),
15131 diag::err_template_kw_refers_to_non_template)
15135 diag::note_template_kw_refers_to_non_template)
15136 << R.getLookupName();
15144template <
typename Derived>
15150template <
typename Derived>
15153 bool IsAddressOfOperand) {
15158 if (TransformOverloadExprDecls(Old, Old->
requiresADL(), R))
15165 = getDerived().TransformNestedNameSpecifierLoc(Old->
getQualifierLoc());
15169 SS.
Adopt(QualifierLoc);
15173 CXXRecordDecl *NamingClass
15174 = cast_or_null<CXXRecordDecl>(getDerived().TransformDecl(
15177 if (!NamingClass) {
15182 R.setNamingClass(NamingClass);
15203 SS, TemplateKWLoc, R,
15210 return getDerived().RebuildDeclarationNameExpr(SS, R, Old->
requiresADL());
15213 return getDerived().RebuildTemplateIdExpr(SS, TemplateKWLoc, R,
15217template<
typename Derived>
15220 bool ArgChanged =
false;
15222 for (
unsigned I = 0, N = E->getNumArgs(); I != N; ++I) {
15224 TypeLoc FromTL = From->getTypeLoc();
15227 TLB.
reserve(FromTL.getFullDataSize());
15228 QualType To = getDerived().TransformType(TLB, FromTL);
15232 if (To == From->getType())
15233 Args.push_back(From);
15235 Args.push_back(TLB.getTypeSourceInfo(SemaRef.
Context, To));
15245 TypeLoc PatternTL = ExpansionTL.getPatternLoc();
15251 bool Expand =
true;
15252 bool RetainExpansion =
false;
15254 ExpansionTL.getTypePtr()->getNumExpansions();
15256 if (getDerived().TryExpandParameterPacks(
15257 ExpansionTL.getEllipsisLoc(), PatternTL.getSourceRange(),
15258 Unexpanded,
true, Expand,
15259 RetainExpansion, NumExpansions))
15269 TLB.
reserve(From->getTypeLoc().getFullDataSize());
15271 QualType To = getDerived().TransformType(TLB, PatternTL);
15275 To = getDerived().RebuildPackExpansionType(To,
15276 PatternTL.getSourceRange(),
15277 ExpansionTL.getEllipsisLoc(),
15285 Args.push_back(TLB.getTypeSourceInfo(SemaRef.
Context, To));
15291 for (
unsigned I = 0; I != *NumExpansions; ++I) {
15294 TLB.
reserve(PatternTL.getFullDataSize());
15295 QualType To = getDerived().TransformType(TLB, PatternTL);
15299 if (To->containsUnexpandedParameterPack()) {
15300 To = getDerived().RebuildPackExpansionType(To,
15301 PatternTL.getSourceRange(),
15302 ExpansionTL.getEllipsisLoc(),
15312 Args.push_back(TLB.getTypeSourceInfo(SemaRef.
Context, To));
15315 if (!RetainExpansion)
15320 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
15323 TLB.
reserve(From->getTypeLoc().getFullDataSize());
15325 QualType To = getDerived().TransformType(TLB, PatternTL);
15329 To = getDerived().RebuildPackExpansionType(To,
15330 PatternTL.getSourceRange(),
15331 ExpansionTL.getEllipsisLoc(),
15339 Args.push_back(TLB.getTypeSourceInfo(SemaRef.
Context, To));
15342 if (!getDerived().AlwaysRebuild() && !ArgChanged)
15345 return getDerived().RebuildTypeTrait(E->getTrait(), E->getBeginLoc(), Args,
15349template<
typename Derived>
15355 if (getDerived().TransformTemplateArguments(Old->getTemplateArgs(),
15356 Old->NumTemplateArgs, TransArgs))
15359 return getDerived().RebuildConceptSpecializationExpr(
15360 E->getNestedNameSpecifierLoc(), E->getTemplateKWLoc(),
15361 E->getConceptNameInfo(), E->getFoundDecl(), E->getNamedConcept(),
15365template<
typename Derived>
15379 getSema().Context, getSema().CurContext,
15380 E->getBody()->getBeginLoc());
15384 ExprResult TypeParamResult = getDerived().TransformRequiresTypeParams(
15385 E->getRequiresKWLoc(), E->getRBraceLoc(), E, Body,
15386 E->getLocalParameters(), TransParamTypes, TransParams, ExtParamInfos);
15390 Param->setDeclContext(Body);
15396 if (!TypeParamResult.isUnset())
15397 return TypeParamResult;
15400 if (getDerived().TransformRequiresExprRequirements(E->getRequirements(),
15405 if (
auto *ER = dyn_cast<concepts::ExprRequirement>(Req)) {
15406 if (ER->getReturnTypeRequirement().isTypeConstraint()) {
15407 ER->getReturnTypeRequirement()
15408 .getTypeConstraintTemplateParameterList()->getParam(0)
15409 ->setDeclContext(Body);
15414 return getDerived().RebuildRequiresExpr(
15415 E->getRequiresKWLoc(), Body, E->getLParenLoc(), TransParams,
15416 E->getRParenLoc(), TransReqs, E->getRBraceLoc());
15419template<
typename Derived>
15425 if (
auto *TypeReq = dyn_cast<concepts::TypeRequirement>(Req))
15426 TransReq =
getDerived().TransformTypeRequirement(TypeReq);
15427 else if (
auto *ExprReq = dyn_cast<concepts::ExprRequirement>(Req))
15428 TransReq =
getDerived().TransformExprRequirement(ExprReq);
15430 TransReq =
getDerived().TransformNestedRequirement(
15434 Transformed.push_back(TransReq);
15439template<
typename Derived>
15452 return getDerived().RebuildTypeRequirement(TransType);
15455template<
typename Derived>
15458 llvm::PointerUnion<Expr *, concepts::Requirement::SubstitutionDiagnostic *> TransExpr;
15464 TransExprRes =
SemaRef.CheckPlaceholderExpr(TransExprRes.
get());
15467 TransExpr = TransExprRes.
get();
15470 std::optional<concepts::ExprRequirement::ReturnTypeRequirement> TransRetReq;
15472 if (RetReq.isEmpty())
15473 TransRetReq.emplace();
15474 else if (RetReq.isSubstitutionFailure())
15475 TransRetReq.emplace(RetReq.getSubstitutionDiagnostic());
15476 else if (RetReq.isTypeConstraint()) {
15478 RetReq.getTypeConstraintTemplateParameterList();
15480 getDerived().TransformTemplateParameterList(OrigTPL);
15483 TransRetReq.emplace(TPL);
15485 assert(TransRetReq &&
"All code paths leading here must set TransRetReq");
15486 if (
Expr *E = dyn_cast<Expr *>(TransExpr))
15489 std::move(*TransRetReq));
15495template<
typename Derived>
15501 return getDerived().RebuildNestedRequirement(
15509 return getDerived().RebuildNestedRequirement(TransConstraint.
get());
15512template<
typename Derived>
15519 if (!getDerived().AlwaysRebuild() &&
15536template<
typename Derived>
15543 SubExpr = getDerived().TransformExpr(E->getQueriedExpression());
15544 if (SubExpr.isInvalid())
15547 if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getQueriedExpression())
15551 return getDerived().RebuildExpressionTrait(E->getTrait(), E->getBeginLoc(),
15552 SubExpr.get(), E->getEndLoc());
15555template <
typename Derived>
15560 DRE, AddrTaken, RecoveryTSI);
15573template <
typename Derived>
15580template <
typename Derived>
15596 getDerived().TransformDeclarationNameInfo(E->
getNameInfo());
15601 if (!getDerived().AlwaysRebuild() && QualifierLoc == E->
getQualifierLoc() &&
15607 return getDerived().RebuildDependentScopeDeclRefExpr(
15608 QualifierLoc, TemplateKWLoc, NameInfo,
nullptr,
15609 IsAddressOfOperand, RecoveryTSI);
15613 if (getDerived().TransformTemplateArguments(
15617 return getDerived().RebuildDependentScopeDeclRefExpr(
15618 QualifierLoc, TemplateKWLoc, NameInfo, &TransArgs, IsAddressOfOperand,
15622template<
typename Derived>
15628 if (getDerived().AllowSkippingCXXConstructExpr() &&
15629 ((E->getNumArgs() == 1 ||
15630 (E->getNumArgs() > 1 && getDerived().DropCallArgument(E->getArg(1)))) &&
15631 (!getDerived().DropCallArgument(E->getArg(0))) &&
15632 !E->isListInitialization()))
15638 QualType T = getDerived().TransformType(E->getType());
15643 getDerived().TransformDecl(E->getBeginLoc(), E->getConstructor()));
15647 bool ArgumentChanged =
false;
15652 E->isListInitialization());
15653 if (getDerived().TransformExprs(E->getArgs(), E->getNumArgs(),
true, Args,
15658 if (!getDerived().AlwaysRebuild() &&
15659 T == E->getType() &&
15661 !ArgumentChanged) {
15668 return getDerived().RebuildCXXConstructExpr(
15669 T, E->getBeginLoc(),
Constructor, E->isElidable(), Args,
15670 E->hadMultipleCandidates(), E->isListInitialization(),
15671 E->isStdInitListInitialization(), E->requiresZeroInitialization(),
15672 E->getConstructionKind(), E->getParenOrBraceRange());
15675template<
typename Derived>
15678 QualType T = getDerived().TransformType(E->getType());
15683 getDerived().TransformDecl(E->getBeginLoc(), E->getConstructor()));
15687 if (!getDerived().AlwaysRebuild() &&
15688 T == E->getType() &&
15696 return getDerived().RebuildCXXInheritedCtorInitExpr(
15698 E->constructsVBase(), E->inheritedFromVBase());
15705template<
typename Derived>
15708 if (
auto *Dtor = E->getTemporary()->getDestructor())
15711 return getDerived().TransformExpr(E->getSubExpr());
15719template<
typename Derived>
15725template<
typename Derived>
15730 getDerived().TransformTypeWithDeducedTST(E->getTypeSourceInfo());
15735 getDerived().TransformDecl(E->getBeginLoc(), E->getConstructor()));
15739 bool ArgumentChanged =
false;
15741 Args.reserve(E->getNumArgs());
15745 E->isListInitialization());
15746 if (TransformExprs(E->getArgs(), E->getNumArgs(),
true, Args,
15750 if (E->isListInitialization() && !E->isStdInitListInitialization()) {
15751 ExprResult Res = RebuildInitList(E->getBeginLoc(), Args, E->getEndLoc(),
15753 if (Res.isInvalid())
15755 Args = {Res.get()};
15759 if (!getDerived().AlwaysRebuild() &&
15760 T == E->getTypeSourceInfo() &&
15762 !ArgumentChanged) {
15769 return getDerived().RebuildCXXTemporaryObjectExpr(
15770 T, LParenLoc, Args, E->getEndLoc(), E->isListInitialization());
15773template<
typename Derived>
15778 typedef std::pair<ExprResult, QualType> InitCaptureInfoTy;
15779 struct TransformedInitCapture {
15781 SourceLocation EllipsisLoc;
15783 SmallVector<InitCaptureInfoTy, 4> Expansions;
15786 InitCaptures.resize(E->explicit_capture_end() - E->explicit_capture_begin());
15788 CEnd = E->capture_end();
15790 if (!E->isInitCapture(
C))
15793 TransformedInitCapture &
Result = InitCaptures[
C - E->capture_begin()];
15798 ExprResult NewExprInitResult = getDerived().TransformInitializer(
15801 if (NewExprInitResult.isInvalid()) {
15805 Expr *NewExprInit = NewExprInitResult.get();
15808 getSema().buildLambdaInitCaptureInitialization(
15809 C->getLocation(),
C->getCaptureKind() ==
LCK_ByRef,
15810 EllipsisLoc, NumExpansions, OldVD->getIdentifier(),
15814 Result.Expansions.push_back(
15815 InitCaptureInfoTy(NewExprInit, NewInitCaptureType));
15819 if (OldVD->isParameterPack()) {
15828 bool Expand =
true;
15829 bool RetainExpansion =
false;
15831 ExpansionTL.getTypePtr()->getNumExpansions();
15833 if (getDerived().TryExpandParameterPacks(
15834 ExpansionTL.getEllipsisLoc(), OldVD->getInit()->getSourceRange(),
15835 Unexpanded,
true, Expand,
15836 RetainExpansion, NumExpansions))
15838 assert(!RetainExpansion &&
"Should not need to retain expansion after a "
15839 "capture since it cannot be extended");
15841 for (
unsigned I = 0; I != *NumExpansions; ++I) {
15846 SubstInitCapture(ExpansionTL.getEllipsisLoc(), NumExpansions);
15847 Result.EllipsisLoc = ExpansionTL.getEllipsisLoc();
15884 while (DC->isRequiresExprBody())
15886 if ((getSema().isUnevaluatedContext() ||
15887 getSema().isConstantEvaluatedContext()) &&
15888 !(dyn_cast_or_null<CXXRecordDecl>(DC->getParent()) &&
15890 (DC->isFileContext() || !DC->getParent()->isDependentContext()))
15895 E->getIntroducerRange(),
nullptr, DependencyKind,
15896 E->getCaptureDefault());
15897 getDerived().transformedLocalDecl(OldClass, {
Class});
15900 getSema().CreateLambdaCallOperator(E->getIntroducerRange(),
Class);
15903 getSema().buildLambdaScope(LSI, NewCallOperator, E->getIntroducerRange(),
15904 E->getCaptureDefault(), E->getCaptureDefaultLoc(),
15905 E->hasExplicitParameters(), E->isMutable());
15915 CEnd = E->capture_end();
15919 if (
C->isImplicit())
15923 if (
C->capturesThis()) {
15931 dyn_cast_if_present<CXXRecordDecl>(
15932 getSema().getFunctionLevelDeclContext()),
15934 getSema().CheckCXXThisCapture(
C->getLocation(),
C->isExplicit(),
15941 if (
C->capturesVLAType())
15945 if (E->isInitCapture(
C)) {
15946 TransformedInitCapture &NewC = InitCaptures[
C - E->capture_begin()];
15951 for (InitCaptureInfoTy &Info : NewC.Expansions) {
15953 QualType InitQualType = Info.second;
15954 if (
Init.isInvalid() || InitQualType.isNull()) {
15958 VarDecl *NewVD = getSema().createLambdaInitCaptureVarDecl(
15959 OldVD->getLocation(), InitQualType, NewC.EllipsisLoc,
15960 OldVD->getIdentifier(), OldVD->getInitStyle(),
Init.get(),
15961 getSema().CurContext);
15966 NewVDs.push_back(NewVD);
15967 getSema().addInitCapture(LSI, NewVD,
C->getCaptureKind() ==
LCK_ByRef);
15972 if (NewC.EllipsisLoc.isInvalid())
15973 LSI->ContainsUnexpandedParameterPack |=
15974 Init.get()->containsUnexpandedParameterPack();
15980 getDerived().transformedLocalDecl(OldVD, NewVDs);
15984 assert(
C->capturesVariable() &&
"unexpected kind of lambda capture");
15992 if (
C->isPackExpansion()) {
15994 bool ShouldExpand =
false;
15995 bool RetainExpansion =
false;
15997 if (getDerived().TryExpandParameterPacks(
15998 C->getEllipsisLoc(),
C->getLocation(), Unexpanded,
15999 true, ShouldExpand,
16000 RetainExpansion, NumExpansions)) {
16005 if (ShouldExpand) {
16010 for (
unsigned I = 0; I != *NumExpansions; ++I) {
16012 ValueDecl *CapturedVar = cast_if_present<ValueDecl>(
16013 getDerived().TransformDecl(
C->getLocation(), Pack));
16014 if (!CapturedVar) {
16020 getSema().tryCaptureVariable(CapturedVar,
C->getLocation(), Kind);
16028 EllipsisLoc =
C->getEllipsisLoc();
16032 auto *CapturedVar = cast_or_null<ValueDecl>(
16033 getDerived().TransformDecl(
C->getLocation(),
C->getCapturedVar()));
16034 if (!CapturedVar || CapturedVar->isInvalidDecl()) {
16041 if (
auto *VD = dyn_cast<VarDecl>(CapturedVar); VD && !
C->isPackExpansion())
16042 LSI->ContainsUnexpandedParameterPack |= VD->isParameterPack();
16045 getSema().tryCaptureVariable(CapturedVar,
C->getLocation(), Kind,
16048 getSema().finishLambdaExplicitCaptures(LSI);
16052 auto TPL = getDerived().TransformTemplateParameterList(
16053 E->getTemplateParameterList());
16054 LSI->GLTemplateParameterList = TPL;
16056 getSema().AddTemplateParametersToLambdaCallOperator(NewCallOperator,
Class,
16058 LSI->ContainsUnexpandedParameterPack |=
16059 TPL->containsUnexpandedParameterPack();
16064 E->getCallOperator()->getTypeSourceInfo()->getTypeLoc();
16066 getDerived().TransformType(NewCallOpTLBuilder, OldCallOpTypeLoc);
16067 if (NewCallOpType.isNull())
16069 LSI->ContainsUnexpandedParameterPack |=
16070 NewCallOpType->containsUnexpandedParameterPack();
16072 NewCallOpTLBuilder.getTypeSourceInfo(getSema().Context, NewCallOpType);
16077 assert(FPTL &&
"Not a FunctionProtoType?");
16082 if (TRC && TRC.ConstraintExpr->containsUnexpandedParameterPack() &&
16083 !TRC.ArgPackSubstIndex)
16086 getSema().CompleteLambdaCallOperator(
16087 NewCallOperator, E->getCallOperator()->getLocation(),
16088 E->getCallOperator()->getInnerLocStart(), TRC, NewCallOpTSI,
16089 E->getCallOperator()->getConstexprKind(),
16090 E->getCallOperator()->getStorageClass(), FPTL.getParams(),
16091 E->hasExplicitResultType());
16093 getDerived().transformAttrs(E->getCallOperator(), NewCallOperator);
16094 getDerived().transformedLocalDecl(E->getCallOperator(), {NewCallOperator});
16100 std::optional<CXXRecordDecl::LambdaNumbering> Numbering;
16101 if (getDerived().ReplacingOriginal()) {
16102 Numbering = OldClass->getLambdaNumbering();
16105 getSema().handleLambdaNumbering(
Class, NewCallOperator, Numbering);
16110 getSema().PushExpressionEvaluationContextForFunction(
16112 E->getCallOperator());
16119 C.PointOfInstantiation = E->getBody()->getBeginLoc();
16120 getSema().pushCodeSynthesisContext(
C);
16124 : getDerived().TransformLambdaBody(E, E->getBody());
16126 getSema().popCodeSynthesisContext();
16130 FuncScopeCleanup.disable();
16132 if (Body.isInvalid()) {
16133 SavedContext.pop();
16134 getSema().ActOnLambdaError(E->getBeginLoc(),
nullptr,
16139 getSema().ActOnFinishFunctionBody(NewCallOperator, Body.get(),
16142 SavedContext.pop();
16177 DependencyKind = getDerived().ComputeLambdaDependency(LSI);
16178 Class->setLambdaDependencyKind(DependencyKind);
16180 return getDerived().RebuildLambdaExpr(E->getBeginLoc(),
16181 Body.get()->getEndLoc(), LSI);
16184template<
typename Derived>
16190template<
typename Derived>
16199 if (!
C->isImplicit())
16203 if (
C->capturesThis()) {
16204 getSema().CheckCXXThisCapture(
C->getLocation(),
C->isExplicit(),
16211 if (
C->capturesVLAType())
16214 assert(
C->capturesVariable() &&
"unexpected kind of lambda capture");
16218 VarDecl *CapturedVar = cast_or_null<VarDecl>(
16224 getSema().tryCaptureVariable(CapturedVar,
C->getLocation());
16230template<
typename Derived>
16239 bool ArgumentChanged =
false;
16251 if (!getDerived().AlwaysRebuild() &&
16257 return getDerived().RebuildCXXUnresolvedConstructExpr(
16261template<
typename Derived>
16270 if (!E->isImplicitAccess()) {
16271 OldBase = E->getBase();
16272 Base = getDerived().TransformExpr(OldBase);
16273 if (
Base.isInvalid())
16278 bool MayBePseudoDestructor =
false;
16280 E->getOperatorLoc(),
16281 E->isArrow()? tok::arrow : tok::period,
16283 MayBePseudoDestructor);
16284 if (
Base.isInvalid())
16287 ObjectType = ObjectTy.get();
16288 BaseType = ((
Expr*)
Base.get())->getType();
16291 BaseType = getDerived().TransformType(E->getBaseType());
16298 = getDerived().TransformFirstQualifierInScope(
16299 E->getFirstQualifierFoundInScope(),
16300 E->getQualifierLoc().getBeginLoc());
16303 if (E->getQualifier()) {
16305 = getDerived().TransformNestedNameSpecifierLoc(E->getQualifierLoc(),
16307 FirstQualifierInScope);
16319 = getDerived().TransformDeclarationNameInfo(E->getMemberNameInfo());
16320 if (!NameInfo.getName())
16323 if (!E->hasExplicitTemplateArgs()) {
16326 if (!getDerived().AlwaysRebuild() &&
16327 Base.get() == OldBase &&
16328 BaseType == E->getBaseType() &&
16329 QualifierLoc == E->getQualifierLoc() &&
16330 NameInfo.getName() == E->getMember() &&
16331 FirstQualifierInScope == E->getFirstQualifierFoundInScope())
16334 return getDerived().RebuildCXXDependentScopeMemberExpr(
Base.get(),
16337 E->getOperatorLoc(),
16340 FirstQualifierInScope,
16346 if (getDerived().TransformTemplateArguments(E->getTemplateArgs(),
16347 E->getNumTemplateArgs(),
16351 return getDerived().RebuildCXXDependentScopeMemberExpr(
Base.get(),
16354 E->getOperatorLoc(),
16357 FirstQualifierInScope,
16362template <
typename Derived>
16368 if (!Old->isImplicitAccess()) {
16369 Base = getDerived().TransformExpr(Old->getBase());
16370 if (
Base.isInvalid())
16373 getSema().PerformMemberExprBaseConversion(
Base.get(), Old->isArrow());
16374 if (
Base.isInvalid())
16376 BaseType =
Base.get()->getType();
16378 BaseType = getDerived().TransformType(Old->getBaseType());
16382 if (Old->getQualifierLoc()) {
16384 getDerived().TransformNestedNameSpecifierLoc(Old->getQualifierLoc());
16394 if (TransformOverloadExprDecls(Old,
false, R))
16398 if (Old->getNamingClass()) {
16400 getDerived().TransformDecl(Old->getMemberLoc(), Old->getNamingClass()));
16404 R.setNamingClass(NamingClass);
16408 if (Old->hasExplicitTemplateArgs()) {
16409 TransArgs.setLAngleLoc(Old->getLAngleLoc());
16410 TransArgs.setRAngleLoc(Old->getRAngleLoc());
16411 if (getDerived().TransformTemplateArguments(
16412 Old->getTemplateArgs(), Old->getNumTemplateArgs(), TransArgs))
16420 NamedDecl *FirstQualifierInScope =
nullptr;
16422 return getDerived().RebuildUnresolvedMemberExpr(
16423 Base.get(), BaseType, Old->getOperatorLoc(), Old->isArrow(), QualifierLoc,
16424 TemplateKWLoc, FirstQualifierInScope, R,
16425 (Old->hasExplicitTemplateArgs() ? &TransArgs :
nullptr));
16428template<
typename Derived>
16433 ExprResult SubExpr = getDerived().TransformExpr(E->getOperand());
16434 if (SubExpr.isInvalid())
16437 if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getOperand())
16440 return getDerived().RebuildCXXNoexceptExpr(E->getSourceRange(),SubExpr.get());
16443template<
typename Derived>
16446 ExprResult Pattern = getDerived().TransformExpr(E->getPattern());
16447 if (Pattern.isInvalid())
16450 if (!getDerived().AlwaysRebuild() && Pattern.get() == E->getPattern())
16453 return getDerived().RebuildPackExpansion(Pattern.get(), E->getEllipsisLoc(),
16454 E->getNumExpansions());
16457template <
typename Derived>
16462 if (!Arg.isPackExpansion()) {
16474 getSema().getTemplateArgumentPackExpansionPattern(ArgLoc, Ellipsis,
16475 OrigNumExpansions);
16487 if (!NumExpansions) {
16499template<
typename Derived>
16518 bool ShouldExpand =
false;
16519 bool RetainExpansion =
false;
16521 if (getDerived().TryExpandParameterPacks(
16523 true, ShouldExpand,
16524 RetainExpansion, NumExpansions))
16529 if (ShouldExpand) {
16531 if (
auto *TTPD = dyn_cast<TemplateTypeParmDecl>(Pack)) {
16532 ArgStorage = getSema().Context.getPackExpansionType(
16533 getSema().Context.getTypeDeclType(TTPD), std::nullopt);
16534 }
else if (
auto *TTPD = dyn_cast<TemplateTemplateParmDecl>(Pack)) {
16538 ExprResult DRE = getSema().BuildDeclRefExpr(
16539 VD, VD->getType().getNonLValueExprType(getSema().Context),
16542 if (DRE.isInvalid())
16545 new (getSema().Context)
16549 PackArgs = ArgStorage;
16554 if (!PackArgs.size()) {
16555 auto *Pack = cast_or_null<NamedDecl>(
16559 return getDerived().RebuildSizeOfPackExpr(
16566 getDerived().ComputeSizeOfPackExprWithoutSubstitution(PackArgs);
16578 TemporaryBase Rebase(*
this, E->
getPackLoc(), getBaseEntity());
16581 if (TransformTemplateArguments(PackLocIterator(*
this, PackArgs.begin()),
16582 PackLocIterator(*
this, PackArgs.end()),
16583 TransformedPackArgs,
true))
16590 bool PartialSubstitution =
false;
16591 for (
auto &Loc : TransformedPackArgs.arguments()) {
16592 Args.push_back(Loc.getArgument());
16593 if (Loc.getArgument().isPackExpansion())
16594 PartialSubstitution =
true;
16597 if (PartialSubstitution)
16598 return getDerived().RebuildSizeOfPackExpr(
16600 std::nullopt, Args);
16602 return getDerived().RebuildSizeOfPackExpr(
16604 static_cast<unsigned>(Args.size()),
16608template <
typename Derived>
16611 if (!E->isValueDependent())
16619 IndexExpr = getDerived().TransformExpr(E->getIndexExpr());
16620 if (IndexExpr.isInvalid())
16625 bool FullySubstituted =
true;
16626 if (!E->expandsToEmptyPack() && E->getExpressions().empty()) {
16627 Expr *Pattern = E->getPackIdExpression();
16629 getSema().collectUnexpandedParameterPacks(E->getPackIdExpression(),
16631 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
16635 bool ShouldExpand =
true;
16636 bool RetainExpansion =
false;
16638 NumExpansions = std::nullopt;
16639 if (getDerived().TryExpandParameterPacks(
16640 E->getEllipsisLoc(), Pattern->getSourceRange(), Unexpanded,
16641 true, ShouldExpand,
16642 RetainExpansion, NumExpansions))
16644 if (!ShouldExpand) {
16646 ExprResult Pack = getDerived().TransformExpr(Pattern);
16647 if (Pack.isInvalid())
16649 return getDerived().RebuildPackIndexingExpr(
16650 E->getEllipsisLoc(), E->getRSquareLoc(), Pack.get(), IndexExpr.get(),
16653 for (
unsigned I = 0; I != *NumExpansions; ++I) {
16656 if (
Out.isInvalid())
16658 if (
Out.get()->containsUnexpandedParameterPack()) {
16659 Out = getDerived().RebuildPackExpansion(
Out.get(), E->getEllipsisLoc(),
16660 OrigNumExpansions);
16661 if (
Out.isInvalid())
16663 FullySubstituted =
false;
16665 ExpandedExprs.push_back(
Out.get());
16669 if (RetainExpansion) {
16670 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
16673 if (
Out.isInvalid())
16676 Out = getDerived().RebuildPackExpansion(
Out.get(), E->getEllipsisLoc(),
16677 OrigNumExpansions);
16678 if (
Out.isInvalid())
16680 FullySubstituted =
false;
16681 ExpandedExprs.push_back(
Out.get());
16683 }
else if (!E->expandsToEmptyPack()) {
16684 if (getDerived().TransformExprs(E->getExpressions().data(),
16685 E->getExpressions().size(),
false,
16690 return getDerived().RebuildPackIndexingExpr(
16691 E->getEllipsisLoc(), E->getRSquareLoc(), E->getPackIdExpression(),
16692 IndexExpr.get(), ExpandedExprs, FullySubstituted);
16695template <
typename Derived>
16698 if (!getSema().ArgPackSubstIndex)
16704 return getDerived().RebuildSubstNonTypeTemplateParmExpr(
16705 E->getAssociatedDecl(), E->getParameterPack()->getPosition(),
16706 E->getParameterPack()->getType(), E->getParameterPackLocation(), Arg,
16710template <
typename Derived>
16714 ExprResult Replacement = getDerived().TransformExpr(OrigReplacement);
16715 if (Replacement.isInvalid())
16718 Decl *AssociatedDecl =
16719 getDerived().TransformDecl(E->getNameLoc(), E->getAssociatedDecl());
16720 if (!AssociatedDecl)
16723 QualType ParamType = TransformType(E->getParameterType());
16724 if (ParamType.isNull())
16727 if (Replacement.get() == OrigReplacement &&
16728 AssociatedDecl == E->getAssociatedDecl() &&
16729 ParamType == E->getParameterType())
16732 if (Replacement.get() != OrigReplacement ||
16733 ParamType != E->getParameterType()) {
16742 Param, ParamType, Replacement.get(), SugaredConverted,
16743 CanonicalConverted,
16745 if (Replacement.isInvalid())
16749 Replacement = E->getReplacement();
16752 return getDerived().RebuildSubstNonTypeTemplateParmExpr(
16753 AssociatedDecl, E->getIndex(), ParamType, E->getNameLoc(),
16755 E->getPackIndex(), E->getFinal());
16758template<
typename Derived>
16765template<
typename Derived>
16772template<
typename Derived>
16776 if (
Expr *OldCallee = E->getCallee()) {
16777 ExprResult CalleeResult = getDerived().TransformExpr(OldCallee);
16778 if (CalleeResult.isInvalid())
16783 Expr *Pattern = E->getPattern();
16786 getSema().collectUnexpandedParameterPacks(Pattern, Unexpanded);
16787 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
16791 bool Expand =
true;
16792 bool RetainExpansion =
false;
16794 NumExpansions = OrigNumExpansions;
16795 if (getDerived().TryExpandParameterPacks(
16796 E->getEllipsisLoc(), Pattern->getSourceRange(), Unexpanded,
16797 true, Expand, RetainExpansion,
16807 E->getLHS() ? getDerived().TransformExpr(E->getLHS()) :
ExprResult();
16808 if (LHS.isInvalid())
16812 E->getRHS() ? getDerived().TransformExpr(E->getRHS()) :
ExprResult();
16813 if (RHS.isInvalid())
16816 if (!getDerived().AlwaysRebuild() &&
16817 LHS.get() == E->getLHS() && RHS.get() == E->getRHS())
16820 return getDerived().RebuildCXXFoldExpr(
16821 Callee, E->getBeginLoc(), LHS.get(), E->getOperator(),
16822 E->getEllipsisLoc(), RHS.get(), E->getEndLoc(), NumExpansions);
16828 if (NumExpansions && SemaRef.
getLangOpts().BracketDepth < *NumExpansions) {
16829 SemaRef.
Diag(E->getEllipsisLoc(),
16830 clang::diag::err_fold_expression_limit_exceeded)
16831 << *NumExpansions << SemaRef.
getLangOpts().BracketDepth
16832 << E->getSourceRange();
16833 SemaRef.
Diag(E->getEllipsisLoc(), diag::note_bracket_depth);
16842 bool LeftFold = E->isLeftFold();
16846 if (!LeftFold && RetainExpansion) {
16847 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
16850 if (
Out.isInvalid())
16853 Result = getDerived().RebuildCXXFoldExpr(
16854 Callee, E->getBeginLoc(),
Out.get(), E->getOperator(),
16855 E->getEllipsisLoc(),
Result.get(), E->getEndLoc(), OrigNumExpansions);
16860 bool WarnedOnComparison =
false;
16861 for (
unsigned I = 0; I != *NumExpansions; ++I) {
16863 getSema(), LeftFold ? I : *NumExpansions - I - 1);
16865 if (
Out.isInvalid())
16868 if (
Out.get()->containsUnexpandedParameterPack()) {
16870 Result = getDerived().RebuildCXXFoldExpr(
16871 Callee, E->getBeginLoc(), LeftFold ?
Result.get() :
Out.get(),
16872 E->getOperator(), E->getEllipsisLoc(),
16873 LeftFold ?
Out.get() :
Result.get(), E->getEndLoc(),
16874 OrigNumExpansions);
16875 }
else if (
Result.isUsable()) {
16882 Result = getDerived().RebuildCXXOperatorCallExpr(
16884 E->getEllipsisLoc(),
Callee->getBeginLoc(),
Callee->requiresADL(),
16885 Functions, LHS, RHS);
16887 Result = getDerived().RebuildBinaryOperator(E->getEllipsisLoc(),
16888 E->getOperator(), LHS, RHS,
16890 if (!WarnedOnComparison &&
Result.isUsable()) {
16891 if (
auto *BO = dyn_cast<BinaryOperator>(
Result.get());
16892 BO && BO->isComparisonOp()) {
16893 WarnedOnComparison =
true;
16894 SemaRef.
Diag(BO->getBeginLoc(),
16895 diag::warn_comparison_in_fold_expression)
16896 << BO->getOpcodeStr();
16909 if (LeftFold && RetainExpansion) {
16910 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
16913 if (
Out.isInvalid())
16916 Result = getDerived().RebuildCXXFoldExpr(
16917 Callee, E->getBeginLoc(),
Result.get(), E->getOperator(),
16918 E->getEllipsisLoc(),
Out.get(), E->getEndLoc(), OrigNumExpansions);
16924 PE->setIsProducedByFoldExpansion();
16929 return getDerived().RebuildEmptyCXXFoldExpr(E->getEllipsisLoc(),
16934template <
typename Derived>
16940 QualType T = getDerived().TransformType(E->getType());
16942 bool ArgChanged =
false;
16944 if (getDerived().TransformExprs(InitExprs.data(), InitExprs.size(),
true,
16945 TransformedInits, &ArgChanged))
16948 if (!getDerived().AlwaysRebuild() && !ArgChanged && T == E->getType())
16951 return getDerived().RebuildCXXParenListInitExpr(
16952 TransformedInits, T, E->getUserSpecifiedInitExprs().size(),
16953 E->getInitLoc(), E->getBeginLoc(), E->getEndLoc());
16956template<
typename Derived>
16963template<
typename Derived>
16969template<
typename Derived>
16975template<
typename Derived>
16978 ExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
16979 if (SubExpr.isInvalid())
16982 if (!getDerived().AlwaysRebuild() &&
16983 SubExpr.get() == E->getSubExpr())
16986 return getDerived().RebuildObjCBoxedExpr(E->getSourceRange(), SubExpr.get());
16989template<
typename Derived>
16994 bool ArgChanged =
false;
16995 if (getDerived().TransformExprs(E->getElements(), E->getNumElements(),
16996 false, Elements, &ArgChanged))
16999 if (!getDerived().AlwaysRebuild() && !ArgChanged)
17002 return getDerived().RebuildObjCArrayLiteral(E->getSourceRange(),
17007template<
typename Derived>
17013 bool ArgChanged =
false;
17014 for (
unsigned I = 0, N = E->getNumElements(); I != N; ++I) {
17017 if (OrigElement.isPackExpansion()) {
17020 getSema().collectUnexpandedParameterPacks(OrigElement.Key, Unexpanded);
17021 getSema().collectUnexpandedParameterPacks(OrigElement.Value, Unexpanded);
17022 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
17026 bool Expand =
true;
17027 bool RetainExpansion =
false;
17030 SourceRange PatternRange(OrigElement.Key->getBeginLoc(),
17031 OrigElement.Value->getEndLoc());
17032 if (getDerived().TryExpandParameterPacks(
17033 OrigElement.EllipsisLoc, PatternRange, Unexpanded,
17034 true, Expand, RetainExpansion,
17043 ExprResult Key = getDerived().TransformExpr(OrigElement.Key);
17044 if (Key.isInvalid())
17047 if (Key.get() != OrigElement.Key)
17051 if (
Value.isInvalid())
17058 Key.get(),
Value.get(), OrigElement.EllipsisLoc, NumExpansions
17060 Elements.push_back(Expansion);
17070 for (
unsigned I = 0; I != *NumExpansions; ++I) {
17072 ExprResult Key = getDerived().TransformExpr(OrigElement.Key);
17073 if (Key.isInvalid())
17077 if (
Value.isInvalid())
17087 if (Key.get()->containsUnexpandedParameterPack() ||
17088 Value.get()->containsUnexpandedParameterPack())
17089 Element.EllipsisLoc = OrigElement.EllipsisLoc;
17091 Elements.push_back(Element);
17101 ExprResult Key = getDerived().TransformExpr(OrigElement.Key);
17102 if (Key.isInvalid())
17105 if (Key.get() != OrigElement.Key)
17110 = getDerived().TransformExpr(OrigElement.Value);
17111 if (
Value.isInvalid())
17119 Elements.push_back(Element);
17122 if (!getDerived().AlwaysRebuild() && !ArgChanged)
17125 return getDerived().RebuildObjCDictionaryLiteral(E->getSourceRange(),
17129template<
typename Derived>
17133 = getDerived().TransformType(E->getEncodedTypeSourceInfo());
17134 if (!EncodedTypeInfo)
17137 if (!getDerived().AlwaysRebuild() &&
17138 EncodedTypeInfo == E->getEncodedTypeSourceInfo())
17141 return getDerived().RebuildObjCEncodeExpr(E->getAtLoc(),
17143 E->getRParenLoc());
17146template<
typename Derived>
17156template<
typename Derived>
17160 = getDerived().TransformType(E->getTypeInfoAsWritten());
17168 if (!getDerived().AlwaysRebuild() &&
17169 TSInfo == E->getTypeInfoAsWritten() &&
17170 Result.get() == E->getSubExpr())
17174 E->getLParenLoc(), E->getBridgeKind(), E->getBridgeKeywordLoc(), TSInfo,
17178template <
typename Derived>
17184template<
typename Derived>
17188 bool ArgChanged =
false;
17190 Args.reserve(E->getNumArgs());
17191 if (getDerived().TransformExprs(E->getArgs(), E->getNumArgs(),
false, Args,
17198 = getDerived().TransformType(E->getClassReceiverTypeInfo());
17199 if (!ReceiverTypeInfo)
17203 if (!getDerived().AlwaysRebuild() &&
17204 ReceiverTypeInfo == E->getClassReceiverTypeInfo() && !ArgChanged)
17209 E->getSelectorLocs(SelLocs);
17210 return getDerived().RebuildObjCMessageExpr(ReceiverTypeInfo,
17213 E->getMethodDecl(),
17220 if (!E->getMethodDecl())
17225 E->getSelectorLocs(SelLocs);
17226 return getDerived().RebuildObjCMessageExpr(E->getSuperLoc(),
17229 E->getReceiverType(),
17230 E->getMethodDecl(),
17238 "Only class and instance messages may be instantiated");
17240 = getDerived().TransformExpr(E->getInstanceReceiver());
17241 if (Receiver.isInvalid())
17245 if (!getDerived().AlwaysRebuild() &&
17246 Receiver.get() == E->getInstanceReceiver() && !ArgChanged)
17251 E->getSelectorLocs(SelLocs);
17252 return getDerived().RebuildObjCMessageExpr(Receiver.get(),
17255 E->getMethodDecl(),
17261template<
typename Derived>
17267template<
typename Derived>
17273template<
typename Derived>
17278 if (
Base.isInvalid())
17284 if (!getDerived().AlwaysRebuild() &&
17285 Base.get() == E->getBase())
17288 return getDerived().RebuildObjCIvarRefExpr(
Base.get(), E->getDecl(),
17290 E->isArrow(), E->isFreeIvar());
17293template<
typename Derived>
17298 if (!E->isObjectReceiver())
17303 if (
Base.isInvalid())
17309 if (!getDerived().AlwaysRebuild() &&
17310 Base.get() == E->getBase())
17313 if (E->isExplicitProperty())
17314 return getDerived().RebuildObjCPropertyRefExpr(
Base.get(),
17315 E->getExplicitProperty(),
17318 return getDerived().RebuildObjCPropertyRefExpr(
Base.get(),
17320 E->getImplicitPropertyGetter(),
17321 E->getImplicitPropertySetter(),
17325template<
typename Derived>
17330 if (
Base.isInvalid())
17334 ExprResult Key = getDerived().TransformExpr(E->getKeyExpr());
17335 if (Key.isInvalid())
17339 if (!getDerived().AlwaysRebuild() &&
17340 Key.get() == E->getKeyExpr() &&
Base.get() == E->getBaseExpr())
17343 return getDerived().RebuildObjCSubscriptRefExpr(E->getRBracket(),
17344 Base.get(), Key.get(),
17345 E->getAtIndexMethodDecl(),
17346 E->setAtIndexMethodDecl());
17349template<
typename Derived>
17354 if (
Base.isInvalid())
17358 if (!getDerived().AlwaysRebuild() &&
17359 Base.get() == E->getBase())
17362 return getDerived().RebuildObjCIsaExpr(
Base.get(), E->getIsaMemberLoc(),
17367template<
typename Derived>
17370 bool ArgumentChanged =
false;
17372 SubExprs.reserve(E->getNumSubExprs());
17373 if (getDerived().TransformExprs(E->getSubExprs(), E->getNumSubExprs(),
false,
17374 SubExprs, &ArgumentChanged))
17377 if (!getDerived().AlwaysRebuild() &&
17381 return getDerived().RebuildShuffleVectorExpr(E->getBuiltinLoc(),
17383 E->getRParenLoc());
17386template<
typename Derived>
17389 ExprResult SrcExpr = getDerived().TransformExpr(E->getSrcExpr());
17390 if (SrcExpr.isInvalid())
17397 if (!getDerived().AlwaysRebuild() &&
17398 Type == E->getTypeSourceInfo() &&
17399 SrcExpr.get() == E->getSrcExpr())
17402 return getDerived().RebuildConvertVectorExpr(E->getBuiltinLoc(),
17403 SrcExpr.get(),
Type,
17404 E->getRParenLoc());
17407template<
typename Derived>
17410 BlockDecl *oldBlock = E->getBlockDecl();
17416 blockScope->TheDecl->setBlockMissingReturnType(
17417 oldBlock->blockMissingReturnType());
17426 if (getDerived().TransformFunctionTypeParams(
17427 E->getCaretLocation(), oldBlock->parameters(),
nullptr,
17428 exprFunctionType->getExtParameterInfosOrNull(), paramTypes, ¶ms,
17430 getSema().ActOnBlockError(E->getCaretLocation(),
nullptr);
17435 getDerived().TransformType(exprFunctionType->getReturnType());
17437 auto epi = exprFunctionType->getExtProtoInfo();
17438 epi.ExtParameterInfos = extParamInfos.getPointerOrNull(paramTypes.size());
17441 getDerived().RebuildFunctionProtoType(exprResultType, paramTypes, epi);
17445 if (!params.empty())
17446 blockScope->TheDecl->setParams(params);
17448 if (!oldBlock->blockMissingReturnType()) {
17449 blockScope->HasImplicitReturnType =
false;
17450 blockScope->ReturnType = exprResultType;
17454 StmtResult body = getDerived().TransformStmt(E->getBody());
17455 if (body.isInvalid()) {
17456 getSema().ActOnBlockError(E->getCaretLocation(),
nullptr);
17464 for (
const auto &I : oldBlock->captures()) {
17465 VarDecl *oldCapture = I.getVariable();
17468 if (oldCapture->isParameterPack())
17472 cast<VarDecl>(getDerived().TransformDecl(E->getCaretLocation(),
17474 assert(blockScope->CaptureMap.count(newCapture));
17480 assert((!blockScope->isCXXThisCaptured() || oldBlock->capturesCXXThis()) &&
17481 "this pointer isn't captured in the old block");
17489template<
typename Derived>
17492 ExprResult SrcExpr = getDerived().TransformExpr(E->getSrcExpr());
17493 if (SrcExpr.isInvalid())
17496 QualType Type = getDerived().TransformType(E->getType());
17499 E->getRParenLoc());
17502template<
typename Derived>
17505 bool ArgumentChanged =
false;
17507 SubExprs.reserve(E->getNumSubExprs());
17508 if (getDerived().TransformExprs(E->getSubExprs(), E->getNumSubExprs(),
false,
17509 SubExprs, &ArgumentChanged))
17512 if (!getDerived().AlwaysRebuild() &&
17516 return getDerived().RebuildAtomicExpr(E->getBuiltinLoc(), SubExprs,
17517 E->getOp(), E->getRParenLoc());
17524template<
typename Derived>
17527 return SemaRef.BuildPointerType(PointeeType,
Star,
17531template<
typename Derived>
17534 return SemaRef.BuildBlockPointerType(PointeeType,
Star,
17538template<
typename Derived>
17541 bool WrittenAsLValue,
17543 return SemaRef.BuildReferenceType(ReferentType, WrittenAsLValue,
17547template <
typename Derived>
17551 return SemaRef.BuildMemberPointerType(PointeeType, SS, Cls, Sigil,
17555template<
typename Derived>
17562 return SemaRef.ObjC().BuildObjCTypeParamType(
17563 Decl, ProtocolLAngleLoc, Protocols, ProtocolLocs, ProtocolRAngleLoc,
17567template<
typename Derived>
17578 return SemaRef.ObjC().BuildObjCObjectType(
17579 BaseType, Loc, TypeArgsLAngleLoc, TypeArgs, TypeArgsRAngleLoc,
17580 ProtocolLAngleLoc, Protocols, ProtocolLocs, ProtocolRAngleLoc,
17585template<
typename Derived>
17589 return SemaRef.Context.getObjCObjectPointerType(PointeeType);
17592template <
typename Derived>
17595 Expr *SizeExpr,
unsigned IndexTypeQuals,
SourceRange BracketsRange) {
17596 if (SizeExpr || !Size)
17597 return SemaRef.BuildArrayType(ElementType, SizeMod, SizeExpr,
17598 IndexTypeQuals, BracketsRange,
17602 SemaRef.Context.UnsignedCharTy,
SemaRef.Context.UnsignedShortTy,
17604 SemaRef.Context.UnsignedLongLongTy,
SemaRef.Context.UnsignedInt128Ty
17607 for (
const auto &T : Types)
17608 if (Size->getBitWidth() ==
SemaRef.Context.getIntWidth(T)) {
17618 return SemaRef.BuildArrayType(ElementType, SizeMod, ArraySize,
17619 IndexTypeQuals, BracketsRange,
17623template <
typename Derived>
17626 Expr *SizeExpr,
unsigned IndexTypeQuals,
SourceRange BracketsRange) {
17627 return getDerived().RebuildArrayType(ElementType, SizeMod, &Size, SizeExpr,
17628 IndexTypeQuals, BracketsRange);
17631template <
typename Derived>
17635 return getDerived().RebuildArrayType(ElementType, SizeMod,
nullptr,
nullptr,
17636 IndexTypeQuals, BracketsRange);
17639template <
typename Derived>
17642 unsigned IndexTypeQuals,
SourceRange BracketsRange) {
17643 return getDerived().RebuildArrayType(ElementType, SizeMod,
nullptr,
17645 IndexTypeQuals, BracketsRange);
17648template <
typename Derived>
17651 unsigned IndexTypeQuals,
SourceRange BracketsRange) {
17652 return getDerived().RebuildArrayType(ElementType, SizeMod,
nullptr,
17654 IndexTypeQuals, BracketsRange);
17657template <
typename Derived>
17660 return SemaRef.BuildAddressSpaceAttr(PointeeType, AddrSpaceExpr,
17664template <
typename Derived>
17666 unsigned NumElements,
17669 return SemaRef.Context.getVectorType(ElementType, NumElements, VecKind);
17672template <
typename Derived>
17676 return SemaRef.BuildVectorType(ElementType, SizeExpr, AttributeLoc);
17679template<
typename Derived>
17681 unsigned NumElements,
17683 llvm::APInt numElements(
SemaRef.Context.getIntWidth(
SemaRef.Context.IntTy),
17684 NumElements,
true);
17688 return SemaRef.BuildExtVectorType(ElementType, VectorSize, AttributeLoc);
17691template<
typename Derived>
17696 return SemaRef.BuildExtVectorType(ElementType, SizeExpr, AttributeLoc);
17699template <
typename Derived>
17701 QualType ElementType,
unsigned NumRows,
unsigned NumColumns) {
17702 return SemaRef.Context.getConstantMatrixType(ElementType, NumRows,
17706template <
typename Derived>
17710 return SemaRef.BuildMatrixType(ElementType, RowExpr, ColumnExpr,
17714template <
typename Derived>
17718 return SemaRef.BuildFunctionType(T, ParamTypes,
17724template<
typename Derived>
17726 return SemaRef.Context.getFunctionNoProtoType(T);
17729template <
typename Derived>
17733 assert(D &&
"no decl found");
17737 if (
auto *UPD = dyn_cast<UsingPackDecl>(D)) {
17741 if (UPD->expansions().empty()) {
17742 getSema().Diag(NameLoc, diag::err_using_pack_expansion_empty)
17743 << UPD->isCXXClassMember() << UPD;
17752 for (
auto *E : UPD->expansions()) {
17759 else if (T.isNull())
17762 assert(
getSema().Context.hasSameType(ThisT, T) &&
17763 "mismatched resolved types in using pack expansion");
17765 return T.
isNull() ? FallbackT : T;
17767 if (
auto *Using = dyn_cast<UsingDecl>(D)) {
17768 assert(Using->hasTypename() &&
17769 "UnresolvedUsingTypenameDecl transformed to non-typename using");
17772 assert(++Using->shadow_begin() == Using->shadow_end());
17777 return SemaRef.Context.getUsingType(
Keyword, Qualifier, Shadow);
17780 "UnresolvedUsingTypenameDecl transformed to non-using decl");
17781 return SemaRef.Context.getUnresolvedUsingType(
17785template <
typename Derived>
17788 return SemaRef.BuildTypeofExprType(E, Kind);
17791template<
typename Derived>
17794 return SemaRef.Context.getTypeOfType(Underlying, Kind);
17797template <
typename Derived>
17799 return SemaRef.BuildDecltypeType(E);
17802template <
typename Derived>
17807 return SemaRef.BuildPackIndexingType(Pattern, IndexExpr, Loc, EllipsisLoc,
17808 FullySubstituted, Expansions);
17811template<
typename Derived>
17813 UnaryTransformType::UTTKind UKind,
17815 return SemaRef.BuildUnaryTransformType(BaseType, UKind, Loc);
17818template <
typename Derived>
17822 return SemaRef.CheckTemplateIdType(
17827template<
typename Derived>
17830 return SemaRef.BuildAtomicType(ValueType, KWLoc);
17833template<
typename Derived>
17837 return isReadPipe ?
SemaRef.BuildReadPipeType(ValueType, KWLoc)
17838 :
SemaRef.BuildWritePipeType(ValueType, KWLoc);
17841template <
typename Derived>
17845 llvm::APInt NumBitsAP(
SemaRef.Context.getIntWidth(
SemaRef.Context.IntTy),
17849 return SemaRef.BuildBitIntType(IsUnsigned, Bits, Loc);
17852template <
typename Derived>
17855 return SemaRef.BuildBitIntType(IsUnsigned, NumBitsExpr, Loc);
17858template <
typename Derived>
17866template <
typename Derived>
17873 getSema().ActOnTemplateName(
nullptr, SS, TemplateKWLoc,
17876 AllowInjectedClassName);
17880template<
typename Derived>
17887 bool AllowInjectedClassName) {
17890 SourceLocation SymbolLocations[3] = { NameLoc, NameLoc, NameLoc };
17895 false,
Template, AllowInjectedClassName);
17899template <
typename Derived>
17904 bool isPostIncDec = Second && (Op == OO_PlusPlus || Op == OO_MinusMinus);
17909 return SemaRef.PseudoObject().checkAssignment(
nullptr, OpLoc,
17910 Opc,
First, Second);
17925 if (Op == OO_Subscript) {
17926 if (!
First->getType()->isOverloadableType() &&
17928 return getSema().CreateBuiltinArraySubscriptExpr(
First, CalleeLoc, Second,
17930 }
else if (Op == OO_Arrow) {
17933 if (
First->getType()->isDependentType())
17936 return SemaRef.BuildOverloadedArrowExpr(
nullptr,
First, OpLoc);
17937 }
else if (Second ==
nullptr || isPostIncDec) {
17938 if (!
First->getType()->isOverloadableType() ||
17939 (Op == OO_Amp &&
getSema().isQualifiedMemberAccess(
First))) {
17946 return getSema().CreateBuiltinUnaryOp(OpLoc, Opc,
First);
17950 !
First->getType()->isOverloadableType() &&
17956 =
SemaRef.CreateBuiltinBinOp(OpLoc, Opc,
First, Second);
17965 if (!Second || isPostIncDec) {
17968 return SemaRef.CreateOverloadedUnaryOp(OpLoc, Opc, Functions,
First,
17975 First, Second, RequiresADL);
17982template<
typename Derived>
17992 QualType CanonicalBaseType =
Base->getType().getCanonicalType();
17993 if (
Base->isTypeDependent() || Destroyed.getIdentifier() ||
17998 ->getAsCanonical<RecordType>())) {
18000 return SemaRef.BuildPseudoDestructorExpr(
18001 Base, OperatorLoc, isArrow ? tok::arrow : tok::period, SS, ScopeType,
18002 CCLoc, TildeLoc, Destroyed);
18014 if (!
isa<TagType>(ScopeType->getType().getCanonicalType())) {
18015 getSema().Diag(ScopeType->getTypeLoc().getBeginLoc(),
18016 diag::err_expected_class_or_namespace)
18017 << ScopeType->getType() <<
getSema().getLangOpts().CPlusPlus;
18021 SS.
Make(
SemaRef.Context, ScopeType->getTypeLoc(), CCLoc);
18025 return getSema().BuildMemberReferenceExpr(
18026 Base,
Base->getType(), OperatorLoc, isArrow, SS, TemplateKWLoc,
18032template<
typename Derived>
18040 for (
unsigned I = 0; I < NumParams; ++I) {
18041 if (I != ContextParamPos) {
18047 Params.push_back(std::make_pair(StringRef(), QualType()));
18050 getSema().ActOnCapturedRegionStart(Loc,
nullptr,
18058 if (Body.isInvalid()) {
18059 getSema().ActOnCapturedRegionError();
18063 return getSema().ActOnCapturedRegionEnd(Body.get());
18066template <
typename Derived>
18072 llvm_unreachable(
"SYCL kernel call statement cannot appear in dependent "
18076template <
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.
Result
Implement __builtin_bit_cast and related operations.
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 HLSL constructs.
This file declares semantic analysis for Objective-C.
This file declares semantic analysis for OpenACC constructs and clauses.
This file declares semantic analysis for OpenMP constructs and clauses.
This file declares semantic analysis for expressions involving.
This file declares semantic analysis for SYCL constructs.
static bool PreparePackForExpansion(Sema &S, const CXXBaseSpecifier &Base, const MultiLevelTemplateArgumentList &TemplateArgs, TypeSourceInfo *&Out, UnexpandedInfo &Info)
Defines the Objective-C statement AST node classes.
This file defines OpenACC AST classes for statement-level contructs.
This file defines OpenMP AST classes for executable directives and clauses.
This file defines SYCL AST classes used to represent calls to SYCL kernels.
static QualType getPointeeType(const MemRegion *R)
This represents clause 'map' in the 'pragma omp ...' directives.
This represents clauses with a list of expressions that are mappable. Examples of these clauses are '...
QualType getAttributedType(attr::Kind attrKind, QualType modifiedType, QualType equivalentType, const Attr *attr=nullptr) const
QualType getArrayParameterType(QualType Ty) const
Return the uniqued reference to a specified array parameter type from the original array type.
QualType getSubstTemplateTypeParmType(QualType Replacement, Decl *AssociatedDecl, unsigned Index, UnsignedOrNone PackIndex, bool Final) const
Retrieve a substitution-result type.
QualType getDecayedType(QualType T) const
Return the uniqued reference to the decayed version of the given type.
QualType getBaseElementType(const ArrayType *VAT) const
Return the innermost element type of an array type.
TypeSourceInfo * getTrivialTypeSourceInfo(QualType T, SourceLocation Loc=SourceLocation()) const
Allocate a TypeSourceInfo where all locations have been initialized to a given location,...
CanQualType PseudoObjectTy
QualType getObjCObjectPointerType(QualType OIT) const
Return a ObjCObjectPointerType type for the given ObjCObjectType.
const ArrayType * getAsArrayType(QualType T) const
Type Query functions.
QualType getPackExpansionType(QualType Pattern, UnsignedOrNone NumExpansions, bool ExpectPackInType=true) const
Form a pack expansion type with the given pattern.
static bool hasSameType(QualType T1, QualType T2)
Determine whether the given types T1 and T2 are equivalent.
QualType getSizeType() const
Return the unique type for "size_t" (C99 7.17), defined in <stddef.h>.
QualType getOverflowBehaviorType(const OverflowBehaviorAttr *Attr, QualType Wrapped) const
TemplateName getSubstTemplateTemplateParmPack(const TemplateArgument &ArgPack, Decl *AssociatedDecl, unsigned Index, bool Final) const
QualType getHLSLAttributedResourceType(QualType Wrapped, QualType Contained, const HLSLAttributedResourceType::Attributes &Attrs)
AddrLabelExpr - The GNU address of label extension, representing &&label.
Represents the index of the current element of an array being initialized by an ArrayInitLoopExpr.
Represents a loop initializing the elements of an array.
Wrapper for source info for array parameter types.
This class represents BOTH the OpenMP Array Section and OpenACC 'subarray', with a boolean differenti...
ArraySubscriptExpr - [C99 6.5.2.1] Array Subscripting.
Wrapper for source info for arrays.
void setLBracketLoc(SourceLocation Loc)
An Embarcadero array type trait, as used in the implementation of __array_rank and __array_extent.
SourceLocation getEndLoc() const LLVM_READONLY
ArrayTypeTrait getTrait() const
Expr * getDimensionExpression() const
TypeSourceInfo * getQueriedTypeSourceInfo() const
SourceLocation getBeginLoc() const LLVM_READONLY
Represents an array type, per C99 6.7.5.2 - Array Declarators.
AsTypeExpr - Clang builtin function __builtin_astype [OpenCL 6.2.4.2] This AST node provides support ...
AtomicExpr - Variadic atomic builtins: __atomic_exchange, __atomic_fetch_*, __atomic_load,...
void setKWLoc(SourceLocation Loc)
Attr - This represents one attribute.
Represents an attribute applied to a statement.
SourceLocation getAttrLoc() const
ArrayRef< const Attr * > getAttrs() const
Type source information for an attributed type.
void setAttr(const Attr *A)
Type source information for an btf_tag attributed type.
BinaryConditionalOperator - The GNU extension to the conditional operator which allows the middle ope...
A builtin binary operation expression such as "x + y" or "x <= y".
static OverloadedOperatorKind getOverloadedOperator(Opcode Opc)
Retrieve the overloaded operator kind that corresponds to the given binary opcode.
static bool isAssignmentOp(Opcode Opc)
static Opcode getOverloadedOpcode(OverloadedOperatorKind OO)
Retrieve the binary opcode that corresponds to the given overloaded operator.
A fixed int type of a specified bitwidth.
Represents a block literal declaration, which is like an unnamed FunctionDecl.
void setIsVariadic(bool value)
BlockExpr - Adaptor class for mixing a BlockDecl with expressions.
Wrapper for source info for block pointers.
BreakStmt - This represents a break.
Represents a C++2a __builtin_bit_cast(T, v) expression.
SourceLocation getEndLoc() const LLVM_READONLY
SourceLocation getBeginLoc() const LLVM_READONLY
CStyleCastExpr - An explicit cast in C (C99 6.5.4) or a C-style cast in C++ (C++ [expr....
Represents a call to a CUDA kernel function.
A C++ addrspace_cast expression (currently only enabled for OpenCL).
Represents binding an expression to a temporary.
A boolean literal, per ([C++ lex.bool] Boolean literals).
CXXCatchStmt - This represents a C++ catch block.
A C++ const_cast expression (C++ [expr.const.cast]).
Represents a call to a C++ constructor.
SourceRange getParenOrBraceRange() const
Expr * getArg(unsigned Arg)
Return the specified argument.
bool isStdInitListInitialization() const
Whether this constructor call was written as list-initialization, but was interpreted as forming a st...
SourceLocation getEndLoc() const LLVM_READONLY
SourceLocation getBeginLoc() const LLVM_READONLY
bool isListInitialization() const
Whether this constructor call was written as list-initialization.
unsigned getNumArgs() const
Return the number of arguments to the constructor call.
Represents a C++ constructor within a class.
A default argument (C++ [dcl.fct.default]).
static CXXDefaultArgExpr * Create(const ASTContext &C, SourceLocation Loc, ParmVarDecl *Param, Expr *RewrittenExpr, DeclContext *UsedContext)
A use of a default initializer in a constructor or in aggregate initialization.
Represents a delete expression for memory deallocation and destructor calls, e.g.
Represents a C++ member access expression where the actual member referenced could not be resolved be...
Represents a C++ destructor within a class.
A C++ dynamic_cast expression (C++ [expr.dynamic.cast]).
Represents a folding of a pack over an operator.
CXXForRangeStmt - This represents C++0x [stmt.ranged]'s ranged for statement, represented as 'for (ra...
Represents an explicit C++ type conversion that uses "functional" notation (C++ [expr....
Represents a call to an inherited base class constructor from an inheriting constructor.
Represents a call to a member function that may be written either with member call syntax (e....
Represents a static or instance method of a struct/union/class.
Abstract class common to all of the C++ "named"/"keyword" casts.
SourceLocation getOperatorLoc() const
Retrieve the location of the cast operator keyword, e.g., static_cast.
SourceRange getAngleBrackets() const LLVM_READONLY
SourceLocation getRParenLoc() const
Retrieve the location of the closing parenthesis.
Represents a new-expression for memory allocation and constructor calls, e.g: "new CXXNewExpr(foo)".
Represents a C++11 noexcept expression (C++ [expr.unary.noexcept]).
The null pointer literal (C++11 [lex.nullptr])
A call to an overloaded operator written using operator syntax.
Represents a list-initialization with parenthesis.
Represents a C++ pseudo-destructor (C++ [expr.pseudo]).
Represents a C++ struct/union/class.
unsigned getLambdaDependencyKind() const
Represents a C++26 reflect expression [expr.reflect].
A C++ reinterpret_cast expression (C++ [expr.reinterpret.cast]).
A rewritten comparison expression that was originally written using operator syntax.
An expression "T()" which creates an rvalue of a non-class type T.
Represents a C++ nested-name-specifier or a global scope specifier.
void Make(ASTContext &Context, TypeLoc TL, SourceLocation ColonColonLoc)
Make a nested-name-specifier of the form 'type::'.
char * location_data() const
Retrieve the data associated with the source-location information.
SourceRange getRange() const
void MakeGlobal(ASTContext &Context, SourceLocation ColonColonLoc)
Turn this (empty) nested-name-specifier into the global nested-name-specifier '::'.
NestedNameSpecifier getScopeRep() const
Retrieve the representation of the nested-name-specifier.
NestedNameSpecifierLoc getWithLocInContext(ASTContext &Context) const
Retrieve a nested-name-specifier with location information, copied into the given AST context.
unsigned location_size() const
Retrieve the size of the data associated with source-location information.
void Extend(ASTContext &Context, NamespaceBaseDecl *Namespace, SourceLocation NamespaceLoc, SourceLocation ColonColonLoc)
Extend the current nested-name-specifier by another nested-name-specifier component of the form 'name...
void MakeMicrosoftSuper(ASTContext &Context, CXXRecordDecl *RD, SourceLocation SuperLoc, SourceLocation ColonColonLoc)
Turns this (empty) nested-name-specifier into '__super' nested-name-specifier.
bool isEmpty() const
No scope specifier.
void Adopt(NestedNameSpecifierLoc Other)
Adopt an existing nested-name-specifier (with source-range information).
Implicit construction of a std::initializer_list<T> object from an array temporary within list-initia...
Represents a C++ functional cast expression that builds a temporary object.
Represents the this expression in C++.
A C++ throw-expression (C++ [except.throw]).
CXXTryStmt - A C++ try block, including all handlers.
A C++ typeid expression (C++ [expr.typeid]), which gets the type_info that corresponds to the supplie...
Describes an explicit type conversion that uses functional notion but could not be resolved because o...
SourceLocation getLParenLoc() const
Retrieve the location of the left parentheses ('(') that precedes the argument list.
bool isListInitialization() const
Determine whether this expression models list-initialization.
TypeSourceInfo * getTypeSourceInfo() const
Retrieve the type source information for the type being constructed.
SourceLocation getRParenLoc() const
Retrieve the location of the right parentheses (')') that follows the argument list.
unsigned getNumArgs() const
Retrieve the number of arguments.
A Microsoft C++ __uuidof expression, which gets the _GUID that corresponds to the supplied type or ex...
CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).
static CallExpr * Create(const ASTContext &Ctx, Expr *Fn, ArrayRef< Expr * > Args, QualType Ty, ExprValueKind VK, SourceLocation RParenLoc, FPOptionsOverride FPFeatures, unsigned MinNumArgs=0, ADLCallKind UsesADL=NotADL)
Create a call expression.
Represents the body of a CapturedStmt, and serves as its DeclContext.
unsigned getNumParams() const
unsigned getContextParamPosition() const
ImplicitParamDecl * getParam(unsigned i) const
This captures a statement into a function.
CapturedDecl * getCapturedDecl()
Retrieve the outlined function declaration.
Stmt * getCapturedStmt()
Retrieve the statement being captured.
SourceLocation getBeginLoc() const LLVM_READONLY
CapturedRegionKind getCapturedRegionKind() const
Retrieve the captured region kind.
CaseStmt - Represent a case statement.
Expr * getSubExprAsWritten()
Retrieve the cast subexpression as it was written in the source code, looking through any implicit ca...
ChooseExpr - GNU builtin-in function __builtin_choose_expr.
Represents a 'co_await' expression.
CompoundAssignOperator - For compound assignments (e.g.
CompoundLiteralExpr - [C99 6.5.2.5].
CompoundStmt - This represents a group of statements like { stmt stmt }.
FPOptionsOverride getStoredFPFeatures() const
Get FPOptionsOverride from trailing storage.
SourceLocation getLBracLoc() const
bool hasStoredFPFeatures() const
SourceLocation getRBracLoc() const
Declaration of a C++20 concept.
static ConceptReference * Create(const ASTContext &C, NestedNameSpecifierLoc NNS, SourceLocation TemplateKWLoc, DeclarationNameInfo ConceptNameInfo, NamedDecl *FoundDecl, TemplateDecl *NamedConcept, const ASTTemplateArgumentListInfo *ArgsAsWritten)
Represents the specialization of a concept - evaluates to a prvalue of type bool.
const TypeClass * getTypePtr() const
ConditionalOperator - The ?
Represents the canonical version of C arrays with a specified constant size.
ConstantExpr - An expression that occurs in a constant context and optionally the result of evaluatin...
Represents a concrete matrix type with constant number of rows and columns.
ContinueStmt - This represents a continue.
ConvertVectorExpr - Clang builtin function __builtin_convertvector This AST node provides support for...
Represents a 'co_return' statement in the C++ Coroutines TS.
Represents the body of a coroutine.
Represents a sugar type with __counted_by or __sized_by annotations, including their _or_null variant...
Represents a 'co_yield' expression.
Wrapper for source info for pointers decayed from arrays and functions.
static DeclAccessPair make(NamedDecl *D, AccessSpecifier AS)
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
DeclContext * getParent()
getParent - Returns the containing DeclContext.
DeclContextLookupResult lookup_result
lookup_result lookup(DeclarationName Name) const
lookup - Find the declarations (if any) with the given Name in this context.
void addDecl(Decl *D)
Add the declaration D into this context.
A reference to a declared variable, function, enum, etc.
DeclStmt - Adaptor class for mixing declarations with statements and expressions.
Decl - This represents one declaration (or definition), e.g.
bool isInvalidDecl() const
SourceLocation getLocation() const
DeclContext * getDeclContext()
AccessSpecifier getAccess() const
The name of a declaration.
TemplateDecl * getCXXDeductionGuideTemplate() const
If this name is the name of a C++ deduction guide, return the template associated with that name.
@ CXXConversionFunctionName
QualType getCXXNameType() const
If this name is one of the C++ names (of a constructor, destructor, or conversion function),...
NameKind getNameKind() const
Determine what kind of name this is.
SourceLocation getInnerLocStart() const
Return start of source range ignoring outer template declarations.
TypeSourceInfo * getTypeSourceInfo() const
Information about one declarator, including the parsed type information and the identifier.
void setDecltypeLoc(SourceLocation Loc)
void setElaboratedKeywordLoc(SourceLocation Loc)
DeferStmt - This represents a deferred statement.
static DeferStmt * Create(ASTContext &Context, SourceLocation DeferLoc, Stmt *Body)
void setAttrOperandParensRange(SourceRange range)
Represents an extended address space qualifier where the input address space value is dependent.
Represents a 'co_await' expression while the type of the promise is dependent.
void setElaboratedKeywordLoc(SourceLocation Loc)
A qualified reference to a name whose declaration cannot yet be resolved.
SourceLocation getRAngleLoc() const
Retrieve the location of the right angle bracket ending the explicit template argument list following...
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies the name, with source location information.
SourceLocation getLAngleLoc() const
Retrieve the location of the left angle bracket starting the explicit template argument list followin...
bool hasExplicitTemplateArgs() const
Determines whether this lookup had explicit template arguments.
SourceLocation getTemplateKeywordLoc() const
Retrieve the location of the template keyword preceding this name, if any.
unsigned getNumTemplateArgs() const
DeclarationName getDeclName() const
Retrieve the name that this expression refers to.
TemplateArgumentLoc const * getTemplateArgs() const
const DeclarationNameInfo & getNameInfo() const
Retrieve the name that this expression refers to.
Represents an array type in C++ whose size is a value-dependent expression.
void setNameLoc(SourceLocation Loc)
Represents an extended vector type where either the type or size is dependent.
Represents a matrix type where the type and the number of rows and columns is dependent on a template...
void setNameLoc(SourceLocation Loc)
Represents a vector type where either the type or size is dependent.
Represents a single C99 designator.
Represents a C99 designated initializer expression.
Designation - Represent a full designation, which is a sequence of designators.
static Designator CreateArrayRangeDesignator(Expr *Start, Expr *End, SourceLocation LBracketLoc, SourceLocation EllipsisLoc)
Creates a GNU array-range designator.
static Designator CreateArrayDesignator(Expr *Index, SourceLocation LBracketLoc)
Creates an array designator.
static Designator CreateFieldDesignator(const IdentifierInfo *FieldName, SourceLocation DotLoc, SourceLocation FieldLoc)
Creates a field designator.
bool hasErrorOccurred() const
DoStmt - This represents a 'do/while' stmt.
Wrap a function effect's condition expression in another struct so that FunctionProtoType's TrailingO...
Expr * getCondition() const
void set(SourceLocation ElaboratedKeywordLoc, NestedNameSpecifierLoc QualifierLoc, SourceLocation NameLoc)
Represents a reference to emded data.
RAII object that enters a new expression evaluation context.
Wrapper for source info for enum types.
TypeSourceInfo * getTypeInfoAsWritten() const
getTypeInfoAsWritten - Returns the type source info for the type that this expression is casting to.
Represents an expression – generally a full-expression – that introduces cleanups to be run at the en...
This represents one expression.
bool isValueDependent() const
Determines whether the value of this expression depends on.
bool isTypeDependent() const
Determines whether the type of this expression depends on.
ExprObjectKind getObjectKind() const
getObjectKind - The object kind that this expression produces.
Expr * IgnoreImplicitAsWritten() LLVM_READONLY
Skip past any implicit AST nodes which might surround this expression until reaching a fixed point.
bool isDefaultArgument() const
Determine whether this expression is a default function argument.
bool hasPlaceholderType() const
Returns whether this expression has a placeholder type.
static ExprValueKind getValueKindForType(QualType T)
getValueKindForType - Given a formal return or parameter type, give its value kind.
An expression trait intrinsic.
ExtVectorElementExpr - This represents access to specific elements of a vector, and may occur on the ...
Represents difference between two FPOptions values.
FPOptions applyOverrides(FPOptions Base)
Represents a member of a struct/union/class.
ForStmt - This represents a 'for (init;cond;inc)' stmt.
Represents a function declaration or definition.
ArrayRef< ParmVarDecl * > parameters() const
SmallVector< Conflict > Conflicts
Represents an abstract function effect, using just an enumeration describing its kind.
StringRef name() const
The description printed in diagnostics, e.g. 'nonblocking'.
Kind oppositeKind() const
Return the opposite kind, for effects which have opposites.
ArrayRef< EffectConditionExpr > conditions() const
Represents a K&R-style 'int foo()' function, which has no information available about its arguments.
Represents a reference to a function parameter pack, init-capture pack, or binding pack that has been...
Represents a prototype with parameter type info, e.g.
param_type_iterator param_type_begin() const
unsigned getNumParams() const
SourceLocation getLocalRangeEnd() const
void setLocalRangeBegin(SourceLocation L)
void setLParenLoc(SourceLocation Loc)
SourceRange getExceptionSpecRange() const
void setParam(unsigned i, ParmVarDecl *VD)
ArrayRef< ParmVarDecl * > getParams() const
void setRParenLoc(SourceLocation Loc)
void setLocalRangeEnd(SourceLocation L)
void setExceptionSpecRange(SourceRange R)
TypeLoc getReturnLoc() const
SourceLocation getLocalRangeBegin() const
SourceLocation getLParenLoc() const
SourceLocation getRParenLoc() const
Interesting information about a specific parameter that can't simply be reflected in parameter's type...
This represents a GCC inline-assembly statement extension.
GNUNullExpr - Implements the GNU __null extension, which is a name for a null pointer constant that h...
Represents a C11 generic selection.
AssociationTy< false > Association
GotoStmt - This represents a direct goto.
Type source information for HLSL attributed resource type.
void setSourceRange(const SourceRange &R)
This class represents temporary values used to represent inout and out arguments in HLSL.
One of these records is kept for each identifier that is lexed.
IfStmt - This represents an if/then/else.
ImaginaryLiteral - We support imaginary integer and floating point literals, like "1....
ImplicitCastExpr - Allows us to explicitly represent implicit type conversions, which have no direct ...
Represents an implicitly-generated value initialization of an object of a given type.
Represents a C array with an unspecified size.
IndirectGotoStmt - This represents an indirect goto.
const TypeClass * getTypePtr() const
Describes an C or C++ initializer list.
InitListExpr * getSyntacticForm() const
Wrapper for source info for injected class names of class templates.
static IntegerLiteral * Create(const ASTContext &C, const llvm::APInt &V, QualType type, SourceLocation l)
Returns a new integer literal with value 'V' and type 'type'.
Represents the declaration of a label.
LabelStmt - Represents a label, which has a substatement.
A C++ lambda expression, which produces a function object (of unspecified type) that can be invoked l...
capture_iterator capture_begin() const
Retrieve an iterator pointing to the first lambda capture.
bool isInitCapture(const LambdaCapture *Capture) const
Determine whether one of this lambda's captures is an init-capture.
capture_iterator capture_end() const
Retrieve an iterator pointing past the end of the sequence of lambda captures.
const LambdaCapture * capture_iterator
An iterator that walks over the captures of the lambda, both implicit and explicit.
Represents the results of name lookup.
This represents a Microsoft inline-assembly statement extension.
Representation of a Microsoft __if_exists or __if_not_exists statement with a dependent name.
An instance of this class represents the declaration of a property member.
A member reference to an MSPropertyDecl.
MS property subscript expression.
void setExpansionLoc(SourceLocation Loc)
Represents a prvalue temporary that is written into memory so that a reference can bind to it.
MatrixSingleSubscriptExpr - Matrix single subscript expression for the MatrixType extension when you ...
MatrixSubscriptExpr - Matrix subscript expression for the MatrixType extension.
void setAttrNameLoc(SourceLocation loc)
MemberExpr - [C99 6.5.2.3] Structure and Union Members.
Wrapper for source info for member pointers.
A pointer to member type per C++ 8.3.3 - Pointers to members.
Data structure that captures multiple levels of template argument lists for use in template instantia...
This represents a decl that may have a name.
IdentifierInfo * getIdentifier() const
Get the identifier that names this declaration, if there is one.
StringRef getName() const
Get the name of identifier for this declaration as a StringRef.
DeclarationName getDeclName() const
Get the actual, stored name of the declaration, which may be a special name.
Represents C++ namespaces and their aliases.
Class that aids in the construction of nested-name-specifiers along with source-location information ...
void MakeTrivial(ASTContext &Context, NestedNameSpecifier Qualifier, SourceRange R)
Make a new nested-name-specifier from incomplete source-location information.
A C++ nested-name-specifier augmented with source location information.
NestedNameSpecifier getNestedNameSpecifier() const
Retrieve the nested-name-specifier to which this instance refers.
SourceLocation getLocalEndLoc() const
Retrieve the location of the end of this component of the nested-name-specifier.
SourceRange getSourceRange() const LLVM_READONLY
Retrieve the source range covering the entirety of this nested-name-specifier.
SourceLocation getEndLoc() const
Retrieve the location of the end of this nested-name-specifier.
SourceLocation getBeginLoc() const
Retrieve the location of the beginning of this nested-name-specifier.
TypeLoc castAsTypeLoc() const
For a nested-name-specifier that refers to a type, retrieve the type with source-location information...
void * getOpaqueData() const
Retrieve the opaque pointer that refers to source-location data.
SourceLocation getLocalBeginLoc() const
Retrieve the location of the beginning of this component of the nested-name-specifier.
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
NamespaceAndPrefix getAsNamespaceAndPrefix() const
CXXRecordDecl * getAsRecordDecl() const
Retrieve the record declaration stored in this nested name specifier, or null.
bool isDependent() const
Whether this nested name specifier refers to a dependent type or not.
@ MicrosoftSuper
Microsoft's '__super' specifier, stored as a CXXRecordDecl* of the class it appeared in.
@ Global
The global specifier '::'. There is no stored value.
@ Type
A type, stored as a Type*.
@ Namespace
A namespace-like entity, stored as a NamespaceBaseDecl*.
Represents a place-holder for an object not to be initialized by anything.
NullStmt - This is the null statement ";": C99 6.8.3p3.
This represents the 'align' clause in the 'pragma omp allocate' directive.
This represents clause 'allocate' in the 'pragma omp ...' directives.
This represents 'allocator' clause in the 'pragma omp ...' directive.
An explicit cast in C or a C-style cast in C++, which uses the syntax ([s1][s2]......
This is a basic class for representing single OpenMP clause.
OpenMPClauseKind getClauseKind() const
Returns kind of OpenMP clause (private, shared, reduction, etc.).
This represents 'collapse' clause in the 'pragma omp ...' directive.
This represents the 'counts' clause in the 'pragma omp split' directive.
This represents 'default' clause in the 'pragma omp ...' directive.
This represents 'final' clause in the 'pragma omp ...' directive.
Representation of the 'full' clause of the 'pragma omp unroll' directive.
This represents 'if' clause in the 'pragma omp ...' directive.
OpenMP 5.0 [2.1.6 Iterators] Iterators are identifiers that expand to multiple values in the clause o...
This class represents the 'looprange' clause in the 'pragma omp fuse' directive.
This represents 'num_threads' clause in the 'pragma omp ...' directive.
Representation of the 'partial' clause of the 'pragma omp unroll' directive.
This class represents the 'permutation' clause in the 'pragma omp interchange' directive.
This represents 'safelen' clause in the 'pragma omp ...' directive.
This represents 'simdlen' clause in the 'pragma omp ...' directive.
This represents the 'sizes' clause in the 'pragma omp tile' directive.
This represents 'threadset' clause in the 'pragma omp task ...' directive.
ObjCArrayLiteral - used for objective-c array containers; as in: @["Hello", NSApp,...
Represents Objective-C's @catch statement.
Represents Objective-C's @finally statement.
Represents Objective-C's @synchronized statement.
Represents Objective-C's @throw statement.
Represents Objective-C's @try ... @catch ... @finally statement.
Represents Objective-C's @autoreleasepool Statement.
A runtime availability query.
ObjCBoolLiteralExpr - Objective-C Boolean Literal.
ObjCBoxedExpr - used for generalized expression boxing.
An Objective-C "bridged" cast expression, which casts between Objective-C pointers and C pointers,...
ObjCDictionaryLiteral - AST node to represent objective-c dictionary literals; as in:"name" : NSUserN...
ObjCEncodeExpr, used for @encode in Objective-C.
Represents Objective-C's collection statement.
ObjCIndirectCopyRestoreExpr - Represents the passing of a function argument by indirect copy-restore ...
Wrapper for source info for ObjC interfaces.
ObjCIsaExpr - Represent X->isa and X.isa when X is an ObjC 'id' type.
ObjCIvarDecl - Represents an ObjC instance variable.
ObjCIvarRefExpr - A reference to an ObjC instance variable.
An expression that sends a message to the given Objective-C object or class.
@ SuperInstance
The receiver is the instance of the superclass object.
@ Instance
The receiver is an object instance.
@ SuperClass
The receiver is a superclass.
@ Class
The receiver is a class.
ObjCMethodDecl - Represents an instance or class method declaration.
Wraps an ObjCPointerType with source location information.
void setStarLoc(SourceLocation Loc)
void setHasBaseTypeAsWritten(bool HasBaseType)
Represents one property declaration in an Objective-C interface.
ObjCPropertyRefExpr - A dot-syntax expression to access an ObjC property.
ObjCProtocolExpr used for protocol expression in Objective-C.
ObjCSelectorExpr used for @selector in Objective-C.
ObjCStringLiteral, used for Objective-C string literals i.e.
ObjCSubscriptRefExpr - used for array and dictionary subscripting.
Represents the declaration of an Objective-C type parameter.
ProtocolLAngleLoc, ProtocolRAngleLoc, and the source locations for protocol qualifiers are stored aft...
@ Array
An index into an array.
@ Identifier
A field in a dependent type, known only by its name.
@ Base
An implicit indirection through a C++ base class, when the field found is in a base class.
static OpaquePtr make(QualType P)
OpaqueValueExpr - An expression referring to an opaque object of a fixed type and value class.
Expr * getSourceExpr() const
The source expression of an opaque value expression is the expression which originally generated the ...
This expression type represents an asterisk in an OpenACC Size-Expr, used in the 'tile' and 'gang' cl...
static OpenACCAsyncClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *IntExpr, SourceLocation EndLoc)
static OpenACCAttachClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCAutoClause * Create(const ASTContext &Ctx, SourceLocation BeginLoc, SourceLocation EndLoc)
This is the base type for all OpenACC Clauses.
Represents a 'collapse' clause on a 'loop' construct.
static OpenACCCollapseClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, bool HasForce, Expr *LoopCount, SourceLocation EndLoc)
static OpenACCCopyClause * Create(const ASTContext &C, OpenACCClauseKind Spelling, SourceLocation BeginLoc, SourceLocation LParenLoc, OpenACCModifierKind Mods, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCCopyInClause * Create(const ASTContext &C, OpenACCClauseKind Spelling, SourceLocation BeginLoc, SourceLocation LParenLoc, OpenACCModifierKind Mods, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCCopyOutClause * Create(const ASTContext &C, OpenACCClauseKind Spelling, SourceLocation BeginLoc, SourceLocation LParenLoc, OpenACCModifierKind Mods, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCCreateClause * Create(const ASTContext &C, OpenACCClauseKind Spelling, SourceLocation BeginLoc, SourceLocation LParenLoc, OpenACCModifierKind Mods, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCDefaultAsyncClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *IntExpr, SourceLocation EndLoc)
A 'default' clause, has the optional 'none' or 'present' argument.
static OpenACCDefaultClause * Create(const ASTContext &C, OpenACCDefaultClauseKind K, SourceLocation BeginLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
static OpenACCDeleteClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCDetachClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCDeviceClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCDeviceNumClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *IntExpr, SourceLocation EndLoc)
static OpenACCDevicePtrClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
A 'device_type' or 'dtype' clause, takes a list of either an 'asterisk' or an identifier.
static OpenACCDeviceTypeClause * Create(const ASTContext &C, OpenACCClauseKind K, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< DeviceTypeArgument > Archs, SourceLocation EndLoc)
static OpenACCFinalizeClause * Create(const ASTContext &Ctx, SourceLocation BeginLoc, SourceLocation EndLoc)
static OpenACCFirstPrivateClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, ArrayRef< OpenACCFirstPrivateRecipe > InitRecipes, SourceLocation EndLoc)
static OpenACCHostClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
An 'if' clause, which has a required condition expression.
static OpenACCIfClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *ConditionExpr, SourceLocation EndLoc)
static OpenACCIfPresentClause * Create(const ASTContext &Ctx, SourceLocation BeginLoc, SourceLocation EndLoc)
static OpenACCIndependentClause * Create(const ASTContext &Ctx, SourceLocation BeginLoc, SourceLocation EndLoc)
static OpenACCNoCreateClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCNumGangsClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > IntExprs, SourceLocation EndLoc)
static OpenACCNumWorkersClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *IntExpr, SourceLocation EndLoc)
static OpenACCPresentClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCPrivateClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, ArrayRef< OpenACCPrivateRecipe > InitRecipes, SourceLocation EndLoc)
A 'self' clause, which has an optional condition expression, or, in the event of an 'update' directiv...
static OpenACCSelfClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *ConditionExpr, SourceLocation EndLoc)
static OpenACCSeqClause * Create(const ASTContext &Ctx, SourceLocation BeginLoc, SourceLocation EndLoc)
static OpenACCTileClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > SizeExprs, SourceLocation EndLoc)
static OpenACCUseDeviceClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCVectorClause * Create(const ASTContext &Ctx, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *IntExpr, SourceLocation EndLoc)
static OpenACCVectorLengthClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *IntExpr, SourceLocation EndLoc)
static OpenACCWaitClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *DevNumExpr, SourceLocation QueuesLoc, ArrayRef< Expr * > QueueIdExprs, SourceLocation EndLoc)
static OpenACCWorkerClause * Create(const ASTContext &Ctx, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *IntExpr, SourceLocation EndLoc)
void initializeLocal(ASTContext &Context, SourceLocation loc)
A reference to an overloaded function set, either an UnresolvedLookupExpr or an UnresolvedMemberExpr.
bool hasExplicitTemplateArgs() const
Determines whether this expression had explicit template arguments.
SourceLocation getLAngleLoc() const
Retrieve the location of the left angle bracket starting the explicit template argument list followin...
SourceLocation getNameLoc() const
Gets the location of the name.
SourceLocation getTemplateKeywordLoc() const
Retrieve the location of the template keyword preceding this name, if any.
NestedNameSpecifierLoc getQualifierLoc() const
Fetches the nested-name qualifier with source-location information, if one was given.
TemplateArgumentLoc const * getTemplateArgs() const
llvm::iterator_range< decls_iterator > decls() const
unsigned getNumTemplateArgs() const
DeclarationName getName() const
Gets the name looked up.
SourceLocation getRAngleLoc() const
Retrieve the location of the right angle bracket ending the explicit template argument list following...
bool hasTemplateKeyword() const
Determines whether the name was preceded by the template keyword.
Represents a C++11 pack expansion that produces a sequence of expressions.
void setEllipsisLoc(SourceLocation Loc)
SourceLocation getEllipsisLoc() const
TypeLoc getPatternLoc() const
void setEllipsisLoc(SourceLocation Loc)
ParenExpr - This represents a parenthesized expression, e.g.
SourceLocation getLParen() const
Get the location of the left parentheses '('.
SourceLocation getRParen() const
Get the location of the right parentheses ')'.
void setLParenLoc(SourceLocation Loc)
Represents a parameter to a function.
unsigned getFunctionScopeIndex() const
Returns the index of this parameter in its prototype or method scope.
void setScopeInfo(unsigned scopeDepth, unsigned parameterIndex)
static ParmVarDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, const IdentifierInfo *Id, QualType T, TypeSourceInfo *TInfo, StorageClass S, Expr *DefArg)
unsigned getFunctionScopeDepth() const
void setKWLoc(SourceLocation Loc)
Pointer-authentication qualifiers.
void setSigilLoc(SourceLocation Loc)
TypeLoc getPointeeLoc() const
SourceLocation getSigilLoc() const
Wrapper for source info for pointers.
PointerType - C99 6.7.5.1 - Pointer Declarators.
[C99 6.4.2.2] - A predefined identifier such as func.
Stores the type being destroyed by a pseudo-destructor expression.
PseudoObjectExpr - An expression which accesses a pseudo-object l-value.
A (possibly-)qualified type.
bool isNull() const
Return true if this QualType doesn't point to a type yet.
const Type * getTypePtr() const
Retrieves a pointer to the underlying (unqualified) type.
Qualifiers getLocalQualifiers() const
Retrieve the set of qualifiers local to this particular QualType instance, not including any qualifie...
Represents a template name as written in source code.
Wrapper of type source information for a type with non-trivial direct qualifiers.
The collection of all-type qualifiers we support.
void removeObjCLifetime()
static Qualifiers fromCVRMask(unsigned CVR)
PointerAuthQualifier getPointerAuth() const
bool hasObjCLifetime() const
LangAS getAddressSpace() const
Frontend produces RecoveryExprs on semantic errors that prevent creating other well-formed expression...
Base for LValueReferenceType and RValueReferenceType.
QualType getPointeeTypeAsWritten() const
Represents the body of a requires-expression.
static RequiresExprBodyDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc)
C++2a [expr.prim.req]: A requires-expression provides a concise way to express requirements on templa...
static RequiresExpr * Create(ASTContext &C, SourceLocation RequiresKWLoc, RequiresExprBodyDecl *Body, SourceLocation LParenLoc, ArrayRef< ParmVarDecl * > LocalParameters, SourceLocation RParenLoc, ArrayRef< concepts::Requirement * > Requirements, SourceLocation RBraceLoc)
ReturnStmt - This represents a return, optionally of an expression: return; return 4;.
static SEHFinallyStmt * Create(const ASTContext &C, SourceLocation FinallyLoc, Stmt *Block)
Represents a __leave statement.
SYCLKernelCallStmt represents the transformation that is applied to the body of a function declared w...
Smart pointer class that efficiently represents Objective-C method names.
SemaDiagnosticBuilder Diag(SourceLocation Loc, unsigned DiagID)
Emit a diagnostic.
bool diagnoseMatrixLayoutInstantiation(attr::Kind K, QualType T, SourceLocation Loc)
VarDecl * BuildObjCExceptionDecl(TypeSourceInfo *TInfo, QualType ExceptionType, SourceLocation StartLoc, SourceLocation IdLoc, const IdentifierInfo *Id, bool Invalid=false)
Build a type-check a new Objective-C exception variable declaration.
StmtResult ActOnObjCForCollectionStmt(SourceLocation ForColLoc, Stmt *First, Expr *collection, SourceLocation RParenLoc)
StmtResult FinishObjCForCollectionStmt(Stmt *ForCollection, Stmt *Body)
FinishObjCForCollectionStmt - Attach the body to a objective-C foreach statement.
ExprResult BuildObjCDictionaryLiteral(SourceRange SR, MutableArrayRef< ObjCDictionaryElement > Elements)
StmtResult ActOnObjCAtSynchronizedStmt(SourceLocation AtLoc, Expr *SynchExpr, Stmt *SynchBody)
ExprResult BuildObjCArrayLiteral(SourceRange SR, MultiExprArg Elements)
ExprResult BuildObjCBoxedExpr(SourceRange SR, Expr *ValueExpr)
BuildObjCBoxedExpr - builds an ObjCBoxedExpr AST node for the '@' prefixed parenthesized expression.
StmtResult ActOnObjCAtTryStmt(SourceLocation AtLoc, Stmt *Try, MultiStmtArg Catch, Stmt *Finally)
StmtResult ActOnObjCAtFinallyStmt(SourceLocation AtLoc, Stmt *Body)
StmtResult BuildObjCAtThrowStmt(SourceLocation AtLoc, Expr *Throw)
ExprResult ActOnObjCAtSynchronizedOperand(SourceLocation atLoc, Expr *operand)
ExprResult BuildObjCBridgedCast(SourceLocation LParenLoc, ObjCBridgeCastKind Kind, SourceLocation BridgeKeywordLoc, TypeSourceInfo *TSInfo, Expr *SubExpr)
StmtResult ActOnObjCAtCatchStmt(SourceLocation AtLoc, SourceLocation RParen, Decl *Parm, Stmt *Body)
StmtResult ActOnObjCAutoreleasePoolStmt(SourceLocation AtLoc, Stmt *Body)
ExprResult BuildObjCSubscriptExpression(SourceLocation RB, Expr *BaseExpr, Expr *IndexExpr, ObjCMethodDecl *getterMethod, ObjCMethodDecl *setterMethod)
Build an ObjC subscript pseudo-object expression, given that that's supported by the runtime.
Helper type for the registration/assignment of constructs that need to 'know' about their parent cons...
Helper type to restore the state of various 'loop' constructs when we run into a loop (for,...
A type to represent all the data for an OpenACC Clause that has been parsed, but not yet created/sema...
void ActOnWhileStmt(SourceLocation WhileLoc)
ExprResult ActOnOpenACCAsteriskSizeExpr(SourceLocation AsteriskLoc)
void ActOnDoStmt(SourceLocation DoLoc)
void ActOnRangeForStmtBegin(SourceLocation ForLoc, const Stmt *OldRangeFor, const Stmt *RangeFor)
StmtResult ActOnEndStmtDirective(OpenACCDirectiveKind K, SourceLocation StartLoc, SourceLocation DirLoc, SourceLocation LParenLoc, SourceLocation MiscLoc, ArrayRef< Expr * > Exprs, OpenACCAtomicKind AK, SourceLocation RParenLoc, SourceLocation EndLoc, ArrayRef< OpenACCClause * > Clauses, StmtResult AssocStmt)
Called after the directive has been completely parsed, including the declaration group or associated ...
void ActOnForStmtEnd(SourceLocation ForLoc, StmtResult Body)
void ActOnForStmtBegin(SourceLocation ForLoc, const Stmt *First, const Stmt *Second, const Stmt *Third)
ExprResult ActOnArraySectionExpr(Expr *Base, SourceLocation LBLoc, Expr *LowerBound, SourceLocation ColonLocFirst, Expr *Length, SourceLocation RBLoc)
Checks and creates an Array Section used in an OpenACC construct/clause.
OMPClause * ActOnOpenMPNocontextClause(Expr *Condition, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'nocontext' clause.
OMPClause * ActOnOpenMPXDynCGroupMemClause(Expr *Size, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on a well-formed 'ompx_dyn_cgroup_mem' clause.
OMPClause * ActOnOpenMPSafelenClause(Expr *Length, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'safelen' clause.
OMPClause * ActOnOpenMPHoldsClause(Expr *E, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'holds' clause.
OMPClause * ActOnOpenMPFilterClause(Expr *ThreadID, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'filter' clause.
OMPClause * ActOnOpenMPFullClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-form 'full' clauses.
OMPClause * ActOnOpenMPDetachClause(Expr *Evt, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'detach' clause.
OMPClause * ActOnOpenMPUseClause(Expr *InteropVar, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation VarLoc, SourceLocation EndLoc)
Called on well-formed 'use' clause.
OMPClause * ActOnOpenMPPrivateClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'private' clause.
OMPClause * ActOnOpenMPOrderedClause(SourceLocation StartLoc, SourceLocation EndLoc, SourceLocation LParenLoc=SourceLocation(), Expr *NumForLoops=nullptr)
Called on well-formed 'ordered' clause.
OMPClause * ActOnOpenMPIsDevicePtrClause(ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs)
Called on well-formed 'is_device_ptr' clause.
OMPClause * ActOnOpenMPCountsClause(ArrayRef< Expr * > CountExprs, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc, std::optional< unsigned > FillIdx, SourceLocation FillLoc, unsigned FillCount)
Called on well-formed 'counts' clause after parsing its arguments.
OMPClause * ActOnOpenMPHasDeviceAddrClause(ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs)
Called on well-formed 'has_device_addr' clause.
OMPClause * ActOnOpenMPPartialClause(Expr *FactorExpr, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-form 'partial' clauses.
OMPClause * ActOnOpenMPLastprivateClause(ArrayRef< Expr * > VarList, OpenMPLastprivateModifier LPKind, SourceLocation LPKindLoc, SourceLocation ColonLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'lastprivate' clause.
OMPClause * ActOnOpenMPFirstprivateClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'firstprivate' clause.
OMPClause * ActOnOpenMPPriorityClause(Expr *Priority, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'priority' clause.
OMPClause * ActOnOpenMPDistScheduleClause(OpenMPDistScheduleClauseKind Kind, Expr *ChunkSize, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation KindLoc, SourceLocation CommaLoc, SourceLocation EndLoc)
Called on well-formed 'dist_schedule' clause.
OMPClause * ActOnOpenMPLoopRangeClause(Expr *First, Expr *Count, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation FirstLoc, SourceLocation CountLoc, SourceLocation EndLoc)
Called on well-form 'looprange' clause after parsing its arguments.
OMPClause * ActOnOpenMPPermutationClause(ArrayRef< Expr * > PermExprs, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-form 'permutation' clause after parsing its arguments.
OMPClause * ActOnOpenMPNontemporalClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'nontemporal' clause.
OMPClause * ActOnOpenMPBindClause(OpenMPBindClauseKind Kind, SourceLocation KindLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on a well-formed 'bind' clause.
OMPClause * ActOnOpenMPThreadLimitClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'thread_limit' clause.
OMPClause * ActOnOpenMPSharedClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'shared' clause.
OMPClause * ActOnOpenMPCopyinClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'copyin' clause.
OMPClause * ActOnOpenMPDestroyClause(Expr *InteropVar, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation VarLoc, SourceLocation EndLoc)
Called on well-formed 'destroy' clause.
OMPClause * ActOnOpenMPAffinityClause(SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc, Expr *Modifier, ArrayRef< Expr * > Locators)
Called on well-formed 'affinity' clause.
OMPClause * ActOnOpenMPNumTeamsClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'num_teams' clause.
OMPClause * ActOnOpenMPDependClause(const OMPDependClause::DependDataTy &Data, Expr *DepModifier, ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'depend' clause.
OMPClause * ActOnOpenMPDoacrossClause(OpenMPDoacrossClauseModifier DepType, SourceLocation DepLoc, SourceLocation ColonLoc, ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'doacross' clause.
OMPClause * ActOnOpenMPUseDevicePtrClause(ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs, OpenMPUseDevicePtrFallbackModifier FallbackModifier, SourceLocation FallbackModifierLoc)
Called on well-formed 'use_device_ptr' clause.
OMPClause * ActOnOpenMPGrainsizeClause(OpenMPGrainsizeClauseModifier Modifier, Expr *Size, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ModifierLoc, SourceLocation EndLoc)
Called on well-formed 'grainsize' clause.
ExprResult ActOnOMPArraySectionExpr(Expr *Base, SourceLocation LBLoc, Expr *LowerBound, SourceLocation ColonLocFirst, SourceLocation ColonLocSecond, Expr *Length, Expr *Stride, SourceLocation RBLoc)
ExprResult ActOnOMPIteratorExpr(Scope *S, SourceLocation IteratorKwLoc, SourceLocation LLoc, SourceLocation RLoc, ArrayRef< OMPIteratorData > Data)
OMPClause * ActOnOpenMPUsesAllocatorClause(SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc, ArrayRef< UsesAllocatorsData > Data)
Called on well-formed 'uses_allocators' clause.
OMPClause * ActOnOpenMPAllocatorClause(Expr *Allocator, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'allocator' clause.
OMPClause * ActOnOpenMPInclusiveClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'inclusive' clause.
OMPClause * ActOnOpenMPTaskReductionClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc, CXXScopeSpec &ReductionIdScopeSpec, const DeclarationNameInfo &ReductionId, ArrayRef< Expr * > UnresolvedReductions={})
Called on well-formed 'task_reduction' clause.
OMPClause * ActOnOpenMPNowaitClause(SourceLocation StartLoc, SourceLocation EndLoc, SourceLocation LParenLoc, Expr *Condition)
Called on well-formed 'nowait' clause.
OMPClause * ActOnOpenMPOrderClause(OpenMPOrderClauseModifier Modifier, OpenMPOrderClauseKind Kind, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation MLoc, SourceLocation KindLoc, SourceLocation EndLoc)
Called on well-formed 'order' clause.
OMPClause * ActOnOpenMPSizesClause(ArrayRef< Expr * > SizeExprs, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-form 'sizes' clause.
OMPClause * ActOnOpenMPDeviceClause(OpenMPDeviceClauseModifier Modifier, Expr *Device, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ModifierLoc, SourceLocation EndLoc)
Called on well-formed 'device' clause.
OMPClause * ActOnOpenMPInReductionClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc, CXXScopeSpec &ReductionIdScopeSpec, const DeclarationNameInfo &ReductionId, ArrayRef< Expr * > UnresolvedReductions={})
Called on well-formed 'in_reduction' clause.
OMPClause * ActOnOpenMPFlushClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'flush' pseudo clause.
StmtResult ActOnOpenMPExecutableDirective(OpenMPDirectiveKind Kind, const DeclarationNameInfo &DirName, OpenMPDirectiveKind CancelRegion, ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
OMPClause * ActOnOpenMPMessageClause(Expr *MS, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'message' clause.
OMPClause * ActOnOpenMPScheduleClause(OpenMPScheduleClauseModifier M1, OpenMPScheduleClauseModifier M2, OpenMPScheduleClauseKind Kind, Expr *ChunkSize, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation M1Loc, SourceLocation M2Loc, SourceLocation KindLoc, SourceLocation CommaLoc, SourceLocation EndLoc)
Called on well-formed 'schedule' clause.
OMPClause * ActOnOpenMPSimdlenClause(Expr *Length, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'simdlen' clause.
OMPClause * ActOnOpenMPProcBindClause(llvm::omp::ProcBindKind Kind, SourceLocation KindLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'proc_bind' clause.
OMPClause * ActOnOpenMPXBareClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on a well-formed 'ompx_bare' clause.
StmtResult ActOnOpenMPInformationalDirective(OpenMPDirectiveKind Kind, const DeclarationNameInfo &DirName, ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Process an OpenMP informational directive.
StmtResult ActOnOpenMPCanonicalLoop(Stmt *AStmt)
Called for syntactical loops (ForStmt or CXXForRangeStmt) associated to an OpenMP loop directive.
OMPClause * ActOnOpenMPTransparentClause(Expr *Transparent, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'transparent' clause.
OMPClause * ActOnOpenMPHintClause(Expr *Hint, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'hint' clause.
ExprResult ActOnOMPArrayShapingExpr(Expr *Base, SourceLocation LParenLoc, SourceLocation RParenLoc, ArrayRef< Expr * > Dims, ArrayRef< SourceRange > Brackets)
OMPClause * ActOnOpenMPNumThreadsClause(OpenMPNumThreadsClauseModifier Modifier, Expr *NumThreads, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ModifierLoc, SourceLocation EndLoc)
Called on well-formed 'num_threads' clause.
OMPClause * ActOnOpenMPAtClause(OpenMPAtClauseKind Kind, SourceLocation KindLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'at' clause.
OMPClause * ActOnOpenMPInitClause(Expr *InteropVar, OMPInteropInfo &InteropInfo, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation VarLoc, SourceLocation EndLoc)
Called on well-formed 'init' clause.
OMPClause * ActOnOpenMPUseDeviceAddrClause(ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs)
Called on well-formed 'use_device_addr' clause.
OMPClause * ActOnOpenMPAllocateClause(Expr *Allocator, Expr *Alignment, OpenMPAllocateClauseModifier FirstModifier, SourceLocation FirstModifierLoc, OpenMPAllocateClauseModifier SecondModifier, SourceLocation SecondModifierLoc, ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation ColonLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'allocate' clause.
OMPClause * ActOnOpenMPFinalClause(Expr *Condition, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'final' clause.
OMPClause * ActOnOpenMPMapClause(Expr *IteratorModifier, ArrayRef< OpenMPMapModifierKind > MapTypeModifiers, ArrayRef< SourceLocation > MapTypeModifiersLoc, CXXScopeSpec &MapperIdScopeSpec, DeclarationNameInfo &MapperId, OpenMPMapClauseKind MapType, bool IsMapTypeImplicit, SourceLocation MapLoc, SourceLocation ColonLoc, ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs, bool NoDiagnose=false, ArrayRef< Expr * > UnresolvedMappers={})
Called on well-formed 'map' clause.
OMPClause * ActOnOpenMPNumTasksClause(OpenMPNumTasksClauseModifier Modifier, Expr *NumTasks, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ModifierLoc, SourceLocation EndLoc)
Called on well-formed 'num_tasks' clause.
OMPClause * ActOnOpenMPFromClause(ArrayRef< OpenMPMotionModifierKind > MotionModifiers, ArrayRef< SourceLocation > MotionModifiersLoc, Expr *IteratorModifier, CXXScopeSpec &MapperIdScopeSpec, DeclarationNameInfo &MapperId, SourceLocation ColonLoc, ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs, ArrayRef< Expr * > UnresolvedMappers={})
Called on well-formed 'from' clause.
OMPClause * ActOnOpenMPDynGroupprivateClause(OpenMPDynGroupprivateClauseModifier M1, OpenMPDynGroupprivateClauseFallbackModifier M2, Expr *Size, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation M1Loc, SourceLocation M2Loc, SourceLocation EndLoc)
Called on a well-formed 'dyn_groupprivate' clause.
void StartOpenMPDSABlock(OpenMPDirectiveKind K, const DeclarationNameInfo &DirName, Scope *CurScope, SourceLocation Loc)
Called on start of new data sharing attribute block.
OMPClause * ActOnOpenMPSeverityClause(OpenMPSeverityClauseKind Kind, SourceLocation KindLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'severity' clause.
OMPClause * ActOnOpenMPToClause(ArrayRef< OpenMPMotionModifierKind > MotionModifiers, ArrayRef< SourceLocation > MotionModifiersLoc, Expr *IteratorModifier, CXXScopeSpec &MapperIdScopeSpec, DeclarationNameInfo &MapperId, SourceLocation ColonLoc, ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs, ArrayRef< Expr * > UnresolvedMappers={})
Called on well-formed 'to' clause.
OMPClause * ActOnOpenMPLinearClause(ArrayRef< Expr * > VarList, Expr *Step, SourceLocation StartLoc, SourceLocation LParenLoc, OpenMPLinearClauseKind LinKind, SourceLocation LinLoc, SourceLocation ColonLoc, SourceLocation StepModifierLoc, SourceLocation EndLoc)
Called on well-formed 'linear' clause.
OMPClause * ActOnOpenMPDefaultmapClause(OpenMPDefaultmapClauseModifier M, OpenMPDefaultmapClauseKind Kind, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation MLoc, SourceLocation KindLoc, SourceLocation EndLoc)
Called on well-formed 'defaultmap' clause.
OMPClause * ActOnOpenMPReductionClause(ArrayRef< Expr * > VarList, OpenMPVarListDataTy::OpenMPReductionClauseModifiers Modifiers, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ModifierLoc, SourceLocation ColonLoc, SourceLocation EndLoc, CXXScopeSpec &ReductionIdScopeSpec, const DeclarationNameInfo &ReductionId, ArrayRef< Expr * > UnresolvedReductions={})
Called on well-formed 'reduction' clause.
OMPClause * ActOnOpenMPAlignedClause(ArrayRef< Expr * > VarList, Expr *Alignment, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc)
Called on well-formed 'aligned' clause.
OMPClause * ActOnOpenMPDepobjClause(Expr *Depobj, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'depobj' pseudo clause.
OMPClause * ActOnOpenMPNovariantsClause(Expr *Condition, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'novariants' clause.
OMPClause * ActOnOpenMPCopyprivateClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'copyprivate' clause.
OMPClause * ActOnOpenMPCollapseClause(Expr *NumForLoops, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'collapse' clause.
OMPClause * ActOnOpenMPDefaultClause(llvm::omp::DefaultKind M, SourceLocation MLoc, OpenMPDefaultClauseVariableCategory VCKind, SourceLocation VCKindLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'default' clause.
OMPClause * ActOnOpenMPAlignClause(Expr *Alignment, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'align' clause.
OMPClause * ActOnOpenMPXAttributeClause(ArrayRef< const Attr * > Attrs, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on a well-formed 'ompx_attribute' clause.
OMPClause * ActOnOpenMPExclusiveClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'exclusive' clause.
OMPClause * ActOnOpenMPIfClause(OpenMPDirectiveKind NameModifier, Expr *Condition, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation NameModifierLoc, SourceLocation ColonLoc, SourceLocation EndLoc)
Called on well-formed 'if' clause.
Expr * recreateSyntacticForm(PseudoObjectExpr *E)
Given a pseudo-object expression, recreate what it looks like syntactically without the attendant Opa...
ExprResult checkRValue(Expr *E)
StmtResult BuildSYCLKernelCallStmt(FunctionDecl *FD, CompoundStmt *Body, Expr *LaunchIdExpr)
Builds a SYCLKernelCallStmt to wrap 'Body' and to be used as the body of 'FD'.
ExprResult BuildUniqueStableNameExpr(SourceLocation OpLoc, SourceLocation LParen, SourceLocation RParen, TypeSourceInfo *TSI)
RAII object used to change the argument pack substitution index within a Sema object.
RAII object used to temporarily allow the C++ 'this' expression to be used, with the given qualifiers...
A RAII object to enter scope of a compound statement.
A helper class for building up ExtParameterInfos.
const FunctionProtoType::ExtParameterInfo * getPointerOrNull(unsigned numParams)
Return a pointer (suitable for setting in an ExtProtoInfo) to the ExtParameterInfo array we've built ...
void set(unsigned index, FunctionProtoType::ExtParameterInfo info)
Set the ExtParameterInfo for the parameter at the given index,.
Records and restores the CurFPFeatures state on entry/exit of compound statements.
Sema - This implements semantic analysis and AST building for C.
ParsedType CreateParsedType(QualType T, TypeSourceInfo *TInfo)
Package the given type and TSI into a ParsedType.
ExprResult ActOnCXXParenListInitExpr(ArrayRef< Expr * > Args, QualType T, unsigned NumUserSpecifiedExprs, SourceLocation InitLoc, SourceLocation LParenLoc, SourceLocation RParenLoc)
ExprResult BuildOperatorCoawaitCall(SourceLocation Loc, Expr *E, UnresolvedLookupExpr *Lookup)
Build a call to 'operator co_await' if there is a suitable operator for the given expression.
ExprResult BuildMemberReferenceExpr(Expr *Base, QualType BaseType, SourceLocation OpLoc, bool IsArrow, CXXScopeSpec &SS, SourceLocation TemplateKWLoc, NamedDecl *FirstQualifierInScope, const DeclarationNameInfo &NameInfo, const TemplateArgumentListInfo *TemplateArgs, const Scope *S, ActOnMemberAccessExtraArgs *ExtraArgs=nullptr)
StmtResult BuildMSDependentExistsStmt(SourceLocation KeywordLoc, bool IsIfExists, NestedNameSpecifierLoc QualifierLoc, DeclarationNameInfo NameInfo, Stmt *Nested)
@ LookupOrdinaryName
Ordinary name lookup, which finds ordinary names (functions, variables, typedefs, etc....
@ LookupMemberName
Member name lookup, which finds the names of class/struct/union members.
@ LookupTagName
Tag name lookup, which finds the names of enums, classes, structs, and unions.
bool checkFinalSuspendNoThrow(const Stmt *FinalSuspend)
Check that the expression co_await promise.final_suspend() shall not be potentially-throwing.
ExprResult CreateBuiltinMatrixSingleSubscriptExpr(Expr *Base, Expr *RowIdx, SourceLocation RBLoc)
ExprResult ActOnConstantExpression(ExprResult Res)
StmtResult ActOnMSAsmStmt(SourceLocation AsmLoc, SourceLocation LBraceLoc, ArrayRef< Token > AsmToks, StringRef AsmString, unsigned NumOutputs, unsigned NumInputs, ArrayRef< StringRef > Constraints, ArrayRef< StringRef > Clobbers, ArrayRef< Expr * > Exprs, SourceLocation EndLoc)
StmtResult BuildCoroutineBodyStmt(CoroutineBodyStmt::CtorArgs)
ExprResult BuildCoyieldExpr(SourceLocation KwLoc, Expr *E)
void ActOnStartStmtExpr()
void ActOnStmtExprError()
void MarkDeclarationsReferencedInExpr(Expr *E, bool SkipLocalVariables=false, ArrayRef< const Expr * > StopAt={})
Mark any declarations that appear within this expression or any potentially-evaluated subexpressions ...
VarDecl * buildCoroutinePromise(SourceLocation Loc)
ExprResult CheckBooleanCondition(SourceLocation Loc, Expr *E, bool IsConstexpr=false)
CheckBooleanCondition - Diagnose problems involving the use of the given expression as a boolean cond...
@ Boolean
A boolean condition, from 'if', 'while', 'for', or 'do'.
@ Switch
An integral condition for a 'switch' statement.
@ ConstexprIf
A constant boolean condition from 'if constexpr'.
ExprResult 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 BuildSubstNonTypeTemplateParmExpr(Decl *AssociatedDecl, unsigned Index, QualType ParamType, SourceLocation loc, TemplateArgument Replacement, UnsignedOrNone PackIndex, bool Final)
ExprResult BuildCXXConstructExpr(SourceLocation ConstructLoc, QualType DeclInitType, NamedDecl *FoundDecl, CXXConstructorDecl *Constructor, MultiExprArg Exprs, bool HadMultipleCandidates, bool IsListInitialization, bool IsStdInitListInitialization, bool RequiresZeroInit, CXXConstructionKind ConstructKind, SourceRange ParenRange)
BuildCXXConstructExpr - Creates a complete call to a constructor, including handling of its default a...
ExprResult BuildAsTypeExpr(Expr *E, QualType DestTy, SourceLocation BuiltinLoc, SourceLocation RParenLoc)
Create a new AsTypeExpr node (bitcast) from the arguments.
ExprResult BuildFieldReferenceExpr(Expr *BaseExpr, bool IsArrow, SourceLocation OpLoc, const CXXScopeSpec &SS, FieldDecl *Field, DeclAccessPair FoundDecl, const DeclarationNameInfo &MemberNameInfo)
ExprResult ActOnConditionalOp(SourceLocation QuestionLoc, SourceLocation ColonLoc, Expr *CondExpr, Expr *LHSExpr, Expr *RHSExpr)
ActOnConditionalOp - Parse a ?
ExprResult BuildPossibleImplicitMemberExpr(const CXXScopeSpec &SS, SourceLocation TemplateKWLoc, LookupResult &R, const TemplateArgumentListInfo *TemplateArgs, const Scope *S)
Builds an expression which might be an implicit member expression.
UnsignedOrNone ArgPackSubstIndex
The current index into pack expansion arguments that will be used for substitution of parameter packs...
StmtResult BuildReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp, bool AllowRecovery=false)
StmtResult BuildCXXForRangeStmt(SourceLocation ForLoc, SourceLocation CoawaitLoc, Stmt *InitStmt, SourceLocation ColonLoc, Stmt *RangeDecl, Stmt *Begin, Stmt *End, Expr *Cond, Expr *Inc, Stmt *LoopVarDecl, SourceLocation RParenLoc, BuildForRangeKind Kind, ArrayRef< MaterializeTemporaryExpr * > LifetimeExtendTemps={})
BuildCXXForRangeStmt - Build or instantiate a C++11 for-range statement.
StmtResult ActOnDoStmt(SourceLocation DoLoc, Stmt *Body, SourceLocation WhileLoc, SourceLocation CondLParen, Expr *Cond, SourceLocation CondRParen)
StmtResult ActOnStartOfSwitchStmt(SourceLocation SwitchLoc, SourceLocation LParenLoc, Stmt *InitStmt, ConditionResult Cond, SourceLocation RParenLoc)
ExprResult BuildQualifiedTemplateIdExpr(CXXScopeSpec &SS, SourceLocation TemplateKWLoc, const DeclarationNameInfo &NameInfo, const TemplateArgumentListInfo *TemplateArgs, bool IsAddressOfOperand)
@ ConstantEvaluated
The current context is "potentially evaluated" in C++11 terms, but the expression is evaluated at com...
@ PotentiallyEvaluated
The current expression is potentially evaluated at run time, which means that code may be generated t...
@ Unevaluated
The current expression and its subexpressions occur within an unevaluated operand (C++11 [expr]p7),...
@ ImmediateFunctionContext
In addition of being constant evaluated, the current expression occurs in an immediate function conte...
StmtResult ActOnSEHExceptBlock(SourceLocation Loc, Expr *FilterExpr, Stmt *Block)
ExprResult CreateUnaryExprOrTypeTraitExpr(TypeSourceInfo *TInfo, SourceLocation OpLoc, UnaryExprOrTypeTrait ExprKind, SourceRange R)
Build a sizeof or alignof expression given a type operand.
StmtResult ActOnDeclStmt(DeclGroupPtrTy Decl, SourceLocation StartLoc, SourceLocation EndLoc)
bool RequireCompleteType(SourceLocation Loc, QualType T, CompleteTypeKind Kind, TypeDiagnoser &Diagnoser)
Ensure that the type T is a complete type.
ExprResult PerformObjectMemberConversion(Expr *From, NestedNameSpecifier Qualifier, NamedDecl *FoundDecl, NamedDecl *Member)
Cast a base object to a member's actual type.
Expr * MaybeCreateExprWithCleanups(Expr *SubExpr)
MaybeCreateExprWithCleanups - If the current full-expression requires any cleanups,...
SmallVector< ExpressionEvaluationContextRecord, 8 > ExprEvalContexts
A stack of expression evaluation contexts.
ExprResult BuildEmptyCXXFoldExpr(SourceLocation EllipsisLoc, BinaryOperatorKind Operator)
ExprResult BuildCXXThrow(SourceLocation OpLoc, Expr *Ex, bool IsThrownVarInScope)
ExprResult BuildBinOp(Scope *S, SourceLocation OpLoc, BinaryOperatorKind Opc, Expr *LHSExpr, Expr *RHSExpr, bool ForFoldExpression=false)
ExprResult BuildCXXDefaultInitExpr(SourceLocation Loc, FieldDecl *Field)
ExprResult BuildLambdaExpr(SourceLocation StartLoc, SourceLocation EndLoc)
Complete a lambda-expression having processed and attached the lambda body.
@ BFRK_Rebuild
Instantiation or recovery rebuild of a for-range statement.
void ActOnCaseStmtBody(Stmt *CaseStmt, Stmt *SubStmt)
ActOnCaseStmtBody - This installs a statement as the body of a case.
ExprResult ActOnBlockStmtExpr(SourceLocation CaretLoc, Stmt *Body, Scope *CurScope)
ActOnBlockStmtExpr - This is called when the body of a block statement literal was successfully compl...
ExprResult BuildArrayTypeTrait(ArrayTypeTrait ATT, SourceLocation KWLoc, TypeSourceInfo *TSInfo, Expr *DimExpr, SourceLocation RParen)
void MarkMemberReferenced(MemberExpr *E)
Perform reference-marking and odr-use handling for a MemberExpr.
ExprResult BuildCXXNamedCast(SourceLocation OpLoc, tok::TokenKind Kind, TypeSourceInfo *Ty, Expr *E, SourceRange AngleBrackets, SourceRange Parens)
void MarkFunctionReferenced(SourceLocation Loc, FunctionDecl *Func, bool MightBeOdrUse=true)
Mark a function referenced, and check whether it is odr-used (C++ [basic.def.odr]p2,...
ExprResult CreateRecoveryExpr(SourceLocation Begin, SourceLocation End, ArrayRef< Expr * > SubExprs, QualType T=QualType())
Attempts to produce a RecoveryExpr after some AST node cannot be created.
ExprResult ActOnGCCAsmStmtString(Expr *Stm, bool ForAsmLabel)
StmtResult ActOnIfStmt(SourceLocation IfLoc, IfStatementKind StatementKind, SourceLocation LParenLoc, Stmt *InitStmt, ConditionResult Cond, SourceLocation RParenLoc, Stmt *ThenVal, SourceLocation ElseLoc, Stmt *ElseVal)
void ActOnBlockStart(SourceLocation CaretLoc, Scope *CurScope)
ActOnBlockStart - This callback is invoked when a block literal is started.
ExprResult ActOnArraySubscriptExpr(Scope *S, Expr *Base, SourceLocation LLoc, MultiExprArg ArgExprs, SourceLocation RLoc)
ExprResult BuildAtomicExpr(SourceRange CallRange, SourceRange ExprRange, SourceLocation RParenLoc, MultiExprArg Args, AtomicExpr::AtomicOp Op, AtomicArgumentOrder ArgOrder=AtomicArgumentOrder::API)
ExprResult ActOnCallExpr(Scope *S, Expr *Fn, SourceLocation LParenLoc, MultiExprArg ArgExprs, SourceLocation RParenLoc, Expr *ExecConfig=nullptr)
ActOnCallExpr - Handle a call to Fn with the specified array of arguments.
OpaquePtr< TemplateName > TemplateTy
static QualType GetTypeFromParser(ParsedType Ty, TypeSourceInfo **TInfo=nullptr)
static ConditionResult ConditionError()
StmtResult ActOnCompoundStmt(SourceLocation L, SourceLocation R, ArrayRef< Stmt * > Elts, bool isStmtExpr)
SemaPseudoObject & PseudoObject()
StmtResult ActOnCXXTryBlock(SourceLocation TryLoc, Stmt *TryBlock, ArrayRef< Stmt * > Handlers)
ActOnCXXTryBlock - Takes a try compound-statement and a number of handlers and creates a try statemen...
OpaquePtr< DeclGroupRef > DeclGroupPtrTy
StmtResult ActOnDefaultStmt(SourceLocation DefaultLoc, SourceLocation ColonLoc, Stmt *SubStmt, Scope *CurScope)
ExprResult HandleExprEvaluationContextForTypeof(Expr *E)
StmtResult ActOnCaseStmt(SourceLocation CaseLoc, ExprResult LHS, SourceLocation DotDotDotLoc, ExprResult RHS, SourceLocation ColonLoc)
TypeSourceInfo * CheckPackExpansion(TypeSourceInfo *Pattern, SourceLocation EllipsisLoc, UnsignedOrNone NumExpansions)
Construct a pack expansion type from the pattern of the pack expansion.
StmtResult FinishCXXForRangeStmt(Stmt *ForRange, Stmt *Body)
FinishCXXForRangeStmt - Attach the body to a C++0x for-range statement.
ExprResult ActOnFinishFullExpr(Expr *Expr, bool DiscardedValue)
ExprResult CreateBuiltinMatrixSubscriptExpr(Expr *Base, Expr *RowIdx, Expr *ColumnIdx, SourceLocation RBLoc)
StmtResult ActOnGCCAsmStmt(SourceLocation AsmLoc, bool IsSimple, bool IsVolatile, unsigned NumOutputs, unsigned NumInputs, IdentifierInfo **Names, MultiExprArg Constraints, MultiExprArg Exprs, Expr *AsmString, MultiExprArg Clobbers, unsigned NumLabels, SourceLocation RParenLoc)
ShuffleVectorExpr - clang-specific builtin-in function __builtin_shufflevector.
Represents an expression that computes the length of a parameter pack.
SourceLocation getPackLoc() const
Determine the location of the parameter pack.
bool isPartiallySubstituted() const
Determine whether this represents a partially-substituted sizeof... expression, such as is produced f...
static SizeOfPackExpr * Create(ASTContext &Context, SourceLocation OperatorLoc, NamedDecl *Pack, SourceLocation PackLoc, SourceLocation RParenLoc, UnsignedOrNone Length=std::nullopt, ArrayRef< TemplateArgument > PartialArgs={})
ArrayRef< TemplateArgument > getPartialArguments() const
Get.
SourceLocation getOperatorLoc() const
Determine the location of the 'sizeof' keyword.
SourceLocation getRParenLoc() const
Determine the location of the right parenthesis.
NamedDecl * getPack() const
Retrieve the parameter pack.
Represents a function call to one of __builtin_LINE(), __builtin_COLUMN(), __builtin_FUNCTION(),...
static bool MayBeDependent(SourceLocIdentKind Kind)
Encodes a location in the source.
bool isValid() const
Return true if this is a valid SourceLocation object.
A trivial tuple used to represent a source range.
SourceLocation getEnd() const
SourceLocation getBegin() const
StmtExpr - This is the GNU Statement Expression extension: ({int X=4; X;}).
Stmt - This represents one statement.
SourceLocation getEndLoc() const LLVM_READONLY
StmtClass getStmtClass() const
SourceRange getSourceRange() const LLVM_READONLY
SourceLocation tokens are not useful in isolation - they are low level value objects created/interpre...
StringLiteral - This represents a string literal expression, e.g.
Wrapper for substituted template type parameters.
Represents a reference to a non-type template parameter that has been substituted with a template arg...
Represents a reference to a non-type template parameter pack that has been substituted with a non-tem...
A structure for storing an already-substituted template template parameter pack.
A structure for storing the information associated with a substituted template template parameter.
Wrapper for substituted template type parameters.
SwitchStmt - This represents a 'switch' stmt.
Represents the declaration of a struct/union/class/enum.
SourceLocation getNameLoc() const
SourceLocation getElaboratedKeywordLoc() const
NestedNameSpecifierLoc getQualifierLoc() const
void setQualifierLoc(NestedNameSpecifierLoc QualifierLoc)
void setNameLoc(SourceLocation Loc)
void setElaboratedKeywordLoc(SourceLocation Loc)
A convenient class for passing around template argument information.
void setLAngleLoc(SourceLocation Loc)
void setRAngleLoc(SourceLocation Loc)
void addArgument(const TemplateArgumentLoc &Loc)
const TemplateArgumentLoc * operator->() const
pointer(TemplateArgumentLoc Arg)
Simple iterator that traverses the template arguments in a container that provides a getArgLoc() memb...
TemplateArgumentLoc operator*() const
TemplateArgumentLocContainerIterator operator++(int)
friend bool operator!=(const TemplateArgumentLocContainerIterator &X, const TemplateArgumentLocContainerIterator &Y)
TemplateArgumentLocContainerIterator()
TemplateArgumentLoc value_type
TemplateArgumentLocContainerIterator(ArgLocContainer &Container, unsigned Index)
friend bool operator==(const TemplateArgumentLocContainerIterator &X, const TemplateArgumentLocContainerIterator &Y)
TemplateArgumentLocContainerIterator & operator++()
std::input_iterator_tag iterator_category
TemplateArgumentLoc reference
pointer operator->() const
const TemplateArgumentLoc * operator->() const
pointer(TemplateArgumentLoc Arg)
Iterator adaptor that invents template argument location information for each of the template argumen...
TemplateArgumentLocInventIterator & operator++()
pointer operator->() const
std::iterator_traits< InputIterator >::difference_type difference_type
reference operator*() const
TemplateArgumentLocInventIterator operator++(int)
friend bool operator==(const TemplateArgumentLocInventIterator &X, const TemplateArgumentLocInventIterator &Y)
TemplateArgumentLocInventIterator(TreeTransform< Derived > &Self, InputIterator Iter)
friend bool operator!=(const TemplateArgumentLocInventIterator &X, const TemplateArgumentLocInventIterator &Y)
std::input_iterator_tag iterator_category
TemplateArgumentLoc reference
TemplateArgumentLoc value_type
Location wrapper for a TemplateArgument.
const TemplateArgument & getArgument() const
SourceLocation getTemplateNameLoc() const
SourceLocation getTemplateKWLoc() const
TypeSourceInfo * getTypeSourceInfo() const
Expr * getSourceExpression() const
NestedNameSpecifierLoc getTemplateQualifierLoc() const
Represents a template argument.
Expr * getAsExpr() const
Retrieve the template argument as an expression.
const TemplateArgument * pack_iterator
Iterator that traverses the elements of a template argument pack.
QualType getNonTypeTemplateArgumentType() const
If this is a non-type template argument, get its type.
QualType getAsType() const
Retrieve the type for a type template argument.
llvm::APSInt getAsIntegral() const
Retrieve the template argument as an integral value.
TemplateName getAsTemplate() const
Retrieve the template name for a template name argument.
bool containsUnexpandedParameterPack() const
Whether this template argument contains an unexpanded parameter pack.
ValueDecl * getAsDecl() const
Retrieve the declaration for a declaration non-type template argument.
@ Declaration
The template argument is a declaration that was provided for a pointer, reference,...
@ Template
The template argument is a template name that was provided for a template template parameter.
@ StructuralValue
The template argument is a non-type template argument that can't be represented by the special-case D...
@ Pack
The template argument is actually a parameter pack.
@ TemplateExpansion
The template argument is a pack expansion of a template name that was provided for a template templat...
@ NullPtr
The template argument is a null pointer or null pointer to member that was provided for a non-type te...
@ Type
The template argument is a type.
@ Null
Represents an empty template argument, e.g., one that has not been deduced.
@ Integral
The template argument is an integral value stored in an llvm::APSInt that was provided for an integra...
@ Expression
The template argument is an expression, and we've not resolved it to one of the other forms yet,...
ArgKind getKind() const
Return the kind of stored template argument.
bool isPackExpansion() const
Determine whether this template argument is a pack expansion.
const APValue & getAsStructuralValue() const
Get the value of a StructuralValue.
The base class of all kinds of template declarations (e.g., class, function, etc.).
Represents a C++ template name within the type system.
TemplateDecl * getAsTemplateDecl(bool IgnoreDeduced=false) const
Retrieve the underlying template declaration that this template name refers to, if known.
DeducedTemplateStorage * getAsDeducedTemplateName() const
Retrieve the deduced template info, if any.
bool isNull() const
Determine whether this template name is NULL.
DependentTemplateName * getAsDependentTemplateName() const
Retrieve the underlying dependent template name structure, if any.
QualifiedTemplateName * getAsQualifiedTemplateName() const
Retrieve the underlying qualified template name structure, if any.
NestedNameSpecifier getQualifier() const
SubstTemplateTemplateParmPackStorage * getAsSubstTemplateTemplateParmPack() const
Retrieve the substituted template template parameter pack, if known.
SubstTemplateTemplateParmStorage * getAsSubstTemplateTemplateParm() const
Retrieve the substituted template template parameter, if known.
Stores a list of template parameters for a TemplateDecl and its derived classes.
unsigned getNumArgs() const
SourceLocation getLAngleLoc() const
SourceLocation getRAngleLoc() const
SourceLocation getTemplateNameLoc() const
SourceLocation getTemplateKeywordLoc() const
NestedNameSpecifierLoc getQualifierLoc() const
SourceLocation getElaboratedKeywordLoc() const
Wrapper for template type parameters.
The top declaration context.
TypeLoc getTypeLocInContext(ASTContext &Context, QualType T)
Copies the type-location information to the given AST context and returns a TypeLoc referring into th...
TyLocType push(QualType T)
Pushes space for a new TypeLoc of the given type.
void reserve(size_t Requested)
Ensures that this buffer has at least as much capacity as described.
void TypeWasModifiedSafely(QualType T)
Tell the TypeLocBuilder that the type it is storing has been modified in some safe way that doesn't a...
TypeSourceInfo * getTypeSourceInfo(ASTContext &Context, QualType T)
Creates a TypeSourceInfo for the given type.
Base wrapper for a particular "section" of type source info.
UnqualTypeLoc getUnqualifiedLoc() const
Skips past any qualifiers, if this is qualified.
QualType getType() const
Get the type for which this source info wrapper provides information.
T getAs() const
Convert to the specified TypeLoc type, returning a null TypeLoc if this TypeLoc is not of the desired...
T castAs() const
Convert to the specified TypeLoc type, asserting that this TypeLoc is of the desired type.
SourceRange getSourceRange() const LLVM_READONLY
Get the full source range.
unsigned getFullDataSize() const
Returns the size of the type source info data block.
TypeLocClass getTypeLocClass() const
T getAsAdjusted() const
Convert to the specified TypeLoc type, returning a null TypeLoc if this TypeLoc is not of the desired...
SourceLocation getBeginLoc() const
Get the begin source location.
Represents a typeof (or typeof) expression (a C23 feature and GCC extension) or a typeof_unqual expre...
A container of type source information.
TypeLoc getTypeLoc() const
Return the TypeLoc wrapper for the type source info.
QualType getType() const
Return the type wrapped by this type source info.
void setNameLoc(SourceLocation Loc)
A type trait used in the implementation of various C++11 and Library TR1 trait templates.
The base class of the type hierarchy.
bool containsUnexpandedParameterPack() const
Whether this type is or contains an unexpanded parameter pack, used to support C++0x variadic templat...
bool isOverloadableType() const
Determines whether this is a type for which one can define an overloaded operator.
bool isObjCObjectPointerType() const
const T * getAs() const
Member-template getAs<specific type>'.
Base class for declarations which introduce a typedef-name.
Wrapper for source info for typedefs.
void setTypeofLoc(SourceLocation Loc)
UnaryExprOrTypeTraitExpr - expression with either a type or (unevaluated) expression operand.
UnaryOperator - This represents the unary-expression's (except sizeof and alignof),...
SourceLocation getOperatorLoc() const
getOperatorLoc - Return the location of the operator.
Expr * getSubExpr() const
static Opcode getOverloadedOpcode(OverloadedOperatorKind OO, bool Postfix)
Retrieve the unary opcode that corresponds to the given overloaded operator.
Represents a C++ unqualified-id that has been parsed.
void setOperatorFunctionId(SourceLocation OperatorLoc, OverloadedOperatorKind Op, SourceLocation SymbolLocations[3])
Specify that this unqualified-id was parsed as an operator-function-id.
A reference to a name which we were able to look up during parsing but could not resolve to a specifi...
CXXRecordDecl * getNamingClass()
Gets the 'naming class' (in the sense of C++0x [class.access.base]p5) of the lookup.
bool requiresADL() const
True if this declaration should be extended by argument-dependent lookup.
static UnresolvedLookupExpr * Create(const ASTContext &Context, CXXRecordDecl *NamingClass, NestedNameSpecifierLoc QualifierLoc, const DeclarationNameInfo &NameInfo, bool RequiresADL, UnresolvedSetIterator Begin, UnresolvedSetIterator End, bool KnownDependent, bool KnownInstantiationDependent)
Represents a C++ member access expression for which lookup produced a set of overloaded functions.
A set of unresolved declarations.
void append(iterator I, iterator E)
A set of unresolved declarations.
Wrapper for source info for unresolved typename using decls.
Represents the dependent type named by a dependently-scoped typename using declaration,...
A call to a literal operator (C++11 [over.literal]) written as a user-defined literal (C++11 [lit....
Represents a shadow declaration implicitly introduced into a scope by a (resolved) using-declaration ...
NamedDecl * getTargetDecl() const
Gets the underlying declaration which has been brought into the local scope.
Wrapper for source info for types used via transparent aliases.
Represents a call to the builtin function __builtin_va_arg.
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
bool isParameterPack() const
Determine whether this value is actually a function parameter pack, init-capture pack,...
Represents a variable declaration or definition.
@ CInit
C-style initialization with assignment.
@ CallInit
Call-style initialization (C++98)
StorageClass getStorageClass() const
Returns the storage class as written in the source.
Represents a C array with a specified size that is not an integer-constant-expression.
void setNameLoc(SourceLocation Loc)
Represents a GCC generic vector type.
WhileStmt - This represents a 'while' stmt.
A requires-expression requirement which queries the validity and properties of an expression ('simple...
SubstitutionDiagnostic * getExprSubstitutionDiagnostic() const
bool isExprSubstitutionFailure() const
const ReturnTypeRequirement & getReturnTypeRequirement() const
SourceLocation getNoexceptLoc() const
A requires-expression requirement which is satisfied when a general constraint expression is satisfie...
const ASTConstraintSatisfaction & getConstraintSatisfaction() const
bool hasInvalidConstraint() const
Expr * getConstraintExpr() const
StringRef getInvalidConstraintEntity()
A static requirement that can be used in a requires-expression to check properties of types and expre...
A requires-expression requirement which queries the existence of a type name or type template special...
bool isSubstitutionFailure() const
SubstitutionDiagnostic * getSubstitutionDiagnostic() const
TypeSourceInfo * getType() const
Retains information about a block that is currently being parsed.
bool ContainsUnexpandedParameterPack
Whether this contains an unexpanded parameter pack.
CXXRecordDecl * Lambda
The class that describes the lambda.
CXXMethodDecl * CallOperator
The lambda's compiler-generated operator().
@ AttributedType
The l-value was considered opaque, so the alignment was determined from a type, but that type was an ...
const AstTypeMatcher< FunctionType > functionType
llvm::PointerUnion< const Decl *, const Expr * > DeclTy
bool Comp(InterpState &S, CodePtr OpPC)
1) Pops the value from the stack.
bool Inc(InterpState &S, CodePtr OpPC, bool CanOverflow)
1) Pops a pointer from the stack 2) Load the value from the pointer 3) Writes the value increased by ...
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.
OptionalUnsigned< unsigned > UnsignedOrNone
bool isComputedNoexcept(ExceptionSpecificationType ESpecType)
OpenMPLastprivateModifier
OpenMP 'lastprivate' clause modifier.
@ Template
We are parsing a template declaration.
ActionResult< CXXBaseSpecifier * > BaseResult
OpenMPGrainsizeClauseModifier
OpenMPNumTasksClauseModifier
TagTypeKind
The kind of a tag type.
bool transformOMPMappableExprListClause(TreeTransform< Derived > &TT, OMPMappableExprListClause< T > *C, llvm::SmallVectorImpl< Expr * > &Vars, CXXScopeSpec &MapperIdScopeSpec, DeclarationNameInfo &MapperIdInfo, llvm::SmallVectorImpl< Expr * > &UnresolvedMappers)
OpenMPUseDevicePtrFallbackModifier
OpenMP 6.1 use_device_ptr fallback modifier.
@ Keyword
The name has been typo-corrected to a keyword.
bool isOpenMPLoopDirective(OpenMPDirectiveKind DKind)
Checks if the specified directive is a directive with an associated loop construct.
OpenMPSeverityClauseKind
OpenMP attributes for 'severity' clause.
@ Deduced
The normal deduced case.
@ Undeduced
Not deduced yet. This is for example an 'auto' which was just parsed.
std::tuple< NamedDecl *, TemplateArgument > getReplacedTemplateParameter(Decl *D, unsigned Index)
Internal helper used by Subst* nodes to retrieve a parameter from the AssociatedDecl,...
OpenMPDefaultmapClauseKind
OpenMP attributes for 'defaultmap' clause.
OpenMPAllocateClauseModifier
OpenMP modifiers for 'allocate' clause.
OpenMPLinearClauseKind
OpenMP attributes for 'linear' clause.
llvm::omp::Directive OpenMPDirectiveKind
OpenMP directives.
OpenMPDynGroupprivateClauseModifier
@ VK_PRValue
A pr-value expression (in the C++11 taxonomy) produces a temporary value.
@ VK_LValue
An l-value expression is a reference to an object with independent storage.
@ Dependent
The name is a dependent name, so the results will differ from one instantiation to the next.
@ Exists
The symbol exists.
@ Error
An error occurred.
@ DoesNotExist
The symbol does not exist.
MutableArrayRef< Stmt * > MultiStmtArg
OpenMPNumThreadsClauseModifier
U cast(CodeGen::Address addr)
OpenMPDeviceClauseModifier
OpenMP modifiers for 'device' clause.
OpaquePtr< QualType > ParsedType
An opaque type for threading parsed type information through the parser.
ElaboratedTypeKeyword
The elaboration keyword that precedes a qualified type name or introduces an elaborated-type-specifie...
@ None
No keyword precedes the qualified type name.
@ Class
The "class" keyword introduces the elaborated-type-specifier.
@ Typename
The "typename" keyword precedes the qualified type name, e.g., typename T::type.
ActionResult< Expr * > ExprResult
OpenMPOrderClauseKind
OpenMP attributes for 'order' clause.
TypeTrait
Names for traits that operate specifically on types.
@ Parens
New-expression has a C++98 paren-delimited initializer.
ExceptionSpecificationType
The various types of exception specifications that exist in C++11.
@ EST_Uninstantiated
not instantiated yet
@ EST_Unevaluated
not evaluated yet, for special member function
@ EST_Dynamic
throw(T1, T2)
OpenMPScheduleClauseKind
OpenMP attributes for 'schedule' clause.
static QualType TransformTypeSpecType(TypeLocBuilder &TLB, TyLoc T)
ActionResult< Stmt * > StmtResult
OpenMPMapClauseKind
OpenMP mapping kind for 'map' clause.
Expr * AllocatorTraits
Allocator traits.
Expr * Allocator
Allocator.
SourceLocation LParenLoc
Locations of '(' and ')' symbols.
The result of a constraint satisfaction check, containing the necessary information to diagnose an un...
Represents an explicit template argument list in C++, e.g., the "<int>" in "sort<int>".
static const ASTTemplateArgumentListInfo * Create(const ASTContext &C, const TemplateArgumentListInfo &List)
UnsignedOrNone ArgPackSubstIndex
DeclarationNameInfo - A collector data type for bundling together a DeclarationName and the correspon...
SourceLocation getLoc() const
getLoc - Returns the main location of the declaration name.
DeclarationName getName() const
getName - Returns the embedded declaration name.
void setNamedTypeInfo(TypeSourceInfo *TInfo)
setNamedTypeInfo - Sets the source type info associated to the name.
void setName(DeclarationName N)
setName - Sets the embedded declaration name.
TypeSourceInfo * getNamedTypeInfo() const
A FunctionEffect plus a potential boolean expression determining whether the effect is declared (e....
Holds information about the various types of exception specification.
FunctionDecl * SourceTemplate
The function template whose exception specification this is instantiated from, for EST_Uninstantiated...
ExceptionSpecificationType Type
The kind of exception specification this is.
ArrayRef< QualType > Exceptions
Explicitly-specified list of exception types.
Expr * NoexceptExpr
Noexcept expression, if this is a computed noexcept specification.
Extra information about a function prototype.
ExceptionSpecInfo ExceptionSpec
FunctionEffectsRef FunctionEffects
const ExtParameterInfo * ExtParameterInfos
const IdentifierInfo * getIdentifier() const
Returns the identifier to which this template name refers.
OverloadedOperatorKind getOperator() const
Return the overloaded operator to which this template name refers.
static TagTypeKind getTagTypeKindForKeyword(ElaboratedTypeKeyword Keyword)
Converts an elaborated type keyword into a TagTypeKind.
const NamespaceBaseDecl * Namespace
Iterator range representation begin:end[:step].
This structure contains most locations needed for by an OMPVarListClause.
An element in an Objective-C dictionary literal.
Data for list of allocators.
A context in which code is being synthesized (where a source location alone is not sufficient to iden...
@ LambdaExpressionSubstitution
We are substituting into a lambda expression.
An RAII helper that pops function a function scope on exit.
Keeps information about an identifier in a nested-name-spec.
Location information for a TemplateArgument.
UnsignedOrNone OrigNumExpansions
bool ExpandUnderForgetSubstitions
UnsignedOrNone NumExpansions