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 for (OMPInitClause::PrefView P :
C->prefs()) {
11009 Expr *NewFr =
nullptr;
11011 ExprResult ER = getDerived().TransformExpr(P.Fr);
11012 if (ER.isInvalid())
11017 NewAttrs.reserve(P.Attrs.size());
11018 for (
Expr *A : P.Attrs) {
11019 ExprResult ER = getDerived().TransformExpr(A);
11020 if (ER.isInvalid())
11022 NewAttrs.push_back(ER.get());
11024 InteropInfo.Prefs.emplace_back(NewFr, std::move(NewAttrs));
11026 InteropInfo.HasPreferAttrs =
C->hasPreferAttrs();
11027 return getDerived().RebuildOMPInitClause(IVR.get(), InteropInfo,
11028 C->getBeginLoc(),
C->getLParenLoc(),
11029 C->getVarLoc(),
C->getEndLoc());
11032template <
typename Derived>
11034 ExprResult ER = getDerived().TransformExpr(
C->getInteropVar());
11035 if (ER.isInvalid())
11037 return getDerived().RebuildOMPUseClause(ER.get(),
C->getBeginLoc(),
11038 C->getLParenLoc(),
C->getVarLoc(),
11042template <
typename Derived>
11046 if (
Expr *IV =
C->getInteropVar()) {
11047 ER = getDerived().TransformExpr(IV);
11048 if (ER.isInvalid())
11051 return getDerived().RebuildOMPDestroyClause(ER.get(),
C->getBeginLoc(),
11052 C->getLParenLoc(),
C->getVarLoc(),
11056template <
typename Derived>
11060 if (
Cond.isInvalid())
11062 return getDerived().RebuildOMPNovariantsClause(
11063 Cond.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11066template <
typename Derived>
11070 if (
Cond.isInvalid())
11072 return getDerived().RebuildOMPNocontextClause(
11073 Cond.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11076template <
typename Derived>
11079 ExprResult ThreadID = getDerived().TransformExpr(
C->getThreadID());
11080 if (ThreadID.isInvalid())
11082 return getDerived().RebuildOMPFilterClause(ThreadID.get(),
C->getBeginLoc(),
11083 C->getLParenLoc(),
C->getEndLoc());
11086template <
typename Derived>
11088 ExprResult E = getDerived().TransformExpr(
C->getAlignment());
11091 return getDerived().RebuildOMPAlignClause(E.get(),
C->getBeginLoc(),
11092 C->getLParenLoc(),
C->getEndLoc());
11095template <
typename Derived>
11097 OMPUnifiedAddressClause *
C) {
11098 llvm_unreachable(
"unified_address clause cannot appear in dependent context");
11101template <
typename Derived>
11103 OMPUnifiedSharedMemoryClause *
C) {
11105 "unified_shared_memory clause cannot appear in dependent context");
11108template <
typename Derived>
11110 OMPReverseOffloadClause *
C) {
11111 llvm_unreachable(
"reverse_offload clause cannot appear in dependent context");
11114template <
typename Derived>
11116 OMPDynamicAllocatorsClause *
C) {
11118 "dynamic_allocators clause cannot appear in dependent context");
11121template <
typename Derived>
11123 OMPAtomicDefaultMemOrderClause *
C) {
11125 "atomic_default_mem_order clause cannot appear in dependent context");
11128template <
typename Derived>
11131 llvm_unreachable(
"self_maps clause cannot appear in dependent context");
11134template <
typename Derived>
11137 C->getBeginLoc(),
C->getLParenLoc(),
11141template <
typename Derived>
11145 C->getSeverityKind(),
C->getSeverityKindKwLoc(),
C->getBeginLoc(),
11146 C->getLParenLoc(),
C->getEndLoc());
11149template <
typename Derived>
11152 ExprResult E = getDerived().TransformExpr(
C->getMessageString());
11155 return getDerived().RebuildOMPMessageClause(
11156 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11159template <
typename Derived>
11163 Vars.reserve(
C->varlist_size());
11164 for (
auto *
VE :
C->varlist()) {
11166 if (EVar.isInvalid())
11168 Vars.push_back(EVar.get());
11170 return getDerived().RebuildOMPPrivateClause(
11171 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11174template <
typename Derived>
11176 OMPFirstprivateClause *
C) {
11178 Vars.reserve(
C->varlist_size());
11179 for (
auto *
VE :
C->varlist()) {
11181 if (EVar.isInvalid())
11183 Vars.push_back(EVar.get());
11185 return getDerived().RebuildOMPFirstprivateClause(
11186 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11189template <
typename Derived>
11193 Vars.reserve(
C->varlist_size());
11194 for (
auto *
VE :
C->varlist()) {
11196 if (EVar.isInvalid())
11198 Vars.push_back(EVar.get());
11200 return getDerived().RebuildOMPLastprivateClause(
11201 Vars,
C->getKind(),
C->getKindLoc(),
C->getColonLoc(),
C->getBeginLoc(),
11202 C->getLParenLoc(),
C->getEndLoc());
11205template <
typename Derived>
11209 Vars.reserve(
C->varlist_size());
11210 for (
auto *
VE :
C->varlist()) {
11212 if (EVar.isInvalid())
11214 Vars.push_back(EVar.get());
11216 return getDerived().RebuildOMPSharedClause(Vars,
C->getBeginLoc(),
11217 C->getLParenLoc(),
C->getEndLoc());
11220template <
typename Derived>
11224 Vars.reserve(
C->varlist_size());
11225 for (
auto *
VE :
C->varlist()) {
11227 if (EVar.isInvalid())
11229 Vars.push_back(EVar.get());
11232 ReductionIdScopeSpec.
Adopt(
C->getQualifierLoc());
11235 if (NameInfo.getName()) {
11236 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
11237 if (!NameInfo.getName())
11243 for (
auto *E :
C->reduction_ops()) {
11248 for (
auto *D : ULE->decls()) {
11251 Decls.addDecl(InstD, InstD->getAccess());
11255 ReductionIdScopeSpec.getWithLocInContext(SemaRef.
Context), NameInfo,
11256 true, Decls.begin(), Decls.end(),
11259 UnresolvedReductions.push_back(
nullptr);
11261 return getDerived().RebuildOMPReductionClause(
11262 Vars,
C->getModifier(),
C->getOriginalSharingModifier(),
C->getBeginLoc(),
11263 C->getLParenLoc(),
C->getModifierLoc(),
C->getColonLoc(),
C->getEndLoc(),
11264 ReductionIdScopeSpec, NameInfo, UnresolvedReductions);
11267template <
typename Derived>
11269 OMPTaskReductionClause *
C) {
11271 Vars.reserve(
C->varlist_size());
11272 for (
auto *
VE :
C->varlist()) {
11274 if (EVar.isInvalid())
11276 Vars.push_back(EVar.get());
11279 ReductionIdScopeSpec.
Adopt(
C->getQualifierLoc());
11282 if (NameInfo.getName()) {
11283 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
11284 if (!NameInfo.getName())
11290 for (
auto *E :
C->reduction_ops()) {
11295 for (
auto *D : ULE->decls()) {
11298 Decls.addDecl(InstD, InstD->getAccess());
11302 ReductionIdScopeSpec.getWithLocInContext(SemaRef.
Context), NameInfo,
11303 true, Decls.begin(), Decls.end(),
11306 UnresolvedReductions.push_back(
nullptr);
11308 return getDerived().RebuildOMPTaskReductionClause(
11309 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getColonLoc(),
11310 C->getEndLoc(), ReductionIdScopeSpec, NameInfo, UnresolvedReductions);
11313template <
typename Derived>
11317 Vars.reserve(
C->varlist_size());
11318 for (
auto *
VE :
C->varlist()) {
11320 if (EVar.isInvalid())
11322 Vars.push_back(EVar.get());
11325 ReductionIdScopeSpec.
Adopt(
C->getQualifierLoc());
11328 if (NameInfo.getName()) {
11329 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
11330 if (!NameInfo.getName())
11336 for (
auto *E :
C->reduction_ops()) {
11341 for (
auto *D : ULE->decls()) {
11344 Decls.addDecl(InstD, InstD->getAccess());
11348 ReductionIdScopeSpec.getWithLocInContext(SemaRef.
Context), NameInfo,
11349 true, Decls.begin(), Decls.end(),
11352 UnresolvedReductions.push_back(
nullptr);
11354 return getDerived().RebuildOMPInReductionClause(
11355 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getColonLoc(),
11356 C->getEndLoc(), ReductionIdScopeSpec, NameInfo, UnresolvedReductions);
11359template <
typename Derived>
11363 Vars.reserve(
C->varlist_size());
11364 for (
auto *
VE :
C->varlist()) {
11366 if (EVar.isInvalid())
11368 Vars.push_back(EVar.get());
11370 ExprResult Step = getDerived().TransformExpr(
C->getStep());
11371 if (Step.isInvalid())
11373 return getDerived().RebuildOMPLinearClause(
11374 Vars, Step.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getModifier(),
11375 C->getModifierLoc(),
C->getColonLoc(),
C->getStepModifierLoc(),
11379template <
typename Derived>
11383 Vars.reserve(
C->varlist_size());
11384 for (
auto *
VE :
C->varlist()) {
11386 if (EVar.isInvalid())
11388 Vars.push_back(EVar.get());
11390 ExprResult Alignment = getDerived().TransformExpr(
C->getAlignment());
11391 if (Alignment.isInvalid())
11393 return getDerived().RebuildOMPAlignedClause(
11394 Vars, Alignment.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11395 C->getColonLoc(),
C->getEndLoc());
11398template <
typename Derived>
11402 Vars.reserve(
C->varlist_size());
11403 for (
auto *
VE :
C->varlist()) {
11405 if (EVar.isInvalid())
11407 Vars.push_back(EVar.get());
11409 return getDerived().RebuildOMPCopyinClause(Vars,
C->getBeginLoc(),
11410 C->getLParenLoc(),
C->getEndLoc());
11413template <
typename Derived>
11417 Vars.reserve(
C->varlist_size());
11418 for (
auto *
VE :
C->varlist()) {
11420 if (EVar.isInvalid())
11422 Vars.push_back(EVar.get());
11424 return getDerived().RebuildOMPCopyprivateClause(
11425 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11428template <
typename Derived>
11431 Vars.reserve(
C->varlist_size());
11432 for (
auto *
VE :
C->varlist()) {
11434 if (EVar.isInvalid())
11436 Vars.push_back(EVar.get());
11438 return getDerived().RebuildOMPFlushClause(Vars,
C->getBeginLoc(),
11439 C->getLParenLoc(),
C->getEndLoc());
11442template <
typename Derived>
11445 ExprResult E = getDerived().TransformExpr(
C->getDepobj());
11448 return getDerived().RebuildOMPDepobjClause(E.get(),
C->getBeginLoc(),
11449 C->getLParenLoc(),
C->getEndLoc());
11452template <
typename Derived>
11456 Expr *DepModifier =
C->getModifier();
11458 ExprResult DepModRes = getDerived().TransformExpr(DepModifier);
11459 if (DepModRes.isInvalid())
11461 DepModifier = DepModRes.get();
11463 Vars.reserve(
C->varlist_size());
11464 for (
auto *
VE :
C->varlist()) {
11466 if (EVar.isInvalid())
11468 Vars.push_back(EVar.get());
11470 return getDerived().RebuildOMPDependClause(
11471 {
C->getDependencyKind(),
C->getDependencyLoc(),
C->getColonLoc(),
11472 C->getOmpAllMemoryLoc()},
11473 DepModifier, Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11476template <
typename Derived>
11479 ExprResult E = getDerived().TransformExpr(
C->getDevice());
11482 return getDerived().RebuildOMPDeviceClause(
11483 C->getModifier(), E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11484 C->getModifierLoc(),
C->getEndLoc());
11487template <
typename Derived,
class T>
11494 Vars.reserve(
C->varlist_size());
11495 for (
auto *
VE :
C->varlist()) {
11499 Vars.push_back(EVar.
get());
11503 if (
C->getMapperQualifierLoc()) {
11504 QualifierLoc = TT.
getDerived().TransformNestedNameSpecifierLoc(
11505 C->getMapperQualifierLoc());
11509 MapperIdScopeSpec.
Adopt(QualifierLoc);
11510 MapperIdInfo =
C->getMapperIdInfo();
11511 if (MapperIdInfo.
getName()) {
11512 MapperIdInfo = TT.
getDerived().TransformDeclarationNameInfo(MapperIdInfo);
11518 for (
auto *E :
C->mapperlists()) {
11523 for (
auto *D : ULE->decls()) {
11526 Decls.addDecl(InstD, InstD->
getAccess());
11531 MapperIdInfo,
true, Decls.begin(), Decls.end(),
11534 UnresolvedMappers.push_back(
nullptr);
11540template <
typename Derived>
11542 OMPVarListLocTy Locs(
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11544 Expr *IteratorModifier =
C->getIteratorModifier();
11545 if (IteratorModifier) {
11546 ExprResult MapModRes = getDerived().TransformExpr(IteratorModifier);
11547 if (MapModRes.isInvalid())
11549 IteratorModifier = MapModRes.
get();
11555 *
this,
C, Vars, MapperIdScopeSpec, MapperIdInfo, UnresolvedMappers))
11557 return getDerived().RebuildOMPMapClause(
11558 IteratorModifier,
C->getMapTypeModifiers(),
C->getMapTypeModifiersLoc(),
11559 MapperIdScopeSpec, MapperIdInfo,
C->getMapType(),
C->isImplicitMapType(),
11560 C->getMapLoc(),
C->getColonLoc(), Vars, Locs, UnresolvedMappers);
11563template <
typename Derived>
11566 Expr *Allocator =
C->getAllocator();
11568 ExprResult AllocatorRes = getDerived().TransformExpr(Allocator);
11569 if (AllocatorRes.isInvalid())
11571 Allocator = AllocatorRes.get();
11573 Expr *Alignment =
C->getAlignment();
11575 ExprResult AlignmentRes = getDerived().TransformExpr(Alignment);
11576 if (AlignmentRes.isInvalid())
11578 Alignment = AlignmentRes.get();
11581 Vars.reserve(
C->varlist_size());
11582 for (
auto *
VE :
C->varlist()) {
11584 if (EVar.isInvalid())
11586 Vars.push_back(EVar.get());
11588 return getDerived().RebuildOMPAllocateClause(
11589 Allocator, Alignment,
C->getFirstAllocateModifier(),
11590 C->getFirstAllocateModifierLoc(),
C->getSecondAllocateModifier(),
11591 C->getSecondAllocateModifierLoc(), Vars,
C->getBeginLoc(),
11592 C->getLParenLoc(),
C->getColonLoc(),
C->getEndLoc());
11595template <
typename Derived>
11599 Vars.reserve(
C->varlist_size());
11600 for (
auto *
VE :
C->varlist()) {
11602 if (EVar.isInvalid())
11604 Vars.push_back(EVar.get());
11606 return getDerived().RebuildOMPNumTeamsClause(
11607 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11610template <
typename Derived>
11614 Vars.reserve(
C->varlist_size());
11615 for (
auto *
VE :
C->varlist()) {
11617 if (EVar.isInvalid())
11619 Vars.push_back(EVar.get());
11621 return getDerived().RebuildOMPThreadLimitClause(
11622 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11625template <
typename Derived>
11628 ExprResult E = getDerived().TransformExpr(
C->getPriority());
11631 return getDerived().RebuildOMPPriorityClause(
11632 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11635template <
typename Derived>
11638 ExprResult E = getDerived().TransformExpr(
C->getGrainsize());
11641 return getDerived().RebuildOMPGrainsizeClause(
11642 C->getModifier(), E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11643 C->getModifierLoc(),
C->getEndLoc());
11646template <
typename Derived>
11649 ExprResult E = getDerived().TransformExpr(
C->getNumTasks());
11652 return getDerived().RebuildOMPNumTasksClause(
11653 C->getModifier(), E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11654 C->getModifierLoc(),
C->getEndLoc());
11657template <
typename Derived>
11659 ExprResult E = getDerived().TransformExpr(
C->getHint());
11662 return getDerived().RebuildOMPHintClause(E.get(),
C->getBeginLoc(),
11663 C->getLParenLoc(),
C->getEndLoc());
11666template <
typename Derived>
11668 OMPDistScheduleClause *
C) {
11669 ExprResult E = getDerived().TransformExpr(
C->getChunkSize());
11672 return getDerived().RebuildOMPDistScheduleClause(
11673 C->getDistScheduleKind(), E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11674 C->getDistScheduleKindLoc(),
C->getCommaLoc(),
C->getEndLoc());
11677template <
typename Derived>
11683 C->getDefaultmapKind(),
11686 C->getDefaultmapModifierLoc(),
11687 C->getDefaultmapKindLoc(),
11691template <
typename Derived>
11695 Expr *IteratorModifier =
C->getIteratorModifier();
11696 if (IteratorModifier) {
11697 ExprResult MapModRes = getDerived().TransformExpr(IteratorModifier);
11698 if (MapModRes.isInvalid())
11700 IteratorModifier = MapModRes.get();
11706 *
this,
C, Vars, MapperIdScopeSpec, MapperIdInfo, UnresolvedMappers))
11708 return getDerived().RebuildOMPToClause(
11709 C->getMotionModifiers(),
C->getMotionModifiersLoc(), IteratorModifier,
11710 MapperIdScopeSpec, MapperIdInfo,
C->getColonLoc(), Vars, Locs,
11711 UnresolvedMappers);
11714template <
typename Derived>
11718 Expr *IteratorModifier =
C->getIteratorModifier();
11719 if (IteratorModifier) {
11720 ExprResult MapModRes = getDerived().TransformExpr(IteratorModifier);
11721 if (MapModRes.isInvalid())
11723 IteratorModifier = MapModRes.get();
11729 *
this,
C, Vars, MapperIdScopeSpec, MapperIdInfo, UnresolvedMappers))
11731 return getDerived().RebuildOMPFromClause(
11732 C->getMotionModifiers(),
C->getMotionModifiersLoc(), IteratorModifier,
11733 MapperIdScopeSpec, MapperIdInfo,
C->getColonLoc(), Vars, Locs,
11734 UnresolvedMappers);
11737template <
typename Derived>
11739 OMPUseDevicePtrClause *
C) {
11741 Vars.reserve(
C->varlist_size());
11742 for (
auto *
VE :
C->varlist()) {
11744 if (EVar.isInvalid())
11746 Vars.push_back(EVar.get());
11749 return getDerived().RebuildOMPUseDevicePtrClause(
11750 Vars, Locs,
C->getFallbackModifier(),
C->getFallbackModifierLoc());
11753template <
typename Derived>
11755 OMPUseDeviceAddrClause *
C) {
11757 Vars.reserve(
C->varlist_size());
11758 for (
auto *
VE :
C->varlist()) {
11760 if (EVar.isInvalid())
11762 Vars.push_back(EVar.get());
11765 return getDerived().RebuildOMPUseDeviceAddrClause(Vars, Locs);
11768template <
typename Derived>
11772 Vars.reserve(
C->varlist_size());
11773 for (
auto *
VE :
C->varlist()) {
11775 if (EVar.isInvalid())
11777 Vars.push_back(EVar.get());
11780 return getDerived().RebuildOMPIsDevicePtrClause(Vars, Locs);
11783template <
typename Derived>
11785 OMPHasDeviceAddrClause *
C) {
11787 Vars.reserve(
C->varlist_size());
11788 for (
auto *
VE :
C->varlist()) {
11790 if (EVar.isInvalid())
11792 Vars.push_back(EVar.get());
11795 return getDerived().RebuildOMPHasDeviceAddrClause(Vars, Locs);
11798template <
typename Derived>
11802 Vars.reserve(
C->varlist_size());
11803 for (
auto *
VE :
C->varlist()) {
11805 if (EVar.isInvalid())
11807 Vars.push_back(EVar.get());
11809 return getDerived().RebuildOMPNontemporalClause(
11810 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11813template <
typename Derived>
11817 Vars.reserve(
C->varlist_size());
11818 for (
auto *
VE :
C->varlist()) {
11820 if (EVar.isInvalid())
11822 Vars.push_back(EVar.get());
11824 return getDerived().RebuildOMPInclusiveClause(
11825 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11828template <
typename Derived>
11832 Vars.reserve(
C->varlist_size());
11833 for (
auto *
VE :
C->varlist()) {
11835 if (EVar.isInvalid())
11837 Vars.push_back(EVar.get());
11839 return getDerived().RebuildOMPExclusiveClause(
11840 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11843template <
typename Derived>
11845 OMPUsesAllocatorsClause *
C) {
11847 Data.reserve(
C->getNumberOfAllocators());
11848 for (
unsigned I = 0, E =
C->getNumberOfAllocators(); I < E; ++I) {
11849 OMPUsesAllocatorsClause::Data D =
C->getAllocatorData(I);
11851 if (Allocator.isInvalid())
11855 AllocatorTraits = getDerived().TransformExpr(AT);
11856 if (AllocatorTraits.isInvalid())
11860 NewD.Allocator = Allocator.get();
11861 NewD.AllocatorTraits = AllocatorTraits.get();
11865 return getDerived().RebuildOMPUsesAllocatorsClause(
11866 Data,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11869template <
typename Derived>
11873 Locators.reserve(
C->varlist_size());
11875 if (
Expr *Modifier =
C->getModifier()) {
11876 ModifierRes = getDerived().TransformExpr(Modifier);
11877 if (ModifierRes.isInvalid())
11880 for (
Expr *E :
C->varlist()) {
11881 ExprResult Locator = getDerived().TransformExpr(E);
11882 if (Locator.isInvalid())
11884 Locators.push_back(Locator.get());
11886 return getDerived().RebuildOMPAffinityClause(
11887 C->getBeginLoc(),
C->getLParenLoc(),
C->getColonLoc(),
C->getEndLoc(),
11888 ModifierRes.get(), Locators);
11891template <
typename Derived>
11894 C->getKind(),
C->getKindKwLoc(),
C->getBeginLoc(),
C->getLParenLoc(),
11895 C->getEndLoc(),
C->getModifier(),
C->getModifierKwLoc());
11898template <
typename Derived>
11901 C->getBindKind(),
C->getBindKindLoc(),
C->getBeginLoc(),
11902 C->getLParenLoc(),
C->getEndLoc());
11905template <
typename Derived>
11907 OMPXDynCGroupMemClause *
C) {
11909 if (
Size.isInvalid())
11911 return getDerived().RebuildOMPXDynCGroupMemClause(
11912 Size.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11915template <
typename Derived>
11917 OMPDynGroupprivateClause *
C) {
11919 if (
Size.isInvalid())
11921 return getDerived().RebuildOMPDynGroupprivateClause(
11922 C->getDynGroupprivateModifier(),
C->getDynGroupprivateFallbackModifier(),
11923 Size.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11924 C->getDynGroupprivateModifierLoc(),
11925 C->getDynGroupprivateFallbackModifierLoc(),
C->getEndLoc());
11928template <
typename Derived>
11932 Vars.reserve(
C->varlist_size());
11933 for (
auto *
VE :
C->varlist()) {
11935 if (EVar.isInvalid())
11937 Vars.push_back(EVar.get());
11939 return getDerived().RebuildOMPDoacrossClause(
11940 C->getDependenceType(),
C->getDependenceLoc(),
C->getColonLoc(), Vars,
11941 C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11944template <
typename Derived>
11948 for (
auto *A :
C->getAttrs())
11949 NewAttrs.push_back(getDerived().TransformAttr(A));
11950 return getDerived().RebuildOMPXAttributeClause(
11951 NewAttrs,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11954template <
typename Derived>
11963template <
typename Derived>
11964class OpenACCClauseTransform final
11966 TreeTransform<Derived> &Self;
11967 ArrayRef<const OpenACCClause *> ExistingClauses;
11968 SemaOpenACC::OpenACCParsedClause &ParsedClause;
11969 OpenACCClause *NewClause =
nullptr;
11972 ExprResult Res = Self.TransformExpr(VarRef);
11974 if (!Res.isUsable())
11977 Res = Self.getSema().OpenACC().ActOnVar(ParsedClause.getDirectiveKind(),
11978 ParsedClause.getClauseKind(),
11984 llvm::SmallVector<Expr *> VisitVarList(ArrayRef<Expr *> VarList) {
11985 llvm::SmallVector<Expr *> InstantiatedVarList;
11986 for (Expr *CurVar : VarList) {
11989 if (VarRef.isUsable())
11990 InstantiatedVarList.push_back(VarRef.get());
11993 return InstantiatedVarList;
11997 OpenACCClauseTransform(TreeTransform<Derived> &Self,
11998 ArrayRef<const OpenACCClause *> ExistingClauses,
11999 SemaOpenACC::OpenACCParsedClause &PC)
12000 : Self(Self), ExistingClauses(ExistingClauses), ParsedClause(PC) {}
12002 OpenACCClause *CreatedClause()
const {
return NewClause; }
12004#define VISIT_CLAUSE(CLAUSE_NAME) \
12005 void Visit##CLAUSE_NAME##Clause(const OpenACC##CLAUSE_NAME##Clause &Clause);
12006#include "clang/Basic/OpenACCClauses.def"
12009template <
typename Derived>
12010void OpenACCClauseTransform<Derived>::VisitDefaultClause(
12012 ParsedClause.setDefaultDetails(
C.getDefaultClauseKind());
12015 Self.getSema().getASTContext(), ParsedClause.getDefaultClauseKind(),
12016 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12017 ParsedClause.getEndLoc());
12020template <
typename Derived>
12021void OpenACCClauseTransform<Derived>::VisitIfClause(
const OpenACCIfClause &
C) {
12023 assert(
Cond &&
"If constructed with invalid Condition");
12027 if (Res.isInvalid() || !Res.get().second)
12030 ParsedClause.setConditionDetails(Res.get().second);
12033 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12034 ParsedClause.getLParenLoc(), ParsedClause.getConditionExpr(),
12035 ParsedClause.getEndLoc());
12038template <
typename Derived>
12039void OpenACCClauseTransform<Derived>::VisitSelfClause(
12045 for (
Expr *CurVar :
C.getVarList()) {
12048 if (!Res.isUsable())
12051 Res =
Self.getSema().OpenACC().ActOnVar(ParsedClause.getDirectiveKind(),
12052 ParsedClause.getClauseKind(),
12055 if (Res.isUsable())
12056 InstantiatedVarList.push_back(Res.get());
12059 ParsedClause.setVarListDetails(InstantiatedVarList,
12063 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12064 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12065 ParsedClause.getEndLoc());
12068 if (
C.hasConditionExpr()) {
12071 Self.TransformCondition(
Cond->getExprLoc(),
nullptr,
Cond,
12074 if (Res.isInvalid() || !Res.get().second)
12077 ParsedClause.setConditionDetails(Res.get().second);
12081 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12082 ParsedClause.getLParenLoc(), ParsedClause.getConditionExpr(),
12083 ParsedClause.getEndLoc());
12087template <
typename Derived>
12088void OpenACCClauseTransform<Derived>::VisitNumGangsClause(
12092 for (
Expr *CurIntExpr :
C.getIntExprs()) {
12095 if (!Res.isUsable())
12100 C.getBeginLoc(), Res.get());
12101 if (!Res.isUsable())
12104 InstantiatedIntExprs.push_back(Res.get());
12107 ParsedClause.setIntExprDetails(InstantiatedIntExprs);
12109 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12110 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs(),
12111 ParsedClause.getEndLoc());
12114template <
typename Derived>
12115void OpenACCClauseTransform<Derived>::VisitPrivateClause(
12120 for (
const auto [RefExpr, InitRecipe] :
12121 llvm::zip(
C.getVarList(),
C.getInitRecipes())) {
12124 if (VarRef.isUsable()) {
12125 InstantiatedVarList.push_back(VarRef.get());
12129 if (InitRecipe.isSet())
12130 InitRecipes.push_back(InitRecipe);
12132 InitRecipes.push_back(
12133 Self.getSema().OpenACC().CreatePrivateInitRecipe(VarRef.get()));
12136 ParsedClause.setVarListDetails(InstantiatedVarList,
12140 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12141 ParsedClause.getLParenLoc(), ParsedClause.getVarList(), InitRecipes,
12142 ParsedClause.getEndLoc());
12145template <
typename Derived>
12146void OpenACCClauseTransform<Derived>::VisitHostClause(
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>::VisitDeviceClause(
12160 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12164 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12165 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12166 ParsedClause.getEndLoc());
12169template <
typename Derived>
12170void OpenACCClauseTransform<Derived>::VisitFirstPrivateClause(
12175 for (
const auto [RefExpr, InitRecipe] :
12176 llvm::zip(
C.getVarList(),
C.getInitRecipes())) {
12179 if (VarRef.isUsable()) {
12180 InstantiatedVarList.push_back(VarRef.get());
12184 if (InitRecipe.isSet())
12185 InitRecipes.push_back(InitRecipe);
12187 InitRecipes.push_back(
12188 Self.getSema().OpenACC().CreateFirstPrivateInitRecipe(
12192 ParsedClause.setVarListDetails(InstantiatedVarList,
12196 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12197 ParsedClause.getLParenLoc(), ParsedClause.getVarList(), InitRecipes,
12198 ParsedClause.getEndLoc());
12201template <
typename Derived>
12202void OpenACCClauseTransform<Derived>::VisitNoCreateClause(
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>::VisitPresentClause(
12216 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12220 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12221 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12222 ParsedClause.getEndLoc());
12225template <
typename Derived>
12226void OpenACCClauseTransform<Derived>::VisitCopyClause(
12228 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12229 C.getModifierList());
12232 Self.getSema().getASTContext(), ParsedClause.getClauseKind(),
12233 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12234 ParsedClause.getModifierList(), ParsedClause.getVarList(),
12235 ParsedClause.getEndLoc());
12238template <
typename Derived>
12239void OpenACCClauseTransform<Derived>::VisitLinkClause(
12241 llvm_unreachable(
"link clause not valid unless a decl transform");
12244template <
typename Derived>
12245void OpenACCClauseTransform<Derived>::VisitDeviceResidentClause(
12247 llvm_unreachable(
"device_resident clause not valid unless a decl transform");
12249template <
typename Derived>
12250void OpenACCClauseTransform<Derived>::VisitNoHostClause(
12252 llvm_unreachable(
"nohost clause not valid unless a decl transform");
12254template <
typename Derived>
12255void OpenACCClauseTransform<Derived>::VisitBindClause(
12257 llvm_unreachable(
"bind clause not valid unless a decl transform");
12260template <
typename Derived>
12261void OpenACCClauseTransform<Derived>::VisitCopyInClause(
12263 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12264 C.getModifierList());
12267 Self.getSema().getASTContext(), ParsedClause.getClauseKind(),
12268 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12269 ParsedClause.getModifierList(), ParsedClause.getVarList(),
12270 ParsedClause.getEndLoc());
12273template <
typename Derived>
12274void OpenACCClauseTransform<Derived>::VisitCopyOutClause(
12276 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12277 C.getModifierList());
12280 Self.getSema().getASTContext(), ParsedClause.getClauseKind(),
12281 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12282 ParsedClause.getModifierList(), ParsedClause.getVarList(),
12283 ParsedClause.getEndLoc());
12286template <
typename Derived>
12287void OpenACCClauseTransform<Derived>::VisitCreateClause(
12289 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12290 C.getModifierList());
12293 Self.getSema().getASTContext(), ParsedClause.getClauseKind(),
12294 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12295 ParsedClause.getModifierList(), ParsedClause.getVarList(),
12296 ParsedClause.getEndLoc());
12298template <
typename Derived>
12299void OpenACCClauseTransform<Derived>::VisitAttachClause(
12304 llvm::erase_if(VarList, [&](
Expr *E) {
12305 return Self.getSema().OpenACC().CheckVarIsPointerType(
12311 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12312 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12313 ParsedClause.getEndLoc());
12316template <
typename Derived>
12317void OpenACCClauseTransform<Derived>::VisitDetachClause(
12322 llvm::erase_if(VarList, [&](
Expr *E) {
12323 return Self.getSema().OpenACC().CheckVarIsPointerType(
12329 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12330 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12331 ParsedClause.getEndLoc());
12334template <
typename Derived>
12335void OpenACCClauseTransform<Derived>::VisitDeleteClause(
12337 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12340 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12341 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12342 ParsedClause.getEndLoc());
12345template <
typename Derived>
12346void OpenACCClauseTransform<Derived>::VisitUseDeviceClause(
12348 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12351 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12352 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12353 ParsedClause.getEndLoc());
12356template <
typename Derived>
12357void OpenACCClauseTransform<Derived>::VisitDevicePtrClause(
12362 llvm::erase_if(VarList, [&](
Expr *E) {
12363 return Self.getSema().OpenACC().CheckVarIsPointerType(
12369 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12370 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12371 ParsedClause.getEndLoc());
12374template <
typename Derived>
12375void OpenACCClauseTransform<Derived>::VisitNumWorkersClause(
12377 Expr *IntExpr =
const_cast<Expr *
>(
C.getIntExpr());
12378 assert(IntExpr &&
"num_workers clause constructed with invalid int expr");
12381 if (!Res.isUsable())
12386 C.getBeginLoc(), Res.get());
12387 if (!Res.isUsable())
12390 ParsedClause.setIntExprDetails(Res.get());
12392 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12393 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs()[0],
12394 ParsedClause.getEndLoc());
12397template <
typename Derived>
12398void OpenACCClauseTransform<Derived>::VisitDeviceNumClause (
12400 Expr *IntExpr =
const_cast<Expr *
>(
C.getIntExpr());
12401 assert(IntExpr &&
"device_num clause constructed with invalid int expr");
12404 if (!Res.isUsable())
12409 C.getBeginLoc(), Res.get());
12410 if (!Res.isUsable())
12413 ParsedClause.setIntExprDetails(Res.get());
12415 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12416 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs()[0],
12417 ParsedClause.getEndLoc());
12420template <
typename Derived>
12421void OpenACCClauseTransform<Derived>::VisitDefaultAsyncClause(
12423 Expr *IntExpr =
const_cast<Expr *
>(
C.getIntExpr());
12424 assert(IntExpr &&
"default_async clause constructed with invalid int expr");
12427 if (!Res.isUsable())
12432 C.getBeginLoc(), Res.get());
12433 if (!Res.isUsable())
12436 ParsedClause.setIntExprDetails(Res.get());
12438 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12439 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs()[0],
12440 ParsedClause.getEndLoc());
12443template <
typename Derived>
12444void OpenACCClauseTransform<Derived>::VisitVectorLengthClause(
12446 Expr *IntExpr =
const_cast<Expr *
>(
C.getIntExpr());
12447 assert(IntExpr &&
"vector_length clause constructed with invalid int expr");
12450 if (!Res.isUsable())
12455 C.getBeginLoc(), Res.get());
12456 if (!Res.isUsable())
12459 ParsedClause.setIntExprDetails(Res.get());
12461 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12462 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs()[0],
12463 ParsedClause.getEndLoc());
12466template <
typename Derived>
12467void OpenACCClauseTransform<Derived>::VisitAsyncClause(
12469 if (
C.hasIntExpr()) {
12471 if (!Res.isUsable())
12476 C.getBeginLoc(), Res.get());
12477 if (!Res.isUsable())
12479 ParsedClause.setIntExprDetails(Res.get());
12483 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12484 ParsedClause.getLParenLoc(),
12485 ParsedClause.getNumIntExprs() != 0 ? ParsedClause.getIntExprs()[0]
12487 ParsedClause.getEndLoc());
12490template <
typename Derived>
12491void OpenACCClauseTransform<Derived>::VisitWorkerClause(
12493 if (
C.hasIntExpr()) {
12498 if (!Res.isUsable())
12503 C.getBeginLoc(), Res.get());
12504 if (!Res.isUsable())
12506 ParsedClause.setIntExprDetails(Res.get());
12510 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12511 ParsedClause.getLParenLoc(),
12512 ParsedClause.getNumIntExprs() != 0 ? ParsedClause.getIntExprs()[0]
12514 ParsedClause.getEndLoc());
12517template <
typename Derived>
12518void OpenACCClauseTransform<Derived>::VisitVectorClause(
12520 if (
C.hasIntExpr()) {
12525 if (!Res.isUsable())
12530 C.getBeginLoc(), Res.get());
12531 if (!Res.isUsable())
12533 ParsedClause.setIntExprDetails(Res.get());
12537 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12538 ParsedClause.getLParenLoc(),
12539 ParsedClause.getNumIntExprs() != 0 ? ParsedClause.getIntExprs()[0]
12541 ParsedClause.getEndLoc());
12544template <
typename Derived>
12545void OpenACCClauseTransform<Derived>::VisitWaitClause(
12547 if (
C.hasExprs()) {
12548 Expr *DevNumExpr =
nullptr;
12552 if (
C.getDevNumExpr()) {
12554 if (!Res.isUsable())
12558 C.getBeginLoc(), Res.get());
12559 if (!Res.isUsable())
12562 DevNumExpr = Res.get();
12566 for (
Expr *CurQueueIdExpr :
C.getQueueIdExprs()) {
12568 if (!Res.isUsable())
12572 C.getBeginLoc(), Res.get());
12573 if (!Res.isUsable())
12576 InstantiatedQueueIdExprs.push_back(Res.get());
12579 ParsedClause.setWaitDetails(DevNumExpr,
C.getQueuesLoc(),
12580 std::move(InstantiatedQueueIdExprs));
12584 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12585 ParsedClause.getLParenLoc(), ParsedClause.getDevNumExpr(),
12586 ParsedClause.getQueuesLoc(), ParsedClause.getQueueIdExprs(),
12587 ParsedClause.getEndLoc());
12590template <
typename Derived>
12591void OpenACCClauseTransform<Derived>::VisitDeviceTypeClause(
12595 Self.getSema().getASTContext(),
C.getClauseKind(),
12596 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12597 C.getArchitectures(), ParsedClause.getEndLoc());
12600template <
typename Derived>
12601void OpenACCClauseTransform<Derived>::VisitAutoClause(
12605 ParsedClause.getBeginLoc(),
12606 ParsedClause.getEndLoc());
12609template <
typename Derived>
12610void OpenACCClauseTransform<Derived>::VisitIndependentClause(
12613 ParsedClause.getBeginLoc(),
12614 ParsedClause.getEndLoc());
12617template <
typename Derived>
12618void OpenACCClauseTransform<Derived>::VisitSeqClause(
12621 ParsedClause.getBeginLoc(),
12622 ParsedClause.getEndLoc());
12624template <
typename Derived>
12625void OpenACCClauseTransform<Derived>::VisitFinalizeClause(
12628 ParsedClause.getBeginLoc(),
12629 ParsedClause.getEndLoc());
12632template <
typename Derived>
12633void OpenACCClauseTransform<Derived>::VisitIfPresentClause(
12636 ParsedClause.getBeginLoc(),
12637 ParsedClause.getEndLoc());
12640template <
typename Derived>
12641void OpenACCClauseTransform<Derived>::VisitReductionClause(
12647 for (
const auto [Var, OrigRecipe] :
12648 llvm::zip(TransformedVars,
C.getRecipes())) {
12650 ParsedClause.getDirectiveKind(),
C.getReductionOp(), Var);
12651 if (Res.isUsable()) {
12652 ValidVars.push_back(Res.get());
12654 if (OrigRecipe.isSet())
12655 Recipes.emplace_back(OrigRecipe.AllocaDecl, OrigRecipe.CombinerRecipes);
12657 Recipes.push_back(
Self.getSema().OpenACC().CreateReductionInitRecipe(
12658 C.getReductionOp(), Res.get()));
12662 NewClause =
Self.getSema().OpenACC().CheckReductionClause(
12663 ExistingClauses, ParsedClause.getDirectiveKind(),
12664 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12665 C.getReductionOp(), ValidVars, Recipes, ParsedClause.getEndLoc());
12668template <
typename Derived>
12669void OpenACCClauseTransform<Derived>::VisitCollapseClause(
12671 Expr *LoopCount =
const_cast<Expr *
>(
C.getLoopCount());
12672 assert(LoopCount &&
"collapse clause constructed with invalid loop count");
12676 if (!NewLoopCount.isUsable())
12679 NewLoopCount =
Self.getSema().OpenACC().ActOnIntExpr(
12681 NewLoopCount.get()->getBeginLoc(), NewLoopCount.get());
12685 if (!NewLoopCount.isUsable())
12689 Self.getSema().OpenACC().CheckCollapseLoopCount(NewLoopCount.get());
12693 if (!NewLoopCount.isUsable())
12696 ParsedClause.setCollapseDetails(
C.hasForce(), NewLoopCount.get());
12698 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12699 ParsedClause.getLParenLoc(), ParsedClause.isForce(),
12700 ParsedClause.getLoopCount(), ParsedClause.getEndLoc());
12703template <
typename Derived>
12704void OpenACCClauseTransform<Derived>::VisitTileClause(
12709 for (
Expr *E :
C.getSizeExprs()) {
12712 if (!NewSizeExpr.isUsable())
12715 NewSizeExpr =
Self.getSema().OpenACC().ActOnIntExpr(
12717 NewSizeExpr.get()->getBeginLoc(), NewSizeExpr.get());
12721 if (!NewSizeExpr.isUsable())
12724 NewSizeExpr =
Self.getSema().OpenACC().CheckTileSizeExpr(NewSizeExpr.get());
12726 if (!NewSizeExpr.isUsable())
12728 TransformedExprs.push_back(NewSizeExpr.get());
12731 ParsedClause.setIntExprDetails(TransformedExprs);
12733 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12734 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs(),
12735 ParsedClause.getEndLoc());
12737template <
typename Derived>
12738void OpenACCClauseTransform<Derived>::VisitGangClause(
12743 for (
unsigned I = 0; I <
C.getNumExprs(); ++I) {
12745 if (!ER.isUsable())
12748 ER =
Self.getSema().OpenACC().CheckGangExpr(ExistingClauses,
12749 ParsedClause.getDirectiveKind(),
12750 C.getExpr(I).first, ER.get());
12751 if (!ER.isUsable())
12753 TransformedGangKinds.push_back(
C.getExpr(I).first);
12754 TransformedIntExprs.push_back(ER.get());
12757 NewClause =
Self.getSema().OpenACC().CheckGangClause(
12758 ParsedClause.getDirectiveKind(), ExistingClauses,
12759 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12760 TransformedGangKinds, TransformedIntExprs, ParsedClause.getEndLoc());
12763template <
typename Derived>
12764OpenACCClause *TreeTransform<Derived>::TransformOpenACCClause(
12769 DirKind, OldClause->getClauseKind(), OldClause->getBeginLoc());
12770 ParsedClause.setEndLoc(OldClause->getEndLoc());
12772 if (
const auto *WithParms = dyn_cast<OpenACCClauseWithParams>(OldClause))
12773 ParsedClause.setLParenLoc(WithParms->getLParenLoc());
12775 OpenACCClauseTransform<Derived> Transform{*
this, ExistingClauses,
12777 Transform.Visit(OldClause);
12779 return Transform.CreatedClause();
12782template <
typename Derived>
12784TreeTransform<Derived>::TransformOpenACCClauseList(
12787 for (
const auto *Clause : OldClauses) {
12788 if (
OpenACCClause *TransformedClause = getDerived().TransformOpenACCClause(
12789 TransformedClauses, DirKind, Clause))
12790 TransformedClauses.push_back(TransformedClause);
12792 return TransformedClauses;
12795template <
typename Derived>
12798 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12801 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12804 if (getSema().OpenACC().ActOnStartStmtDirective(
12805 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12810 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
12811 C->clauses(), TransformedClauses);
12812 StmtResult StrBlock = getDerived().TransformStmt(
C->getStructuredBlock());
12813 StrBlock = getSema().OpenACC().ActOnAssociatedStmt(
12814 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses, StrBlock);
12816 return getDerived().RebuildOpenACCComputeConstruct(
12817 C->getDirectiveKind(),
C->getBeginLoc(),
C->getDirectiveLoc(),
12818 C->getEndLoc(), TransformedClauses, StrBlock);
12821template <
typename Derived>
12825 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12828 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12831 if (getSema().OpenACC().ActOnStartStmtDirective(
12832 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12837 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
12838 C->clauses(), TransformedClauses);
12840 Loop = getSema().OpenACC().ActOnAssociatedStmt(
12841 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses,
Loop);
12843 return getDerived().RebuildOpenACCLoopConstruct(
12844 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12845 TransformedClauses,
Loop);
12848template <
typename Derived>
12850 OpenACCCombinedConstruct *
C) {
12851 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12854 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12857 if (getSema().OpenACC().ActOnStartStmtDirective(
12858 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12863 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
12864 C->clauses(), TransformedClauses);
12866 Loop = getSema().OpenACC().ActOnAssociatedStmt(
12867 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses,
Loop);
12869 return getDerived().RebuildOpenACCCombinedConstruct(
12870 C->getDirectiveKind(),
C->getBeginLoc(),
C->getDirectiveLoc(),
12871 C->getEndLoc(), TransformedClauses,
Loop);
12874template <
typename Derived>
12877 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12880 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12882 if (getSema().OpenACC().ActOnStartStmtDirective(
12883 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12887 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
12888 C->clauses(), TransformedClauses);
12889 StmtResult StrBlock = getDerived().TransformStmt(
C->getStructuredBlock());
12890 StrBlock = getSema().OpenACC().ActOnAssociatedStmt(
12891 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses, StrBlock);
12893 return getDerived().RebuildOpenACCDataConstruct(
12894 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12895 TransformedClauses, StrBlock);
12898template <
typename Derived>
12900 OpenACCEnterDataConstruct *
C) {
12901 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12904 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12906 if (getSema().OpenACC().ActOnStartStmtDirective(
12907 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12910 return getDerived().RebuildOpenACCEnterDataConstruct(
12911 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12912 TransformedClauses);
12915template <
typename Derived>
12917 OpenACCExitDataConstruct *
C) {
12918 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12921 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12923 if (getSema().OpenACC().ActOnStartStmtDirective(
12924 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12927 return getDerived().RebuildOpenACCExitDataConstruct(
12928 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12929 TransformedClauses);
12932template <
typename Derived>
12934 OpenACCHostDataConstruct *
C) {
12935 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12938 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12940 if (getSema().OpenACC().ActOnStartStmtDirective(
12941 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12945 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
12946 C->clauses(), TransformedClauses);
12947 StmtResult StrBlock = getDerived().TransformStmt(
C->getStructuredBlock());
12948 StrBlock = getSema().OpenACC().ActOnAssociatedStmt(
12949 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses, StrBlock);
12951 return getDerived().RebuildOpenACCHostDataConstruct(
12952 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12953 TransformedClauses, StrBlock);
12956template <
typename Derived>
12959 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12962 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12964 if (getSema().OpenACC().ActOnStartStmtDirective(
12965 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12968 return getDerived().RebuildOpenACCInitConstruct(
12969 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12970 TransformedClauses);
12973template <
typename Derived>
12975 OpenACCShutdownConstruct *
C) {
12976 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12979 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12981 if (getSema().OpenACC().ActOnStartStmtDirective(
12982 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12985 return getDerived().RebuildOpenACCShutdownConstruct(
12986 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12987 TransformedClauses);
12989template <
typename Derived>
12992 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12995 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12997 if (getSema().OpenACC().ActOnStartStmtDirective(
12998 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
13001 return getDerived().RebuildOpenACCSetConstruct(
13002 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
13003 TransformedClauses);
13006template <
typename Derived>
13008 OpenACCUpdateConstruct *
C) {
13009 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13012 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
13014 if (getSema().OpenACC().ActOnStartStmtDirective(
13015 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
13018 return getDerived().RebuildOpenACCUpdateConstruct(
13019 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
13020 TransformedClauses);
13023template <
typename Derived>
13026 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13029 if (
C->hasDevNumExpr()) {
13030 DevNumExpr = getDerived().TransformExpr(
C->getDevNumExpr());
13032 if (DevNumExpr.isUsable())
13033 DevNumExpr = getSema().OpenACC().ActOnIntExpr(
13035 C->getBeginLoc(), DevNumExpr.get());
13040 for (
Expr *QE :
C->getQueueIdExprs()) {
13041 assert(QE &&
"Null queue id expr?");
13042 ExprResult NewEQ = getDerived().TransformExpr(QE);
13044 if (!NewEQ.isUsable())
13048 C->getBeginLoc(), NewEQ.get());
13049 if (NewEQ.isUsable())
13050 QueueIdExprs.push_back(NewEQ.get());
13054 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
13057 if (getSema().OpenACC().ActOnStartStmtDirective(
13058 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
13061 return getDerived().RebuildOpenACCWaitConstruct(
13062 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getLParenLoc(),
13063 DevNumExpr.isUsable() ? DevNumExpr.get() :
nullptr,
C->getQueuesLoc(),
13064 QueueIdExprs,
C->getRParenLoc(),
C->getEndLoc(), TransformedClauses);
13066template <
typename Derived>
13068 OpenACCCacheConstruct *
C) {
13069 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13072 for (
Expr *Var :
C->getVarList()) {
13073 assert(Var &&
"Null var listexpr?");
13075 ExprResult NewVar = getDerived().TransformExpr(Var);
13077 if (!NewVar.isUsable())
13080 NewVar = getSema().OpenACC().ActOnVar(
13082 if (!NewVar.isUsable())
13085 TransformedVarList.push_back(NewVar.get());
13088 if (getSema().OpenACC().ActOnStartStmtDirective(
C->getDirectiveKind(),
13089 C->getBeginLoc(), {}))
13092 return getDerived().RebuildOpenACCCacheConstruct(
13093 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getLParenLoc(),
13094 C->getReadOnlyLoc(), TransformedVarList,
C->getRParenLoc(),
13098template <
typename Derived>
13100 OpenACCAtomicConstruct *
C) {
13101 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13104 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
13107 if (getSema().OpenACC().ActOnStartStmtDirective(
C->getDirectiveKind(),
13108 C->getBeginLoc(), {}))
13113 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(), {}, {});
13115 StmtResult AssocStmt = getDerived().TransformStmt(
C->getAssociatedStmt());
13116 AssocStmt = getSema().OpenACC().ActOnAssociatedStmt(
13117 C->getBeginLoc(),
C->getDirectiveKind(),
C->getAtomicKind(), {},
13120 return getDerived().RebuildOpenACCAtomicConstruct(
13121 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getAtomicKind(),
13122 C->getEndLoc(), TransformedClauses, AssocStmt);
13125template <
typename Derived>
13128 if (getDerived().AlwaysRebuild())
13137template<
typename Derived>
13140 return TransformExpr(E->getSubExpr());
13143template <
typename Derived>
13146 if (!E->isTypeDependent())
13149 TypeSourceInfo *NewT = getDerived().TransformType(E->getTypeSourceInfo());
13154 if (!getDerived().AlwaysRebuild() && E->getTypeSourceInfo() == NewT)
13157 return getDerived().RebuildSYCLUniqueStableNameExpr(
13158 E->getLocation(), E->getLParenLocation(), E->getRParenLocation(), NewT);
13161template <
typename Derived>
13165 const auto *SKEPAttr = FD->template getAttr<SYCLKernelEntryPointAttr>();
13166 if (!SKEPAttr || SKEPAttr->isInvalidAttr())
13169 ExprResult IdExpr = getDerived().TransformExpr(S->getKernelLaunchIdExpr());
13170 if (IdExpr.isInvalid())
13173 StmtResult Body = getDerived().TransformStmt(S->getOriginalStmt());
13174 if (Body.isInvalid())
13180 if (SR.isInvalid())
13186template <
typename Derived>
13189 assert(
false &&
"not implemented yet");
13193template<
typename Derived>
13196 if (!E->isTypeDependent())
13200 E->getIdentKind());
13203template<
typename Derived>
13207 if (E->getQualifierLoc()) {
13209 = getDerived().TransformNestedNameSpecifierLoc(E->getQualifierLoc());
13215 = cast_or_null<ValueDecl>(getDerived().TransformDecl(E->getLocation(),
13217 if (!ND || ND->isInvalidDecl())
13221 if (E->getFoundDecl() != E->getDecl()) {
13222 Found = cast_or_null<NamedDecl>(
13223 getDerived().TransformDecl(E->getLocation(), E->getFoundDecl()));
13229 if (NameInfo.getName()) {
13230 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
13231 if (!NameInfo.getName())
13235 if (!getDerived().AlwaysRebuild() &&
13236 !E->isCapturedByCopyInLambdaWithExplicitObjectParameter() &&
13237 QualifierLoc == E->getQualifierLoc() && ND == E->getDecl() &&
13238 Found == E->getFoundDecl() &&
13239 NameInfo.getName() == E->getDecl()->getDeclName() &&
13240 !E->hasExplicitTemplateArgs()) {
13250 if (E->hasExplicitTemplateArgs()) {
13251 TemplateArgs = &TransArgs;
13252 TransArgs.setLAngleLoc(E->getLAngleLoc());
13253 TransArgs.setRAngleLoc(E->getRAngleLoc());
13254 if (getDerived().TransformTemplateArguments(E->getTemplateArgs(),
13255 E->getNumTemplateArgs(),
13260 return getDerived().RebuildDeclRefExpr(QualifierLoc, ND, NameInfo,
13261 Found, TemplateArgs);
13264template<
typename Derived>
13270template <
typename Derived>
13276template<
typename Derived>
13282template<
typename Derived>
13288template<
typename Derived>
13294template<
typename Derived>
13300template<
typename Derived>
13303 return getDerived().TransformCallExpr(E);
13306template<
typename Derived>
13311 if (E->isExprPredicate())
13312 ControllingExpr = getDerived().TransformExpr(E->getControllingExpr());
13314 ControllingType = getDerived().TransformType(E->getControllingType());
13316 if (ControllingExpr.isInvalid() && !ControllingType)
13327 AssocTypes.push_back(AssocType);
13329 AssocTypes.push_back(
nullptr);
13333 getDerived().TransformExpr(Assoc.getAssociationExpr());
13334 if (AssocExpr.isInvalid())
13336 AssocExprs.push_back(AssocExpr.get());
13339 if (!ControllingType)
13340 return getDerived().RebuildGenericSelectionExpr(E->getGenericLoc(),
13341 E->getDefaultLoc(),
13343 ControllingExpr.get(),
13346 return getDerived().RebuildGenericSelectionExpr(
13347 E->getGenericLoc(), E->getDefaultLoc(), E->getRParenLoc(),
13348 ControllingType, AssocTypes, AssocExprs);
13351template<
typename Derived>
13354 ExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
13355 if (SubExpr.isInvalid())
13358 if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getSubExpr())
13361 return getDerived().RebuildParenExpr(SubExpr.get(), E->getLParen(),
13368template<
typename Derived>
13372 return getDerived().TransformDependentScopeDeclRefExpr(
13373 DRE,
true,
nullptr);
13375 return getDerived().TransformUnresolvedLookupExpr(
13381template<
typename Derived>
13386 SubExpr = TransformAddressOfOperand(E->
getSubExpr());
13392 if (!getDerived().AlwaysRebuild() && SubExpr.
get() == E->
getSubExpr())
13400template<
typename Derived>
13402TreeTransform<Derived>::TransformOffsetOfExpr(OffsetOfExpr *E) {
13404 TypeSourceInfo *Type = getDerived().TransformType(E->getTypeSourceInfo());
13414 bool ExprChanged =
false;
13415 typedef Sema::OffsetOfComponent Component;
13417 for (
unsigned I = 0, N = E->getNumComponents(); I != N; ++I) {
13418 const OffsetOfNode &ON = E->getComponent(I);
13420 Comp.isBrackets =
true;
13421 Comp.LocStart = ON.getSourceRange().getBegin();
13422 Comp.LocEnd = ON.getSourceRange().getEnd();
13423 switch (ON.getKind()) {
13425 Expr *FromIndex = E->getIndexExpr(ON.getArrayExprIndex());
13426 ExprResult Index = getDerived().TransformExpr(FromIndex);
13427 if (Index.isInvalid())
13430 ExprChanged = ExprChanged || Index.get() != FromIndex;
13431 Comp.isBrackets =
true;
13432 Comp.U.E = Index.get();
13438 Comp.isBrackets =
false;
13439 Comp.U.IdentInfo = ON.getFieldName();
13440 if (!
Comp.U.IdentInfo)
13450 Components.push_back(Comp);
13454 if (!getDerived().AlwaysRebuild() &&
13455 Type == E->getTypeSourceInfo() &&
13460 return getDerived().RebuildOffsetOfExpr(E->getOperatorLoc(),
Type,
13461 Components, E->getRParenLoc());
13464template<
typename Derived>
13467 assert((!E->getSourceExpr() || getDerived().AlreadyTransformed(E->getType())) &&
13468 "opaque value expression requires transformation");
13472template <
typename Derived>
13476 for (
Expr *
C : E->subExpressions()) {
13478 if (NewC.isInvalid())
13484 if (!getDerived().AlwaysRebuild() && !Changed)
13486 return getDerived().RebuildRecoveryExpr(E->getBeginLoc(), E->getEndLoc(),
13490template<
typename Derived>
13500 ExprResult result = getDerived().TransformExpr(newSyntacticForm);
13501 if (result.isInvalid())
return ExprError();
13506 if (result.get()->hasPlaceholderType(BuiltinType::PseudoObject))
13512template<
typename Derived>
13516 if (E->isArgumentType()) {
13523 if (!getDerived().AlwaysRebuild() && OldT == NewT)
13526 return getDerived().RebuildUnaryExprOrTypeTrait(NewT, E->getOperatorLoc(),
13528 E->getSourceRange());
13542 auto *PE = dyn_cast<ParenExpr>(E->getArgumentExpr());
13544 PE ? dyn_cast<DependentScopeDeclRefExpr>(PE->getSubExpr()) :
nullptr)
13545 SubExpr = getDerived().TransformParenDependentScopeDeclRefExpr(
13546 PE, DRE,
false, &RecoveryTSI);
13548 SubExpr = getDerived().TransformExpr(E->getArgumentExpr());
13551 return getDerived().RebuildUnaryExprOrTypeTrait(
13552 RecoveryTSI, E->getOperatorLoc(), E->getKind(), E->getSourceRange());
13553 }
else if (SubExpr.isInvalid())
13556 if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getArgumentExpr())
13559 return getDerived().RebuildUnaryExprOrTypeTrait(SubExpr.get(),
13560 E->getOperatorLoc(),
13562 E->getSourceRange());
13565template<
typename Derived>
13568 ExprResult LHS = getDerived().TransformExpr(E->getLHS());
13569 if (LHS.isInvalid())
13572 ExprResult RHS = getDerived().TransformExpr(E->getRHS());
13573 if (RHS.isInvalid())
13577 if (!getDerived().AlwaysRebuild() &&
13578 LHS.get() == E->getLHS() &&
13579 RHS.get() == E->getRHS())
13582 return getDerived().RebuildArraySubscriptExpr(
13584 E->getLHS()->getBeginLoc(), RHS.get(), E->getRBracketLoc());
13587template <
typename Derived>
13591 if (
Base.isInvalid())
13594 ExprResult RowIdx = getDerived().TransformExpr(E->getRowIdx());
13595 if (RowIdx.isInvalid())
13598 if (!getDerived().AlwaysRebuild() &&
Base.get() == E->getBase() &&
13599 RowIdx.get() == E->getRowIdx())
13602 return getDerived().RebuildMatrixSingleSubscriptExpr(
Base.get(), RowIdx.get(),
13603 E->getRBracketLoc());
13606template <
typename Derived>
13610 if (
Base.isInvalid())
13613 ExprResult RowIdx = getDerived().TransformExpr(E->getRowIdx());
13614 if (RowIdx.isInvalid())
13617 ExprResult ColumnIdx = getDerived().TransformExpr(E->getColumnIdx());
13618 if (ColumnIdx.isInvalid())
13621 if (!getDerived().AlwaysRebuild() &&
Base.get() == E->getBase() &&
13622 RowIdx.get() == E->getRowIdx() && ColumnIdx.get() == E->getColumnIdx())
13625 return getDerived().RebuildMatrixSubscriptExpr(
13626 Base.get(), RowIdx.get(), ColumnIdx.get(), E->getRBracketLoc());
13629template <
typename Derived>
13633 if (
Base.isInvalid())
13637 if (E->getLowerBound()) {
13638 LowerBound = getDerived().TransformExpr(E->getLowerBound());
13639 if (LowerBound.isInvalid())
13644 if (E->getLength()) {
13645 Length = getDerived().TransformExpr(E->getLength());
13646 if (Length.isInvalid())
13651 if (E->isOMPArraySection()) {
13652 if (
Expr *Str = E->getStride()) {
13653 Stride = getDerived().TransformExpr(Str);
13654 if (Stride.isInvalid())
13659 if (!getDerived().AlwaysRebuild() &&
Base.get() == E->getBase() &&
13660 LowerBound.get() == E->getLowerBound() &&
13661 Length.get() == E->getLength() &&
13662 (E->isOpenACCArraySection() || Stride.get() == E->getStride()))
13665 return getDerived().RebuildArraySectionExpr(
13666 E->isOMPArraySection(),
Base.get(), E->getBase()->getEndLoc(),
13667 LowerBound.get(), E->getColonLocFirst(),
13668 E->isOMPArraySection() ? E->getColonLocSecond() :
SourceLocation{},
13669 Length.get(), Stride.get(), E->getRBracketLoc());
13672template <
typename Derived>
13676 if (
Base.isInvalid())
13680 bool ErrorFound =
false;
13681 for (
Expr *
Dim : E->getDimensions()) {
13683 if (DimRes.isInvalid()) {
13687 Dims.push_back(DimRes.get());
13692 return getDerived().RebuildOMPArrayShapingExpr(
Base.get(), E->getLParenLoc(),
13693 E->getRParenLoc(), Dims,
13694 E->getBracketsRanges());
13697template <
typename Derived>
13700 unsigned NumIterators = E->numOfIterators();
13703 bool ErrorFound =
false;
13704 bool NeedToRebuild = getDerived().AlwaysRebuild();
13705 for (
unsigned I = 0; I < NumIterators; ++I) {
13707 Data[I].DeclIdent = D->getIdentifier();
13708 Data[I].DeclIdentLoc = D->getLocation();
13709 if (D->getLocation() == D->getBeginLoc()) {
13711 "Implicit type must be int.");
13713 TypeSourceInfo *TSI = getDerived().TransformType(D->getTypeSourceInfo());
13721 ErrorFound = ErrorFound ||
13722 !(!D->getTypeSourceInfo() || (
Data[I].
Type.getAsOpaquePtr() &&
13723 !
Data[I].Type.get().isNull())) ||
13724 Begin.isInvalid() || End.isInvalid() || Step.isInvalid();
13727 Data[I].Range.Begin = Begin.get();
13728 Data[I].Range.End = End.get();
13729 Data[I].Range.Step = Step.get();
13730 Data[I].AssignLoc = E->getAssignLoc(I);
13731 Data[I].ColonLoc = E->getColonLoc(I);
13732 Data[I].SecColonLoc = E->getSecondColonLoc(I);
13735 (D->getTypeSourceInfo() &&
Data[I].
Type.get().getTypePtrOrNull() !=
13736 D->getType().getTypePtrOrNull()) ||
13742 if (!NeedToRebuild)
13745 ExprResult Res = getDerived().RebuildOMPIteratorExpr(
13746 E->getIteratorKwLoc(), E->getLParenLoc(), E->getRParenLoc(),
Data);
13747 if (!Res.isUsable())
13750 for (
unsigned I = 0; I < NumIterators; ++I)
13751 getDerived().transformedLocalDecl(E->getIteratorDecl(I),
13752 IE->getIteratorDecl(I));
13756template<
typename Derived>
13765 bool ArgChanged =
false;
13767 if (getDerived().TransformExprs(E->getArgs(), E->getNumArgs(),
true, Args,
13771 if (!getDerived().AlwaysRebuild() &&
13772 Callee.get() == E->getCallee() &&
13778 = ((
Expr *)
Callee.get())->getSourceRange().getBegin();
13781 if (E->hasStoredFPFeatures()) {
13783 getSema().CurFPFeatures =
13785 getSema().FpPragmaStack.CurrentValue = NewOverrides;
13788 return getDerived().RebuildCallExpr(
Callee.get(), FakeLParenLoc,
13790 E->getRParenLoc());
13793template<
typename Derived>
13797 if (
Base.isInvalid())
13801 if (E->hasQualifier()) {
13803 = getDerived().TransformNestedNameSpecifierLoc(E->getQualifierLoc());
13811 = cast_or_null<ValueDecl>(getDerived().TransformDecl(E->getMemberLoc(),
13812 E->getMemberDecl()));
13816 NamedDecl *FoundDecl = E->getFoundDecl();
13817 if (FoundDecl == E->getMemberDecl()) {
13820 FoundDecl = cast_or_null<NamedDecl>(
13821 getDerived().TransformDecl(E->getMemberLoc(), FoundDecl));
13826 if (!getDerived().AlwaysRebuild() &&
13827 Base.get() == E->getBase() &&
13828 QualifierLoc == E->getQualifierLoc() &&
13829 Member == E->getMemberDecl() &&
13830 FoundDecl == E->getFoundDecl() &&
13831 !E->hasExplicitTemplateArgs()) {
13836 getSema().OpenMP().isOpenMPRebuildMemberExpr(
13846 if (E->hasExplicitTemplateArgs()) {
13847 TransArgs.setLAngleLoc(E->getLAngleLoc());
13848 TransArgs.setRAngleLoc(E->getRAngleLoc());
13849 if (getDerived().TransformTemplateArguments(E->getTemplateArgs(),
13850 E->getNumTemplateArgs(),
13863 NamedDecl *FirstQualifierInScope =
nullptr;
13865 if (MemberNameInfo.getName()) {
13866 MemberNameInfo = getDerived().TransformDeclarationNameInfo(MemberNameInfo);
13867 if (!MemberNameInfo.getName())
13871 return getDerived().RebuildMemberExpr(
Base.get(), FakeOperatorLoc,
13878 (E->hasExplicitTemplateArgs()
13879 ? &TransArgs :
nullptr),
13880 FirstQualifierInScope);
13883template<
typename Derived>
13886 ExprResult LHS = getDerived().TransformExpr(E->getLHS());
13887 if (LHS.isInvalid())
13891 getDerived().TransformInitializer(E->getRHS(),
false);
13892 if (RHS.isInvalid())
13895 if (!getDerived().AlwaysRebuild() &&
13896 LHS.get() == E->getLHS() &&
13897 RHS.get() == E->getRHS())
13900 if (E->isCompoundAssignmentOp())
13902 return getDerived().RebuildBinaryOperator(
13903 E->getOperatorLoc(), E->getOpcode(), LHS.get(), RHS.get());
13906 getSema().CurFPFeatures =
13907 NewOverrides.applyOverrides(getSema().getLangOpts());
13908 getSema().FpPragmaStack.CurrentValue = NewOverrides;
13909 return getDerived().RebuildBinaryOperator(E->getOperatorLoc(), E->getOpcode(),
13910 LHS.get(), RHS.get());
13913template <
typename Derived>
13918 ExprResult LHS = getDerived().TransformExpr(
const_cast<Expr*
>(Decomp.LHS));
13919 if (LHS.isInvalid())
13922 ExprResult RHS = getDerived().TransformExpr(
const_cast<Expr*
>(Decomp.RHS));
13923 if (RHS.isInvalid())
13929 bool ChangedAnyLookups =
false;
13930 Expr *PossibleBinOps[] = {E->getSemanticForm(),
13931 const_cast<Expr *
>(Decomp.InnerBinOp)};
13932 for (
Expr *PossibleBinOp : PossibleBinOps) {
13933 auto *Op = dyn_cast<CXXOperatorCallExpr>(PossibleBinOp->IgnoreImplicit());
13936 auto *
Callee = dyn_cast<DeclRefExpr>(Op->getCallee()->IgnoreImplicit());
13942 NamedDecl *
Found = cast_or_null<NamedDecl>(getDerived().TransformDecl(
13943 E->getOperatorLoc(),
Callee->getFoundDecl()));
13947 ChangedAnyLookups =
true;
13948 UnqualLookups.addDecl(
Found);
13951 if (!getDerived().AlwaysRebuild() && !ChangedAnyLookups &&
13952 LHS.get() == Decomp.LHS && RHS.get() == Decomp.RHS) {
13958 const Expr *StopAt[] = {Decomp.LHS, Decomp.RHS};
13963 return getDerived().RebuildCXXRewrittenBinaryOperator(
13964 E->getOperatorLoc(), Decomp.Opcode, UnqualLookups, LHS.get(), RHS.get());
13967template<
typename Derived>
13973 getSema().CurFPFeatures =
13974 NewOverrides.applyOverrides(getSema().getLangOpts());
13975 getSema().FpPragmaStack.CurrentValue = NewOverrides;
13976 return getDerived().TransformBinaryOperator(E);
13979template<
typename Derived>
13985 ExprResult commonExpr = getDerived().TransformExpr(e->getCommon());
13986 if (commonExpr.isInvalid())
13989 ExprResult rhs = getDerived().TransformExpr(e->getFalseExpr());
13990 if (rhs.isInvalid())
13993 if (!getDerived().AlwaysRebuild() &&
13994 commonExpr.get() == e->getCommon() &&
13995 rhs.get() == e->getFalseExpr())
13998 return getDerived().RebuildConditionalOperator(commonExpr.get(),
13999 e->getQuestionLoc(),
14005template<
typename Derived>
14009 if (
Cond.isInvalid())
14012 ExprResult LHS = getDerived().TransformExpr(E->getLHS());
14013 if (LHS.isInvalid())
14016 ExprResult RHS = getDerived().TransformExpr(E->getRHS());
14017 if (RHS.isInvalid())
14020 if (!getDerived().AlwaysRebuild() &&
14021 Cond.get() == E->getCond() &&
14022 LHS.get() == E->getLHS() &&
14023 RHS.get() == E->getRHS())
14026 return getDerived().RebuildConditionalOperator(
Cond.get(),
14027 E->getQuestionLoc(),
14033template<
typename Derived>
14038 return getDerived().
TransformExpr(E->getSubExprAsWritten());
14041template<
typename Derived>
14049 = getDerived().TransformExpr(E->getSubExprAsWritten());
14050 if (SubExpr.isInvalid())
14053 if (!getDerived().AlwaysRebuild() &&
14054 Type == E->getTypeInfoAsWritten() &&
14055 SubExpr.get() == E->getSubExpr())
14058 return getDerived().RebuildCStyleCastExpr(E->getLParenLoc(),
14064template<
typename Derived>
14072 ExprResult Init = getDerived().TransformExpr(E->getInitializer());
14073 if (
Init.isInvalid())
14076 if (!getDerived().AlwaysRebuild() &&
14078 Init.get() == E->getInitializer())
14085 return getDerived().RebuildCompoundLiteralExpr(
14086 E->getLParenLoc(), NewT,
14087 E->getInitializer()->getEndLoc(),
Init.get());
14090template<
typename Derived>
14094 if (
Base.isInvalid())
14097 if (!getDerived().AlwaysRebuild() &&
14098 Base.get() == E->getBase())
14104 return getDerived().RebuildExtVectorOrMatrixElementExpr(
14105 Base.get(), FakeOperatorLoc, E->isArrow(), E->getAccessorLoc(),
14109template <
typename Derived>
14113 if (
Base.isInvalid())
14116 if (!getDerived().AlwaysRebuild() &&
Base.get() == E->getBase())
14122 return getDerived().RebuildExtVectorOrMatrixElementExpr(
14123 Base.get(), FakeOperatorLoc,
false, E->getAccessorLoc(),
14127template<
typename Derived>
14133 bool InitChanged =
false;
14139 if (getDerived().TransformExprs(E->getInits(), E->getNumInits(),
false,
14140 Inits, &InitChanged))
14143 if (!getDerived().AlwaysRebuild() && !InitChanged) {
14150 return getDerived().RebuildInitList(E->getLBraceLoc(),
Inits,
14151 E->getRBraceLoc(), E->isExplicit());
14154template<
typename Derived>
14161 if (
Init.isInvalid())
14166 bool ExprChanged =
false;
14168 if (D.isFieldDesignator()) {
14169 if (D.getFieldDecl()) {
14171 getDerived().TransformDecl(D.getFieldLoc(), D.getFieldDecl()));
14172 if (Field != D.getFieldDecl())
14175 ExprChanged =
true;
14176 if (
Field->isAnonymousStructOrUnion())
14182 ExprChanged =
true;
14185 D.getFieldName(), D.getDotLoc(), D.getFieldLoc()));
14189 if (D.isArrayDesignator()) {
14190 ExprResult Index = getDerived().TransformExpr(E->getArrayIndex(D));
14191 if (Index.isInvalid())
14194 Desig.AddDesignator(
14197 ExprChanged = ExprChanged || Index.get() != E->getArrayIndex(D);
14198 ArrayExprs.push_back(Index.get());
14202 assert(D.isArrayRangeDesignator() &&
"New kind of designator?");
14204 = getDerived().TransformExpr(E->getArrayRangeStart(D));
14205 if (Start.isInvalid())
14208 ExprResult End = getDerived().TransformExpr(E->getArrayRangeEnd(D));
14209 if (End.isInvalid())
14213 Start.get(), End.get(), D.getLBracketLoc(), D.getEllipsisLoc()));
14215 ExprChanged = ExprChanged || Start.get() != E->getArrayRangeStart(D) ||
14216 End.get() != E->getArrayRangeEnd(D);
14218 ArrayExprs.push_back(Start.get());
14219 ArrayExprs.push_back(End.get());
14222 if (!getDerived().AlwaysRebuild() &&
14223 Init.get() == E->getInit() &&
14227 return getDerived().RebuildDesignatedInitExpr(Desig, ArrayExprs,
14228 E->getEqualOrColonLoc(),
14229 E->usesGNUSyntax(),
Init.get());
14234template<
typename Derived>
14238 llvm_unreachable(
"Unexpected DesignatedInitUpdateExpr in syntactic form of "
14243template<
typename Derived>
14247 llvm_unreachable(
"Unexpected NoInitExpr in syntactic form of initializer");
14251template<
typename Derived>
14254 llvm_unreachable(
"Unexpected ArrayInitLoopExpr outside of initializer");
14258template<
typename Derived>
14261 llvm_unreachable(
"Unexpected ArrayInitIndexExpr outside of initializer");
14265template<
typename Derived>
14273 QualType T = getDerived().TransformType(E->getType());
14277 if (!getDerived().AlwaysRebuild() &&
14281 return getDerived().RebuildImplicitValueInitExpr(T);
14284template<
typename Derived>
14287 TypeSourceInfo *TInfo = getDerived().TransformType(E->getWrittenTypeInfo());
14291 ExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
14292 if (SubExpr.isInvalid())
14295 if (!getDerived().AlwaysRebuild() &&
14296 TInfo == E->getWrittenTypeInfo() &&
14297 SubExpr.get() == E->getSubExpr())
14300 return getDerived().RebuildVAArgExpr(E->getBuiltinLoc(), SubExpr.get(),
14301 TInfo, E->getRParenLoc());
14304template<
typename Derived>
14307 bool ArgumentChanged =
false;
14309 if (TransformExprs(E->getExprs(), E->getNumExprs(),
true,
Inits,
14313 return getDerived().RebuildParenListExpr(E->getLParenLoc(),
14315 E->getRParenLoc());
14323template<
typename Derived>
14326 Decl *LD = getDerived().TransformDecl(E->getLabel()->getLocation(),
14331 return getDerived().RebuildAddrLabelExpr(E->getAmpAmpLoc(), E->getLabelLoc(),
14335template<
typename Derived>
14340 = getDerived().TransformCompoundStmt(E->getSubStmt(),
true);
14341 if (SubStmt.isInvalid()) {
14346 unsigned OldDepth = E->getTemplateDepth();
14347 unsigned NewDepth = getDerived().TransformTemplateDepth(OldDepth);
14349 if (!getDerived().AlwaysRebuild() && OldDepth == NewDepth &&
14350 SubStmt.get() == E->getSubStmt()) {
14356 return getDerived().RebuildStmtExpr(E->getLParenLoc(), SubStmt.get(),
14357 E->getRParenLoc(), NewDepth);
14360template<
typename Derived>
14364 if (
Cond.isInvalid())
14367 ExprResult LHS = getDerived().TransformExpr(E->getLHS());
14368 if (LHS.isInvalid())
14371 ExprResult RHS = getDerived().TransformExpr(E->getRHS());
14372 if (RHS.isInvalid())
14375 if (!getDerived().AlwaysRebuild() &&
14376 Cond.get() == E->getCond() &&
14377 LHS.get() == E->getLHS() &&
14378 RHS.get() == E->getRHS())
14381 return getDerived().RebuildChooseExpr(E->getBuiltinLoc(),
14382 Cond.get(), LHS.get(), RHS.get(),
14383 E->getRParenLoc());
14386template<
typename Derived>
14392template<
typename Derived>
14395 switch (E->getOperator()) {
14399 case OO_Array_Delete:
14400 llvm_unreachable(
"new and delete operators cannot use CXXOperatorCallExpr");
14405 assert(E->getNumArgs() >= 1 &&
"Object call is missing arguments");
14418 if (FakeLParenLoc.isInvalid() && EndLoc.isValid())
14419 FakeLParenLoc = EndLoc;
14423 if (getDerived().TransformExprs(E->getArgs() + 1, E->getNumArgs() - 1,
true,
14427 if (E->getOperator() == OO_Subscript)
14428 return getDerived().RebuildCxxSubscriptExpr(
Object.get(), FakeLParenLoc,
14429 Args, E->getEndLoc());
14431 return getDerived().RebuildCallExpr(
Object.get(), FakeLParenLoc, Args,
14435#define OVERLOADED_OPERATOR(Name, Spelling, Token, Unary, Binary, MemberOnly) \
14439#define OVERLOADED_OPERATOR_MULTI(Name,Spelling,Unary,Binary,MemberOnly)
14440#include "clang/Basic/OperatorKinds.def"
14442 case OO_Conditional:
14443 llvm_unreachable(
"conditional operator is not actually overloadable");
14447 llvm_unreachable(
"not an overloaded operator?");
14451 if (E->getNumArgs() == 1 && E->getOperator() == OO_Amp)
14452 First = getDerived().TransformAddressOfOperand(E->getArg(0));
14454 First = getDerived().TransformExpr(E->getArg(0));
14455 if (
First.isInvalid())
14459 if (E->getNumArgs() == 2) {
14461 getDerived().TransformInitializer(E->getArg(1),
false);
14462 if (Second.isInvalid())
14468 getSema().CurFPFeatures =
14469 NewOverrides.applyOverrides(getSema().getLangOpts());
14470 getSema().FpPragmaStack.CurrentValue = NewOverrides;
14476 if (getDerived().TransformOverloadExprDecls(ULE, ULE->requiresADL(), R))
14479 return getDerived().RebuildCXXOperatorCallExpr(
14480 E->getOperator(), E->getOperatorLoc(),
Callee->getBeginLoc(),
14481 ULE->requiresADL(),
R.asUnresolvedSet(),
First.get(), Second.get());
14486 Callee = ICE->getSubExprAsWritten();
14488 ValueDecl *VD = cast_or_null<ValueDecl>(
14489 getDerived().TransformDecl(DR->getLocation(), DR));
14494 Functions.addDecl(VD);
14496 return getDerived().RebuildCXXOperatorCallExpr(
14497 E->getOperator(), E->getOperatorLoc(),
Callee->getBeginLoc(),
14498 false, Functions,
First.get(), Second.get());
14501template<
typename Derived>
14504 return getDerived().TransformCallExpr(E);
14507template <
typename Derived>
14510 getSema().CurContext != E->getParentContext();
14512 if (!getDerived().AlwaysRebuild() && !NeedRebuildFunc)
14515 return getDerived().RebuildSourceLocExpr(E->getIdentKind(), E->getType(),
14516 E->getBeginLoc(), E->getEndLoc(),
14517 getSema().CurContext);
14520template <
typename Derived>
14525template<
typename Derived>
14534 ExprResult EC = getDerived().TransformCallExpr(E->getConfig());
14535 if (EC.isInvalid())
14539 bool ArgChanged =
false;
14541 if (getDerived().TransformExprs(E->getArgs(), E->getNumArgs(),
true, Args,
14545 if (!getDerived().AlwaysRebuild() &&
14546 Callee.get() == E->getCallee() &&
14552 = ((
Expr *)
Callee.get())->getSourceRange().getBegin();
14553 return getDerived().RebuildCallExpr(
Callee.get(), FakeLParenLoc,
14555 E->getRParenLoc(), EC.get());
14558template<
typename Derived>
14574 return getDerived().RebuildCXXNamedCastExpr(
14581template<
typename Derived>
14590 if (Sub.isInvalid())
14593 return getDerived().RebuildBuiltinBitCastExpr(BCE->
getBeginLoc(), TSI,
14597template<
typename Derived>
14599TreeTransform<Derived>::TransformCXXStaticCastExpr(CXXStaticCastExpr *E) {
14600 return getDerived().TransformCXXNamedCastExpr(E);
14603template<
typename Derived>
14609template<
typename Derived>
14616template<
typename Derived>
14622template<
typename Derived>
14628template<
typename Derived>
14633 getDerived().TransformTypeWithDeducedTST(E->getTypeInfoAsWritten());
14638 = getDerived().TransformExpr(E->getSubExprAsWritten());
14639 if (SubExpr.isInvalid())
14642 if (!getDerived().AlwaysRebuild() &&
14643 Type == E->getTypeInfoAsWritten() &&
14644 SubExpr.get() == E->getSubExpr())
14647 return getDerived().RebuildCXXFunctionalCastExpr(
Type,
14651 E->isListInitialization());
14654template<
typename Derived>
14657 if (E->isTypeOperand()) {
14659 = getDerived().TransformType(E->getTypeOperandSourceInfo());
14663 if (!getDerived().AlwaysRebuild() &&
14664 TInfo == E->getTypeOperandSourceInfo())
14667 return getDerived().RebuildCXXTypeidExpr(E->getType(), E->getBeginLoc(),
14668 TInfo, E->getEndLoc());
14674 Expr *Op = E->getExprOperand();
14676 if (E->isGLValue()) {
14678 if (
auto *RD = OpType->getAsCXXRecordDecl()) {
14680 diag::err_incomplete_typeid))
14683 if (RD->isPolymorphic())
14691 ExprResult SubExpr = getDerived().TransformExpr(Op);
14692 if (SubExpr.isInvalid())
14695 if (!getDerived().AlwaysRebuild() &&
14696 SubExpr.get() == E->getExprOperand())
14699 return getDerived().RebuildCXXTypeidExpr(E->getType(), E->getBeginLoc(),
14700 SubExpr.get(), E->getEndLoc());
14703template<
typename Derived>
14706 if (E->isTypeOperand()) {
14708 = getDerived().TransformType(E->getTypeOperandSourceInfo());
14712 if (!getDerived().AlwaysRebuild() &&
14713 TInfo == E->getTypeOperandSourceInfo())
14716 return getDerived().RebuildCXXUuidofExpr(E->getType(), E->getBeginLoc(),
14717 TInfo, E->getEndLoc());
14723 ExprResult SubExpr = getDerived().TransformExpr(E->getExprOperand());
14724 if (SubExpr.isInvalid())
14727 if (!getDerived().AlwaysRebuild() &&
14728 SubExpr.get() == E->getExprOperand())
14731 return getDerived().RebuildCXXUuidofExpr(E->getType(), E->getBeginLoc(),
14732 SubExpr.get(), E->getEndLoc());
14735template<
typename Derived>
14741template<
typename Derived>
14748template<
typename Derived>
14764 auto &S = getSema();
14765 if (E->isCapturedByCopyInLambdaWithExplicitObjectParameter())
14766 return S.getCurrentThisType();
14767 if (S.getCurLambda())
14768 return getDerived().TransformType(E->getType());
14769 return S.getCurrentThisType();
14772 if (!getDerived().AlwaysRebuild() && T == E->getType() &&
14773 !E->isCapturedByCopyInLambdaWithExplicitObjectParameter()) {
14776 getSema().MarkThisReferenced(E);
14780 return getDerived().RebuildCXXThisExpr(E->getBeginLoc(), T, E->isImplicit());
14783template<
typename Derived>
14786 ExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
14787 if (SubExpr.isInvalid())
14790 getSema().DiagnoseExceptionUse(E->getThrowLoc(),
false);
14792 if (!getDerived().AlwaysRebuild() &&
14793 SubExpr.get() == E->getSubExpr())
14796 return getDerived().RebuildCXXThrowExpr(E->getThrowLoc(), SubExpr.get(),
14797 E->isThrownVariableInScope());
14800template<
typename Derived>
14804 getDerived().TransformDecl(E->getBeginLoc(), E->getParam()));
14809 if (E->hasRewrittenInit()) {
14810 InitRes = getDerived().TransformExpr(E->getRewrittenExpr());
14811 if (InitRes.isInvalid())
14815 if (!getDerived().AlwaysRebuild() && Param == E->getParam() &&
14816 E->getUsedContext() == SemaRef.
CurContext &&
14817 InitRes.get() == E->getRewrittenExpr())
14820 return getDerived().RebuildCXXDefaultArgExpr(E->getUsedLocation(), Param,
14824template<
typename Derived>
14828 getDerived().TransformDecl(E->getBeginLoc(), E->getField()));
14832 if (!getDerived().AlwaysRebuild() && Field == E->getField() &&
14836 return getDerived().RebuildCXXDefaultInitExpr(E->getExprLoc(), Field);
14839template<
typename Derived>
14843 TypeSourceInfo *T = getDerived().TransformType(E->getTypeSourceInfo());
14847 if (!getDerived().AlwaysRebuild() &&
14848 T == E->getTypeSourceInfo())
14851 return getDerived().RebuildCXXScalarValueInitExpr(T,
14852 T->getTypeLoc().getEndLoc(),
14853 E->getRParenLoc());
14856template<
typename Derived>
14861 getDerived().TransformTypeWithDeducedTST(E->getAllocatedTypeSourceInfo());
14862 if (!AllocTypeInfo)
14866 std::optional<Expr *> ArraySize;
14867 if (E->isArray()) {
14869 if (std::optional<Expr *> OldArraySize = E->getArraySize()) {
14870 NewArraySize = getDerived().TransformExpr(*OldArraySize);
14871 if (NewArraySize.isInvalid())
14874 ArraySize = NewArraySize.get();
14878 bool ArgumentChanged =
false;
14880 if (getDerived().TransformExprs(E->getPlacementArgs(),
14881 E->getNumPlacementArgs(),
true,
14882 PlacementArgs, &ArgumentChanged))
14886 Expr *OldInit = E->getInitializer();
14889 NewInit = getDerived().TransformInitializer(OldInit,
true);
14890 if (NewInit.isInvalid())
14895 if (E->getOperatorNew()) {
14896 OperatorNew = cast_or_null<FunctionDecl>(
14897 getDerived().TransformDecl(E->getBeginLoc(), E->getOperatorNew()));
14903 if (E->getOperatorDelete()) {
14904 OperatorDelete = cast_or_null<FunctionDecl>(
14905 getDerived().TransformDecl(E->getBeginLoc(), E->getOperatorDelete()));
14906 if (!OperatorDelete)
14910 if (!getDerived().AlwaysRebuild() &&
14911 AllocTypeInfo == E->getAllocatedTypeSourceInfo() &&
14912 ArraySize == E->getArraySize() &&
14913 NewInit.get() == OldInit &&
14914 OperatorNew == E->getOperatorNew() &&
14915 OperatorDelete == E->getOperatorDelete() &&
14916 !ArgumentChanged) {
14921 if (OperatorDelete)
14924 if (E->isArray() && !E->getAllocatedType()->isDependentType()) {
14936 QualType AllocType = AllocTypeInfo->getType();
14947 = dyn_cast<ConstantArrayType>(ArrayT)) {
14951 AllocType = ConsArrayT->getElementType();
14953 = dyn_cast<DependentSizedArrayType>(ArrayT)) {
14954 if (DepArrayT->getSizeExpr()) {
14955 ArraySize = DepArrayT->getSizeExpr();
14956 AllocType = DepArrayT->getElementType();
14961 return getDerived().RebuildCXXNewExpr(
14962 E->getBeginLoc(), E->isGlobalNew(),
14963 E->getBeginLoc(), PlacementArgs,
14964 E->getBeginLoc(), E->getTypeIdParens(), AllocType,
14965 AllocTypeInfo, ArraySize, E->getDirectInitRange(), NewInit.get());
14968template<
typename Derived>
14977 if (E->getOperatorDelete()) {
14978 OperatorDelete = cast_or_null<FunctionDecl>(
14979 getDerived().TransformDecl(E->getBeginLoc(), E->getOperatorDelete()));
14980 if (!OperatorDelete)
14984 if (!getDerived().AlwaysRebuild() &&
14985 Operand.get() == E->getArgument() &&
14986 OperatorDelete == E->getOperatorDelete()) {
14989 if (OperatorDelete)
14992 if (!E->getArgument()->isTypeDependent()) {
14994 E->getDestroyedType());
15003 return getDerived().RebuildCXXDeleteExpr(
15004 E->getBeginLoc(), E->isGlobalDelete(), E->isArrayForm(),
Operand.get());
15007template<
typename Derived>
15012 if (
Base.isInvalid())
15016 bool MayBePseudoDestructor =
false;
15018 E->getOperatorLoc(),
15019 E->isArrow()? tok::arrow : tok::period,
15021 MayBePseudoDestructor);
15022 if (
Base.isInvalid())
15025 QualType ObjectType = ObjectTypePtr.get();
15027 if (QualifierLoc) {
15029 = getDerived().TransformNestedNameSpecifierLoc(QualifierLoc, ObjectType);
15034 SS.
Adopt(QualifierLoc);
15037 if (E->getDestroyedTypeInfo()) {
15038 TypeSourceInfo *DestroyedTypeInfo = getDerived().TransformTypeInObjectScope(
15039 E->getDestroyedTypeInfo(), ObjectType,
15041 if (!DestroyedTypeInfo)
15044 }
else if (!ObjectType.isNull() && ObjectType->isDependentType()) {
15048 E->getDestroyedTypeLoc());
15052 *E->getDestroyedTypeIdentifier(), E->getDestroyedTypeLoc(),
15053 nullptr, SS, ObjectTypePtr,
false);
15059 E->getDestroyedTypeLoc());
15063 if (E->getScopeTypeInfo()) {
15064 ScopeTypeInfo = getDerived().TransformTypeInObjectScope(
15065 E->getScopeTypeInfo(), ObjectType,
nullptr);
15066 if (!ScopeTypeInfo)
15070 return getDerived().RebuildCXXPseudoDestructorExpr(
Base.get(),
15071 E->getOperatorLoc(),
15075 E->getColonColonLoc(),
15080template <
typename Derived>
15085 bool AllEmptyPacks =
true;
15086 for (
auto *OldD : Old->
decls()) {
15102 if (
auto *UPD = dyn_cast<UsingPackDecl>(InstD))
15103 Decls = UPD->expansions();
15106 for (
auto *D : Decls) {
15107 if (
auto *UD = dyn_cast<UsingDecl>(D)) {
15108 for (
auto *SD : UD->shadows())
15115 AllEmptyPacks &= Decls.empty();
15124 if (AllEmptyPacks && !RequiresADL) {
15135 NamedDecl *FoundDecl = R.getRepresentativeDecl()->getUnderlyingDecl();
15136 getSema().FilterAcceptableTemplateNames(R,
15142 getSema().Diag(R.getNameLoc(),
15143 diag::err_template_kw_refers_to_non_template)
15147 diag::note_template_kw_refers_to_non_template)
15148 << R.getLookupName();
15156template <
typename Derived>
15162template <
typename Derived>
15165 bool IsAddressOfOperand) {
15170 if (TransformOverloadExprDecls(Old, Old->
requiresADL(), R))
15177 = getDerived().TransformNestedNameSpecifierLoc(Old->
getQualifierLoc());
15181 SS.
Adopt(QualifierLoc);
15185 CXXRecordDecl *NamingClass
15186 = cast_or_null<CXXRecordDecl>(getDerived().TransformDecl(
15189 if (!NamingClass) {
15194 R.setNamingClass(NamingClass);
15215 SS, TemplateKWLoc, R,
15222 return getDerived().RebuildDeclarationNameExpr(SS, R, Old->
requiresADL());
15225 return getDerived().RebuildTemplateIdExpr(SS, TemplateKWLoc, R,
15229template<
typename Derived>
15232 bool ArgChanged =
false;
15234 for (
unsigned I = 0, N = E->getNumArgs(); I != N; ++I) {
15236 TypeLoc FromTL = From->getTypeLoc();
15239 TLB.
reserve(FromTL.getFullDataSize());
15240 QualType To = getDerived().TransformType(TLB, FromTL);
15244 if (To == From->getType())
15245 Args.push_back(From);
15247 Args.push_back(TLB.getTypeSourceInfo(SemaRef.
Context, To));
15257 TypeLoc PatternTL = ExpansionTL.getPatternLoc();
15263 bool Expand =
true;
15264 bool RetainExpansion =
false;
15266 ExpansionTL.getTypePtr()->getNumExpansions();
15268 if (getDerived().TryExpandParameterPacks(
15269 ExpansionTL.getEllipsisLoc(), PatternTL.getSourceRange(),
15270 Unexpanded,
true, Expand,
15271 RetainExpansion, NumExpansions))
15281 TLB.
reserve(From->getTypeLoc().getFullDataSize());
15283 QualType To = getDerived().TransformType(TLB, PatternTL);
15287 To = getDerived().RebuildPackExpansionType(To,
15288 PatternTL.getSourceRange(),
15289 ExpansionTL.getEllipsisLoc(),
15297 Args.push_back(TLB.getTypeSourceInfo(SemaRef.
Context, To));
15303 for (
unsigned I = 0; I != *NumExpansions; ++I) {
15306 TLB.
reserve(PatternTL.getFullDataSize());
15307 QualType To = getDerived().TransformType(TLB, PatternTL);
15311 if (To->containsUnexpandedParameterPack()) {
15312 To = getDerived().RebuildPackExpansionType(To,
15313 PatternTL.getSourceRange(),
15314 ExpansionTL.getEllipsisLoc(),
15324 Args.push_back(TLB.getTypeSourceInfo(SemaRef.
Context, To));
15327 if (!RetainExpansion)
15332 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
15335 TLB.
reserve(From->getTypeLoc().getFullDataSize());
15337 QualType To = getDerived().TransformType(TLB, PatternTL);
15341 To = getDerived().RebuildPackExpansionType(To,
15342 PatternTL.getSourceRange(),
15343 ExpansionTL.getEllipsisLoc(),
15351 Args.push_back(TLB.getTypeSourceInfo(SemaRef.
Context, To));
15354 if (!getDerived().AlwaysRebuild() && !ArgChanged)
15357 return getDerived().RebuildTypeTrait(E->getTrait(), E->getBeginLoc(), Args,
15361template<
typename Derived>
15367 if (getDerived().TransformTemplateArguments(Old->getTemplateArgs(),
15368 Old->NumTemplateArgs, TransArgs))
15371 return getDerived().RebuildConceptSpecializationExpr(
15372 E->getNestedNameSpecifierLoc(), E->getTemplateKWLoc(),
15373 E->getConceptNameInfo(), E->getFoundDecl(), E->getNamedConcept(),
15377template<
typename Derived>
15391 getSema().Context, getSema().CurContext,
15392 E->getBody()->getBeginLoc());
15396 ExprResult TypeParamResult = getDerived().TransformRequiresTypeParams(
15397 E->getRequiresKWLoc(), E->getRBraceLoc(), E, Body,
15398 E->getLocalParameters(), TransParamTypes, TransParams, ExtParamInfos);
15402 Param->setDeclContext(Body);
15408 if (!TypeParamResult.isUnset())
15409 return TypeParamResult;
15412 if (getDerived().TransformRequiresExprRequirements(E->getRequirements(),
15417 if (
auto *ER = dyn_cast<concepts::ExprRequirement>(Req)) {
15418 if (ER->getReturnTypeRequirement().isTypeConstraint()) {
15419 ER->getReturnTypeRequirement()
15420 .getTypeConstraintTemplateParameterList()->getParam(0)
15421 ->setDeclContext(Body);
15426 return getDerived().RebuildRequiresExpr(
15427 E->getRequiresKWLoc(), Body, E->getLParenLoc(), TransParams,
15428 E->getRParenLoc(), TransReqs, E->getRBraceLoc());
15431template<
typename Derived>
15437 if (
auto *TypeReq = dyn_cast<concepts::TypeRequirement>(Req))
15438 TransReq =
getDerived().TransformTypeRequirement(TypeReq);
15439 else if (
auto *ExprReq = dyn_cast<concepts::ExprRequirement>(Req))
15440 TransReq =
getDerived().TransformExprRequirement(ExprReq);
15442 TransReq =
getDerived().TransformNestedRequirement(
15446 Transformed.push_back(TransReq);
15451template<
typename Derived>
15464 return getDerived().RebuildTypeRequirement(TransType);
15467template<
typename Derived>
15470 llvm::PointerUnion<Expr *, concepts::Requirement::SubstitutionDiagnostic *> TransExpr;
15476 TransExprRes =
SemaRef.CheckPlaceholderExpr(TransExprRes.
get());
15479 TransExpr = TransExprRes.
get();
15482 std::optional<concepts::ExprRequirement::ReturnTypeRequirement> TransRetReq;
15484 if (RetReq.isEmpty())
15485 TransRetReq.emplace();
15486 else if (RetReq.isSubstitutionFailure())
15487 TransRetReq.emplace(RetReq.getSubstitutionDiagnostic());
15488 else if (RetReq.isTypeConstraint()) {
15490 RetReq.getTypeConstraintTemplateParameterList();
15492 getDerived().TransformTemplateParameterList(OrigTPL);
15495 TransRetReq.emplace(TPL);
15497 assert(TransRetReq &&
"All code paths leading here must set TransRetReq");
15498 if (
Expr *E = dyn_cast<Expr *>(TransExpr))
15501 std::move(*TransRetReq));
15507template<
typename Derived>
15513 return getDerived().RebuildNestedRequirement(
15521 return getDerived().RebuildNestedRequirement(TransConstraint.
get());
15524template<
typename Derived>
15531 if (!getDerived().AlwaysRebuild() &&
15548template<
typename Derived>
15555 SubExpr = getDerived().TransformExpr(E->getQueriedExpression());
15556 if (SubExpr.isInvalid())
15559 if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getQueriedExpression())
15563 return getDerived().RebuildExpressionTrait(E->getTrait(), E->getBeginLoc(),
15564 SubExpr.get(), E->getEndLoc());
15567template <
typename Derived>
15572 DRE, AddrTaken, RecoveryTSI);
15585template <
typename Derived>
15592template <
typename Derived>
15608 getDerived().TransformDeclarationNameInfo(E->
getNameInfo());
15613 if (!getDerived().AlwaysRebuild() && QualifierLoc == E->
getQualifierLoc() &&
15619 return getDerived().RebuildDependentScopeDeclRefExpr(
15620 QualifierLoc, TemplateKWLoc, NameInfo,
nullptr,
15621 IsAddressOfOperand, RecoveryTSI);
15625 if (getDerived().TransformTemplateArguments(
15629 return getDerived().RebuildDependentScopeDeclRefExpr(
15630 QualifierLoc, TemplateKWLoc, NameInfo, &TransArgs, IsAddressOfOperand,
15634template<
typename Derived>
15640 if (getDerived().AllowSkippingCXXConstructExpr() &&
15641 ((E->getNumArgs() == 1 ||
15642 (E->getNumArgs() > 1 && getDerived().DropCallArgument(E->getArg(1)))) &&
15643 (!getDerived().DropCallArgument(E->getArg(0))) &&
15644 !E->isListInitialization()))
15650 QualType T = getDerived().TransformType(E->getType());
15655 getDerived().TransformDecl(E->getBeginLoc(), E->getConstructor()));
15659 bool ArgumentChanged =
false;
15664 E->isListInitialization());
15665 if (getDerived().TransformExprs(E->getArgs(), E->getNumArgs(),
true, Args,
15670 if (!getDerived().AlwaysRebuild() &&
15671 T == E->getType() &&
15673 !ArgumentChanged) {
15680 return getDerived().RebuildCXXConstructExpr(
15681 T, E->getBeginLoc(),
Constructor, E->isElidable(), Args,
15682 E->hadMultipleCandidates(), E->isListInitialization(),
15683 E->isStdInitListInitialization(), E->requiresZeroInitialization(),
15684 E->getConstructionKind(), E->getParenOrBraceRange());
15687template<
typename Derived>
15690 QualType T = getDerived().TransformType(E->getType());
15695 getDerived().TransformDecl(E->getBeginLoc(), E->getConstructor()));
15699 if (!getDerived().AlwaysRebuild() &&
15700 T == E->getType() &&
15708 return getDerived().RebuildCXXInheritedCtorInitExpr(
15710 E->constructsVBase(), E->inheritedFromVBase());
15717template<
typename Derived>
15720 if (
auto *Dtor = E->getTemporary()->getDestructor())
15723 return getDerived().TransformExpr(E->getSubExpr());
15731template<
typename Derived>
15737template<
typename Derived>
15742 getDerived().TransformTypeWithDeducedTST(E->getTypeSourceInfo());
15747 getDerived().TransformDecl(E->getBeginLoc(), E->getConstructor()));
15751 bool ArgumentChanged =
false;
15753 Args.reserve(E->getNumArgs());
15757 E->isListInitialization());
15758 if (TransformExprs(E->getArgs(), E->getNumArgs(),
true, Args,
15762 if (E->isListInitialization() && !E->isStdInitListInitialization()) {
15763 ExprResult Res = RebuildInitList(E->getBeginLoc(), Args, E->getEndLoc(),
15765 if (Res.isInvalid())
15767 Args = {Res.get()};
15771 if (!getDerived().AlwaysRebuild() &&
15772 T == E->getTypeSourceInfo() &&
15774 !ArgumentChanged) {
15781 return getDerived().RebuildCXXTemporaryObjectExpr(
15782 T, LParenLoc, Args, E->getEndLoc(), E->isListInitialization());
15785template<
typename Derived>
15790 typedef std::pair<ExprResult, QualType> InitCaptureInfoTy;
15791 struct TransformedInitCapture {
15793 SourceLocation EllipsisLoc;
15795 SmallVector<InitCaptureInfoTy, 4> Expansions;
15798 InitCaptures.resize(E->explicit_capture_end() - E->explicit_capture_begin());
15800 CEnd = E->capture_end();
15802 if (!E->isInitCapture(
C))
15805 TransformedInitCapture &
Result = InitCaptures[
C - E->capture_begin()];
15810 ExprResult NewExprInitResult = getDerived().TransformInitializer(
15813 if (NewExprInitResult.isInvalid()) {
15817 Expr *NewExprInit = NewExprInitResult.get();
15820 getSema().buildLambdaInitCaptureInitialization(
15821 C->getLocation(),
C->getCaptureKind() ==
LCK_ByRef,
15822 EllipsisLoc, NumExpansions, OldVD->getIdentifier(),
15826 Result.Expansions.push_back(
15827 InitCaptureInfoTy(NewExprInit, NewInitCaptureType));
15831 if (OldVD->isParameterPack()) {
15840 bool Expand =
true;
15841 bool RetainExpansion =
false;
15843 ExpansionTL.getTypePtr()->getNumExpansions();
15845 if (getDerived().TryExpandParameterPacks(
15846 ExpansionTL.getEllipsisLoc(), OldVD->getInit()->getSourceRange(),
15847 Unexpanded,
true, Expand,
15848 RetainExpansion, NumExpansions))
15850 assert(!RetainExpansion &&
"Should not need to retain expansion after a "
15851 "capture since it cannot be extended");
15853 for (
unsigned I = 0; I != *NumExpansions; ++I) {
15858 SubstInitCapture(ExpansionTL.getEllipsisLoc(), NumExpansions);
15859 Result.EllipsisLoc = ExpansionTL.getEllipsisLoc();
15896 while (DC->isRequiresExprBody())
15898 if ((getSema().isUnevaluatedContext() ||
15899 getSema().isConstantEvaluatedContext()) &&
15900 !(dyn_cast_or_null<CXXRecordDecl>(DC->getParent()) &&
15902 (DC->isFileContext() || !DC->getParent()->isDependentContext()))
15907 E->getIntroducerRange(),
nullptr, DependencyKind,
15908 E->getCaptureDefault());
15909 getDerived().transformedLocalDecl(OldClass, {
Class});
15912 getSema().CreateLambdaCallOperator(E->getIntroducerRange(),
Class);
15915 getSema().buildLambdaScope(LSI, NewCallOperator, E->getIntroducerRange(),
15916 E->getCaptureDefault(), E->getCaptureDefaultLoc(),
15917 E->hasExplicitParameters(), E->isMutable());
15927 CEnd = E->capture_end();
15931 if (
C->isImplicit())
15935 if (
C->capturesThis()) {
15943 dyn_cast_if_present<CXXRecordDecl>(
15944 getSema().getFunctionLevelDeclContext()),
15946 getSema().CheckCXXThisCapture(
C->getLocation(),
C->isExplicit(),
15953 if (
C->capturesVLAType())
15957 if (E->isInitCapture(
C)) {
15958 TransformedInitCapture &NewC = InitCaptures[
C - E->capture_begin()];
15963 for (InitCaptureInfoTy &Info : NewC.Expansions) {
15965 QualType InitQualType = Info.second;
15966 if (
Init.isInvalid() || InitQualType.isNull()) {
15970 VarDecl *NewVD = getSema().createLambdaInitCaptureVarDecl(
15971 OldVD->getLocation(), InitQualType, NewC.EllipsisLoc,
15972 OldVD->getIdentifier(), OldVD->getInitStyle(),
Init.get(),
15973 getSema().CurContext);
15978 NewVDs.push_back(NewVD);
15979 getSema().addInitCapture(LSI, NewVD,
C->getCaptureKind() ==
LCK_ByRef);
15984 if (NewC.EllipsisLoc.isInvalid())
15985 LSI->ContainsUnexpandedParameterPack |=
15986 Init.get()->containsUnexpandedParameterPack();
15992 getDerived().transformedLocalDecl(OldVD, NewVDs);
15996 assert(
C->capturesVariable() &&
"unexpected kind of lambda capture");
16004 if (
C->isPackExpansion()) {
16006 bool ShouldExpand =
false;
16007 bool RetainExpansion =
false;
16009 if (getDerived().TryExpandParameterPacks(
16010 C->getEllipsisLoc(),
C->getLocation(), Unexpanded,
16011 true, ShouldExpand,
16012 RetainExpansion, NumExpansions)) {
16017 if (ShouldExpand) {
16022 for (
unsigned I = 0; I != *NumExpansions; ++I) {
16024 ValueDecl *CapturedVar = cast_if_present<ValueDecl>(
16025 getDerived().TransformDecl(
C->getLocation(), Pack));
16026 if (!CapturedVar) {
16032 getSema().tryCaptureVariable(CapturedVar,
C->getLocation(), Kind);
16040 EllipsisLoc =
C->getEllipsisLoc();
16044 auto *CapturedVar = cast_or_null<ValueDecl>(
16045 getDerived().TransformDecl(
C->getLocation(),
C->getCapturedVar()));
16046 if (!CapturedVar || CapturedVar->isInvalidDecl()) {
16053 if (
auto *VD = dyn_cast<VarDecl>(CapturedVar); VD && !
C->isPackExpansion())
16054 LSI->ContainsUnexpandedParameterPack |= VD->isParameterPack();
16057 getSema().tryCaptureVariable(CapturedVar,
C->getLocation(), Kind,
16060 getSema().finishLambdaExplicitCaptures(LSI);
16064 auto TPL = getDerived().TransformTemplateParameterList(
16065 E->getTemplateParameterList());
16066 LSI->GLTemplateParameterList = TPL;
16068 getSema().AddTemplateParametersToLambdaCallOperator(NewCallOperator,
Class,
16070 LSI->ContainsUnexpandedParameterPack |=
16071 TPL->containsUnexpandedParameterPack();
16076 E->getCallOperator()->getTypeSourceInfo()->getTypeLoc();
16078 getDerived().TransformType(NewCallOpTLBuilder, OldCallOpTypeLoc);
16079 if (NewCallOpType.isNull())
16081 LSI->ContainsUnexpandedParameterPack |=
16082 NewCallOpType->containsUnexpandedParameterPack();
16084 NewCallOpTLBuilder.getTypeSourceInfo(getSema().Context, NewCallOpType);
16089 assert(FPTL &&
"Not a FunctionProtoType?");
16094 if (TRC && TRC.ConstraintExpr->containsUnexpandedParameterPack() &&
16095 !TRC.ArgPackSubstIndex)
16098 getSema().CompleteLambdaCallOperator(
16099 NewCallOperator, E->getCallOperator()->getLocation(),
16100 E->getCallOperator()->getInnerLocStart(), TRC, NewCallOpTSI,
16101 E->getCallOperator()->getConstexprKind(),
16102 E->getCallOperator()->getStorageClass(), FPTL.getParams(),
16103 E->hasExplicitResultType());
16105 getDerived().transformAttrs(E->getCallOperator(), NewCallOperator);
16106 getDerived().transformedLocalDecl(E->getCallOperator(), {NewCallOperator});
16112 std::optional<CXXRecordDecl::LambdaNumbering> Numbering;
16113 if (getDerived().ReplacingOriginal()) {
16114 Numbering = OldClass->getLambdaNumbering();
16117 getSema().handleLambdaNumbering(
Class, NewCallOperator, Numbering);
16122 getSema().PushExpressionEvaluationContextForFunction(
16124 E->getCallOperator());
16131 C.PointOfInstantiation = E->getBody()->getBeginLoc();
16132 getSema().pushCodeSynthesisContext(
C);
16136 : getDerived().TransformLambdaBody(E, E->getBody());
16138 getSema().popCodeSynthesisContext();
16142 FuncScopeCleanup.disable();
16144 if (Body.isInvalid()) {
16145 SavedContext.pop();
16146 getSema().ActOnLambdaError(E->getBeginLoc(),
nullptr,
16151 getSema().ActOnFinishFunctionBody(NewCallOperator, Body.get(),
16154 SavedContext.pop();
16189 DependencyKind = getDerived().ComputeLambdaDependency(LSI);
16190 Class->setLambdaDependencyKind(DependencyKind);
16192 return getDerived().RebuildLambdaExpr(E->getBeginLoc(),
16193 Body.get()->getEndLoc(), LSI);
16196template<
typename Derived>
16202template<
typename Derived>
16211 if (!
C->isImplicit())
16215 if (
C->capturesThis()) {
16216 getSema().CheckCXXThisCapture(
C->getLocation(),
C->isExplicit(),
16223 if (
C->capturesVLAType())
16226 assert(
C->capturesVariable() &&
"unexpected kind of lambda capture");
16230 VarDecl *CapturedVar = cast_or_null<VarDecl>(
16236 getSema().tryCaptureVariable(CapturedVar,
C->getLocation());
16242template<
typename Derived>
16251 bool ArgumentChanged =
false;
16263 if (!getDerived().AlwaysRebuild() &&
16269 return getDerived().RebuildCXXUnresolvedConstructExpr(
16273template<
typename Derived>
16282 if (!E->isImplicitAccess()) {
16283 OldBase = E->getBase();
16284 Base = getDerived().TransformExpr(OldBase);
16285 if (
Base.isInvalid())
16290 bool MayBePseudoDestructor =
false;
16292 E->getOperatorLoc(),
16293 E->isArrow()? tok::arrow : tok::period,
16295 MayBePseudoDestructor);
16296 if (
Base.isInvalid())
16299 ObjectType = ObjectTy.get();
16300 BaseType = ((
Expr*)
Base.get())->getType();
16303 BaseType = getDerived().TransformType(E->getBaseType());
16310 = getDerived().TransformFirstQualifierInScope(
16311 E->getFirstQualifierFoundInScope(),
16312 E->getQualifierLoc().getBeginLoc());
16315 if (E->getQualifier()) {
16317 = getDerived().TransformNestedNameSpecifierLoc(E->getQualifierLoc(),
16319 FirstQualifierInScope);
16331 = getDerived().TransformDeclarationNameInfo(E->getMemberNameInfo());
16332 if (!NameInfo.getName())
16335 if (!E->hasExplicitTemplateArgs()) {
16338 if (!getDerived().AlwaysRebuild() &&
16339 Base.get() == OldBase &&
16340 BaseType == E->getBaseType() &&
16341 QualifierLoc == E->getQualifierLoc() &&
16342 NameInfo.getName() == E->getMember() &&
16343 FirstQualifierInScope == E->getFirstQualifierFoundInScope())
16346 return getDerived().RebuildCXXDependentScopeMemberExpr(
Base.get(),
16349 E->getOperatorLoc(),
16352 FirstQualifierInScope,
16358 if (getDerived().TransformTemplateArguments(E->getTemplateArgs(),
16359 E->getNumTemplateArgs(),
16363 return getDerived().RebuildCXXDependentScopeMemberExpr(
Base.get(),
16366 E->getOperatorLoc(),
16369 FirstQualifierInScope,
16374template <
typename Derived>
16380 if (!Old->isImplicitAccess()) {
16381 Base = getDerived().TransformExpr(Old->getBase());
16382 if (
Base.isInvalid())
16385 getSema().PerformMemberExprBaseConversion(
Base.get(), Old->isArrow());
16386 if (
Base.isInvalid())
16388 BaseType =
Base.get()->getType();
16390 BaseType = getDerived().TransformType(Old->getBaseType());
16394 if (Old->getQualifierLoc()) {
16396 getDerived().TransformNestedNameSpecifierLoc(Old->getQualifierLoc());
16406 if (TransformOverloadExprDecls(Old,
false, R))
16410 if (Old->getNamingClass()) {
16412 getDerived().TransformDecl(Old->getMemberLoc(), Old->getNamingClass()));
16416 R.setNamingClass(NamingClass);
16420 if (Old->hasExplicitTemplateArgs()) {
16421 TransArgs.setLAngleLoc(Old->getLAngleLoc());
16422 TransArgs.setRAngleLoc(Old->getRAngleLoc());
16423 if (getDerived().TransformTemplateArguments(
16424 Old->getTemplateArgs(), Old->getNumTemplateArgs(), TransArgs))
16432 NamedDecl *FirstQualifierInScope =
nullptr;
16434 return getDerived().RebuildUnresolvedMemberExpr(
16435 Base.get(), BaseType, Old->getOperatorLoc(), Old->isArrow(), QualifierLoc,
16436 TemplateKWLoc, FirstQualifierInScope, R,
16437 (Old->hasExplicitTemplateArgs() ? &TransArgs :
nullptr));
16440template<
typename Derived>
16445 ExprResult SubExpr = getDerived().TransformExpr(E->getOperand());
16446 if (SubExpr.isInvalid())
16449 if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getOperand())
16452 return getDerived().RebuildCXXNoexceptExpr(E->getSourceRange(),SubExpr.get());
16455template<
typename Derived>
16458 ExprResult Pattern = getDerived().TransformExpr(E->getPattern());
16459 if (Pattern.isInvalid())
16462 if (!getDerived().AlwaysRebuild() && Pattern.get() == E->getPattern())
16465 return getDerived().RebuildPackExpansion(Pattern.get(), E->getEllipsisLoc(),
16466 E->getNumExpansions());
16469template <
typename Derived>
16474 if (!Arg.isPackExpansion()) {
16486 getSema().getTemplateArgumentPackExpansionPattern(ArgLoc, Ellipsis,
16487 OrigNumExpansions);
16499 if (!NumExpansions) {
16511template<
typename Derived>
16530 bool ShouldExpand =
false;
16531 bool RetainExpansion =
false;
16533 if (getDerived().TryExpandParameterPacks(
16535 true, ShouldExpand,
16536 RetainExpansion, NumExpansions))
16541 if (ShouldExpand) {
16543 if (
auto *TTPD = dyn_cast<TemplateTypeParmDecl>(Pack)) {
16544 ArgStorage = getSema().Context.getPackExpansionType(
16545 getSema().Context.getTypeDeclType(TTPD), std::nullopt);
16546 }
else if (
auto *TTPD = dyn_cast<TemplateTemplateParmDecl>(Pack)) {
16550 ExprResult DRE = getSema().BuildDeclRefExpr(
16551 VD, VD->getType().getNonLValueExprType(getSema().Context),
16554 if (DRE.isInvalid())
16557 new (getSema().Context)
16561 PackArgs = ArgStorage;
16566 if (!PackArgs.size()) {
16567 auto *Pack = cast_or_null<NamedDecl>(
16571 return getDerived().RebuildSizeOfPackExpr(
16578 getDerived().ComputeSizeOfPackExprWithoutSubstitution(PackArgs);
16590 TemporaryBase Rebase(*
this, E->
getPackLoc(), getBaseEntity());
16593 if (TransformTemplateArguments(PackLocIterator(*
this, PackArgs.begin()),
16594 PackLocIterator(*
this, PackArgs.end()),
16595 TransformedPackArgs,
true))
16602 bool PartialSubstitution =
false;
16603 for (
auto &Loc : TransformedPackArgs.arguments()) {
16604 Args.push_back(Loc.getArgument());
16605 if (Loc.getArgument().isPackExpansion())
16606 PartialSubstitution =
true;
16609 if (PartialSubstitution)
16610 return getDerived().RebuildSizeOfPackExpr(
16612 std::nullopt, Args);
16614 return getDerived().RebuildSizeOfPackExpr(
16616 static_cast<unsigned>(Args.size()),
16620template <
typename Derived>
16623 if (!E->isValueDependent())
16631 IndexExpr = getDerived().TransformExpr(E->getIndexExpr());
16632 if (IndexExpr.isInvalid())
16637 bool FullySubstituted =
true;
16638 if (!E->expandsToEmptyPack() && E->getExpressions().empty()) {
16639 Expr *Pattern = E->getPackIdExpression();
16641 getSema().collectUnexpandedParameterPacks(E->getPackIdExpression(),
16643 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
16647 bool ShouldExpand =
true;
16648 bool RetainExpansion =
false;
16650 NumExpansions = std::nullopt;
16651 if (getDerived().TryExpandParameterPacks(
16652 E->getEllipsisLoc(), Pattern->getSourceRange(), Unexpanded,
16653 true, ShouldExpand,
16654 RetainExpansion, NumExpansions))
16656 if (!ShouldExpand) {
16658 ExprResult Pack = getDerived().TransformExpr(Pattern);
16659 if (Pack.isInvalid())
16661 return getDerived().RebuildPackIndexingExpr(
16662 E->getEllipsisLoc(), E->getRSquareLoc(), Pack.get(), IndexExpr.get(),
16665 for (
unsigned I = 0; I != *NumExpansions; ++I) {
16668 if (
Out.isInvalid())
16670 if (
Out.get()->containsUnexpandedParameterPack()) {
16671 Out = getDerived().RebuildPackExpansion(
Out.get(), E->getEllipsisLoc(),
16672 OrigNumExpansions);
16673 if (
Out.isInvalid())
16675 FullySubstituted =
false;
16677 ExpandedExprs.push_back(
Out.get());
16681 if (RetainExpansion) {
16682 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
16685 if (
Out.isInvalid())
16688 Out = getDerived().RebuildPackExpansion(
Out.get(), E->getEllipsisLoc(),
16689 OrigNumExpansions);
16690 if (
Out.isInvalid())
16692 FullySubstituted =
false;
16693 ExpandedExprs.push_back(
Out.get());
16695 }
else if (!E->expandsToEmptyPack()) {
16696 if (getDerived().TransformExprs(E->getExpressions().data(),
16697 E->getExpressions().size(),
false,
16702 return getDerived().RebuildPackIndexingExpr(
16703 E->getEllipsisLoc(), E->getRSquareLoc(), E->getPackIdExpression(),
16704 IndexExpr.get(), ExpandedExprs, FullySubstituted);
16707template <
typename Derived>
16710 if (!getSema().ArgPackSubstIndex)
16716 return getDerived().RebuildSubstNonTypeTemplateParmExpr(
16717 E->getAssociatedDecl(), E->getParameterPack()->getPosition(),
16718 E->getParameterPack()->getType(), E->getParameterPackLocation(), Arg,
16722template <
typename Derived>
16739 ExprResult Replacement = getDerived().TransformExpr(OrigReplacement);
16740 if (Replacement.isInvalid())
16743 Decl *AssociatedDecl =
16744 getDerived().TransformDecl(E->getNameLoc(), E->getAssociatedDecl());
16745 if (!AssociatedDecl)
16748 QualType ParamType = TransformType(E->getParameterType());
16749 if (ParamType.isNull())
16752 if (Replacement.get() == OrigReplacement &&
16753 AssociatedDecl == E->getAssociatedDecl() &&
16754 ParamType == E->getParameterType())
16757 if (Replacement.get() != OrigReplacement ||
16758 ParamType != E->getParameterType()) {
16767 Param, ParamType, Replacement.get(), SugaredConverted,
16768 CanonicalConverted,
16770 if (Replacement.isInvalid())
16774 Replacement = E->getReplacement();
16777 return getDerived().RebuildSubstNonTypeTemplateParmExpr(
16778 AssociatedDecl, E->getIndex(), ParamType, E->getNameLoc(),
16780 E->getPackIndex(), E->getFinal());
16783template<
typename Derived>
16790template<
typename Derived>
16797template<
typename Derived>
16801 if (
Expr *OldCallee = E->getCallee()) {
16802 ExprResult CalleeResult = getDerived().TransformExpr(OldCallee);
16803 if (CalleeResult.isInvalid())
16808 Expr *Pattern = E->getPattern();
16811 getSema().collectUnexpandedParameterPacks(Pattern, Unexpanded);
16812 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
16816 bool Expand =
true;
16817 bool RetainExpansion =
false;
16819 NumExpansions = OrigNumExpansions;
16820 if (getDerived().TryExpandParameterPacks(
16821 E->getEllipsisLoc(), Pattern->getSourceRange(), Unexpanded,
16822 true, Expand, RetainExpansion,
16832 E->getLHS() ? getDerived().TransformExpr(E->getLHS()) :
ExprResult();
16833 if (LHS.isInvalid())
16837 E->getRHS() ? getDerived().TransformExpr(E->getRHS()) :
ExprResult();
16838 if (RHS.isInvalid())
16841 if (!getDerived().AlwaysRebuild() &&
16842 LHS.get() == E->getLHS() && RHS.get() == E->getRHS())
16845 return getDerived().RebuildCXXFoldExpr(
16846 Callee, E->getBeginLoc(), LHS.get(), E->getOperator(),
16847 E->getEllipsisLoc(), RHS.get(), E->getEndLoc(), NumExpansions);
16853 if (NumExpansions && SemaRef.
getLangOpts().BracketDepth < *NumExpansions) {
16854 SemaRef.
Diag(E->getEllipsisLoc(),
16855 clang::diag::err_fold_expression_limit_exceeded)
16856 << *NumExpansions << SemaRef.
getLangOpts().BracketDepth
16857 << E->getSourceRange();
16858 SemaRef.
Diag(E->getEllipsisLoc(), diag::note_bracket_depth);
16867 bool LeftFold = E->isLeftFold();
16871 if (!LeftFold && RetainExpansion) {
16872 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
16875 if (
Out.isInvalid())
16878 Result = getDerived().RebuildCXXFoldExpr(
16879 Callee, E->getBeginLoc(),
Out.get(), E->getOperator(),
16880 E->getEllipsisLoc(),
Result.get(), E->getEndLoc(), OrigNumExpansions);
16885 bool WarnedOnComparison =
false;
16886 for (
unsigned I = 0; I != *NumExpansions; ++I) {
16888 getSema(), LeftFold ? I : *NumExpansions - I - 1);
16890 if (
Out.isInvalid())
16893 if (
Out.get()->containsUnexpandedParameterPack()) {
16895 Result = getDerived().RebuildCXXFoldExpr(
16896 Callee, E->getBeginLoc(), LeftFold ?
Result.get() :
Out.get(),
16897 E->getOperator(), E->getEllipsisLoc(),
16898 LeftFold ?
Out.get() :
Result.get(), E->getEndLoc(),
16899 OrigNumExpansions);
16900 }
else if (
Result.isUsable()) {
16907 Result = getDerived().RebuildCXXOperatorCallExpr(
16909 E->getEllipsisLoc(),
Callee->getBeginLoc(),
Callee->requiresADL(),
16910 Functions, LHS, RHS);
16912 Result = getDerived().RebuildBinaryOperator(E->getEllipsisLoc(),
16913 E->getOperator(), LHS, RHS,
16915 if (!WarnedOnComparison &&
Result.isUsable()) {
16916 if (
auto *BO = dyn_cast<BinaryOperator>(
Result.get());
16917 BO && BO->isComparisonOp()) {
16918 WarnedOnComparison =
true;
16919 SemaRef.
Diag(BO->getBeginLoc(),
16920 diag::warn_comparison_in_fold_expression)
16921 << BO->getOpcodeStr();
16934 if (LeftFold && RetainExpansion) {
16935 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
16938 if (
Out.isInvalid())
16941 Result = getDerived().RebuildCXXFoldExpr(
16942 Callee, E->getBeginLoc(),
Result.get(), E->getOperator(),
16943 E->getEllipsisLoc(),
Out.get(), E->getEndLoc(), OrigNumExpansions);
16949 PE->setIsProducedByFoldExpansion();
16954 return getDerived().RebuildEmptyCXXFoldExpr(E->getEllipsisLoc(),
16959template <
typename Derived>
16965 QualType T = getDerived().TransformType(E->getType());
16967 bool ArgChanged =
false;
16969 if (getDerived().TransformExprs(InitExprs.data(), InitExprs.size(),
true,
16970 TransformedInits, &ArgChanged))
16973 if (!getDerived().AlwaysRebuild() && !ArgChanged && T == E->getType())
16976 return getDerived().RebuildCXXParenListInitExpr(
16977 TransformedInits, T, E->getUserSpecifiedInitExprs().size(),
16978 E->getInitLoc(), E->getBeginLoc(), E->getEndLoc());
16981template<
typename Derived>
16988template<
typename Derived>
16994template<
typename Derived>
17000template<
typename Derived>
17003 ExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
17004 if (SubExpr.isInvalid())
17007 if (!getDerived().AlwaysRebuild() &&
17008 SubExpr.get() == E->getSubExpr())
17011 return getDerived().RebuildObjCBoxedExpr(E->getSourceRange(), SubExpr.get());
17014template<
typename Derived>
17019 bool ArgChanged =
false;
17020 if (getDerived().TransformExprs(E->getElements(), E->getNumElements(),
17021 false, Elements, &ArgChanged))
17024 if (!getDerived().AlwaysRebuild() && !ArgChanged)
17027 return getDerived().RebuildObjCArrayLiteral(E->getSourceRange(),
17032template<
typename Derived>
17038 bool ArgChanged =
false;
17039 for (
unsigned I = 0, N = E->getNumElements(); I != N; ++I) {
17042 if (OrigElement.isPackExpansion()) {
17045 getSema().collectUnexpandedParameterPacks(OrigElement.Key, Unexpanded);
17046 getSema().collectUnexpandedParameterPacks(OrigElement.Value, Unexpanded);
17047 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
17051 bool Expand =
true;
17052 bool RetainExpansion =
false;
17055 SourceRange PatternRange(OrigElement.Key->getBeginLoc(),
17056 OrigElement.Value->getEndLoc());
17057 if (getDerived().TryExpandParameterPacks(
17058 OrigElement.EllipsisLoc, PatternRange, Unexpanded,
17059 true, Expand, RetainExpansion,
17068 ExprResult Key = getDerived().TransformExpr(OrigElement.Key);
17069 if (Key.isInvalid())
17072 if (Key.get() != OrigElement.Key)
17076 if (
Value.isInvalid())
17083 Key.get(),
Value.get(), OrigElement.EllipsisLoc, NumExpansions
17085 Elements.push_back(Expansion);
17095 for (
unsigned I = 0; I != *NumExpansions; ++I) {
17097 ExprResult Key = getDerived().TransformExpr(OrigElement.Key);
17098 if (Key.isInvalid())
17102 if (
Value.isInvalid())
17112 if (Key.get()->containsUnexpandedParameterPack() ||
17113 Value.get()->containsUnexpandedParameterPack())
17114 Element.EllipsisLoc = OrigElement.EllipsisLoc;
17116 Elements.push_back(Element);
17126 ExprResult Key = getDerived().TransformExpr(OrigElement.Key);
17127 if (Key.isInvalid())
17130 if (Key.get() != OrigElement.Key)
17135 = getDerived().TransformExpr(OrigElement.Value);
17136 if (
Value.isInvalid())
17144 Elements.push_back(Element);
17147 if (!getDerived().AlwaysRebuild() && !ArgChanged)
17150 return getDerived().RebuildObjCDictionaryLiteral(E->getSourceRange(),
17154template<
typename Derived>
17158 = getDerived().TransformType(E->getEncodedTypeSourceInfo());
17159 if (!EncodedTypeInfo)
17162 if (!getDerived().AlwaysRebuild() &&
17163 EncodedTypeInfo == E->getEncodedTypeSourceInfo())
17166 return getDerived().RebuildObjCEncodeExpr(E->getAtLoc(),
17168 E->getRParenLoc());
17171template<
typename Derived>
17181template<
typename Derived>
17185 = getDerived().TransformType(E->getTypeInfoAsWritten());
17193 if (!getDerived().AlwaysRebuild() &&
17194 TSInfo == E->getTypeInfoAsWritten() &&
17195 Result.get() == E->getSubExpr())
17199 E->getLParenLoc(), E->getBridgeKind(), E->getBridgeKeywordLoc(), TSInfo,
17203template <
typename Derived>
17209template<
typename Derived>
17213 bool ArgChanged =
false;
17215 Args.reserve(E->getNumArgs());
17216 if (getDerived().TransformExprs(E->getArgs(), E->getNumArgs(),
false, Args,
17223 = getDerived().TransformType(E->getClassReceiverTypeInfo());
17224 if (!ReceiverTypeInfo)
17228 if (!getDerived().AlwaysRebuild() &&
17229 ReceiverTypeInfo == E->getClassReceiverTypeInfo() && !ArgChanged)
17234 E->getSelectorLocs(SelLocs);
17235 return getDerived().RebuildObjCMessageExpr(ReceiverTypeInfo,
17238 E->getMethodDecl(),
17245 if (!E->getMethodDecl())
17250 E->getSelectorLocs(SelLocs);
17251 return getDerived().RebuildObjCMessageExpr(E->getSuperLoc(),
17254 E->getReceiverType(),
17255 E->getMethodDecl(),
17263 "Only class and instance messages may be instantiated");
17265 = getDerived().TransformExpr(E->getInstanceReceiver());
17266 if (Receiver.isInvalid())
17270 if (!getDerived().AlwaysRebuild() &&
17271 Receiver.get() == E->getInstanceReceiver() && !ArgChanged)
17276 E->getSelectorLocs(SelLocs);
17277 return getDerived().RebuildObjCMessageExpr(Receiver.get(),
17280 E->getMethodDecl(),
17286template<
typename Derived>
17292template<
typename Derived>
17298template<
typename Derived>
17303 if (
Base.isInvalid())
17309 if (!getDerived().AlwaysRebuild() &&
17310 Base.get() == E->getBase())
17313 return getDerived().RebuildObjCIvarRefExpr(
Base.get(), E->getDecl(),
17315 E->isArrow(), E->isFreeIvar());
17318template<
typename Derived>
17323 if (!E->isObjectReceiver())
17328 if (
Base.isInvalid())
17334 if (!getDerived().AlwaysRebuild() &&
17335 Base.get() == E->getBase())
17338 if (E->isExplicitProperty())
17339 return getDerived().RebuildObjCPropertyRefExpr(
Base.get(),
17340 E->getExplicitProperty(),
17343 return getDerived().RebuildObjCPropertyRefExpr(
Base.get(),
17345 E->getImplicitPropertyGetter(),
17346 E->getImplicitPropertySetter(),
17350template<
typename Derived>
17355 if (
Base.isInvalid())
17359 ExprResult Key = getDerived().TransformExpr(E->getKeyExpr());
17360 if (Key.isInvalid())
17364 if (!getDerived().AlwaysRebuild() &&
17365 Key.get() == E->getKeyExpr() &&
Base.get() == E->getBaseExpr())
17368 return getDerived().RebuildObjCSubscriptRefExpr(E->getRBracket(),
17369 Base.get(), Key.get(),
17370 E->getAtIndexMethodDecl(),
17371 E->setAtIndexMethodDecl());
17374template<
typename Derived>
17379 if (
Base.isInvalid())
17383 if (!getDerived().AlwaysRebuild() &&
17384 Base.get() == E->getBase())
17387 return getDerived().RebuildObjCIsaExpr(
Base.get(), E->getIsaMemberLoc(),
17392template<
typename Derived>
17395 bool ArgumentChanged =
false;
17397 SubExprs.reserve(E->getNumSubExprs());
17398 if (getDerived().TransformExprs(E->getSubExprs(), E->getNumSubExprs(),
false,
17399 SubExprs, &ArgumentChanged))
17402 if (!getDerived().AlwaysRebuild() &&
17406 return getDerived().RebuildShuffleVectorExpr(E->getBuiltinLoc(),
17408 E->getRParenLoc());
17411template<
typename Derived>
17414 ExprResult SrcExpr = getDerived().TransformExpr(E->getSrcExpr());
17415 if (SrcExpr.isInvalid())
17422 if (!getDerived().AlwaysRebuild() &&
17423 Type == E->getTypeSourceInfo() &&
17424 SrcExpr.get() == E->getSrcExpr())
17427 return getDerived().RebuildConvertVectorExpr(E->getBuiltinLoc(),
17428 SrcExpr.get(),
Type,
17429 E->getRParenLoc());
17432template<
typename Derived>
17435 BlockDecl *oldBlock = E->getBlockDecl();
17441 blockScope->TheDecl->setBlockMissingReturnType(
17442 oldBlock->blockMissingReturnType());
17451 if (getDerived().TransformFunctionTypeParams(
17452 E->getCaretLocation(), oldBlock->parameters(),
nullptr,
17453 exprFunctionType->getExtParameterInfosOrNull(), paramTypes, ¶ms,
17455 getSema().ActOnBlockError(E->getCaretLocation(),
nullptr);
17460 getDerived().TransformType(exprFunctionType->getReturnType());
17462 auto epi = exprFunctionType->getExtProtoInfo();
17463 epi.ExtParameterInfos = extParamInfos.getPointerOrNull(paramTypes.size());
17466 getDerived().RebuildFunctionProtoType(exprResultType, paramTypes, epi);
17470 if (!params.empty())
17471 blockScope->TheDecl->setParams(params);
17473 if (!oldBlock->blockMissingReturnType()) {
17474 blockScope->HasImplicitReturnType =
false;
17475 blockScope->ReturnType = exprResultType;
17479 StmtResult body = getDerived().TransformStmt(E->getBody());
17480 if (body.isInvalid()) {
17481 getSema().ActOnBlockError(E->getCaretLocation(),
nullptr);
17489 for (
const auto &I : oldBlock->captures()) {
17490 VarDecl *oldCapture = I.getVariable();
17493 if (oldCapture->isParameterPack())
17497 cast<VarDecl>(getDerived().TransformDecl(E->getCaretLocation(),
17499 assert(blockScope->CaptureMap.count(newCapture));
17505 assert((!blockScope->isCXXThisCaptured() || oldBlock->capturesCXXThis()) &&
17506 "this pointer isn't captured in the old block");
17514template<
typename Derived>
17517 ExprResult SrcExpr = getDerived().TransformExpr(E->getSrcExpr());
17518 if (SrcExpr.isInvalid())
17521 QualType Type = getDerived().TransformType(E->getType());
17524 E->getRParenLoc());
17527template<
typename Derived>
17530 bool ArgumentChanged =
false;
17532 SubExprs.reserve(E->getNumSubExprs());
17533 if (getDerived().TransformExprs(E->getSubExprs(), E->getNumSubExprs(),
false,
17534 SubExprs, &ArgumentChanged))
17537 if (!getDerived().AlwaysRebuild() &&
17541 return getDerived().RebuildAtomicExpr(E->getBuiltinLoc(), SubExprs,
17542 E->getOp(), E->getRParenLoc());
17549template<
typename Derived>
17552 return SemaRef.BuildPointerType(PointeeType,
Star,
17556template<
typename Derived>
17559 return SemaRef.BuildBlockPointerType(PointeeType,
Star,
17563template<
typename Derived>
17566 bool WrittenAsLValue,
17568 return SemaRef.BuildReferenceType(ReferentType, WrittenAsLValue,
17572template <
typename Derived>
17576 return SemaRef.BuildMemberPointerType(PointeeType, SS, Cls, Sigil,
17580template<
typename Derived>
17587 return SemaRef.ObjC().BuildObjCTypeParamType(
17588 Decl, ProtocolLAngleLoc, Protocols, ProtocolLocs, ProtocolRAngleLoc,
17592template<
typename Derived>
17603 return SemaRef.ObjC().BuildObjCObjectType(
17604 BaseType, Loc, TypeArgsLAngleLoc, TypeArgs, TypeArgsRAngleLoc,
17605 ProtocolLAngleLoc, Protocols, ProtocolLocs, ProtocolRAngleLoc,
17610template<
typename Derived>
17614 return SemaRef.Context.getObjCObjectPointerType(PointeeType);
17617template <
typename Derived>
17620 Expr *SizeExpr,
unsigned IndexTypeQuals,
SourceRange BracketsRange) {
17621 if (SizeExpr || !Size)
17622 return SemaRef.BuildArrayType(ElementType, SizeMod, SizeExpr,
17623 IndexTypeQuals, BracketsRange,
17627 SemaRef.Context.UnsignedCharTy,
SemaRef.Context.UnsignedShortTy,
17629 SemaRef.Context.UnsignedLongLongTy,
SemaRef.Context.UnsignedInt128Ty
17632 for (
const auto &T : Types)
17633 if (Size->getBitWidth() ==
SemaRef.Context.getIntWidth(T)) {
17643 return SemaRef.BuildArrayType(ElementType, SizeMod, ArraySize,
17644 IndexTypeQuals, BracketsRange,
17648template <
typename Derived>
17651 Expr *SizeExpr,
unsigned IndexTypeQuals,
SourceRange BracketsRange) {
17652 return getDerived().RebuildArrayType(ElementType, SizeMod, &Size, SizeExpr,
17653 IndexTypeQuals, BracketsRange);
17656template <
typename Derived>
17660 return getDerived().RebuildArrayType(ElementType, SizeMod,
nullptr,
nullptr,
17661 IndexTypeQuals, BracketsRange);
17664template <
typename Derived>
17667 unsigned IndexTypeQuals,
SourceRange BracketsRange) {
17668 return getDerived().RebuildArrayType(ElementType, SizeMod,
nullptr,
17670 IndexTypeQuals, BracketsRange);
17673template <
typename Derived>
17676 unsigned IndexTypeQuals,
SourceRange BracketsRange) {
17677 return getDerived().RebuildArrayType(ElementType, SizeMod,
nullptr,
17679 IndexTypeQuals, BracketsRange);
17682template <
typename Derived>
17685 return SemaRef.BuildAddressSpaceAttr(PointeeType, AddrSpaceExpr,
17689template <
typename Derived>
17691 unsigned NumElements,
17694 return SemaRef.Context.getVectorType(ElementType, NumElements, VecKind);
17697template <
typename Derived>
17701 return SemaRef.BuildVectorType(ElementType, SizeExpr, AttributeLoc);
17704template<
typename Derived>
17706 unsigned NumElements,
17708 llvm::APInt numElements(
SemaRef.Context.getIntWidth(
SemaRef.Context.IntTy),
17709 NumElements,
true);
17713 return SemaRef.BuildExtVectorType(ElementType, VectorSize, AttributeLoc);
17716template<
typename Derived>
17721 return SemaRef.BuildExtVectorType(ElementType, SizeExpr, AttributeLoc);
17724template <
typename Derived>
17726 QualType ElementType,
unsigned NumRows,
unsigned NumColumns) {
17727 return SemaRef.Context.getConstantMatrixType(ElementType, NumRows,
17731template <
typename Derived>
17735 return SemaRef.BuildMatrixType(ElementType, RowExpr, ColumnExpr,
17739template <
typename Derived>
17743 return SemaRef.BuildFunctionType(T, ParamTypes,
17749template<
typename Derived>
17751 return SemaRef.Context.getFunctionNoProtoType(T);
17754template <
typename Derived>
17758 assert(D &&
"no decl found");
17762 if (
auto *UPD = dyn_cast<UsingPackDecl>(D)) {
17766 if (UPD->expansions().empty()) {
17767 getSema().Diag(NameLoc, diag::err_using_pack_expansion_empty)
17768 << UPD->isCXXClassMember() << UPD;
17777 for (
auto *E : UPD->expansions()) {
17784 else if (T.isNull())
17787 assert(
getSema().Context.hasSameType(ThisT, T) &&
17788 "mismatched resolved types in using pack expansion");
17790 return T.
isNull() ? FallbackT : T;
17792 if (
auto *Using = dyn_cast<UsingDecl>(D)) {
17793 assert(Using->hasTypename() &&
17794 "UnresolvedUsingTypenameDecl transformed to non-typename using");
17797 assert(++Using->shadow_begin() == Using->shadow_end());
17802 return SemaRef.Context.getUsingType(
Keyword, Qualifier, Shadow);
17805 "UnresolvedUsingTypenameDecl transformed to non-using decl");
17806 return SemaRef.Context.getUnresolvedUsingType(
17810template <
typename Derived>
17813 return SemaRef.BuildTypeofExprType(E, Kind);
17816template<
typename Derived>
17819 return SemaRef.Context.getTypeOfType(Underlying, Kind);
17822template <
typename Derived>
17824 return SemaRef.BuildDecltypeType(E);
17827template <
typename Derived>
17832 return SemaRef.BuildPackIndexingType(Pattern, IndexExpr, Loc, EllipsisLoc,
17833 FullySubstituted, Expansions);
17836template<
typename Derived>
17838 UnaryTransformType::UTTKind UKind,
17840 return SemaRef.BuildUnaryTransformType(BaseType, UKind, Loc);
17843template <
typename Derived>
17847 return SemaRef.CheckTemplateIdType(
17852template<
typename Derived>
17855 return SemaRef.BuildAtomicType(ValueType, KWLoc);
17858template<
typename Derived>
17862 return isReadPipe ?
SemaRef.BuildReadPipeType(ValueType, KWLoc)
17863 :
SemaRef.BuildWritePipeType(ValueType, KWLoc);
17866template <
typename Derived>
17870 llvm::APInt NumBitsAP(
SemaRef.Context.getIntWidth(
SemaRef.Context.IntTy),
17874 return SemaRef.BuildBitIntType(IsUnsigned, Bits, Loc);
17877template <
typename Derived>
17880 return SemaRef.BuildBitIntType(IsUnsigned, NumBitsExpr, Loc);
17883template <
typename Derived>
17891template <
typename Derived>
17898 getSema().ActOnTemplateName(
nullptr, SS, TemplateKWLoc,
17901 AllowInjectedClassName);
17905template<
typename Derived>
17912 bool AllowInjectedClassName) {
17915 SourceLocation SymbolLocations[3] = { NameLoc, NameLoc, NameLoc };
17920 false,
Template, AllowInjectedClassName);
17924template <
typename Derived>
17929 bool isPostIncDec = Second && (Op == OO_PlusPlus || Op == OO_MinusMinus);
17934 return SemaRef.PseudoObject().checkAssignment(
nullptr, OpLoc,
17935 Opc,
First, Second);
17950 if (Op == OO_Subscript) {
17951 if (!
First->getType()->isOverloadableType() &&
17953 return getSema().CreateBuiltinArraySubscriptExpr(
First, CalleeLoc, Second,
17955 }
else if (Op == OO_Arrow) {
17958 if (
First->getType()->isDependentType())
17961 return SemaRef.BuildOverloadedArrowExpr(
nullptr,
First, OpLoc);
17962 }
else if (Second ==
nullptr || isPostIncDec) {
17963 if (!
First->getType()->isOverloadableType() ||
17964 (Op == OO_Amp &&
getSema().isQualifiedMemberAccess(
First))) {
17971 return getSema().CreateBuiltinUnaryOp(OpLoc, Opc,
First);
17975 !
First->getType()->isOverloadableType() &&
17981 =
SemaRef.CreateBuiltinBinOp(OpLoc, Opc,
First, Second);
17990 if (!Second || isPostIncDec) {
17993 return SemaRef.CreateOverloadedUnaryOp(OpLoc, Opc, Functions,
First,
18000 First, Second, RequiresADL);
18007template<
typename Derived>
18017 QualType CanonicalBaseType =
Base->getType().getCanonicalType();
18018 if (
Base->isTypeDependent() || Destroyed.getIdentifier() ||
18023 ->getAsCanonical<RecordType>())) {
18025 return SemaRef.BuildPseudoDestructorExpr(
18026 Base, OperatorLoc, isArrow ? tok::arrow : tok::period, SS, ScopeType,
18027 CCLoc, TildeLoc, Destroyed);
18039 if (!
isa<TagType>(ScopeType->getType().getCanonicalType())) {
18040 getSema().Diag(ScopeType->getTypeLoc().getBeginLoc(),
18041 diag::err_expected_class_or_namespace)
18042 << ScopeType->getType() <<
getSema().getLangOpts().CPlusPlus;
18046 SS.
Make(
SemaRef.Context, ScopeType->getTypeLoc(), CCLoc);
18050 return getSema().BuildMemberReferenceExpr(
18051 Base,
Base->getType(), OperatorLoc, isArrow, SS, TemplateKWLoc,
18057template<
typename Derived>
18065 for (
unsigned I = 0; I < NumParams; ++I) {
18066 if (I != ContextParamPos) {
18072 Params.push_back(std::make_pair(StringRef(), QualType()));
18075 getSema().ActOnCapturedRegionStart(Loc,
nullptr,
18083 if (Body.isInvalid()) {
18084 getSema().ActOnCapturedRegionError();
18088 return getSema().ActOnCapturedRegionEnd(Body.get());
18091template <
typename Derived>
18097 llvm_unreachable(
"SYCL kernel call statement cannot appear in dependent "
18101template <
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