13#ifndef LLVM_CLANG_LIB_SEMA_TREETRANSFORM_H
14#define LLVM_CLANG_LIB_SEMA_TREETRANSFORM_H
49#include "llvm/ADT/ArrayRef.h"
50#include "llvm/Support/ErrorHandling.h"
54using namespace llvm::omp;
121template<
typename Derived>
126 class ForgetPartiallySubstitutedPackRAII {
134 ForgetPartiallySubstitutedPackRAII(Derived &
Self)
135 :
Self(
Self), ResetPackSubstIndex(
Self.getSema(), std::nullopt) {
136 Old =
Self.ForgetPartiallySubstitutedPack();
139 ~ForgetPartiallySubstitutedPackRAII() {
140 Self.RememberPartiallySubstitutedPack(Old);
142 ForgetPartiallySubstitutedPackRAII(
143 const ForgetPartiallySubstitutedPackRAII &) =
delete;
144 ForgetPartiallySubstitutedPackRAII &
145 operator=(
const ForgetPartiallySubstitutedPackRAII &) =
delete;
161 Derived &
getDerived() {
return static_cast<Derived&
>(*this); }
165 return static_cast<const Derived&
>(*this);
233 if (Location.isValid())
234 Self.getDerived().setBase(Location, Entity);
238 Self.getDerived().setBase(OldLocation, OldEntity);
313 bool FailOnPackProducingTemplates,
314 bool &ShouldExpand,
bool &RetainExpansion,
316 ShouldExpand =
false;
344 struct ForgetSubstitutionRAII {
350 Old =
Self.ForgetSubstitution();
353 ~ForgetSubstitutionRAII() {
Self.RememberSubstitution(std::move(Old)); }
453 const X##Attr *Transform##X##Attr(const X##Attr *R) { return R; }
454#include "clang/Basic/AttrList.inc"
464 const X##Attr *TransformStmt##X##Attr(const Stmt *, const Stmt *, \
465 const X##Attr *A) { \
466 return getDerived().Transform##X##Attr(A); \
468#include "clang/Basic/AttrList.inc"
514 bool *ArgChanged =
nullptr);
523 llvm::DenseMap<Decl *, Decl *>::iterator Known
526 return Known->second;
554 assert(
New.size() == 1 &&
555 "must override transformedLocalDecl if performing pack expansion");
593 NamedDecl *FirstQualifierInScope =
nullptr);
638 NamedDecl *FirstQualifierInScope =
nullptr,
639 bool AllowInjectedClassName =
false);
651 bool Uneval =
false);
678 bool Uneval =
false) {
697 template<
typename InputIterator>
701 bool Uneval =
false);
703 template <
typename InputIterator>
707 bool Uneval =
false);
728 return SemaRef.Context.getTrivialTypeSourceInfo(T,
732#define ABSTRACT_TYPELOC(CLASS, PARENT)
733#define TYPELOC(CLASS, PARENT) \
734 QualType Transform##CLASS##Type(TypeLocBuilder &TLB, CLASS##TypeLoc T);
735#include "clang/AST/TypeLocNodes.def"
739 bool SuppressObjCLifetime);
743 bool SuppressObjCLifetime);
745 template<
typename Fn>
763 bool AllowInjectedClassName);
791 return getDerived().TransformFunctionTypeParams(
792 Loc, Params, ParamTypes, ParamInfos, PTypes, PVars, PInfos,
nullptr);
810 KWLoc, Params,
nullptr,
811 nullptr, PTypes, &TransParams, PInfos))
825 bool ExpectParameterPack);
854 bool IsAddressOfOperand,
862 bool IsAddressOfOperand);
870#define STMT(Node, Parent) \
871 LLVM_ATTRIBUTE_NOINLINE \
872 StmtResult Transform##Node(Node *S);
873#define VALUESTMT(Node, Parent) \
874 LLVM_ATTRIBUTE_NOINLINE \
875 StmtResult Transform##Node(Node *S, StmtDiscardKind SDK);
876#define EXPR(Node, Parent) \
877 LLVM_ATTRIBUTE_NOINLINE \
878 ExprResult Transform##Node(Node *E);
879#define ABSTRACT_STMT(Stmt)
880#include "clang/AST/StmtNodes.inc"
882#define GEN_CLANG_CLAUSE_CLASS
883#define CLAUSE_CLASS(Enum, Str, Class) \
884 LLVM_ATTRIBUTE_NOINLINE \
885 OMPClause *Transform##Class(Class *S);
886#include "llvm/Frontend/OpenMP/OMP.inc"
964 const llvm::APInt *Size,
Expr *SizeExpr,
965 unsigned IndexTypeQuals,
SourceRange BracketsRange);
974 const llvm::APInt &Size,
Expr *SizeExpr,
975 unsigned IndexTypeQuals,
985 unsigned IndexTypeQuals,
995 unsigned IndexTypeQuals,
1006 unsigned IndexTypeQuals,
1044 unsigned NumColumns);
1061 Expr *AddrSpaceExpr,
1085 return SemaRef.Context.getUsingType(
Keyword, Qualifier, D, UnderlyingType);
1098 return SemaRef.Context.getMacroQualifiedType(T, MacroII);
1108 return SemaRef.Context.getCanonicalTagType(Tag);
1125 UnaryTransformType::UTTKind UKind,
1137 bool FullySubstituted,
1147 return SemaRef.Context.getAutoType(
1148 DK, DeducedAsType,
Keyword, TypeConstraintConcept, TypeConstraintArgs);
1156 return SemaRef.Context.getDeducedTemplateSpecializationType(
1175 return SemaRef.BuildParenType(InnerType);
1188 bool DeducedTSTContext) {
1190 SS.
Adopt(QualifierLoc);
1194 if (!
SemaRef.computeDeclContext(SS))
1202 return SemaRef.CheckTypenameType(
Keyword, KeywordLoc, QualifierLoc,
1203 *Id, IdLoc, DeducedTSTContext);
1216 if (
SemaRef.RequireCompleteDeclContext(SS, DC))
1221 switch (
Result.getResultKind()) {
1232 llvm_unreachable(
"Tag lookup cannot find non-tags");
1244 switch (
Result.getResultKind()) {
1250 SemaRef.Diag(IdLoc, diag::err_tag_reference_non_tag)
1251 << SomeDecl << NTK << Kind;
1256 SemaRef.Diag(IdLoc, diag::err_not_tag_in_scope)
1262 if (!
SemaRef.isAcceptableTagRedeclaration(Tag, Kind,
false,
1264 SemaRef.Diag(KeywordLoc, diag::err_use_with_wrong_tag) << Id;
1265 SemaRef.Diag(Tag->getLocation(), diag::note_previous_use);
1321 bool AllowInjectedClassName);
1334 bool AllowInjectedClassName);
1340 bool AllowInjectedClassName);
1350 Decl *AssociatedDecl,
unsigned Index,
1353 ArgPack, AssociatedDecl, Index, Final);
1407 return SemaRef.ActOnLabelStmt(IdentLoc, L, ColonLoc, SubStmt);
1417 if (
SemaRef.CheckRebuiltStmtAttributes(Attrs))
1419 return SemaRef.BuildAttributedStmt(AttrLoc, Attrs, SubStmt);
1431 Then, ElseLoc, Else);
1485 Inc, RParenLoc, Body);
1530 bool IsVolatile,
unsigned NumOutputs,
1537 NumInputs, Names, Constraints, Exprs,
1538 AsmString, Clobbers, NumLabels, RParenLoc);
1547 StringRef AsmString,
1548 unsigned NumOutputs,
unsigned NumInputs,
1554 NumOutputs, NumInputs,
1555 Constraints, Clobbers, Exprs, EndLoc);
1584 CoawaitLoc, Operand, OpCoawaitLookup);
1588 Suspend.
get(),
true);
1689 Kind, DirName, CancelRegion, Clauses, AStmt, StartLoc, EndLoc);
1701 Kind, DirName, Clauses, AStmt, StartLoc, EndLoc);
1715 NameModifier,
Condition, StartLoc, LParenLoc, NameModifierLoc, ColonLoc,
1741 Modifier, NumThreads, StartLoc, LParenLoc, ModifierLoc, EndLoc);
1778 std::optional<unsigned> FillIdx,
1780 unsigned FillCount = FillIdx ? 1 : 0;
1782 Counts, StartLoc, LParenLoc, EndLoc, FillIdx, FillLoc, FillCount);
1813 First, Count, StartLoc, LParenLoc, FirstLoc, CountLoc, EndLoc);
1849 Kind, KindKwLoc, VCKind, VCLoc, StartLoc, LParenLoc, EndLoc);
1862 Kind, KindKwLoc, StartLoc, LParenLoc, EndLoc);
1869 ImpexTypeArg, StartLoc, LParenLoc, EndLoc);
1882 M1, M2, Kind, ChunkSize, StartLoc, LParenLoc, M1Loc, M2Loc, KindLoc,
1944 VarList, LPKind, LPKindLoc, ColonLoc, StartLoc, LParenLoc, EndLoc);
1972 VarList, {Modifier, OriginalSharingModifier}, StartLoc, LParenLoc,
1973 ModifierLoc, ColonLoc, EndLoc, ReductionIdScopeSpec, ReductionId,
1974 UnresolvedReductions);
1988 VarList, StartLoc, LParenLoc, ColonLoc, EndLoc, ReductionIdScopeSpec,
1989 ReductionId, UnresolvedReductions);
2004 VarList, StartLoc, LParenLoc, ColonLoc, EndLoc, ReductionIdScopeSpec,
2005 ReductionId, UnresolvedReductions);
2018 VarList, Step, StartLoc, LParenLoc, Modifier, ModifierLoc, ColonLoc,
2019 StepModifierLoc, EndLoc);
2032 VarList, Alignment, StartLoc, LParenLoc, ColonLoc, EndLoc);
2092 Data, DepModifier, VarList, StartLoc, LParenLoc, EndLoc);
2105 Modifier,
Device, StartLoc, LParenLoc, ModifierLoc, EndLoc);
2120 IteratorModifier, MapTypeModifiers, MapTypeModifiersLoc,
2121 MapperIdScopeSpec, MapperId, MapType, IsMapTypeImplicit, MapLoc,
2122 ColonLoc, VarList, Locs,
2123 false, UnresolvedMappers);
2140 Allocate, Alignment, FirstModifier, FirstModifierLoc, SecondModifier,
2141 SecondModifierLoc, VarList, StartLoc, LParenLoc, ColonLoc, EndLoc);
2189 Modifier,
Device, StartLoc, LParenLoc, ModifierLoc, EndLoc);
2202 Modifier, NumTasks, StartLoc, LParenLoc, ModifierLoc, EndLoc);
2237 Kind, ChunkSize, StartLoc, LParenLoc, KindLoc, CommaLoc, EndLoc);
2252 MotionModifiers, MotionModifiersLoc, IteratorModifier,
2253 MapperIdScopeSpec, MapperId, ColonLoc, VarList, Locs,
2269 MotionModifiers, MotionModifiersLoc, IteratorModifier,
2270 MapperIdScopeSpec, MapperId, ColonLoc, VarList, Locs,
2283 VarList, Locs, FallbackModifier, FallbackModifierLoc);
2325 M, Kind, StartLoc, LParenLoc, MLoc, KindLoc, EndLoc);
2372 StartLoc, LParenLoc, EndLoc,
Data);
2385 StartLoc, LParenLoc, ColonLoc, EndLoc, Modifier, Locators);
2397 Modifier, Kind, StartLoc, LParenLoc, ModifierKwLoc, KindKwLoc, EndLoc);
2410 InteropVar, InteropInfo, StartLoc, LParenLoc, VarLoc, EndLoc);
2421 LParenLoc, VarLoc, EndLoc);
2433 InteropVar, StartLoc, LParenLoc, VarLoc, EndLoc);
2504 M1, M2, Size, StartLoc, LParenLoc, M1Loc, M2Loc, EndLoc);
2585 DepType, DepLoc, ColonLoc, VarList, StartLoc, LParenLoc, EndLoc);
2633 ForLoc, Element, Collection, RParenLoc);
2651 StartLoc, IdLoc, Id);
2688 if (
DeclStmt *RangeStmt = dyn_cast<DeclStmt>(Range)) {
2689 if (RangeStmt->isSingleDecl()) {
2690 if (
VarDecl *RangeVar = dyn_cast<VarDecl>(RangeStmt->getSingleDecl())) {
2691 if (RangeVar->isInvalidDecl())
2694 Expr *RangeExpr = RangeVar->getInit();
2701 diag::err_objc_for_range_init_stmt)
2702 <<
Init->getSourceRange();
2705 ForLoc, LoopVar, RangeExpr, RParenLoc);
2712 ForLoc, CoawaitLoc,
Init, ColonLoc, Range, Begin, End,
Cond, Inc,
2726 QualifierLoc, NameInfo, Nested);
2788 SS.
Adopt(QualifierLoc);
2910 if (IsOMPArraySection)
2912 Base, LBracketLoc, LowerBound, ColonLocFirst, ColonLocSecond, Length,
2913 Stride, RBracketLoc);
2915 assert(Stride ==
nullptr && !ColonLocSecond.
isValid() &&
2916 "Stride/second colon not allowed for OpenACC");
2919 Base, LBracketLoc, LowerBound, ColonLocFirst, Length, RBracketLoc);
2931 Base, LParenLoc, RParenLoc, Dims, BracketsRanges);
2943 nullptr, IteratorKwLoc, LLoc, RLoc,
Data);
2953 Expr *ExecConfig =
nullptr) {
2955 nullptr, Callee, LParenLoc, Args, RParenLoc, ExecConfig);
2962 nullptr, Callee, LParenLoc, Args, RParenLoc);
2980 if (!
Member->getDeclName()) {
2984 assert(
Member->getType()->isRecordType() &&
2985 "unnamed member not of record type?");
2998 if (!isArrow &&
Base->isPRValue()) {
3013 SS.
Adopt(QualifierLoc);
3016 if (
Base->containsErrors())
3021 if (isArrow && !BaseType->isPointerType())
3027 R.addDecl(FoundDecl);
3030 if (
getSema().isUnevaluatedContext() &&
Base->isImplicitCXXThis() &&
3035 ->getAsCXXRecordDecl()) {
3039 if (!ThisClass->Equals(
Class) && !ThisClass->isDerivedFrom(
Class))
3047 FirstQualifierInScope,
3048 R, ExplicitTemplateArgs,
3058 bool ForFoldExpression =
false) {
3136 return SemaRef.BuildInitList(LBraceLoc,
Inits, RBraceLoc, IsExplicit);
3149 =
SemaRef.ActOnDesignatedInitializer(Desig, EqualOrColonLoc, GNUSyntax,
3189 unsigned NumUserSpecifiedExprs,
3194 InitLoc, LParenLoc, RParenLoc);
3224 return SemaRef.ActOnChooseExpr(BuiltinLoc,
3236 Expr *ControllingExpr,
3241 ControllingExpr, Types, Exprs);
3256 ControllingType, Types, Exprs);
3289 case Stmt::CXXStaticCastExprClass:
3290 return getDerived().RebuildCXXStaticCastExpr(OpLoc, LAngleLoc, TInfo,
3291 RAngleLoc, LParenLoc,
3292 SubExpr, RParenLoc);
3294 case Stmt::CXXDynamicCastExprClass:
3295 return getDerived().RebuildCXXDynamicCastExpr(OpLoc, LAngleLoc, TInfo,
3296 RAngleLoc, LParenLoc,
3297 SubExpr, RParenLoc);
3299 case Stmt::CXXReinterpretCastExprClass:
3300 return getDerived().RebuildCXXReinterpretCastExpr(OpLoc, LAngleLoc, TInfo,
3301 RAngleLoc, LParenLoc,
3305 case Stmt::CXXConstCastExprClass:
3306 return getDerived().RebuildCXXConstCastExpr(OpLoc, LAngleLoc, TInfo,
3307 RAngleLoc, LParenLoc,
3308 SubExpr, RParenLoc);
3310 case Stmt::CXXAddrspaceCastExprClass:
3311 return getDerived().RebuildCXXAddrspaceCastExpr(
3312 OpLoc, LAngleLoc, TInfo, RAngleLoc, LParenLoc, SubExpr, RParenLoc);
3315 llvm_unreachable(
"Invalid C++ named cast");
3393 OpLoc, tok::kw_addrspace_cast, TInfo, SubExpr,
3405 bool ListInitialization) {
3409 if (
auto *PLE = dyn_cast<ParenListExpr>(Sub))
3411 TInfo, LParenLoc,
MultiExprArg(PLE->getExprs(), PLE->getNumExprs()),
3412 RParenLoc, ListInitialization);
3414 if (
auto *PLE = dyn_cast<CXXParenListInitExpr>(Sub))
3416 TInfo, LParenLoc, PLE->getInitExprs(), RParenLoc, ListInitialization);
3420 ListInitialization);
3484 if (
getSema().CheckCXXThisType(ThisLoc, ThisType))
3494 bool IsThrownVariableInScope) {
3504 Expr *RewrittenExpr) {
3506 RewrittenExpr,
getSema().CurContext);
3540 std::optional<Expr *> ArraySize,
3559 bool IsGlobalDelete,
3610 bool IsAddressOfOperand,
3613 SS.
Adopt(QualifierLoc);
3615 if (TemplateArgs || TemplateKWLoc.
isValid())
3617 SS, TemplateKWLoc, NameInfo, TemplateArgs, IsAddressOfOperand);
3620 SS, NameInfo, IsAddressOfOperand, RecoveryTSI);
3642 bool IsElidable,
MultiExprArg Args,
bool HadMultipleCandidates,
3643 bool ListInitialization,
bool StdInitListInitialization,
3650 FoundCtor =
Constructor->getInheritedConstructor().getConstructor();
3653 if (
getSema().CompleteConstructorCall(FoundCtor, T, Args, Loc,
3660 HadMultipleCandidates,
3662 StdInitListInitialization,
3663 RequiresZeroInit, ConstructKind,
3671 bool ConstructsVBase,
3672 bool InheritedFromVBase) {
3674 Loc, T,
Constructor, ConstructsVBase, InheritedFromVBase);
3685 bool ListInitialization) {
3687 TSInfo, LParenOrBraceLoc, Args, RParenOrBraceLoc, ListInitialization);
3698 bool ListInitialization) {
3700 RParenLoc, ListInitialization);
3717 SS.
Adopt(QualifierLoc);
3719 return SemaRef.BuildMemberReferenceExpr(BaseE, BaseType,
3720 OperatorLoc, IsArrow,
3722 FirstQualifierInScope,
3724 TemplateArgs,
nullptr);
3740 SS.
Adopt(QualifierLoc);
3742 return SemaRef.BuildMemberReferenceExpr(BaseE, BaseType,
3743 OperatorLoc, IsArrow,
3745 FirstQualifierInScope,
3746 R, TemplateArgs,
nullptr);
3754 return SemaRef.BuildCXXNoexceptExpr(Range.getBegin(), Arg, Range.getEnd());
3767 RParenLoc, Length, PartialArgs);
3772 Expr *PackIdExpression,
Expr *IndexExpr,
3774 bool FullySubstituted =
false) {
3776 IndexExpr, RSquareLoc, ExpandedExprs,
3802 NamedConcept, TALI);
3820 LocalParameters, RParenLoc, Requirements,
3827 return SemaRef.BuildTypeRequirement(SubstDiag);
3831 return SemaRef.BuildTypeRequirement(T);
3839 return SemaRef.BuildExprRequirement(SubstDiag, IsSimple, NoexceptLoc,
3846 return SemaRef.BuildExprRequirement(E, IsSimple, NoexceptLoc,
3853 return SemaRef.BuildNestedRequirement(InvalidConstraintEntity,
3858 return SemaRef.BuildNestedRequirement(Constraint);
3874 Expr **Elements,
unsigned NumElements) {
3884 RB,
Base, Key, getterMethod, setterMethod);
3903 return SemaRef.ObjC().BuildObjCEncodeExpression(AtLoc, EncodeTypeInfo,
3915 return SemaRef.ObjC().BuildClassMessage(
3916 ReceiverTypeInfo, ReceiverTypeInfo->
getType(),
3929 return SemaRef.ObjC().BuildInstanceMessage(Receiver, Receiver->
getType(),
3932 SelectorLocs, RBracLoc, Args);
3944 return Method->isInstanceMethod()
3945 ?
SemaRef.ObjC().BuildInstanceMessage(
3946 nullptr, SuperType, SuperLoc, Sel,
Method, LBracLoc,
3947 SelectorLocs, RBracLoc, Args)
3948 :
SemaRef.ObjC().BuildClassMessage(
nullptr, SuperType, SuperLoc,
3950 SelectorLocs, RBracLoc, Args);
3959 bool IsArrow,
bool IsFreeIvar) {
3968 if (IsFreeIvar &&
Result.isUsable())
4005 PropertyLoc,
Base));
4034 =
SemaRef.Context.Idents.get(
"__builtin_shufflevector");
4037 assert(!Lookup.
empty() &&
"No __builtin_shufflevector?");
4045 Callee =
SemaRef.ImpCastExprToType(Callee, CalleePtrTy,
4046 CK_BuiltinFnToFnPtr).get();
4062 return SemaRef.ConvertVectorExpr(SrcExpr, DstTInfo, BuiltinLoc, RParenLoc);
4077 EllipsisLoc, NumExpansions);
4101 llvm_unreachable(
"Pack expansion pattern has no parameter packs");
4137 EllipsisLoc, RHS, RParenLoc,
4146 Init->containsUnexpandedParameterPack();
4147 else if (PVD->hasUninstantiatedDefaultArg())
4149 PVD->getUninstantiatedDefaultArg()
4150 ->containsUnexpandedParameterPack();
4304 Exprs.push_back(DevNumExpr);
4305 llvm::append_range(Exprs, QueueIdExprs);
4342 AssociatedDecl, NTTP, Loc, Arg, PackIndex, Final);
4366 ObjectType, FirstQualifierInScope);
4372 QualType TransformDependentNameType(TypeLocBuilder &TLB,
4373 DependentNameTypeLoc TL,
4374 bool DeducibleTSTContext,
4375 QualType ObjectType = QualType(),
4376 NamedDecl *UnqualLookup =
nullptr);
4379 TransformOpenACCClauseList(OpenACCDirectiveKind DirKind,
4384 OpenACCDirectiveKind DirKind,
4385 const OpenACCClause *OldClause);
4388template <
typename Derived>
4398#define STMT(Node, Parent) \
4399 case Stmt::Node##Class: return getDerived().Transform##Node(cast<Node>(S));
4400#define VALUESTMT(Node, Parent) \
4401 case Stmt::Node##Class: \
4402 return getDerived().Transform##Node(cast<Node>(S), SDK);
4403#define ABSTRACT_STMT(Node)
4404#define EXPR(Node, Parent)
4405#include "clang/AST/StmtNodes.inc"
4408#define STMT(Node, Parent)
4409#define ABSTRACT_STMT(Stmt)
4410#define EXPR(Node, Parent) case Stmt::Node##Class:
4411#include "clang/AST/StmtNodes.inc"
4416 E =
getSema().ActOnStmtExprResult(E);
4424template<
typename Derived>
4432#define GEN_CLANG_CLAUSE_CLASS
4433#define CLAUSE_CLASS(Enum, Str, Class) \
4435 return getDerived().Transform##Class(cast<Class>(S));
4436#include "llvm/Frontend/OpenMP/OMP.inc"
4443template<
typename Derived>
4450#define STMT(Node, Parent) case Stmt::Node##Class: break;
4451#define ABSTRACT_STMT(Stmt)
4452#define EXPR(Node, Parent) \
4453 case Stmt::Node##Class: return getDerived().Transform##Node(cast<Node>(E));
4454#include "clang/AST/StmtNodes.inc"
4460template<
typename Derived>
4468 if (
auto *FE = dyn_cast<FullExpr>(
Init))
4469 Init = FE->getSubExpr();
4471 if (
auto *AIL = dyn_cast<ArrayInitLoopExpr>(
Init)) {
4477 Init = MTE->getSubExpr();
4480 Init = Binder->getSubExpr();
4483 Init = ICE->getSubExprAsWritten();
4486 dyn_cast<CXXStdInitializerListExpr>(
Init))
4523 getSema().currentEvaluationContext().InLifetimeExtendingContext =
4524 getSema().parentEvaluationContext().InLifetimeExtendingContext;
4525 getSema().currentEvaluationContext().RebuildDefaultArgOrDefaultInit =
4526 getSema().parentEvaluationContext().RebuildDefaultArgOrDefaultInit;
4528 bool ArgChanged =
false;
4530 true, NewArgs, &ArgChanged))
4541 if (
Parens.isInvalid()) {
4544 assert(NewArgs.empty() &&
4545 "no parens or braces but have direct init with arguments?");
4552template<
typename Derived>
4558 for (
unsigned I = 0; I != NumInputs; ++I) {
4568 Expr *Pattern = Expansion->getPattern();
4571 getSema().collectUnexpandedParameterPacks(Pattern, Unexpanded);
4572 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
4577 bool RetainExpansion =
false;
4578 UnsignedOrNone OrigNumExpansions = Expansion->getNumExpansions();
4582 Unexpanded,
true, Expand,
4583 RetainExpansion, NumExpansions))
4596 Expansion->getEllipsisLoc(),
4598 if (Out.isInvalid())
4603 Outputs.push_back(Out.get());
4609 if (ArgChanged) *ArgChanged =
true;
4613 for (
unsigned I = 0; I != *NumExpansions; ++I) {
4616 if (Out.isInvalid())
4619 if (Out.get()->containsUnexpandedParameterPack()) {
4621 Out.get(), Expansion->getEllipsisLoc(), OrigNumExpansions);
4622 if (Out.isInvalid())
4626 Outputs.push_back(Out.get());
4631 if (RetainExpansion) {
4632 ForgetPartiallySubstitutedPackRAII Forget(
getDerived());
4635 if (Out.isInvalid())
4639 Out.get(), Expansion->getEllipsisLoc(), OrigNumExpansions);
4640 if (Out.isInvalid())
4643 Outputs.push_back(Out.get());
4650 IsCall ?
getDerived().TransformInitializer(Inputs[I],
false)
4655 if (
Result.get() != Inputs[I] && ArgChanged)
4658 Outputs.push_back(
Result.get());
4664template <
typename Derived>
4675 VarDecl *ConditionVar = cast_or_null<VarDecl>(
4681 return getSema().ActOnConditionVariable(ConditionVar, Loc, Kind);
4690 return getSema().ActOnCondition(
nullptr, Loc, CondExpr.
get(), Kind,
4697template <
typename Derived>
4705 Qualifier = Qualifier.getAsNamespaceAndPrefix().Prefix)
4717 llvm_unreachable(
"unexpected null nested name specifier");
4748 QualifierLoc =
getDerived().TransformNestedNameSpecifierLoc(
4749 QualifierLoc, ObjectType, FirstQualifierInScope);
4753 FirstQualifierInScope =
nullptr;
4755 SS.
Adopt(QualifierLoc);
4759 if (
SemaRef.BuildCXXNestedNameSpecifier(
nullptr, IdInfo,
4761 FirstQualifierInScope,
false))
4769 T = TransformTypeInObjectScope(TLB, TL, ObjectType,
4770 FirstQualifierInScope);
4776 if (T->isDependentType() || T->isRecordType() ||
4777 (
SemaRef.getLangOpts().CPlusPlus11 && T->isEnumeralType())) {
4778 if (T->isEnumeralType())
4780 diag::warn_cxx98_compat_enum_nested_name_spec);
4787 if (!TTL || !TTL.
getDecl()->isInvalidDecl()) {
4811template<
typename Derived>
4831 TemplateDecl *NewTemplate = cast_or_null<TemplateDecl>(
4838 SemaRef.Context.DeclarationNames.getCXXDeductionGuideName(NewTemplate));
4848 NewTInfo =
getDerived().TransformType(OldTInfo);
4851 NewCanTy =
SemaRef.Context.getCanonicalType(NewTInfo->
getType());
4859 NewCanTy =
SemaRef.Context.getCanonicalType(NewT);
4872 llvm_unreachable(
"Unknown name kind.");
4875template <
typename Derived>
4879 QualType ObjectType,
bool AllowInjectedClassName) {
4881 return getDerived().RebuildTemplateName(SS, TemplateKWLoc, *II, NameLoc,
4882 ObjectType, AllowInjectedClassName);
4884 NameLoc, ObjectType,
4885 AllowInjectedClassName);
4888template <
typename Derived>
4892 NamedDecl *FirstQualifierInScope,
bool AllowInjectedClassName) {
4894 TemplateName UnderlyingName = QTN->getUnderlyingTemplate();
4897 QualifierLoc =
getDerived().TransformNestedNameSpecifierLoc(
4898 QualifierLoc, ObjectType, FirstQualifierInScope);
4905 UnderlyingQualifier, TemplateKWLoc, UnderlyingName, NameLoc, ObjectType,
4906 FirstQualifierInScope, AllowInjectedClassName);
4907 if (NewUnderlyingName.
isNull())
4909 assert(!UnderlyingQualifier &&
"unexpected qualifier");
4913 NewUnderlyingName == UnderlyingName)
4916 SS.
Adopt(QualifierLoc);
4917 return getDerived().RebuildTemplateName(SS, QTN->hasTemplateKeyword(),
4923 QualifierLoc =
getDerived().TransformNestedNameSpecifierLoc(
4924 QualifierLoc, ObjectType, FirstQualifierInScope);
4938 SS.
Adopt(QualifierLoc);
4939 return getDerived().RebuildTemplateName(SS, TemplateKWLoc, DTN->getName(),
4940 NameLoc, ObjectType,
4941 AllowInjectedClassName);
4946 assert(!QualifierLoc &&
"Unexpected qualified SubstTemplateTemplateParm");
4953 ReplacementQualifierLoc = Builder.getWithLocInContext(
SemaRef.Context);
4957 ReplacementQualifierLoc, TemplateKWLoc, ReplacementName, NameLoc,
4958 ObjectType, FirstQualifierInScope, AllowInjectedClassName);
4961 Decl *AssociatedDecl =
4962 getDerived().TransformDecl(NameLoc, S->getAssociatedDecl());
4964 AssociatedDecl == S->getAssociatedDecl())
4966 return SemaRef.Context.getSubstTemplateTemplateParm(
4967 NewName, AssociatedDecl, S->getIndex(), S->getPackIndex(),
4972 "DeducedTemplateName should not escape partial ordering");
4976 assert(!QualifierLoc &&
"Unexpected qualifier");
4983 assert(!QualifierLoc &&
4984 "Unexpected qualified SubstTemplateTemplateParmPack");
4986 SubstPack->getArgumentPack(), SubstPack->getAssociatedDecl(),
4987 SubstPack->getIndex(), SubstPack->getFinal());
4991 llvm_unreachable(
"overloaded function decl survived to here");
4994template <
typename Derived>
4999 QualifierLoc, TemplateKeywordLoc, Name, NameLoc);
5005template<
typename Derived>
5009 Output =
getSema().getTrivialTemplateArgumentLoc(
5013template <
typename Derived>
5021 llvm_unreachable(
"Unexpected TemplateArgument");
5044 if (NewT == T && D == NewD)
5061 llvm_unreachable(
"unexpected template argument kind");
5093 llvm_unreachable(
"Caller should expand pack expansions");
5109 E =
SemaRef.ActOnConstantExpression(E);
5124template<
typename Derived,
typename InputIterator>
5132 typedef typename std::iterator_traits<InputIterator>::difference_type
5147 : Self(Self), Iter(Iter) { }
5162 Self.InventTemplateArgumentLoc(*Iter,
Result);
5170 return X.Iter == Y.Iter;
5175 return X.Iter != Y.Iter;
5179template<
typename Derived>
5180template<
typename InputIterator>
5200 PackLocIterator(*
this, In.getArgument().pack_begin()),
5201 PackLocIterator(*
this, In.getArgument().pack_end()), *PackOutput,
5208 if (In.getArgument().isPackExpansion()) {
5220 std::optional<ForgetSubstitutionRAII> ForgetSubst;
5230 if (Out.getArgument().containsUnexpandedParameterPack()) {
5233 if (Out.getArgument().isNull())
5243 ForgetPartiallySubstitutedPackRAII Forget(
getDerived());
5251 if (Out.getArgument().isNull())
5270template <
typename Derived>
5271template <
typename InputIterator>
5280 return !Arg.isDependent() && Arg.isConceptOrConceptTemplateParameter();
5292 PackLocIterator(*
this, In.getArgument().pack_begin()),
5293 PackLocIterator(*
this, In.getArgument().pack_end()), Outputs,
5299 if (!isNonDependentConceptArgument(In.getArgument())) {
5314template <
typename Derived>
5325 Pattern =
getSema().getTemplateArgumentPackExpansionPattern(
5328 getSema().collectUnexpandedParameterPacks(Pattern, Unexpanded);
5329 if (IsLateExpansionAttempt) {
5334 return P.first.dyn_cast<
const SubstBuiltinTemplatePackType *>();
5336 if (!SawPackTypes) {
5341 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
5349 Info.
Ellipsis, Pattern.getSourceRange(), Unexpanded,
5355 if (ComputeInfo(In,
false, Info, Pattern))
5367 std::optional<Sema::ArgPackSubstIndexRAII> SubstIndex(
5368 std::in_place,
getSema(), std::nullopt);
5374 if (Out.getArgument().isNull())
5411 ForgetSubstitutionRAII ForgetSubst(
getDerived());
5412 if (ComputeInfo(Out,
true, Info, OutPattern))
5425template<
typename Derived>
5443template <
typename Derived>
5463template<
typename Derived>
5466 switch (T.getTypeLocClass()) {
5467#define ABSTRACT_TYPELOC(CLASS, PARENT)
5468#define TYPELOC(CLASS, PARENT) \
5469 case TypeLoc::CLASS: \
5470 return getDerived().Transform##CLASS##Type(TLB, \
5471 T.castAs<CLASS##TypeLoc>());
5472#include "clang/AST/TypeLocNodes.def"
5475 llvm_unreachable(
"unhandled type loc!");
5478template<
typename Derived>
5491template <
typename Derived>
5529template<
typename Derived>
5535 auto SuppressObjCLifetime =
5538 Result = getDerived().TransformTemplateTypeParmType(TLB, TTP,
5539 SuppressObjCLifetime);
5540 }
else if (
auto STTP = UnqualTL.
getAs<SubstTemplateTypeParmPackTypeLoc>()) {
5541 Result = getDerived().TransformSubstTemplateTypeParmPackType(
5542 TLB, STTP, SuppressObjCLifetime);
5544 Result = getDerived().TransformType(TLB, UnqualTL);
5563template <
typename Derived>
5573 SemaRef.Diag(Loc, diag::err_address_space_mismatch_templ_inst)
5580 if (T.getPointerAuth().isPresent()) {
5581 SemaRef.Diag(Loc, diag::err_ptrauth_qualifier_redundant) << TL.
getType();
5584 if (!T->isDependentType()) {
5585 if (!T->isSignableType(
SemaRef.getASTContext())) {
5586 SemaRef.Diag(Loc, diag::err_ptrauth_qualifier_invalid_target) << T;
5594 if (T->isFunctionType()) {
5595 T =
SemaRef.getASTContext().getAddrSpaceQualType(T,
5605 if (T->isReferenceType()) {
5615 if (!T->isObjCLifetimeType() && !T->isDependentType())
5617 else if (T.getObjCLifetime()) {
5621 const AutoType *AutoTy;
5622 if ((AutoTy = dyn_cast<AutoType>(T)) && AutoTy->isDeduced()) {
5628 SemaRef.Context.getQualifiedType(
Deduced.getUnqualifiedType(), Qs);
5629 T =
SemaRef.Context.getAutoType(AutoTy->getDeducedKind(),
Deduced,
5630 AutoTy->getKeyword(),
5631 AutoTy->getTypeConstraintConcept(),
5632 AutoTy->getTypeConstraintArguments());
5637 SemaRef.Diag(Loc, diag::err_attr_objc_ownership_redundant) << T;
5643 return SemaRef.BuildQualifiedType(T, Loc, Quals);
5646template <
typename Derived>
5647QualType TreeTransform<Derived>::TransformTypeInObjectScope(
5650 assert(!getDerived().AlreadyTransformed(TL.
getType()));
5653 case TypeLoc::TemplateSpecialization:
5654 return getDerived().TransformTemplateSpecializationType(
5656 FirstQualifierInScope,
true);
5657 case TypeLoc::DependentName:
5658 return getDerived().TransformDependentNameType(
5660 ObjectType, FirstQualifierInScope);
5664 return getDerived().TransformType(TLB, TL);
5668template <
class TyLoc>
static inline
5670 TyLoc NewT = TLB.
push<TyLoc>(T.getType());
5671 NewT.setNameLoc(T.getNameLoc());
5675template<
typename Derived>
5676QualType TreeTransform<Derived>::TransformBuiltinType(TypeLocBuilder &TLB,
5678 BuiltinTypeLoc NewT = TLB.push<BuiltinTypeLoc>(T.getType());
5679 NewT.setBuiltinLoc(T.getBuiltinLoc());
5680 if (T.needsExtraLocalData())
5681 NewT.getWrittenBuiltinSpecs() = T.getWrittenBuiltinSpecs();
5685template<
typename Derived>
5692template <
typename Derived>
5696 return getDerived().
TransformType(TLB, TL.getOriginalLoc());
5699template<
typename Derived>
5702 QualType OriginalType = getDerived().TransformType(TLB, TL.getOriginalLoc());
5703 if (OriginalType.isNull())
5707 if (getDerived().AlwaysRebuild() ||
5708 OriginalType != TL.getOriginalLoc().getType())
5715template <
typename Derived>
5719 QualType OriginalType = getDerived().TransformType(TLB, TL.getElementLoc());
5720 if (OriginalType.isNull())
5724 if (getDerived().AlwaysRebuild() ||
5725 OriginalType != TL.getElementLoc().getType())
5732template<
typename Derived>
5736 = getDerived().TransformType(TLB, TL.getPointeeLoc());
5737 if (PointeeType.isNull())
5741 if (PointeeType->getAs<ObjCObjectType>()) {
5753 if (getDerived().AlwaysRebuild() ||
5754 PointeeType != TL.getPointeeLoc().getType()) {
5755 Result = getDerived().RebuildPointerType(PointeeType, TL.getSigilLoc());
5762 TLB.TypeWasModifiedSafely(
Result->getPointeeType());
5769template<
typename Derived>
5774 = getDerived().TransformType(TLB, TL.getPointeeLoc());
5775 if (PointeeType.isNull())
5779 if (getDerived().AlwaysRebuild() ||
5780 PointeeType != TL.getPointeeLoc().getType()) {
5781 Result = getDerived().RebuildBlockPointerType(PointeeType,
5796template<
typename Derived>
5804 if (PointeeType.
isNull())
5809 PointeeType != T->getPointeeTypeAsWritten()) {
5811 T->isSpelledAsLValue(),
5833template<
typename Derived>
5837 return TransformReferenceType(TLB, TL);
5840template<
typename Derived>
5842TreeTransform<Derived>::TransformRValueReferenceType(TypeLocBuilder &TLB,
5843 RValueReferenceTypeLoc TL) {
5844 return TransformReferenceType(TLB, TL);
5847template<
typename Derived>
5851 QualType PointeeType = getDerived().TransformType(TLB, TL.getPointeeLoc());
5852 if (PointeeType.isNull())
5859 getDerived().TransformNestedNameSpecifierLoc(OldQualifierLoc);
5860 if (!NewQualifierLoc)
5863 CXXRecordDecl *OldCls = T->getMostRecentCXXRecordDecl(), *NewCls =
nullptr;
5865 NewCls = cast_or_null<CXXRecordDecl>(
5866 getDerived().TransformDecl(TL.getStarLoc(), OldCls));
5872 if (getDerived().AlwaysRebuild() || PointeeType != T->getPointeeType() ||
5873 NewQualifierLoc.getNestedNameSpecifier() !=
5874 OldQualifierLoc.getNestedNameSpecifier() ||
5877 SS.
Adopt(NewQualifierLoc);
5878 Result = getDerived().RebuildMemberPointerType(PointeeType, SS, NewCls,
5887 if (MPT && PointeeType != MPT->getPointeeType()) {
5894 NewTL.setQualifierLoc(NewQualifierLoc);
5899template<
typename Derived>
5904 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
5905 if (ElementType.isNull())
5909 Expr *OldSize = TL.getSizeExpr();
5911 OldSize =
const_cast<Expr*
>(T->getSizeExpr());
5912 Expr *NewSize =
nullptr;
5916 NewSize = getDerived().TransformExpr(OldSize).template getAs<Expr>();
5921 if (getDerived().AlwaysRebuild() ||
5922 ElementType != T->getElementType() ||
5923 (T->getSizeExpr() && NewSize != OldSize)) {
5924 Result = getDerived().RebuildConstantArrayType(ElementType,
5925 T->getSizeModifier(),
5926 T->getSize(), NewSize,
5927 T->getIndexTypeCVRQualifiers(),
5928 TL.getBracketsRange());
5939 NewTL.setRBracketLoc(TL.getRBracketLoc());
5940 NewTL.setSizeExpr(NewSize);
5945template<
typename Derived>
5950 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
5951 if (ElementType.isNull())
5955 if (getDerived().AlwaysRebuild() ||
5956 ElementType != T->getElementType()) {
5957 Result = getDerived().RebuildIncompleteArrayType(ElementType,
5958 T->getSizeModifier(),
5959 T->getIndexTypeCVRQualifiers(),
5960 TL.getBracketsRange());
5967 NewTL.setRBracketLoc(TL.getRBracketLoc());
5968 NewTL.setSizeExpr(
nullptr);
5973template<
typename Derived>
5978 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
5979 if (ElementType.isNull())
5986 SizeResult = getDerived().TransformExpr(T->getSizeExpr());
5988 if (SizeResult.isInvalid())
5992 if (SizeResult.isInvalid())
5998 if (getDerived().AlwaysRebuild() ||
5999 ElementType != T->getElementType() ||
6000 Size != T->getSizeExpr()) {
6001 Result = getDerived().RebuildVariableArrayType(ElementType,
6002 T->getSizeModifier(),
6004 T->getIndexTypeCVRQualifiers(),
6005 TL.getBracketsRange());
6014 NewTL.setRBracketLoc(TL.getRBracketLoc());
6015 NewTL.setSizeExpr(Size);
6020template<
typename Derived>
6025 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
6026 if (ElementType.isNull())
6034 SemaRef.
ExprEvalContexts.back().InConditionallyConstantEvaluateContext =
true;
6037 Expr *origSize = TL.getSizeExpr();
6038 if (!origSize) origSize = T->getSizeExpr();
6041 = getDerived().TransformExpr(origSize);
6043 if (sizeResult.isInvalid())
6046 Expr *size = sizeResult.get();
6049 if (getDerived().AlwaysRebuild() ||
6050 ElementType != T->getElementType() ||
6052 Result = getDerived().RebuildDependentSizedArrayType(ElementType,
6053 T->getSizeModifier(),
6055 T->getIndexTypeCVRQualifiers(),
6056 TL.getBracketsRange());
6065 NewTL.setRBracketLoc(TL.getRBracketLoc());
6066 NewTL.setSizeExpr(size);
6071template <
typename Derived>
6075 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
6076 if (ElementType.isNull())
6084 if (
Size.isInvalid())
6088 if (getDerived().AlwaysRebuild() || ElementType != T->getElementType() ||
6089 Size.get() != T->getSizeExpr()) {
6090 Result = getDerived().RebuildDependentVectorType(
6091 ElementType,
Size.get(), T->getAttributeLoc(), T->getVectorKind());
6109template<
typename Derived>
6116 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
6117 if (ElementType.isNull())
6126 if (
Size.isInvalid())
6130 if (getDerived().AlwaysRebuild() ||
6131 ElementType != T->getElementType() ||
6132 Size.get() != T->getSizeExpr()) {
6133 Result = getDerived().RebuildDependentSizedExtVectorType(ElementType,
6135 T->getAttributeLoc());
6153template <
typename Derived>
6158 QualType ElementType = getDerived().TransformType(T->getElementType());
6159 if (ElementType.isNull())
6163 if (getDerived().AlwaysRebuild() || ElementType != T->getElementType()) {
6164 Result = getDerived().RebuildConstantMatrixType(
6165 ElementType, T->getNumRows(), T->getNumColumns());
6172 NewTL.setAttrOperandParensRange(TL.getAttrOperandParensRange());
6173 NewTL.setAttrRowOperand(TL.getAttrRowOperand());
6174 NewTL.setAttrColumnOperand(TL.getAttrColumnOperand());
6179template <
typename Derived>
6184 QualType ElementType = getDerived().TransformType(T->getElementType());
6185 if (ElementType.isNull()) {
6193 Expr *origRows = TL.getAttrRowOperand();
6195 origRows = T->getRowExpr();
6196 Expr *origColumns = TL.getAttrColumnOperand();
6198 origColumns = T->getColumnExpr();
6200 ExprResult rowResult = getDerived().TransformExpr(origRows);
6202 if (rowResult.isInvalid())
6205 ExprResult columnResult = getDerived().TransformExpr(origColumns);
6207 if (columnResult.isInvalid())
6210 Expr *rows = rowResult.get();
6211 Expr *columns = columnResult.get();
6214 if (getDerived().AlwaysRebuild() || ElementType != T->getElementType() ||
6215 rows != origRows || columns != origColumns) {
6216 Result = getDerived().RebuildDependentSizedMatrixType(
6217 ElementType, rows, columns, T->getAttributeLoc());
6227 NewTL.setAttrOperandParensRange(TL.getAttrOperandParensRange());
6228 NewTL.setAttrRowOperand(rows);
6229 NewTL.setAttrColumnOperand(columns);
6233template <
typename Derived>
6239 getDerived().TransformType(TLB, TL.getPointeeTypeLoc());
6241 if (pointeeType.isNull())
6248 ExprResult AddrSpace = getDerived().TransformExpr(T->getAddrSpaceExpr());
6250 if (AddrSpace.isInvalid())
6254 if (getDerived().AlwaysRebuild() || pointeeType != T->getPointeeType() ||
6255 AddrSpace.get() != T->getAddrSpaceExpr()) {
6256 Result = getDerived().RebuildDependentAddressSpaceType(
6257 pointeeType, AddrSpace.get(), T->getAttributeLoc());
6268 NewTL.setAttrExprOperand(TL.getAttrExprOperand());
6269 NewTL.setAttrNameLoc(TL.getAttrNameLoc());
6272 TLB.TypeWasModifiedSafely(
Result);
6278template <
typename Derived>
6282 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
6283 if (ElementType.isNull())
6287 if (getDerived().AlwaysRebuild() ||
6288 ElementType != T->getElementType()) {
6289 Result = getDerived().RebuildVectorType(ElementType, T->getNumElements(),
6290 T->getVectorKind());
6301template<
typename Derived>
6305 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
6306 if (ElementType.isNull())
6310 if (getDerived().AlwaysRebuild() ||
6311 ElementType != T->getElementType()) {
6312 Result = getDerived().RebuildExtVectorType(ElementType,
6313 T->getNumElements(),
6325template <
typename Derived>
6328 bool ExpectParameterPack) {
6363 if (NewTSI == OldTSI && indexAdjustment == 0)
6373 getDerived().transformedLocalDecl(OldParm, {newParm});
6377template <
typename Derived>
6385 unsigned *LastParamTransformed) {
6386 int indexAdjustment = 0;
6388 unsigned NumParams = Params.size();
6389 for (
unsigned i = 0; i != NumParams; ++i) {
6390 if (LastParamTransformed)
6391 *LastParamTransformed = i;
6393 assert(OldParm->getFunctionScopeIndex() == i);
6397 if (OldParm->isParameterPack()) {
6402 TypeLoc TL = OldParm->getTypeSourceInfo()->getTypeLoc();
6405 SemaRef.collectUnexpandedParameterPacks(Pattern, Unexpanded);
6408 bool ShouldExpand =
false;
6409 bool RetainExpansion =
false;
6411 if (Unexpanded.size() > 0) {
6412 OrigNumExpansions = ExpansionTL.
getTypePtr()->getNumExpansions();
6413 NumExpansions = OrigNumExpansions;
6417 ShouldExpand, RetainExpansion, NumExpansions)) {
6422 const AutoType *AT =
6423 Pattern.getType().getTypePtr()->getContainedAutoType();
6424 assert((AT && (!AT->isDeduced() || AT->getDeducedType().isNull())) &&
6425 "Could not find parameter packs or undeduced auto type!");
6432 getDerived().ExpandingFunctionParameterPack(OldParm);
6433 for (
unsigned I = 0; I != *NumExpansions; ++I) {
6436 =
getDerived().TransformFunctionTypeParam(OldParm,
6444 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6445 OutParamTypes.push_back(NewParm->
getType());
6447 PVars->push_back(NewParm);
6452 if (RetainExpansion) {
6453 ForgetPartiallySubstitutedPackRAII Forget(
getDerived());
6455 =
getDerived().TransformFunctionTypeParam(OldParm,
6463 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6464 OutParamTypes.push_back(NewParm->
getType());
6466 PVars->push_back(NewParm);
6482 NewParm =
getDerived().TransformFunctionTypeParam(OldParm,
6487 "Parameter pack no longer a parameter pack after "
6490 NewParm =
getDerived().TransformFunctionTypeParam(
6491 OldParm, indexAdjustment, std::nullopt,
6499 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6500 OutParamTypes.push_back(NewParm->
getType());
6502 PVars->push_back(NewParm);
6510 bool IsPackExpansion =
false;
6513 if (
const PackExpansionType *Expansion
6514 = dyn_cast<PackExpansionType>(OldType)) {
6516 QualType Pattern = Expansion->getPattern();
6518 getSema().collectUnexpandedParameterPacks(Pattern, Unexpanded);
6521 bool ShouldExpand =
false;
6522 bool RetainExpansion =
false;
6526 RetainExpansion, NumExpansions)) {
6533 for (
unsigned I = 0; I != *NumExpansions; ++I) {
6540 NewType =
getSema().getASTContext().getPackExpansionType(
6541 NewType, std::nullopt);
6548 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6549 OutParamTypes.push_back(NewType);
6551 PVars->push_back(
nullptr);
6560 if (RetainExpansion) {
6561 ForgetPartiallySubstitutedPackRAII Forget(
getDerived());
6567 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6568 OutParamTypes.push_back(NewType);
6570 PVars->push_back(
nullptr);
6575 OldType = Expansion->getPattern();
6576 IsPackExpansion =
true;
6578 NewType =
getDerived().TransformType(OldType);
6580 NewType =
getDerived().TransformType(OldType);
6586 if (IsPackExpansion)
6587 NewType =
getSema().Context.getPackExpansionType(NewType,
6591 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6592 OutParamTypes.push_back(NewType);
6594 PVars->push_back(
nullptr);
6599 for (
unsigned i = 0, e = PVars->size(); i != e; ++i)
6601 assert(parm->getFunctionScopeIndex() == i);
6608template<
typename Derived>
6613 return getDerived().TransformFunctionProtoType(
6617 ExceptionStorage, Changed);
6621template<
typename Derived>
template<
typename Fn>
6640 if (T->hasTrailingReturn()) {
6644 T->getExtParameterInfosOrNull(),
6645 ParamTypes, &ParamDecls, ExtParamInfos))
6655 auto *RD = dyn_cast<CXXRecordDecl>(
SemaRef.getCurLexicalContext());
6657 SemaRef, !ThisContext && RD ? RD : ThisContext, ThisTypeQuals);
6672 T->getExtParameterInfosOrNull(),
6673 ParamTypes, &ParamDecls, ExtParamInfos))
6679 bool EPIChanged =
false;
6684 if (
auto NewExtParamInfos =
6700 std::optional<FunctionEffectSet> NewFX;
6712 std::optional<FunctionEffectMode> Mode =
6732 "FunctionEffectMode::None shouldn't be possible here");
6735 if (!
SemaRef.diagnoseConflictingFunctionEffect(*NewFX, NewEC,
6738 NewFX->insert(NewEC, Errs);
6739 assert(Errs.empty());
6748 T->getParamTypes() !=
llvm::ArrayRef(ParamTypes) || EPIChanged) {
6749 Result =
getDerived().RebuildFunctionProtoType(ResultType, ParamTypes, EPI);
6760 for (
unsigned i = 0, e = NewTL.
getNumParams(); i != e; ++i)
6766template<
typename Derived>
6789 getSema().ActOnNoexceptSpec(NoexceptExpr.
get(), EST);
6804 if (
const PackExpansionType *PackExpansion =
6805 T->getAs<PackExpansionType>()) {
6810 SemaRef.collectUnexpandedParameterPacks(PackExpansion->getPattern(),
6812 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
6817 bool Expand =
false;
6818 bool RetainExpansion =
false;
6819 UnsignedOrNone NumExpansions = PackExpansion->getNumExpansions();
6824 true, Expand, RetainExpansion,
6837 U =
SemaRef.Context.getPackExpansionType(
U, NumExpansions);
6838 Exceptions.push_back(
U);
6844 for (
unsigned ArgIdx = 0; ArgIdx != *NumExpansions; ++ArgIdx) {
6848 if (
U.isNull() ||
SemaRef.CheckSpecifiedExceptionType(
U, Loc))
6851 Exceptions.push_back(
U);
6855 if (
U.isNull() ||
SemaRef.CheckSpecifiedExceptionType(
U, Loc))
6860 Exceptions.push_back(
U);
6870template<
typename Derived>
6880 if (getDerived().AlwaysRebuild() || ResultType != T->getReturnType())
6881 Result = getDerived().RebuildFunctionNoProtoType(ResultType);
6892template <
typename Derived>
6893QualType TreeTransform<Derived>::TransformUnresolvedUsingType(
6894 TypeLocBuilder &TLB, UnresolvedUsingTypeLoc TL) {
6896 const UnresolvedUsingType *T = TL.getTypePtr();
6897 bool Changed =
false;
6899 NestedNameSpecifierLoc QualifierLoc = TL.getQualifierLoc();
6900 if (NestedNameSpecifierLoc OldQualifierLoc = QualifierLoc) {
6901 QualifierLoc = getDerived().TransformNestedNameSpecifierLoc(QualifierLoc);
6904 Changed |= QualifierLoc != OldQualifierLoc;
6907 auto *D = getDerived().TransformDecl(TL.getNameLoc(), T->getDecl());
6913 if (getDerived().AlwaysRebuild() || Changed) {
6914 Result = getDerived().RebuildUnresolvedUsingType(
6915 T->getKeyword(), QualifierLoc.getNestedNameSpecifier(), TL.getNameLoc(),
6923 QualifierLoc, TL.getNameLoc());
6926 QualifierLoc, TL.getNameLoc());
6930template <
typename Derived>
6938 QualifierLoc = getDerived().TransformNestedNameSpecifierLoc(QualifierLoc);
6941 Changed |= QualifierLoc != OldQualifierLoc;
6944 auto *D = cast_or_null<UsingShadowDecl>(
6945 getDerived().TransformDecl(TL.getNameLoc(), T->getDecl()));
6950 QualType UnderlyingType = getDerived().TransformType(T->desugar());
6951 if (UnderlyingType.isNull())
6953 Changed |= UnderlyingType != T->desugar();
6956 if (getDerived().AlwaysRebuild() || Changed) {
6957 Result = getDerived().RebuildUsingType(
6958 T->getKeyword(), QualifierLoc.getNestedNameSpecifier(), D,
6968template<
typename Derived>
6976 QualifierLoc = getDerived().TransformNestedNameSpecifierLoc(QualifierLoc);
6979 Changed |= QualifierLoc != OldQualifierLoc;
6982 auto *
Typedef = cast_or_null<TypedefNameDecl>(
6983 getDerived().TransformDecl(TL.getNameLoc(), T->getDecl()));
6991 if (getDerived().AlwaysRebuild() || Changed) {
6992 Result = getDerived().RebuildTypedefType(
6993 T->getKeyword(), QualifierLoc.getNestedNameSpecifier(),
Typedef);
6999 QualifierLoc, TL.getNameLoc());
7003template<
typename Derived>
7011 ExprResult E = getDerived().TransformExpr(TL.getUnderlyingExpr());
7021 if (getDerived().AlwaysRebuild() || E.get() != TL.getUnderlyingExpr()) {
7023 getDerived().RebuildTypeOfExprType(E.get(), TL.getTypeofLoc(), Kind);
7030 NewTL.setLParenLoc(TL.getLParenLoc());
7031 NewTL.setRParenLoc(TL.getRParenLoc());
7036template<
typename Derived>
7040 TypeSourceInfo* New_Under_TI = getDerived().TransformType(Old_Under_TI);
7046 if (getDerived().AlwaysRebuild() || New_Under_TI != Old_Under_TI) {
7047 Result = getDerived().RebuildTypeOfType(New_Under_TI->getType(), Kind);
7054 NewTL.setLParenLoc(TL.getLParenLoc());
7055 NewTL.setRParenLoc(TL.getRParenLoc());
7056 NewTL.setUnmodifiedTInfo(New_Under_TI);
7061template<
typename Derived>
7064 const DecltypeType *T = TL.getTypePtr();
7071 ExprResult E = getDerived().TransformExpr(T->getUnderlyingExpr());
7075 E = getSema().ActOnDecltypeExpression(E.get());
7080 if (getDerived().AlwaysRebuild() ||
7081 E.get() != T->getUnderlyingExpr()) {
7082 Result = getDerived().RebuildDecltypeType(E.get(), TL.getDecltypeLoc());
7090 NewTL.setRParenLoc(TL.getRParenLoc());
7094template <
typename Derived>
7104 IndexExpr = getDerived().TransformExpr(TL.getIndexExpr());
7105 if (IndexExpr.isInvalid())
7108 QualType Pattern = TL.getPattern();
7110 const PackIndexingType *PIT = TL.
getTypePtr();
7114 bool NotYetExpanded = Types.empty();
7115 bool FullySubstituted =
true;
7117 if (Types.empty() && !PIT->expandsToEmptyPack())
7121 if (!T->containsUnexpandedParameterPack()) {
7122 QualType Transformed = getDerived().TransformType(T);
7123 if (Transformed.isNull())
7125 SubtitutedTypes.push_back(Transformed);
7130 getSema().collectUnexpandedParameterPacks(T, Unexpanded);
7131 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
7134 bool ShouldExpand =
true;
7135 bool RetainExpansion =
false;
7137 if (getDerived().TryExpandParameterPacks(
7140 RetainExpansion, NumExpansions))
7142 if (!ShouldExpand) {
7148 QualType Pack = getDerived().TransformType(TLB, TI->getTypeLoc());
7151 if (NotYetExpanded) {
7152 FullySubstituted =
false;
7153 QualType Out = getDerived().RebuildPackIndexingType(
7163 SubtitutedTypes.push_back(Pack);
7166 for (
unsigned I = 0; I != *NumExpansions; ++I) {
7171 SubtitutedTypes.push_back(Out);
7172 FullySubstituted &= !
Out->containsUnexpandedParameterPack();
7176 if (RetainExpansion) {
7177 FullySubstituted =
false;
7178 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
7182 SubtitutedTypes.push_back(Out);
7190 QualType Result = getDerived().TransformType(TLB, TL.getPatternLoc());
7192 QualType Out = getDerived().RebuildPackIndexingType(
7194 FullySubstituted, SubtitutedTypes);
7203template<
typename Derived>
7209 if (
Result->isDependentType()) {
7210 const UnaryTransformType *T = TL.getTypePtr();
7212 NewBaseTSI = getDerived().TransformType(TL.getUnderlyingTInfo());
7215 QualType NewBase = NewBaseTSI->getType();
7217 Result = getDerived().RebuildUnaryTransformType(NewBase,
7226 NewTL.setParensRange(TL.getParensRange());
7227 NewTL.setUnderlyingTInfo(NewBaseTSI);
7231template<
typename Derived>
7234 const DeducedTemplateSpecializationType *T = TL.getTypePtr();
7239 TL.getTemplateNameLoc());
7243 QualType OldDeduced = T->getDeducedType();
7245 if (!OldDeduced.isNull()) {
7246 NewDeduced = getDerived().TransformType(OldDeduced);
7247 if (NewDeduced.isNull())
7251 QualType Result = getDerived().RebuildDeducedTemplateSpecializationType(
7259 NewTL.setTemplateNameLoc(TL.getTemplateNameLoc());
7260 NewTL.setQualifierLoc(QualifierLoc);
7264template <
typename Derived>
7271 QualifierLoc =
getDerived().TransformNestedNameSpecifierLoc(QualifierLoc);
7276 auto *TD = cast_or_null<TagDecl>(
7283 TD != T->getDecl()) {
7284 if (T->isCanonicalUnqualified())
7301template <
typename Derived>
7307template <
typename Derived>
7308QualType TreeTransform<Derived>::TransformRecordType(TypeLocBuilder &TLB,
7310 return getDerived().TransformTagType(TLB, TL);
7313template<
typename Derived>
7320template<
typename Derived>
7324 return getDerived().TransformTemplateTypeParmType(
7329template <
typename Derived>
7335template<
typename Derived>
7336QualType TreeTransform<Derived>::TransformSubstTemplateTypeParmType(
7337 TypeLocBuilder &TLB,
7338 SubstTemplateTypeParmTypeLoc TL) {
7339 const SubstTemplateTypeParmType *T = TL.getTypePtr();
7342 getDerived().TransformDecl(TL.getNameLoc(), T->getAssociatedDecl());
7347 TemporaryBase Rebase(*
this, TL.getNameLoc(), DeclarationName());
7348 QualType Replacement = getDerived().TransformType(T->getReplacementType());
7349 if (Replacement.isNull())
7353 Replacement, NewReplaced, T->getIndex(), T->getPackIndex(),
7357 SubstTemplateTypeParmTypeLoc NewTL
7358 = TLB.push<SubstTemplateTypeParmTypeLoc>(
Result);
7359 NewTL.setNameLoc(TL.getNameLoc());
7363template <
typename Derived>
7369template<
typename Derived>
7373 return getDerived().TransformSubstTemplateTypeParmPackType(
7377template <
typename Derived>
7383template<
typename Derived>
7384QualType TreeTransform<Derived>::TransformAtomicType(TypeLocBuilder &TLB,
7386 QualType ValueType = getDerived().TransformType(TLB, TL.getValueLoc());
7387 if (ValueType.isNull())
7390 QualType
Result = TL.getType();
7391 if (getDerived().AlwaysRebuild() ||
7392 ValueType != TL.getValueLoc().getType()) {
7393 Result = getDerived().RebuildAtomicType(ValueType, TL.getKWLoc());
7400 NewTL.setLParenLoc(TL.getLParenLoc());
7401 NewTL.setRParenLoc(TL.getRParenLoc());
7406template <
typename Derived>
7409 QualType ValueType = getDerived().TransformType(TLB, TL.getValueLoc());
7410 if (ValueType.isNull())
7414 if (getDerived().AlwaysRebuild() || ValueType != TL.getValueLoc().getType()) {
7417 Result = getDerived().RebuildPipeType(ValueType, TL.getKWLoc(), isReadPipe);
7428template <
typename Derived>
7434 if (getDerived().AlwaysRebuild()) {
7435 Result = getDerived().RebuildBitIntType(EIT->isUnsigned(),
7436 EIT->getNumBits(), TL.getNameLoc());
7446template <
typename Derived>
7453 ExprResult BitsExpr = getDerived().TransformExpr(EIT->getNumBitsExpr());
7456 if (BitsExpr.isInvalid())
7461 if (getDerived().AlwaysRebuild() || BitsExpr.get() != EIT->getNumBitsExpr()) {
7462 Result = getDerived().RebuildDependentBitIntType(
7463 EIT->isUnsigned(), BitsExpr.get(), TL.getNameLoc());
7479template <
typename Derived>
7482 llvm_unreachable(
"This type does not need to be transformed.");
7490 template<
typename ArgLocContainer>
7492 ArgLocContainer *Container;
7517 : Container(&Container), Index(Index) { }
7531 return Container->getArgLoc(Index);
7535 return pointer(Container->getArgLoc(Index));
7540 return X.Container == Y.Container &&
X.Index == Y.Index;
7549template<
typename Derived>
7550QualType TreeTransform<Derived>::TransformAutoType(TypeLocBuilder &TLB,
7552 const AutoType *T = TL.getTypePtr();
7553 QualType OldDeduced = T->getDeducedType();
7554 QualType NewDeduced;
7555 if (!OldDeduced.isNull()) {
7556 NewDeduced = getDerived().TransformType(OldDeduced);
7557 if (NewDeduced.isNull())
7564 if (T->isConstrained()) {
7565 assert(TL.getConceptReference());
7566 NewCD = cast_or_null<ConceptDecl>(getDerived().TransformDecl(
7567 TL.getConceptNameLoc(), T->getTypeConstraintConcept()));
7569 NewTemplateArgs.setLAngleLoc(TL.getLAngleLoc());
7570 NewTemplateArgs.setRAngleLoc(TL.getRAngleLoc());
7572 if (getDerived().TransformTemplateArguments(
7573 ArgIterator(TL, 0), ArgIterator(TL, TL.getNumArgs()),
7577 if (TL.getNestedNameSpecifierLoc()) {
7579 = getDerived().TransformNestedNameSpecifierLoc(
7580 TL.getNestedNameSpecifierLoc());
7581 if (!NewNestedNameSpec)
7587 if (getDerived().AlwaysRebuild() || NewDeduced != OldDeduced ||
7588 T->isDependentType() || T->isConstrained()) {
7591 NewArgList.reserve(NewTemplateArgs.size());
7592 for (
const auto &ArgLoc : NewTemplateArgs.arguments())
7593 NewArgList.push_back(ArgLoc.getArgument());
7594 Result = getDerived().RebuildAutoType(
7596 NewDeduced, T->getKeyword(), NewCD, NewArgList);
7603 NewTL.setRParenLoc(TL.getRParenLoc());
7604 NewTL.setConceptReference(
nullptr);
7606 if (T->isConstrained()) {
7608 TL.getTypePtr()->getTypeConstraintConcept()->getDeclName(),
7609 TL.getConceptNameLoc(),
7610 TL.getTypePtr()->getTypeConstraintConcept()->getDeclName());
7612 SemaRef.
Context, NewNestedNameSpec, TL.getTemplateKWLoc(), DNI,
7613 TL.getFoundDecl(), TL.getTypePtr()->getTypeConstraintConcept(),
7615 NewTL.setConceptReference(CR);
7621template <
typename Derived>
7624 return getDerived().TransformTemplateSpecializationType(
7629template <
typename Derived>
7632 NamedDecl *FirstQualifierInScope,
bool AllowInjectedClassName) {
7633 const TemplateSpecializationType *T = TL.
getTypePtr();
7639 AllowInjectedClassName);
7648 if (getDerived().TransformTemplateArguments(ArgIterator(TL, 0),
7657 QualType Result = getDerived().RebuildTemplateSpecializationType(
7670template <
typename Derived>
7674 QualType modifiedType = getDerived().TransformType(TLB, TL.getModifiedLoc());
7675 if (modifiedType.isNull())
7679 const Attr *oldAttr = TL.getAttr();
7680 const Attr *newAttr = oldAttr ? getDerived().TransformAttr(oldAttr) :
nullptr;
7681 if (oldAttr && !newAttr)
7687 if (getDerived().AlwaysRebuild() ||
7688 modifiedType != oldType->getModifiedType()) {
7701 QualType equivalentType = modifiedType;
7702 if (TL.getModifiedLoc().getType() != TL.getEquivalentTypeLoc().getType()) {
7704 AuxiliaryTLB.
reserve(TL.getFullDataSize());
7706 getDerived().TransformType(AuxiliaryTLB, TL.getEquivalentTypeLoc());
7707 if (equivalentType.isNull())
7713 if (
auto nullability = oldType->getImmediateNullability()) {
7714 if (!modifiedType->canHaveNullability()) {
7715 SemaRef.
Diag((TL.getAttr() ? TL.getAttr()->getLocation()
7716 : TL.getModifiedLoc().getBeginLoc()),
7717 diag::err_nullability_nonpointer)
7734template <
typename Derived>
7738 QualType InnerTy = getDerived().TransformType(TLB, TL.getInnerLoc());
7739 if (InnerTy.isNull())
7742 Expr *OldCount = TL.getCountExpr();
7743 Expr *NewCount =
nullptr;
7745 ExprResult CountResult = getDerived().TransformExpr(OldCount);
7746 if (CountResult.isInvalid())
7748 NewCount = CountResult.get();
7752 if (getDerived().AlwaysRebuild() || InnerTy != OldTy->desugar() ||
7753 OldCount != NewCount) {
7756 InnerTy, NewCount, OldTy->isCountInBytes(), OldTy->isOrNull());
7763template <
typename Derived>
7767 llvm_unreachable(
"Unexpected TreeTransform for BTFTagAttributedType");
7770template <
typename Derived>
7773 const OverflowBehaviorType *OldTy = TL.getTypePtr();
7774 QualType InnerTy = getDerived().TransformType(TLB, TL.getWrappedLoc());
7775 if (InnerTy.isNull())
7779 if (getDerived().AlwaysRebuild() || InnerTy != OldTy->getUnderlyingType()) {
7791template <
typename Derived>
7795 const HLSLAttributedResourceType *oldType = TL.getTypePtr();
7797 QualType WrappedTy = getDerived().TransformType(TLB, TL.getWrappedLoc());
7798 if (WrappedTy.isNull())
7802 QualType OldContainedTy = oldType->getContainedType();
7804 if (!OldContainedTy.isNull()) {
7805 TypeSourceInfo *oldContainedTSI = TL.getContainedTypeSourceInfo();
7806 if (!oldContainedTSI)
7807 oldContainedTSI = getSema().getASTContext().getTrivialTypeSourceInfo(
7809 ContainedTSI = getDerived().TransformType(oldContainedTSI);
7812 ContainedTy = ContainedTSI->getType();
7816 if (getDerived().AlwaysRebuild() || WrappedTy != oldType->getWrappedType() ||
7817 ContainedTy != oldType->getContainedType()) {
7819 WrappedTy, ContainedTy, oldType->getAttrs());
7825 NewTL.setContainedTypeSourceInfo(ContainedTSI);
7829template <
typename Derived>
7833 return TL.getType();
7836template<
typename Derived>
7840 QualType Inner = getDerived().TransformType(TLB, TL.getInnerLoc());
7845 if (getDerived().AlwaysRebuild() ||
7846 Inner != TL.getInnerLoc().getType()) {
7847 Result = getDerived().RebuildParenType(Inner);
7854 NewTL.setRParenLoc(TL.getRParenLoc());
7858template <
typename Derived>
7862 QualType Inner = getDerived().TransformType(TLB, TL.getInnerLoc());
7867 if (getDerived().AlwaysRebuild() || Inner != TL.getInnerLoc().getType()) {
7869 getDerived().RebuildMacroQualifiedType(Inner, TL.getMacroIdentifier());
7879template<
typename Derived>
7880QualType TreeTransform<Derived>::TransformDependentNameType(
7882 return TransformDependentNameType(TLB, TL,
false);
7885template <
typename Derived>
7886QualType TreeTransform<Derived>::TransformDependentNameType(
7889 const DependentNameType *T = TL.
getTypePtr();
7893 QualifierLoc = getDerived().TransformNestedNameSpecifierLoc(
7894 QualifierLoc, ObjectType, UnqualLookup);
7898 assert((ObjectType.isNull() && !UnqualLookup) &&
7899 "must be transformed by TransformNestedNameSpecifierLoc");
7903 = getDerived().RebuildDependentNameType(T->getKeyword(),
7904 TL.getElaboratedKeywordLoc(),
7915 NewTL.setQualifierLoc(QualifierLoc);
7916 NewTL.setNameLoc(TL.getNameLoc());
7920 NewTL.setTemplateNameLoc(TL.getNameLoc());
7921 NewTL.setQualifierLoc(QualifierLoc);
7924 QualifierLoc, TL.getNameLoc());
7927 NewTL.
set(TL.getElaboratedKeywordLoc(), QualifierLoc, TL.getNameLoc());
7931 NewTL.setQualifierLoc(QualifierLoc);
7932 NewTL.setNameLoc(TL.getNameLoc());
7937template<
typename Derived>
7941 = getDerived().TransformType(TLB, TL.getPatternLoc());
7942 if (Pattern.isNull())
7946 if (getDerived().AlwaysRebuild() ||
7947 Pattern != TL.getPatternLoc().getType()) {
7948 Result = getDerived().RebuildPackExpansionType(Pattern,
7949 TL.getPatternLoc().getSourceRange(),
7950 TL.getEllipsisLoc(),
7951 TL.getTypePtr()->getNumExpansions());
7961template<
typename Derived>
7966 TLB.pushFullCopy(TL);
7967 return TL.getType();
7970template<
typename Derived>
7974 const ObjCTypeParamType *T = TL.getTypePtr();
7976 getDerived().TransformDecl(T->getDecl()->getLocation(), T->getDecl()));
7981 if (getDerived().AlwaysRebuild() ||
7982 OTP != T->getDecl()) {
7983 Result = getDerived().RebuildObjCTypeParamType(
7984 OTP, TL.getProtocolLAngleLoc(),
7985 llvm::ArrayRef(TL.getTypePtr()->qual_begin(), TL.getNumProtocols()),
7986 TL.getProtocolLocs(), TL.getProtocolRAngleLoc());
7992 if (TL.getNumProtocols()) {
7993 NewTL.setProtocolLAngleLoc(TL.getProtocolLAngleLoc());
7994 for (
unsigned i = 0, n = TL.getNumProtocols(); i != n; ++i)
7995 NewTL.setProtocolLoc(i, TL.getProtocolLoc(i));
7996 NewTL.setProtocolRAngleLoc(TL.getProtocolRAngleLoc());
8001template<
typename Derived>
8006 QualType BaseType = getDerived().TransformType(TLB, TL.getBaseLoc());
8007 if (BaseType.isNull())
8010 bool AnyChanged = BaseType != TL.getBaseLoc().getType();
8014 for (
unsigned i = 0, n = TL.getNumTypeArgs(); i != n; ++i) {
8016 TypeLoc TypeArgLoc = TypeArgInfo->getTypeLoc();
8017 QualType TypeArg = TypeArgInfo->getType();
8022 const auto *PackExpansion = PackExpansionLoc.getType()
8023 ->castAs<PackExpansionType>();
8027 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
8031 TypeLoc PatternLoc = PackExpansionLoc.getPatternLoc();
8032 bool Expand =
false;
8033 bool RetainExpansion =
false;
8034 UnsignedOrNone NumExpansions = PackExpansion->getNumExpansions();
8035 if (getDerived().TryExpandParameterPacks(
8036 PackExpansionLoc.getEllipsisLoc(), PatternLoc.getSourceRange(),
8037 Unexpanded,
true, Expand,
8038 RetainExpansion, NumExpansions))
8048 TypeArgBuilder.
reserve(PatternLoc.getFullDataSize());
8049 QualType NewPatternType = getDerived().TransformType(TypeArgBuilder,
8051 if (NewPatternType.isNull())
8055 NewPatternType, NumExpansions);
8057 NewExpansionLoc.
setEllipsisLoc(PackExpansionLoc.getEllipsisLoc());
8058 NewTypeArgInfos.push_back(
8059 TypeArgBuilder.getTypeSourceInfo(SemaRef.
Context, NewExpansionType));
8065 for (
unsigned ArgIdx = 0; ArgIdx != *NumExpansions; ++ArgIdx) {
8069 TypeArgBuilder.
reserve(PatternLoc.getFullDataSize());
8071 QualType NewTypeArg = getDerived().TransformType(TypeArgBuilder,
8073 if (NewTypeArg.isNull())
8076 NewTypeArgInfos.push_back(
8077 TypeArgBuilder.getTypeSourceInfo(SemaRef.
Context, NewTypeArg));
8084 TypeArgBuilder.
reserve(TypeArgLoc.getFullDataSize());
8086 getDerived().TransformType(TypeArgBuilder, TypeArgLoc);
8087 if (NewTypeArg.isNull())
8091 if (NewTypeArg == TypeArg) {
8092 NewTypeArgInfos.push_back(TypeArgInfo);
8096 NewTypeArgInfos.push_back(
8097 TypeArgBuilder.getTypeSourceInfo(SemaRef.
Context, NewTypeArg));
8102 if (getDerived().AlwaysRebuild() || AnyChanged) {
8104 Result = getDerived().RebuildObjCObjectType(
8105 BaseType, TL.getBeginLoc(), TL.getTypeArgsLAngleLoc(), NewTypeArgInfos,
8106 TL.getTypeArgsRAngleLoc(), TL.getProtocolLAngleLoc(),
8107 llvm::ArrayRef(TL.getTypePtr()->qual_begin(), TL.getNumProtocols()),
8108 TL.getProtocolLocs(), TL.getProtocolRAngleLoc());
8116 NewT.setTypeArgsLAngleLoc(TL.getTypeArgsLAngleLoc());
8117 for (
unsigned i = 0, n = TL.getNumTypeArgs(); i != n; ++i)
8118 NewT.setTypeArgTInfo(i, NewTypeArgInfos[i]);
8119 NewT.setTypeArgsRAngleLoc(TL.getTypeArgsRAngleLoc());
8120 NewT.setProtocolLAngleLoc(TL.getProtocolLAngleLoc());
8121 for (
unsigned i = 0, n = TL.getNumProtocols(); i != n; ++i)
8122 NewT.setProtocolLoc(i, TL.getProtocolLoc(i));
8123 NewT.setProtocolRAngleLoc(TL.getProtocolRAngleLoc());
8127template<
typename Derived>
8131 QualType PointeeType = getDerived().TransformType(TLB, TL.getPointeeLoc());
8132 if (PointeeType.isNull())
8136 if (getDerived().AlwaysRebuild() ||
8137 PointeeType != TL.getPointeeLoc().getType()) {
8138 Result = getDerived().RebuildObjCObjectPointerType(PointeeType,
8152template<
typename Derived>
8158template<
typename Derived>
8161 return getDerived().TransformCompoundStmt(S,
false);
8164template<
typename Derived>
8171 getSema().resetFPOptions(
8174 bool SubStmtInvalid =
false;
8175 bool SubStmtChanged =
false;
8177 for (
auto *B : S->
body()) {
8179 B, IsStmtExpr && B == S->
body_back() ? StmtDiscardKind::StmtExprResult
8180 : StmtDiscardKind::Discarded);
8182 if (
Result.isInvalid()) {
8189 SubStmtInvalid =
true;
8193 SubStmtChanged = SubStmtChanged ||
Result.get() != B;
8194 Statements.push_back(
Result.getAs<Stmt>());
8200 if (!getDerived().AlwaysRebuild() &&
8204 return getDerived().RebuildCompoundStmt(S->
getLBracLoc(),
8210template<
typename Derived>
8219 LHS = getDerived().TransformExpr(S->getLHS());
8221 if (LHS.isInvalid())
8225 RHS = getDerived().TransformExpr(S->getRHS());
8227 if (RHS.isInvalid())
8234 StmtResult Case = getDerived().RebuildCaseStmt(S->getCaseLoc(),
8236 S->getEllipsisLoc(),
8239 if (Case.isInvalid())
8244 getDerived().TransformStmt(S->getSubStmt());
8245 if (SubStmt.isInvalid())
8249 return getDerived().RebuildCaseStmtBody(Case.get(), SubStmt.get());
8252template <
typename Derived>
8256 getDerived().TransformStmt(S->getSubStmt());
8257 if (SubStmt.isInvalid())
8261 return getDerived().RebuildDefaultStmt(S->getDefaultLoc(), S->getColonLoc(),
8265template<
typename Derived>
8268 StmtResult SubStmt = getDerived().TransformStmt(S->getSubStmt(), SDK);
8269 if (SubStmt.isInvalid())
8272 Decl *LD = getDerived().TransformDecl(S->getDecl()->getLocation(),
8280 if (LD == S->getDecl())
8281 S->getDecl()->setStmt(
nullptr);
8284 return getDerived().RebuildLabelStmt(S->getIdentLoc(),
8289template <
typename Derived>
8294 switch (R->getKind()) {
8298 return getDerived().Transform##X##Attr(cast<X##Attr>(R));
8299#include "clang/Basic/AttrList.inc"
8304template <
typename Derived>
8311 switch (R->getKind()) {
8315 return getDerived().TransformStmt##X##Attr(OrigS, InstS, cast<X##Attr>(R));
8316#include "clang/Basic/AttrList.inc"
8321template <
typename Derived>
8324 StmtDiscardKind SDK) {
8329 bool AttrsChanged =
false;
8333 for (
const auto *I : S->
getAttrs()) {
8335 getDerived().TransformStmtAttr(S->
getSubStmt(), SubStmt.
get(), I);
8336 AttrsChanged |= (I != R);
8349 return getDerived().RebuildAttributedStmt(S->
getAttrLoc(), Attrs,
8353template<
typename Derived>
8358 if (
Init.isInvalid())
8362 if (!S->isConsteval()) {
8364 Cond = getDerived().TransformCondition(
8365 S->getIfLoc(), S->getConditionVariable(), S->getCond(),
8368 if (
Cond.isInvalid())
8373 std::optional<bool> ConstexprConditionValue;
8374 if (S->isConstexpr())
8375 ConstexprConditionValue =
Cond.getKnownValue();
8379 if (!ConstexprConditionValue || *ConstexprConditionValue) {
8383 S->isNonNegatedConsteval());
8385 Then = getDerived().TransformStmt(S->getThen());
8386 if (Then.isInvalid())
8392 Then =
new (getSema().Context)
8393 CompoundStmt(S->getThen()->getBeginLoc(), S->getThen()->getEndLoc());
8398 if (!ConstexprConditionValue || !*ConstexprConditionValue) {
8402 S->isNegatedConsteval());
8404 Else = getDerived().TransformStmt(S->getElse());
8405 if (Else.isInvalid())
8407 }
else if (S->getElse() && ConstexprConditionValue &&
8408 *ConstexprConditionValue) {
8412 Else =
new (getSema().Context)
8413 CompoundStmt(S->getElse()->getBeginLoc(), S->getElse()->getEndLoc());
8416 if (!getDerived().AlwaysRebuild() &&
8417 Init.get() == S->getInit() &&
8418 Cond.get() == std::make_pair(S->getConditionVariable(), S->getCond()) &&
8419 Then.get() == S->getThen() &&
8420 Else.get() == S->getElse())
8423 return getDerived().RebuildIfStmt(
8424 S->getIfLoc(), S->getStatementKind(), S->getLParenLoc(),
Cond,
8425 S->getRParenLoc(),
Init.get(), Then.get(), S->getElseLoc(), Else.get());
8428template<
typename Derived>
8433 if (
Init.isInvalid())
8438 S->getSwitchLoc(), S->getConditionVariable(), S->getCond(),
8440 if (
Cond.isInvalid())
8445 getDerived().RebuildSwitchStmtStart(S->getSwitchLoc(), S->getLParenLoc(),
8446 Init.get(),
Cond, S->getRParenLoc());
8451 StmtResult Body = getDerived().TransformStmt(S->getBody());
8452 if (Body.isInvalid())
8456 return getDerived().RebuildSwitchStmtBody(S->getSwitchLoc(),
Switch.get(),
8460template<
typename Derived>
8465 S->getWhileLoc(), S->getConditionVariable(), S->getCond(),
8467 if (
Cond.isInvalid())
8476 StmtResult Body = getDerived().TransformStmt(S->getBody());
8477 if (Body.isInvalid())
8480 if (!getDerived().AlwaysRebuild() &&
8481 Cond.get() == std::make_pair(S->getConditionVariable(), S->getCond()) &&
8482 Body.get() == S->getBody())
8485 return getDerived().RebuildWhileStmt(S->getWhileLoc(), S->getLParenLoc(),
8486 Cond, S->getRParenLoc(), Body.get());
8489template<
typename Derived>
8498 StmtResult Body = getDerived().TransformStmt(S->getBody());
8499 if (Body.isInvalid())
8504 if (
Cond.isInvalid())
8507 if (!getDerived().AlwaysRebuild() &&
8508 Cond.get() == S->getCond() &&
8509 Body.get() == S->getBody())
8512 return getDerived().RebuildDoStmt(S->getDoLoc(), Body.get(), S->getWhileLoc(),
8513 S->getWhileLoc(),
Cond.get(),
8517template<
typename Derived>
8520 if (getSema().getLangOpts().OpenMP)
8521 getSema().OpenMP().startOpenMPLoop();
8525 if (
Init.isInvalid())
8530 if (getSema().getLangOpts().OpenMP &&
Init.isUsable())
8531 getSema().OpenMP().ActOnOpenMPLoopInitialization(S->getForLoc(),
8536 S->getForLoc(), S->getConditionVariable(), S->getCond(),
8538 if (
Cond.isInvalid())
8543 if (
Inc.isInvalid())
8547 if (S->getInc() && !FullInc.get())
8554 S->getBeginLoc(), S->getInit(),
Init.get(), S->getCond(),
8555 Cond.get().second, S->getInc(),
Inc.get());
8558 StmtResult Body = getDerived().TransformStmt(S->getBody());
8559 if (Body.isInvalid())
8564 if (!getDerived().AlwaysRebuild() &&
8565 Init.get() == S->getInit() &&
8566 Cond.get() == std::make_pair(S->getConditionVariable(), S->getCond()) &&
8567 Inc.get() == S->getInc() &&
8568 Body.get() == S->getBody())
8571 return getDerived().RebuildForStmt(S->getForLoc(), S->getLParenLoc(),
8573 S->getRParenLoc(), Body.get());
8576template<
typename Derived>
8579 Decl *LD = getDerived().TransformDecl(S->getLabel()->getLocation(),
8585 return getDerived().RebuildGotoStmt(S->getGotoLoc(), S->getLabelLoc(),
8589template<
typename Derived>
8597 if (!getDerived().AlwaysRebuild() &&
8598 Target.get() == S->getTarget())
8601 return getDerived().RebuildIndirectGotoStmt(S->getGotoLoc(), S->getStarLoc(),
8605template<
typename Derived>
8608 if (!S->hasLabelTarget())
8611 Decl *LD = getDerived().TransformDecl(S->getLabelDecl()->getLocation(),
8620template<
typename Derived>
8623 if (!S->hasLabelTarget())
8626 Decl *LD = getDerived().TransformDecl(S->getLabelDecl()->getLocation(),
8635template <
typename Derived>
8643template<
typename Derived>
8653 return getDerived().RebuildReturnStmt(S->getReturnLoc(),
Result.get());
8656template<
typename Derived>
8659 bool DeclChanged =
false;
8662 for (
auto *D : S->decls()) {
8663 Decl *Transformed = getDerived().TransformDefinition(D->getLocation(), D);
8667 if (Transformed != D)
8671 if (
auto *TD = dyn_cast<TypeDecl>(Transformed)) {
8672 if (
auto *TN = dyn_cast<TypedefNameDecl>(TD)) {
8673 LSI->ContainsUnexpandedParameterPack |=
8674 TN->getUnderlyingType()->containsUnexpandedParameterPack();
8676 LSI->ContainsUnexpandedParameterPack |=
8679 .getTypeDeclType(TD)
8680 ->containsUnexpandedParameterPack();
8683 if (
auto *VD = dyn_cast<VarDecl>(Transformed))
8684 LSI->ContainsUnexpandedParameterPack |=
8685 VD->getType()->containsUnexpandedParameterPack();
8688 Decls.push_back(Transformed);
8691 if (!getDerived().AlwaysRebuild() && !DeclChanged)
8694 return getDerived().RebuildDeclStmt(Decls, S->getBeginLoc(), S->getEndLoc());
8697template<
typename Derived>
8707 bool ExprsChanged =
false;
8709 auto RebuildString = [&](
Expr *E) {
8714 ExprsChanged =
true;
8721 for (
unsigned I = 0, E = S->getNumOutputs(); I != E; ++I) {
8722 Names.push_back(S->getOutputIdentifier(I));
8728 Constraints.push_back(
Result.get());
8731 Expr *OutputExpr = S->getOutputExpr(I);
8732 Result = getDerived().TransformExpr(OutputExpr);
8736 ExprsChanged |=
Result.get() != OutputExpr;
8738 Exprs.push_back(
Result.get());
8742 for (
unsigned I = 0, E = S->getNumInputs(); I != E; ++I) {
8743 Names.push_back(S->getInputIdentifier(I));
8749 Constraints.push_back(
Result.get());
8752 Expr *InputExpr = S->getInputExpr(I);
8753 Result = getDerived().TransformExpr(InputExpr);
8757 ExprsChanged |=
Result.get() != InputExpr;
8759 Exprs.push_back(
Result.get());
8763 for (
unsigned I = 0, E = S->getNumLabels(); I != E; ++I) {
8764 Names.push_back(S->getLabelIdentifier(I));
8769 ExprsChanged |=
Result.get() != S->getLabelExpr(I);
8770 Exprs.push_back(
Result.get());
8774 for (
unsigned I = 0, E = S->getNumClobbers(); I != E; ++I) {
8778 Clobbers.push_back(
Result.get());
8781 ExprResult AsmString = RebuildString(S->getAsmStringExpr());
8782 if (AsmString.isInvalid())
8785 if (!getDerived().AlwaysRebuild() && !ExprsChanged)
8788 return getDerived().RebuildGCCAsmStmt(S->getAsmLoc(), S->isSimple(),
8789 S->isVolatile(), S->getNumOutputs(),
8790 S->getNumInputs(), Names.data(),
8791 Constraints, Exprs, AsmString.get(),
8792 Clobbers, S->getNumLabels(),
8796template<
typename Derived>
8801 bool HadError =
false, HadChange =
false;
8805 TransformedExprs.reserve(SrcExprs.size());
8806 for (
unsigned i = 0, e = SrcExprs.size(); i != e; ++i) {
8808 if (!
Result.isUsable()) {
8811 HadChange |= (
Result.get() != SrcExprs[i]);
8812 TransformedExprs.push_back(
Result.get());
8817 if (!HadChange && !getDerived().AlwaysRebuild())
8820 return getDerived().RebuildMSAsmStmt(S->getAsmLoc(), S->getLBraceLoc(),
8821 AsmToks, S->getAsmString(),
8822 S->getNumOutputs(), S->getNumInputs(),
8823 S->getAllConstraints(), S->getClobbers(),
8824 TransformedExprs, S->getEndLoc());
8828template<
typename Derived>
8833 assert(FD && ScopeInfo && !ScopeInfo->CoroutinePromise &&
8834 ScopeInfo->NeedsCoroutineSuspends &&
8835 ScopeInfo->CoroutineSuspends.first ==
nullptr &&
8836 ScopeInfo->CoroutineSuspends.second ==
nullptr &&
8837 "expected clean scope info");
8841 ScopeInfo->setNeedsCoroutineSuspends(
false);
8854 getDerived().transformedLocalDecl(S->getPromiseDecl(), {Promise});
8855 ScopeInfo->CoroutinePromise = Promise;
8860 StmtResult InitSuspend = getDerived().TransformStmt(S->getInitSuspendStmt());
8861 if (InitSuspend.isInvalid())
8864 getDerived().TransformStmt(S->getFinalSuspendStmt());
8865 if (FinalSuspend.isInvalid() ||
8868 ScopeInfo->setCoroutineSuspends(InitSuspend.get(), FinalSuspend.get());
8871 StmtResult BodyRes = getDerived().TransformStmt(S->getBody());
8872 if (BodyRes.isInvalid())
8876 if (Builder.isInvalid())
8879 Expr *ReturnObject = S->getReturnValueInit();
8880 assert(ReturnObject &&
"the return object is expected to be valid");
8881 ExprResult Res = getDerived().TransformInitializer(ReturnObject,
8883 if (Res.isInvalid())
8885 Builder.ReturnValue = Res.get();
8890 if (S->hasDependentPromiseType()) {
8893 if (!Promise->getType()->isDependentType()) {
8894 assert(!S->getFallthroughHandler() && !S->getExceptionHandler() &&
8895 !S->getReturnStmtOnAllocFailure() && !S->getDeallocate() &&
8896 "these nodes should not have been built yet");
8897 if (!Builder.buildDependentStatements())
8901 if (
auto *OnFallthrough = S->getFallthroughHandler()) {
8902 StmtResult Res = getDerived().TransformStmt(OnFallthrough);
8903 if (Res.isInvalid())
8905 Builder.OnFallthrough = Res.get();
8908 if (
auto *OnException = S->getExceptionHandler()) {
8909 StmtResult Res = getDerived().TransformStmt(OnException);
8910 if (Res.isInvalid())
8912 Builder.OnException = Res.get();
8915 if (
auto *OnAllocFailure = S->getReturnStmtOnAllocFailure()) {
8916 StmtResult Res = getDerived().TransformStmt(OnAllocFailure);
8917 if (Res.isInvalid())
8919 Builder.ReturnStmtOnAllocFailure = Res.get();
8923 assert(S->getAllocate() && S->getDeallocate() &&
8924 "allocation and deallocation calls must already be built");
8925 ExprResult AllocRes = getDerived().TransformExpr(S->getAllocate());
8926 if (AllocRes.isInvalid())
8928 Builder.Allocate = AllocRes.get();
8930 ExprResult DeallocRes = getDerived().TransformExpr(S->getDeallocate());
8931 if (DeallocRes.isInvalid())
8933 Builder.Deallocate = DeallocRes.get();
8935 if (
auto *ResultDecl = S->getResultDecl()) {
8936 StmtResult Res = getDerived().TransformStmt(ResultDecl);
8937 if (Res.isInvalid())
8939 Builder.ResultDecl = Res.get();
8944 if (Res.isInvalid())
8946 Builder.ReturnStmt = Res.get();
8950 return getDerived().RebuildCoroutineBodyStmt(Builder);
8953template<
typename Derived>
8963 return getDerived().RebuildCoreturnStmt(S->getKeywordLoc(),
Result.get(),
8967template <
typename Derived>
8980 ExprResult Lookup = getSema().BuildOperatorCoawaitLookupExpr(
8981 getSema().getCurScope(), E->getKeywordLoc());
8985 return getDerived().RebuildCoawaitExpr(
8986 E->getKeywordLoc(),
Operand.get(),
8990template <
typename Derived>
8993 ExprResult OperandResult = getDerived().TransformInitializer(E->getOperand(),
8995 if (OperandResult.isInvalid())
8999 E->getOperatorCoawaitLookup());
9006 return getDerived().RebuildDependentCoawaitExpr(
9007 E->getKeywordLoc(), OperandResult.get(),
9011template<
typename Derived>
9021 return getDerived().RebuildCoyieldExpr(E->getKeywordLoc(),
Result.get());
9026template<
typename Derived>
9030 StmtResult TryBody = getDerived().TransformStmt(S->getTryBody());
9031 if (TryBody.isInvalid())
9035 bool AnyCatchChanged =
false;
9037 for (
unsigned I = 0, N = S->getNumCatchStmts(); I != N; ++I) {
9038 StmtResult Catch = getDerived().TransformStmt(S->getCatchStmt(I));
9039 if (Catch.isInvalid())
9041 if (Catch.get() != S->getCatchStmt(I))
9042 AnyCatchChanged =
true;
9043 CatchStmts.push_back(Catch.get());
9048 if (S->getFinallyStmt()) {
9049 Finally = getDerived().TransformStmt(S->getFinallyStmt());
9050 if (Finally.isInvalid())
9055 if (!getDerived().AlwaysRebuild() &&
9056 TryBody.get() == S->getTryBody() &&
9058 Finally.get() == S->getFinallyStmt())
9062 return getDerived().RebuildObjCAtTryStmt(S->getAtTryLoc(), TryBody.get(),
9063 CatchStmts, Finally.get());
9066template<
typename Derived>
9071 if (
VarDecl *FromVar = S->getCatchParamDecl()) {
9073 if (FromVar->getTypeSourceInfo()) {
9074 TSInfo = getDerived().TransformType(FromVar->getTypeSourceInfo());
9081 T = TSInfo->getType();
9083 T = getDerived().TransformType(FromVar->getType());
9088 Var = getDerived().RebuildObjCExceptionDecl(FromVar, TSInfo, T);
9093 StmtResult Body = getDerived().TransformStmt(S->getCatchBody());
9094 if (Body.isInvalid())
9097 return getDerived().RebuildObjCAtCatchStmt(S->getAtCatchLoc(),
9102template<
typename Derived>
9106 StmtResult Body = getDerived().TransformStmt(S->getFinallyBody());
9107 if (Body.isInvalid())
9111 if (!getDerived().AlwaysRebuild() &&
9112 Body.get() == S->getFinallyBody())
9116 return getDerived().RebuildObjCAtFinallyStmt(S->getAtFinallyLoc(),
9120template<
typename Derived>
9124 if (S->getThrowExpr()) {
9125 Operand = getDerived().TransformExpr(S->getThrowExpr());
9130 if (!getDerived().AlwaysRebuild() &&
9131 Operand.get() == S->getThrowExpr())
9134 return getDerived().RebuildObjCAtThrowStmt(S->getThrowLoc(),
Operand.get());
9137template<
typename Derived>
9146 getDerived().RebuildObjCAtSynchronizedOperand(S->getAtSynchronizedLoc(),
9152 StmtResult Body = getDerived().TransformStmt(S->getSynchBody());
9153 if (Body.isInvalid())
9157 if (!getDerived().AlwaysRebuild() &&
9158 Object.get() == S->getSynchExpr() &&
9159 Body.get() == S->getSynchBody())
9163 return getDerived().RebuildObjCAtSynchronizedStmt(S->getAtSynchronizedLoc(),
9164 Object.get(), Body.get());
9167template<
typename Derived>
9172 StmtResult Body = getDerived().TransformStmt(S->getSubStmt());
9173 if (Body.isInvalid())
9177 if (!getDerived().AlwaysRebuild() &&
9178 Body.get() == S->getSubStmt())
9182 return getDerived().RebuildObjCAutoreleasePoolStmt(
9183 S->getAtLoc(), Body.get());
9186template<
typename Derived>
9191 StmtResult Element = getDerived().TransformStmt(
9192 S->getElement(), StmtDiscardKind::NotDiscarded);
9193 if (Element.isInvalid())
9197 ExprResult Collection = getDerived().TransformExpr(S->getCollection());
9198 if (Collection.isInvalid())
9202 StmtResult Body = getDerived().TransformStmt(S->getBody());
9203 if (Body.isInvalid())
9207 if (!getDerived().AlwaysRebuild() &&
9208 Element.get() == S->getElement() &&
9209 Collection.get() == S->getCollection() &&
9210 Body.get() == S->getBody())
9214 return getDerived().RebuildObjCForCollectionStmt(S->getForLoc(),
9221template <
typename Derived>
9225 if (
VarDecl *ExceptionDecl = S->getExceptionDecl()) {
9227 getDerived().TransformType(ExceptionDecl->getTypeSourceInfo());
9231 Var = getDerived().RebuildExceptionDecl(
9232 ExceptionDecl, T, ExceptionDecl->getInnerLocStart(),
9233 ExceptionDecl->getLocation(), ExceptionDecl->getIdentifier());
9234 if (!Var || Var->isInvalidDecl())
9239 StmtResult Handler = getDerived().TransformStmt(S->getHandlerBlock());
9240 if (Handler.isInvalid())
9243 if (!getDerived().AlwaysRebuild() && !Var &&
9244 Handler.get() == S->getHandlerBlock())
9247 return getDerived().RebuildCXXCatchStmt(S->getCatchLoc(), Var, Handler.get());
9250template <
typename Derived>
9253 StmtResult TryBlock = getDerived().TransformCompoundStmt(S->getTryBlock());
9254 if (TryBlock.isInvalid())
9258 bool HandlerChanged =
false;
9260 for (
unsigned I = 0, N = S->getNumHandlers(); I != N; ++I) {
9261 StmtResult Handler = getDerived().TransformCXXCatchStmt(S->getHandler(I));
9262 if (Handler.isInvalid())
9265 HandlerChanged = HandlerChanged || Handler.get() != S->getHandler(I);
9266 Handlers.push_back(Handler.getAs<
Stmt>());
9269 getSema().DiagnoseExceptionUse(S->getTryLoc(),
true);
9271 if (!getDerived().AlwaysRebuild() && TryBlock.get() == S->getTryBlock() &&
9275 return getDerived().RebuildCXXTryStmt(S->getTryLoc(), TryBlock.get(),
9279template<
typename Derived>
9290 auto &LastRecord = getSema().currentEvaluationContext();
9291 LastRecord.InLifetimeExtendingContext =
true;
9292 LastRecord.RebuildDefaultArgOrDefaultInit =
true;
9295 S->getInit() ? getDerived().TransformStmt(S->getInit()) :
StmtResult();
9296 if (
Init.isInvalid())
9300 if (
Range.isInvalid())
9305 getSema().ExprEvalContexts.back().ForRangeLifetimeExtendTemps.empty());
9306 auto ForRangeLifetimeExtendTemps =
9307 getSema().ExprEvalContexts.back().ForRangeLifetimeExtendTemps;
9309 StmtResult Begin = getDerived().TransformStmt(S->getBeginStmt());
9310 if (Begin.isInvalid())
9312 StmtResult End = getDerived().TransformStmt(S->getEndStmt());
9313 if (End.isInvalid())
9317 if (
Cond.isInvalid())
9321 if (
Cond.isInvalid())
9327 if (
Inc.isInvalid())
9332 StmtResult LoopVar = getDerived().TransformStmt(S->getLoopVarStmt());
9333 if (LoopVar.isInvalid())
9337 if (getDerived().AlwaysRebuild() ||
9338 Init.get() != S->getInit() ||
9339 Range.get() != S->getRangeStmt() ||
9340 Begin.get() != S->getBeginStmt() ||
9341 End.get() != S->getEndStmt() ||
9342 Cond.get() != S->getCond() ||
9343 Inc.get() != S->getInc() ||
9344 LoopVar.get() != S->getLoopVarStmt()) {
9345 NewStmt = getDerived().RebuildCXXForRangeStmt(
9346 S->getForLoc(), S->getCoawaitLoc(),
Init.get(), S->getColonLoc(),
9347 Range.get(), Begin.get(), End.get(),
Cond.get(),
Inc.get(),
9348 LoopVar.get(), S->getRParenLoc(), ForRangeLifetimeExtendTemps);
9349 if (NewStmt.isInvalid() && LoopVar.get() != S->getLoopVarStmt()) {
9351 getSema().ActOnInitializerError(
9362 StmtResult Body = getDerived().TransformStmt(S->getBody());
9363 if (Body.isInvalid())
9370 if (Body.get() != S->getBody() && NewStmt.get() == S) {
9371 NewStmt = getDerived().RebuildCXXForRangeStmt(
9372 S->getForLoc(), S->getCoawaitLoc(),
Init.get(), S->getColonLoc(),
9373 Range.get(), Begin.get(), End.get(),
Cond.get(),
Inc.get(),
9374 LoopVar.get(), S->getRParenLoc(), ForRangeLifetimeExtendTemps);
9375 if (NewStmt.isInvalid())
9379 if (NewStmt.get() == S)
9382 return FinishCXXForRangeStmt(NewStmt.get(), Body.get());
9385template<
typename Derived>
9391 if (S->getQualifierLoc()) {
9393 = getDerived().TransformNestedNameSpecifierLoc(S->getQualifierLoc());
9400 if (NameInfo.getName()) {
9401 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
9402 if (!NameInfo.getName())
9407 if (!getDerived().AlwaysRebuild() &&
9408 QualifierLoc == S->getQualifierLoc() &&
9409 NameInfo.getName() == S->getNameInfo().getName())
9414 SS.
Adopt(QualifierLoc);
9416 switch (getSema().CheckMicrosoftIfExistsSymbol(
nullptr, SS, NameInfo)) {
9418 if (S->isIfExists())
9421 return new (getSema().Context)
NullStmt(S->getKeywordLoc());
9424 if (S->isIfNotExists())
9427 return new (getSema().Context)
NullStmt(S->getKeywordLoc());
9438 StmtResult SubStmt = getDerived().TransformCompoundStmt(S->getSubStmt());
9439 if (SubStmt.isInvalid())
9447 return getDerived().RebuildMSDependentExistsStmt(S->getKeywordLoc(),
9454template<
typename Derived>
9458 if (E->getQualifierLoc()) {
9460 = getDerived().TransformNestedNameSpecifierLoc(E->getQualifierLoc());
9466 getDerived().TransformDecl(E->getMemberLoc(), E->getPropertyDecl()));
9471 if (
Base.isInvalid())
9477 QualifierLoc, E->getMemberLoc());
9480template <
typename Derived>
9484 if (BaseRes.isInvalid())
9486 auto IdxRes = getDerived().TransformExpr(E->getIdx());
9487 if (IdxRes.isInvalid())
9490 if (!getDerived().AlwaysRebuild() &&
9491 BaseRes.get() == E->getBase() &&
9492 IdxRes.get() == E->getIdx())
9495 return getDerived().RebuildArraySubscriptExpr(
9496 BaseRes.get(),
SourceLocation(), IdxRes.get(), E->getRBracketLoc());
9499template <
typename Derived>
9501 StmtResult TryBlock = getDerived().TransformCompoundStmt(S->getTryBlock());
9502 if (TryBlock.isInvalid())
9505 StmtResult Handler = getDerived().TransformSEHHandler(S->getHandler());
9506 if (Handler.isInvalid())
9509 if (!getDerived().AlwaysRebuild() && TryBlock.get() == S->getTryBlock() &&
9510 Handler.get() == S->getHandler())
9513 return getDerived().RebuildSEHTryStmt(S->getIsCXXTry(), S->getTryLoc(),
9514 TryBlock.get(), Handler.get());
9517template <
typename Derived>
9520 if (
Block.isInvalid())
9523 return getDerived().RebuildSEHFinallyStmt(S->getFinallyLoc(),
Block.get());
9526template <
typename Derived>
9528 ExprResult FilterExpr = getDerived().TransformExpr(S->getFilterExpr());
9529 if (FilterExpr.isInvalid())
9533 if (
Block.isInvalid())
9536 return getDerived().RebuildSEHExceptStmt(S->getExceptLoc(), FilterExpr.get(),
9540template <
typename Derived>
9548template<
typename Derived>
9558template <
typename Derived>
9560TreeTransform<Derived>::TransformOMPCanonicalLoop(OMPCanonicalLoop *L) {
9564 return getDerived().TransformStmt(L->getLoopStmt());
9567template <
typename Derived>
9574 TClauses.reserve(Clauses.size());
9578 getDerived().getSema().OpenMP().StartOpenMPClause((*I)->getClauseKind());
9580 getDerived().getSema().OpenMP().EndOpenMPClause();
9582 TClauses.push_back(Clause);
9584 TClauses.push_back(
nullptr);
9588 if (D->hasAssociatedStmt() && D->getAssociatedStmt()) {
9589 getDerived().getSema().OpenMP().ActOnOpenMPRegionStart(
9590 D->getDirectiveKind(),
9596 if (D->getDirectiveKind() == OMPD_atomic ||
9597 D->getDirectiveKind() == OMPD_critical ||
9598 D->getDirectiveKind() == OMPD_section ||
9599 D->getDirectiveKind() == OMPD_master)
9600 CS = D->getAssociatedStmt();
9602 CS = D->getRawStmt();
9605 getSema().getLangOpts().OpenMPIRBuilder)
9609 getDerived().getSema().OpenMP().ActOnOpenMPRegionEnd(Body, TClauses);
9614 if (TClauses.size() != Clauses.size()) {
9620 if (D->getDirectiveKind() == OMPD_critical) {
9622 DirName =
getDerived().TransformDeclarationNameInfo(DirName);
9625 if (D->getDirectiveKind() == OMPD_cancellation_point) {
9627 }
else if (D->getDirectiveKind() == OMPD_cancel) {
9631 return getDerived().RebuildOMPExecutableDirective(
9632 D->getDirectiveKind(), DirName, CancelRegion, TClauses,
9633 AssociatedStmt.
get(), D->getBeginLoc(), D->getEndLoc());
9641template <
typename Derived>
9648 TClauses.reserve(Clauses.size());
9651 getDerived().getSema().OpenMP().StartOpenMPClause(
C->getClauseKind());
9653 getDerived().getSema().OpenMP().EndOpenMPClause();
9655 TClauses.push_back(Clause);
9657 TClauses.push_back(
nullptr);
9661 if (D->hasAssociatedStmt() && D->getAssociatedStmt()) {
9662 getDerived().getSema().OpenMP().ActOnOpenMPRegionStart(
9663 D->getDirectiveKind(),
9668 assert(D->getDirectiveKind() == OMPD_assume &&
9669 "Unexpected informational directive");
9670 Stmt *CS = D->getAssociatedStmt();
9674 getDerived().getSema().OpenMP().ActOnOpenMPRegionEnd(Body, TClauses);
9678 if (TClauses.size() != Clauses.size())
9683 return getDerived().RebuildOMPInformationalDirective(
9684 D->getDirectiveKind(), DirName, TClauses, AssociatedStmt.
get(),
9685 D->getBeginLoc(), D->getEndLoc());
9688template <
typename Derived>
9693 SemaRef.
Diag(D->getBeginLoc(), diag::err_omp_instantiation_not_supported)
9694 << getOpenMPDirectiveName(D->getDirectiveKind(), OMPVersion);
9698template <
typename Derived>
9700TreeTransform<Derived>::TransformOMPParallelDirective(OMPParallelDirective *D) {
9701 DeclarationNameInfo DirName;
9702 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9703 OMPD_parallel, DirName,
nullptr, D->getBeginLoc());
9704 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9705 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9709template <
typename Derived>
9713 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9714 OMPD_simd, DirName,
nullptr, D->getBeginLoc());
9715 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9716 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9720template <
typename Derived>
9724 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9725 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
9726 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9727 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9731template <
typename Derived>
9735 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9736 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
9737 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9738 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9742template <
typename Derived>
9746 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9747 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
9748 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9749 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9753template <
typename Derived>
9757 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9758 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
9759 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9760 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9764template <
typename Derived>
9766 OMPInterchangeDirective *D) {
9768 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9769 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
9770 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9771 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9775template <
typename Derived>
9779 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9780 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
9781 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9782 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9786template <
typename Derived>
9790 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9791 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
9792 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9793 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9797template <
typename Derived>
9801 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9802 OMPD_for, DirName,
nullptr, D->getBeginLoc());
9803 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9804 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9808template <
typename Derived>
9812 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9813 OMPD_for_simd, DirName,
nullptr, D->getBeginLoc());
9814 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9815 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9819template <
typename Derived>
9823 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9824 OMPD_sections, DirName,
nullptr, D->getBeginLoc());
9825 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9826 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9830template <
typename Derived>
9834 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9835 OMPD_section, DirName,
nullptr, D->getBeginLoc());
9836 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9837 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9841template <
typename Derived>
9845 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9846 OMPD_scope, DirName,
nullptr, D->getBeginLoc());
9847 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9848 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9852template <
typename Derived>
9856 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9857 OMPD_single, DirName,
nullptr, D->getBeginLoc());
9858 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9859 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9863template <
typename Derived>
9867 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9868 OMPD_master, DirName,
nullptr, D->getBeginLoc());
9869 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9870 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9874template <
typename Derived>
9878 OMPD_critical, D->getDirectiveName(),
nullptr, D->getBeginLoc());
9879 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9880 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9884template <
typename Derived>
9886 OMPParallelForDirective *D) {
9888 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9889 OMPD_parallel_for, DirName,
nullptr, D->getBeginLoc());
9890 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9891 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9895template <
typename Derived>
9897 OMPParallelForSimdDirective *D) {
9899 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9900 OMPD_parallel_for_simd, DirName,
nullptr, D->getBeginLoc());
9901 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9902 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9906template <
typename Derived>
9908 OMPParallelMasterDirective *D) {
9910 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9911 OMPD_parallel_master, DirName,
nullptr, D->getBeginLoc());
9912 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9913 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9917template <
typename Derived>
9919 OMPParallelMaskedDirective *D) {
9921 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9922 OMPD_parallel_masked, DirName,
nullptr, D->getBeginLoc());
9923 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9924 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9928template <
typename Derived>
9930 OMPParallelSectionsDirective *D) {
9932 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9933 OMPD_parallel_sections, DirName,
nullptr, D->getBeginLoc());
9934 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9935 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9939template <
typename Derived>
9943 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9944 OMPD_task, DirName,
nullptr, D->getBeginLoc());
9945 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9946 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9950template <
typename Derived>
9952 OMPTaskyieldDirective *D) {
9954 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9955 OMPD_taskyield, DirName,
nullptr, D->getBeginLoc());
9956 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9957 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9961template <
typename Derived>
9965 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9966 OMPD_barrier, DirName,
nullptr, D->getBeginLoc());
9967 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9968 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9972template <
typename Derived>
9976 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9977 OMPD_taskwait, DirName,
nullptr, D->getBeginLoc());
9978 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9979 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9983template <
typename Derived>
9987 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9988 OMPD_assume, DirName,
nullptr, D->getBeginLoc());
9989 StmtResult Res = getDerived().TransformOMPInformationalDirective(D);
9990 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9994template <
typename Derived>
9998 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9999 OMPD_error, DirName,
nullptr, D->getBeginLoc());
10000 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10001 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10005template <
typename Derived>
10007 OMPTaskgroupDirective *D) {
10009 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10010 OMPD_taskgroup, DirName,
nullptr, D->getBeginLoc());
10011 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10012 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10016template <
typename Derived>
10020 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10021 OMPD_flush, DirName,
nullptr, D->getBeginLoc());
10022 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10023 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10027template <
typename Derived>
10031 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10032 OMPD_depobj, DirName,
nullptr, D->getBeginLoc());
10033 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10034 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10038template <
typename Derived>
10042 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10043 OMPD_scan, DirName,
nullptr, D->getBeginLoc());
10044 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10045 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10049template <
typename Derived>
10053 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10054 OMPD_ordered, DirName,
nullptr, D->getBeginLoc());
10055 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10056 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10060template <
typename Derived>
10064 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10065 OMPD_atomic, DirName,
nullptr, D->getBeginLoc());
10066 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10067 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10071template <
typename Derived>
10075 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10076 OMPD_target, DirName,
nullptr, D->getBeginLoc());
10077 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10078 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10082template <
typename Derived>
10084 OMPTargetDataDirective *D) {
10086 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10087 OMPD_target_data, DirName,
nullptr, D->getBeginLoc());
10088 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10089 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10093template <
typename Derived>
10095 OMPTargetEnterDataDirective *D) {
10097 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10098 OMPD_target_enter_data, DirName,
nullptr, D->getBeginLoc());
10099 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10100 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10104template <
typename Derived>
10106 OMPTargetExitDataDirective *D) {
10108 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10109 OMPD_target_exit_data, DirName,
nullptr, D->getBeginLoc());
10110 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10111 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10115template <
typename Derived>
10117 OMPTargetParallelDirective *D) {
10119 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10120 OMPD_target_parallel, DirName,
nullptr, D->getBeginLoc());
10121 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10122 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10126template <
typename Derived>
10128 OMPTargetParallelForDirective *D) {
10130 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10131 OMPD_target_parallel_for, DirName,
nullptr, D->getBeginLoc());
10132 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10133 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10137template <
typename Derived>
10139 OMPTargetUpdateDirective *D) {
10141 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10142 OMPD_target_update, DirName,
nullptr, D->getBeginLoc());
10143 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10144 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10148template <
typename Derived>
10152 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10153 OMPD_teams, DirName,
nullptr, D->getBeginLoc());
10154 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10155 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10159template <
typename Derived>
10161 OMPCancellationPointDirective *D) {
10163 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10164 OMPD_cancellation_point, DirName,
nullptr, D->getBeginLoc());
10165 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10166 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10170template <
typename Derived>
10174 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10175 OMPD_cancel, DirName,
nullptr, D->getBeginLoc());
10176 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10177 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10181template <
typename Derived>
10185 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10186 OMPD_taskloop, DirName,
nullptr, D->getBeginLoc());
10187 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10188 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10192template <
typename Derived>
10194 OMPTaskLoopSimdDirective *D) {
10196 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10197 OMPD_taskloop_simd, DirName,
nullptr, D->getBeginLoc());
10198 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10199 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10203template <
typename Derived>
10205 OMPMasterTaskLoopDirective *D) {
10207 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10208 OMPD_master_taskloop, DirName,
nullptr, D->getBeginLoc());
10209 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10210 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10214template <
typename Derived>
10216 OMPMaskedTaskLoopDirective *D) {
10218 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10219 OMPD_masked_taskloop, DirName,
nullptr, D->getBeginLoc());
10220 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10221 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10225template <
typename Derived>
10227 OMPMasterTaskLoopSimdDirective *D) {
10229 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10230 OMPD_master_taskloop_simd, DirName,
nullptr, D->getBeginLoc());
10231 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10232 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10236template <
typename Derived>
10238 OMPMaskedTaskLoopSimdDirective *D) {
10240 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10241 OMPD_masked_taskloop_simd, DirName,
nullptr, D->getBeginLoc());
10242 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10243 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10247template <
typename Derived>
10249 OMPParallelMasterTaskLoopDirective *D) {
10251 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10252 OMPD_parallel_master_taskloop, DirName,
nullptr, D->getBeginLoc());
10253 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10254 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10258template <
typename Derived>
10260 OMPParallelMaskedTaskLoopDirective *D) {
10262 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10263 OMPD_parallel_masked_taskloop, DirName,
nullptr, D->getBeginLoc());
10264 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10265 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10269template <
typename Derived>
10272 OMPParallelMasterTaskLoopSimdDirective *D) {
10274 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10275 OMPD_parallel_master_taskloop_simd, DirName,
nullptr, D->getBeginLoc());
10276 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10277 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10281template <
typename Derived>
10284 OMPParallelMaskedTaskLoopSimdDirective *D) {
10286 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10287 OMPD_parallel_masked_taskloop_simd, DirName,
nullptr, D->getBeginLoc());
10288 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10289 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10293template <
typename Derived>
10295 OMPDistributeDirective *D) {
10297 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10298 OMPD_distribute, DirName,
nullptr, D->getBeginLoc());
10299 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10300 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10304template <
typename Derived>
10306 OMPDistributeParallelForDirective *D) {
10308 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10309 OMPD_distribute_parallel_for, DirName,
nullptr, D->getBeginLoc());
10310 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10311 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10315template <
typename Derived>
10318 OMPDistributeParallelForSimdDirective *D) {
10320 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10321 OMPD_distribute_parallel_for_simd, DirName,
nullptr, D->getBeginLoc());
10322 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10323 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10327template <
typename Derived>
10329 OMPDistributeSimdDirective *D) {
10331 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10332 OMPD_distribute_simd, DirName,
nullptr, D->getBeginLoc());
10333 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10334 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10338template <
typename Derived>
10340 OMPTargetParallelForSimdDirective *D) {
10342 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10343 OMPD_target_parallel_for_simd, DirName,
nullptr, D->getBeginLoc());
10344 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10345 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10349template <
typename Derived>
10351 OMPTargetSimdDirective *D) {
10353 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10354 OMPD_target_simd, DirName,
nullptr, D->getBeginLoc());
10355 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10356 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10360template <
typename Derived>
10362 OMPTeamsDistributeDirective *D) {
10364 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10365 OMPD_teams_distribute, DirName,
nullptr, D->getBeginLoc());
10366 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10367 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10371template <
typename Derived>
10373 OMPTeamsDistributeSimdDirective *D) {
10375 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10376 OMPD_teams_distribute_simd, DirName,
nullptr, D->getBeginLoc());
10377 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10378 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10382template <
typename Derived>
10384 OMPTeamsDistributeParallelForSimdDirective *D) {
10386 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10387 OMPD_teams_distribute_parallel_for_simd, DirName,
nullptr,
10389 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10390 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10394template <
typename Derived>
10396 OMPTeamsDistributeParallelForDirective *D) {
10398 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10399 OMPD_teams_distribute_parallel_for, DirName,
nullptr, D->getBeginLoc());
10400 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10401 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10405template <
typename Derived>
10407 OMPTargetTeamsDirective *D) {
10409 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10410 OMPD_target_teams, DirName,
nullptr, D->getBeginLoc());
10411 auto Res = getDerived().TransformOMPExecutableDirective(D);
10412 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10416template <
typename Derived>
10418 OMPTargetTeamsDistributeDirective *D) {
10420 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10421 OMPD_target_teams_distribute, DirName,
nullptr, D->getBeginLoc());
10422 auto Res = getDerived().TransformOMPExecutableDirective(D);
10423 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10427template <
typename Derived>
10430 OMPTargetTeamsDistributeParallelForDirective *D) {
10432 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10433 OMPD_target_teams_distribute_parallel_for, DirName,
nullptr,
10435 auto Res = getDerived().TransformOMPExecutableDirective(D);
10436 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10440template <
typename Derived>
10443 OMPTargetTeamsDistributeParallelForSimdDirective *D) {
10445 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10446 OMPD_target_teams_distribute_parallel_for_simd, DirName,
nullptr,
10448 auto Res = getDerived().TransformOMPExecutableDirective(D);
10449 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10453template <
typename Derived>
10456 OMPTargetTeamsDistributeSimdDirective *D) {
10458 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10459 OMPD_target_teams_distribute_simd, DirName,
nullptr, D->getBeginLoc());
10460 auto Res = getDerived().TransformOMPExecutableDirective(D);
10461 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10465template <
typename Derived>
10469 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10470 OMPD_interop, DirName,
nullptr, D->getBeginLoc());
10471 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10472 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10476template <
typename Derived>
10480 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10481 OMPD_dispatch, DirName,
nullptr, D->getBeginLoc());
10482 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10483 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10487template <
typename Derived>
10491 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10492 OMPD_masked, DirName,
nullptr, D->getBeginLoc());
10493 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10494 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10498template <
typename Derived>
10500 OMPGenericLoopDirective *D) {
10502 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10503 OMPD_loop, DirName,
nullptr, D->getBeginLoc());
10504 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10505 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10509template <
typename Derived>
10511 OMPTeamsGenericLoopDirective *D) {
10513 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10514 OMPD_teams_loop, DirName,
nullptr, D->getBeginLoc());
10515 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10516 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10520template <
typename Derived>
10522 OMPTargetTeamsGenericLoopDirective *D) {
10524 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10525 OMPD_target_teams_loop, DirName,
nullptr, D->getBeginLoc());
10526 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10527 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10531template <
typename Derived>
10533 OMPParallelGenericLoopDirective *D) {
10535 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10536 OMPD_parallel_loop, DirName,
nullptr, D->getBeginLoc());
10537 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10538 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10542template <
typename Derived>
10545 OMPTargetParallelGenericLoopDirective *D) {
10547 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10548 OMPD_target_parallel_loop, DirName,
nullptr, D->getBeginLoc());
10549 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10550 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10557template <
typename Derived>
10560 if (
Cond.isInvalid())
10562 return getDerived().RebuildOMPIfClause(
10563 C->getNameModifier(),
Cond.get(),
C->getBeginLoc(),
C->getLParenLoc(),
10564 C->getNameModifierLoc(),
C->getColonLoc(),
C->getEndLoc());
10567template <
typename Derived>
10570 if (
Cond.isInvalid())
10572 return getDerived().RebuildOMPFinalClause(
Cond.get(),
C->getBeginLoc(),
10573 C->getLParenLoc(),
C->getEndLoc());
10576template <
typename Derived>
10579 ExprResult NumThreads = getDerived().TransformExpr(
C->getNumThreads());
10580 if (NumThreads.isInvalid())
10582 return getDerived().RebuildOMPNumThreadsClause(
10583 C->getModifier(), NumThreads.get(),
C->getBeginLoc(),
C->getLParenLoc(),
10584 C->getModifierLoc(),
C->getEndLoc());
10587template <
typename Derived>
10590 ExprResult E = getDerived().TransformExpr(
C->getSafelen());
10593 return getDerived().RebuildOMPSafelenClause(
10594 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10597template <
typename Derived>
10600 ExprResult E = getDerived().TransformExpr(
C->getAllocator());
10603 return getDerived().RebuildOMPAllocatorClause(
10604 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10607template <
typename Derived>
10610 ExprResult E = getDerived().TransformExpr(
C->getSimdlen());
10613 return getDerived().RebuildOMPSimdlenClause(
10614 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10617template <
typename Derived>
10620 TransformedSizes.reserve(
C->getNumSizes());
10622 for (
Expr *E :
C->getSizesRefs()) {
10624 TransformedSizes.push_back(
nullptr);
10628 ExprResult T = getDerived().TransformExpr(E);
10633 TransformedSizes.push_back(T.get());
10636 if (!Changed && !getDerived().AlwaysRebuild())
10638 return RebuildOMPSizesClause(TransformedSizes,
C->getBeginLoc(),
10639 C->getLParenLoc(),
C->getEndLoc());
10642template <
typename Derived>
10646 TransformedCounts.reserve(
C->getNumCounts());
10647 for (
Expr *E :
C->getCountsRefs()) {
10649 TransformedCounts.push_back(
nullptr);
10653 ExprResult T = getDerived().TransformExpr(E);
10656 TransformedCounts.push_back(T.get());
10659 return RebuildOMPCountsClause(TransformedCounts,
C->getBeginLoc(),
10660 C->getLParenLoc(),
C->getEndLoc(),
10661 C->getOmpFillIndex(),
C->getOmpFillLoc());
10664template <
typename Derived>
10668 TransformedArgs.reserve(
C->getNumLoops());
10670 for (
Expr *E :
C->getArgsRefs()) {
10672 TransformedArgs.push_back(
nullptr);
10676 ExprResult T = getDerived().TransformExpr(E);
10681 TransformedArgs.push_back(T.get());
10684 if (!Changed && !getDerived().AlwaysRebuild())
10686 return RebuildOMPPermutationClause(TransformedArgs,
C->getBeginLoc(),
10687 C->getLParenLoc(),
C->getEndLoc());
10690template <
typename Derived>
10692 if (!getDerived().AlwaysRebuild())
10694 return RebuildOMPFullClause(
C->getBeginLoc(),
C->getEndLoc());
10697template <
typename Derived>
10700 ExprResult T = getDerived().TransformExpr(
C->getFactor());
10703 Expr *Factor = T.get();
10704 bool Changed = Factor !=
C->getFactor();
10706 if (!Changed && !getDerived().AlwaysRebuild())
10708 return RebuildOMPPartialClause(Factor,
C->getBeginLoc(),
C->getLParenLoc(),
10712template <
typename Derived>
10715 ExprResult F = getDerived().TransformExpr(
C->getFirst());
10719 ExprResult Cn = getDerived().TransformExpr(
C->getCount());
10720 if (Cn.isInvalid())
10724 Expr *Count = Cn.get();
10726 bool Changed = (
First !=
C->getFirst()) || (Count !=
C->getCount());
10729 if (!Changed && !getDerived().AlwaysRebuild())
10732 return RebuildOMPLoopRangeClause(
First, Count,
C->getBeginLoc(),
10733 C->getLParenLoc(),
C->getFirstLoc(),
10734 C->getCountLoc(),
C->getEndLoc());
10737template <
typename Derived>
10740 ExprResult E = getDerived().TransformExpr(
C->getNumForLoops());
10743 return getDerived().RebuildOMPCollapseClause(
10744 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10747template <
typename Derived>
10751 C->getDefaultKind(),
C->getDefaultKindKwLoc(),
C->getDefaultVC(),
10752 C->getDefaultVCLoc(),
C->getBeginLoc(),
C->getLParenLoc(),
10756template <
typename Derived>
10763template <
typename Derived>
10766 Expr *Impex =
C->getImpexType();
10767 ExprResult TransformedImpex = getDerived().TransformExpr(Impex);
10769 if (TransformedImpex.isInvalid())
10772 return getDerived().RebuildOMPTransparentClause(
10773 TransformedImpex.get(),
C->getBeginLoc(),
C->getLParenLoc(),
10777template <
typename Derived>
10781 C->getProcBindKind(),
C->getProcBindKindKwLoc(),
C->getBeginLoc(),
10782 C->getLParenLoc(),
C->getEndLoc());
10785template <
typename Derived>
10788 ExprResult E = getDerived().TransformExpr(
C->getChunkSize());
10791 return getDerived().RebuildOMPScheduleClause(
10792 C->getFirstScheduleModifier(),
C->getSecondScheduleModifier(),
10793 C->getScheduleKind(), E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
10794 C->getFirstScheduleModifierLoc(),
C->getSecondScheduleModifierLoc(),
10795 C->getScheduleKindLoc(),
C->getCommaLoc(),
C->getEndLoc());
10798template <
typename Derived>
10802 if (
auto *
Num =
C->getNumForLoops()) {
10803 E = getDerived().TransformExpr(
Num);
10807 return getDerived().RebuildOMPOrderedClause(
C->getBeginLoc(),
C->getEndLoc(),
10808 C->getLParenLoc(), E.get());
10811template <
typename Derived>
10815 if (
Expr *Evt =
C->getEventHandler()) {
10816 E = getDerived().TransformExpr(Evt);
10820 return getDerived().RebuildOMPDetachClause(E.get(),
C->getBeginLoc(),
10821 C->getLParenLoc(),
C->getEndLoc());
10824template <
typename Derived>
10830 if (
Cond.isInvalid())
10833 return getDerived().RebuildOMPNowaitClause(
Cond.get(),
C->getBeginLoc(),
10834 C->getLParenLoc(),
C->getEndLoc());
10837template <
typename Derived>
10844template <
typename Derived>
10851template <
typename Derived>
10857template <
typename Derived>
10863template <
typename Derived>
10870template <
typename Derived>
10877template <
typename Derived>
10884template <
typename Derived>
10890template <
typename Derived>
10896template <
typename Derived>
10898 ExprResult E = getDerived().TransformExpr(
C->getExpr());
10901 return getDerived().RebuildOMPHoldsClause(E.get(),
C->getBeginLoc(),
10902 C->getLParenLoc(),
C->getEndLoc());
10905template <
typename Derived>
10911template <
typename Derived>
10916template <
typename Derived>
10918 OMPNoOpenMPRoutinesClause *
C) {
10921template <
typename Derived>
10923 OMPNoOpenMPConstructsClause *
C) {
10926template <
typename Derived>
10928 OMPNoParallelismClause *
C) {
10932template <
typename Derived>
10939template <
typename Derived>
10946template <
typename Derived>
10953template <
typename Derived>
10960template <
typename Derived>
10967template <
typename Derived>
10973template <
typename Derived>
10980template <
typename Derived>
10986template <
typename Derived>
10993template <
typename Derived>
10995 ExprResult IVR = getDerived().TransformExpr(
C->getInteropVar());
10996 if (IVR.isInvalid())
11000 InteropInfo.PreferTypes.reserve(
C->varlist_size() - 1);
11001 for (
Expr *E : llvm::drop_begin(
C->varlist())) {
11003 if (ER.isInvalid())
11005 InteropInfo.PreferTypes.push_back(ER.get());
11007 return getDerived().RebuildOMPInitClause(IVR.get(), InteropInfo,
11008 C->getBeginLoc(),
C->getLParenLoc(),
11009 C->getVarLoc(),
C->getEndLoc());
11012template <
typename Derived>
11014 ExprResult ER = getDerived().TransformExpr(
C->getInteropVar());
11015 if (ER.isInvalid())
11017 return getDerived().RebuildOMPUseClause(ER.get(),
C->getBeginLoc(),
11018 C->getLParenLoc(),
C->getVarLoc(),
11022template <
typename Derived>
11026 if (
Expr *IV =
C->getInteropVar()) {
11027 ER = getDerived().TransformExpr(IV);
11028 if (ER.isInvalid())
11031 return getDerived().RebuildOMPDestroyClause(ER.get(),
C->getBeginLoc(),
11032 C->getLParenLoc(),
C->getVarLoc(),
11036template <
typename Derived>
11040 if (
Cond.isInvalid())
11042 return getDerived().RebuildOMPNovariantsClause(
11043 Cond.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11046template <
typename Derived>
11050 if (
Cond.isInvalid())
11052 return getDerived().RebuildOMPNocontextClause(
11053 Cond.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11056template <
typename Derived>
11059 ExprResult ThreadID = getDerived().TransformExpr(
C->getThreadID());
11060 if (ThreadID.isInvalid())
11062 return getDerived().RebuildOMPFilterClause(ThreadID.get(),
C->getBeginLoc(),
11063 C->getLParenLoc(),
C->getEndLoc());
11066template <
typename Derived>
11068 ExprResult E = getDerived().TransformExpr(
C->getAlignment());
11071 return getDerived().RebuildOMPAlignClause(E.get(),
C->getBeginLoc(),
11072 C->getLParenLoc(),
C->getEndLoc());
11075template <
typename Derived>
11077 OMPUnifiedAddressClause *
C) {
11078 llvm_unreachable(
"unified_address clause cannot appear in dependent context");
11081template <
typename Derived>
11083 OMPUnifiedSharedMemoryClause *
C) {
11085 "unified_shared_memory clause cannot appear in dependent context");
11088template <
typename Derived>
11090 OMPReverseOffloadClause *
C) {
11091 llvm_unreachable(
"reverse_offload clause cannot appear in dependent context");
11094template <
typename Derived>
11096 OMPDynamicAllocatorsClause *
C) {
11098 "dynamic_allocators clause cannot appear in dependent context");
11101template <
typename Derived>
11103 OMPAtomicDefaultMemOrderClause *
C) {
11105 "atomic_default_mem_order clause cannot appear in dependent context");
11108template <
typename Derived>
11111 llvm_unreachable(
"self_maps clause cannot appear in dependent context");
11114template <
typename Derived>
11117 C->getBeginLoc(),
C->getLParenLoc(),
11121template <
typename Derived>
11125 C->getSeverityKind(),
C->getSeverityKindKwLoc(),
C->getBeginLoc(),
11126 C->getLParenLoc(),
C->getEndLoc());
11129template <
typename Derived>
11132 ExprResult E = getDerived().TransformExpr(
C->getMessageString());
11135 return getDerived().RebuildOMPMessageClause(
11136 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11139template <
typename Derived>
11143 Vars.reserve(
C->varlist_size());
11144 for (
auto *
VE :
C->varlist()) {
11146 if (EVar.isInvalid())
11148 Vars.push_back(EVar.get());
11150 return getDerived().RebuildOMPPrivateClause(
11151 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11154template <
typename Derived>
11156 OMPFirstprivateClause *
C) {
11158 Vars.reserve(
C->varlist_size());
11159 for (
auto *
VE :
C->varlist()) {
11161 if (EVar.isInvalid())
11163 Vars.push_back(EVar.get());
11165 return getDerived().RebuildOMPFirstprivateClause(
11166 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11169template <
typename Derived>
11173 Vars.reserve(
C->varlist_size());
11174 for (
auto *
VE :
C->varlist()) {
11176 if (EVar.isInvalid())
11178 Vars.push_back(EVar.get());
11180 return getDerived().RebuildOMPLastprivateClause(
11181 Vars,
C->getKind(),
C->getKindLoc(),
C->getColonLoc(),
C->getBeginLoc(),
11182 C->getLParenLoc(),
C->getEndLoc());
11185template <
typename Derived>
11189 Vars.reserve(
C->varlist_size());
11190 for (
auto *
VE :
C->varlist()) {
11192 if (EVar.isInvalid())
11194 Vars.push_back(EVar.get());
11196 return getDerived().RebuildOMPSharedClause(Vars,
C->getBeginLoc(),
11197 C->getLParenLoc(),
C->getEndLoc());
11200template <
typename Derived>
11204 Vars.reserve(
C->varlist_size());
11205 for (
auto *
VE :
C->varlist()) {
11207 if (EVar.isInvalid())
11209 Vars.push_back(EVar.get());
11212 ReductionIdScopeSpec.
Adopt(
C->getQualifierLoc());
11215 if (NameInfo.getName()) {
11216 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
11217 if (!NameInfo.getName())
11223 for (
auto *E :
C->reduction_ops()) {
11228 for (
auto *D : ULE->decls()) {
11231 Decls.addDecl(InstD, InstD->getAccess());
11235 ReductionIdScopeSpec.getWithLocInContext(SemaRef.
Context), NameInfo,
11236 true, Decls.begin(), Decls.end(),
11239 UnresolvedReductions.push_back(
nullptr);
11241 return getDerived().RebuildOMPReductionClause(
11242 Vars,
C->getModifier(),
C->getOriginalSharingModifier(),
C->getBeginLoc(),
11243 C->getLParenLoc(),
C->getModifierLoc(),
C->getColonLoc(),
C->getEndLoc(),
11244 ReductionIdScopeSpec, NameInfo, UnresolvedReductions);
11247template <
typename Derived>
11249 OMPTaskReductionClause *
C) {
11251 Vars.reserve(
C->varlist_size());
11252 for (
auto *
VE :
C->varlist()) {
11254 if (EVar.isInvalid())
11256 Vars.push_back(EVar.get());
11259 ReductionIdScopeSpec.
Adopt(
C->getQualifierLoc());
11262 if (NameInfo.getName()) {
11263 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
11264 if (!NameInfo.getName())
11270 for (
auto *E :
C->reduction_ops()) {
11275 for (
auto *D : ULE->decls()) {
11278 Decls.addDecl(InstD, InstD->getAccess());
11282 ReductionIdScopeSpec.getWithLocInContext(SemaRef.
Context), NameInfo,
11283 true, Decls.begin(), Decls.end(),
11286 UnresolvedReductions.push_back(
nullptr);
11288 return getDerived().RebuildOMPTaskReductionClause(
11289 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getColonLoc(),
11290 C->getEndLoc(), ReductionIdScopeSpec, NameInfo, UnresolvedReductions);
11293template <
typename Derived>
11297 Vars.reserve(
C->varlist_size());
11298 for (
auto *
VE :
C->varlist()) {
11300 if (EVar.isInvalid())
11302 Vars.push_back(EVar.get());
11305 ReductionIdScopeSpec.
Adopt(
C->getQualifierLoc());
11308 if (NameInfo.getName()) {
11309 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
11310 if (!NameInfo.getName())
11316 for (
auto *E :
C->reduction_ops()) {
11321 for (
auto *D : ULE->decls()) {
11324 Decls.addDecl(InstD, InstD->getAccess());
11328 ReductionIdScopeSpec.getWithLocInContext(SemaRef.
Context), NameInfo,
11329 true, Decls.begin(), Decls.end(),
11332 UnresolvedReductions.push_back(
nullptr);
11334 return getDerived().RebuildOMPInReductionClause(
11335 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getColonLoc(),
11336 C->getEndLoc(), ReductionIdScopeSpec, NameInfo, UnresolvedReductions);
11339template <
typename Derived>
11343 Vars.reserve(
C->varlist_size());
11344 for (
auto *
VE :
C->varlist()) {
11346 if (EVar.isInvalid())
11348 Vars.push_back(EVar.get());
11350 ExprResult Step = getDerived().TransformExpr(
C->getStep());
11351 if (Step.isInvalid())
11353 return getDerived().RebuildOMPLinearClause(
11354 Vars, Step.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getModifier(),
11355 C->getModifierLoc(),
C->getColonLoc(),
C->getStepModifierLoc(),
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 Alignment = getDerived().TransformExpr(
C->getAlignment());
11371 if (Alignment.isInvalid())
11373 return getDerived().RebuildOMPAlignedClause(
11374 Vars, Alignment.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11375 C->getColonLoc(),
C->getEndLoc());
11378template <
typename Derived>
11382 Vars.reserve(
C->varlist_size());
11383 for (
auto *
VE :
C->varlist()) {
11385 if (EVar.isInvalid())
11387 Vars.push_back(EVar.get());
11389 return getDerived().RebuildOMPCopyinClause(Vars,
C->getBeginLoc(),
11390 C->getLParenLoc(),
C->getEndLoc());
11393template <
typename Derived>
11397 Vars.reserve(
C->varlist_size());
11398 for (
auto *
VE :
C->varlist()) {
11400 if (EVar.isInvalid())
11402 Vars.push_back(EVar.get());
11404 return getDerived().RebuildOMPCopyprivateClause(
11405 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11408template <
typename Derived>
11411 Vars.reserve(
C->varlist_size());
11412 for (
auto *
VE :
C->varlist()) {
11414 if (EVar.isInvalid())
11416 Vars.push_back(EVar.get());
11418 return getDerived().RebuildOMPFlushClause(Vars,
C->getBeginLoc(),
11419 C->getLParenLoc(),
C->getEndLoc());
11422template <
typename Derived>
11425 ExprResult E = getDerived().TransformExpr(
C->getDepobj());
11428 return getDerived().RebuildOMPDepobjClause(E.get(),
C->getBeginLoc(),
11429 C->getLParenLoc(),
C->getEndLoc());
11432template <
typename Derived>
11436 Expr *DepModifier =
C->getModifier();
11438 ExprResult DepModRes = getDerived().TransformExpr(DepModifier);
11439 if (DepModRes.isInvalid())
11441 DepModifier = DepModRes.get();
11443 Vars.reserve(
C->varlist_size());
11444 for (
auto *
VE :
C->varlist()) {
11446 if (EVar.isInvalid())
11448 Vars.push_back(EVar.get());
11450 return getDerived().RebuildOMPDependClause(
11451 {
C->getDependencyKind(),
C->getDependencyLoc(),
C->getColonLoc(),
11452 C->getOmpAllMemoryLoc()},
11453 DepModifier, Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11456template <
typename Derived>
11459 ExprResult E = getDerived().TransformExpr(
C->getDevice());
11462 return getDerived().RebuildOMPDeviceClause(
11463 C->getModifier(), E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11464 C->getModifierLoc(),
C->getEndLoc());
11467template <
typename Derived,
class T>
11474 Vars.reserve(
C->varlist_size());
11475 for (
auto *
VE :
C->varlist()) {
11479 Vars.push_back(EVar.
get());
11483 if (
C->getMapperQualifierLoc()) {
11484 QualifierLoc = TT.
getDerived().TransformNestedNameSpecifierLoc(
11485 C->getMapperQualifierLoc());
11489 MapperIdScopeSpec.
Adopt(QualifierLoc);
11490 MapperIdInfo =
C->getMapperIdInfo();
11491 if (MapperIdInfo.
getName()) {
11492 MapperIdInfo = TT.
getDerived().TransformDeclarationNameInfo(MapperIdInfo);
11498 for (
auto *E :
C->mapperlists()) {
11503 for (
auto *D : ULE->decls()) {
11506 Decls.addDecl(InstD, InstD->
getAccess());
11511 MapperIdInfo,
true, Decls.begin(), Decls.end(),
11514 UnresolvedMappers.push_back(
nullptr);
11520template <
typename Derived>
11522 OMPVarListLocTy Locs(
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11524 Expr *IteratorModifier =
C->getIteratorModifier();
11525 if (IteratorModifier) {
11526 ExprResult MapModRes = getDerived().TransformExpr(IteratorModifier);
11527 if (MapModRes.isInvalid())
11529 IteratorModifier = MapModRes.
get();
11535 *
this,
C, Vars, MapperIdScopeSpec, MapperIdInfo, UnresolvedMappers))
11537 return getDerived().RebuildOMPMapClause(
11538 IteratorModifier,
C->getMapTypeModifiers(),
C->getMapTypeModifiersLoc(),
11539 MapperIdScopeSpec, MapperIdInfo,
C->getMapType(),
C->isImplicitMapType(),
11540 C->getMapLoc(),
C->getColonLoc(), Vars, Locs, UnresolvedMappers);
11543template <
typename Derived>
11546 Expr *Allocator =
C->getAllocator();
11548 ExprResult AllocatorRes = getDerived().TransformExpr(Allocator);
11549 if (AllocatorRes.isInvalid())
11551 Allocator = AllocatorRes.get();
11553 Expr *Alignment =
C->getAlignment();
11555 ExprResult AlignmentRes = getDerived().TransformExpr(Alignment);
11556 if (AlignmentRes.isInvalid())
11558 Alignment = AlignmentRes.get();
11561 Vars.reserve(
C->varlist_size());
11562 for (
auto *
VE :
C->varlist()) {
11564 if (EVar.isInvalid())
11566 Vars.push_back(EVar.get());
11568 return getDerived().RebuildOMPAllocateClause(
11569 Allocator, Alignment,
C->getFirstAllocateModifier(),
11570 C->getFirstAllocateModifierLoc(),
C->getSecondAllocateModifier(),
11571 C->getSecondAllocateModifierLoc(), Vars,
C->getBeginLoc(),
11572 C->getLParenLoc(),
C->getColonLoc(),
C->getEndLoc());
11575template <
typename Derived>
11579 Vars.reserve(
C->varlist_size());
11580 for (
auto *
VE :
C->varlist()) {
11582 if (EVar.isInvalid())
11584 Vars.push_back(EVar.get());
11586 return getDerived().RebuildOMPNumTeamsClause(
11587 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11590template <
typename Derived>
11594 Vars.reserve(
C->varlist_size());
11595 for (
auto *
VE :
C->varlist()) {
11597 if (EVar.isInvalid())
11599 Vars.push_back(EVar.get());
11601 return getDerived().RebuildOMPThreadLimitClause(
11602 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11605template <
typename Derived>
11608 ExprResult E = getDerived().TransformExpr(
C->getPriority());
11611 return getDerived().RebuildOMPPriorityClause(
11612 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11615template <
typename Derived>
11618 ExprResult E = getDerived().TransformExpr(
C->getGrainsize());
11621 return getDerived().RebuildOMPGrainsizeClause(
11622 C->getModifier(), E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11623 C->getModifierLoc(),
C->getEndLoc());
11626template <
typename Derived>
11629 ExprResult E = getDerived().TransformExpr(
C->getNumTasks());
11632 return getDerived().RebuildOMPNumTasksClause(
11633 C->getModifier(), E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11634 C->getModifierLoc(),
C->getEndLoc());
11637template <
typename Derived>
11639 ExprResult E = getDerived().TransformExpr(
C->getHint());
11642 return getDerived().RebuildOMPHintClause(E.get(),
C->getBeginLoc(),
11643 C->getLParenLoc(),
C->getEndLoc());
11646template <
typename Derived>
11648 OMPDistScheduleClause *
C) {
11649 ExprResult E = getDerived().TransformExpr(
C->getChunkSize());
11652 return getDerived().RebuildOMPDistScheduleClause(
11653 C->getDistScheduleKind(), E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11654 C->getDistScheduleKindLoc(),
C->getCommaLoc(),
C->getEndLoc());
11657template <
typename Derived>
11663 C->getDefaultmapKind(),
11666 C->getDefaultmapModifierLoc(),
11667 C->getDefaultmapKindLoc(),
11671template <
typename Derived>
11675 Expr *IteratorModifier =
C->getIteratorModifier();
11676 if (IteratorModifier) {
11677 ExprResult MapModRes = getDerived().TransformExpr(IteratorModifier);
11678 if (MapModRes.isInvalid())
11680 IteratorModifier = MapModRes.get();
11686 *
this,
C, Vars, MapperIdScopeSpec, MapperIdInfo, UnresolvedMappers))
11688 return getDerived().RebuildOMPToClause(
11689 C->getMotionModifiers(),
C->getMotionModifiersLoc(), IteratorModifier,
11690 MapperIdScopeSpec, MapperIdInfo,
C->getColonLoc(), Vars, Locs,
11691 UnresolvedMappers);
11694template <
typename Derived>
11698 Expr *IteratorModifier =
C->getIteratorModifier();
11699 if (IteratorModifier) {
11700 ExprResult MapModRes = getDerived().TransformExpr(IteratorModifier);
11701 if (MapModRes.isInvalid())
11703 IteratorModifier = MapModRes.get();
11709 *
this,
C, Vars, MapperIdScopeSpec, MapperIdInfo, UnresolvedMappers))
11711 return getDerived().RebuildOMPFromClause(
11712 C->getMotionModifiers(),
C->getMotionModifiersLoc(), IteratorModifier,
11713 MapperIdScopeSpec, MapperIdInfo,
C->getColonLoc(), Vars, Locs,
11714 UnresolvedMappers);
11717template <
typename Derived>
11719 OMPUseDevicePtrClause *
C) {
11721 Vars.reserve(
C->varlist_size());
11722 for (
auto *
VE :
C->varlist()) {
11724 if (EVar.isInvalid())
11726 Vars.push_back(EVar.get());
11729 return getDerived().RebuildOMPUseDevicePtrClause(
11730 Vars, Locs,
C->getFallbackModifier(),
C->getFallbackModifierLoc());
11733template <
typename Derived>
11735 OMPUseDeviceAddrClause *
C) {
11737 Vars.reserve(
C->varlist_size());
11738 for (
auto *
VE :
C->varlist()) {
11740 if (EVar.isInvalid())
11742 Vars.push_back(EVar.get());
11745 return getDerived().RebuildOMPUseDeviceAddrClause(Vars, Locs);
11748template <
typename Derived>
11752 Vars.reserve(
C->varlist_size());
11753 for (
auto *
VE :
C->varlist()) {
11755 if (EVar.isInvalid())
11757 Vars.push_back(EVar.get());
11760 return getDerived().RebuildOMPIsDevicePtrClause(Vars, Locs);
11763template <
typename Derived>
11765 OMPHasDeviceAddrClause *
C) {
11767 Vars.reserve(
C->varlist_size());
11768 for (
auto *
VE :
C->varlist()) {
11770 if (EVar.isInvalid())
11772 Vars.push_back(EVar.get());
11775 return getDerived().RebuildOMPHasDeviceAddrClause(Vars, Locs);
11778template <
typename Derived>
11782 Vars.reserve(
C->varlist_size());
11783 for (
auto *
VE :
C->varlist()) {
11785 if (EVar.isInvalid())
11787 Vars.push_back(EVar.get());
11789 return getDerived().RebuildOMPNontemporalClause(
11790 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11793template <
typename Derived>
11797 Vars.reserve(
C->varlist_size());
11798 for (
auto *
VE :
C->varlist()) {
11800 if (EVar.isInvalid())
11802 Vars.push_back(EVar.get());
11804 return getDerived().RebuildOMPInclusiveClause(
11805 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11808template <
typename Derived>
11812 Vars.reserve(
C->varlist_size());
11813 for (
auto *
VE :
C->varlist()) {
11815 if (EVar.isInvalid())
11817 Vars.push_back(EVar.get());
11819 return getDerived().RebuildOMPExclusiveClause(
11820 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11823template <
typename Derived>
11825 OMPUsesAllocatorsClause *
C) {
11827 Data.reserve(
C->getNumberOfAllocators());
11828 for (
unsigned I = 0, E =
C->getNumberOfAllocators(); I < E; ++I) {
11829 OMPUsesAllocatorsClause::Data D =
C->getAllocatorData(I);
11831 if (Allocator.isInvalid())
11835 AllocatorTraits = getDerived().TransformExpr(AT);
11836 if (AllocatorTraits.isInvalid())
11840 NewD.Allocator = Allocator.get();
11841 NewD.AllocatorTraits = AllocatorTraits.get();
11845 return getDerived().RebuildOMPUsesAllocatorsClause(
11846 Data,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11849template <
typename Derived>
11853 Locators.reserve(
C->varlist_size());
11855 if (
Expr *Modifier =
C->getModifier()) {
11856 ModifierRes = getDerived().TransformExpr(Modifier);
11857 if (ModifierRes.isInvalid())
11860 for (
Expr *E :
C->varlist()) {
11861 ExprResult Locator = getDerived().TransformExpr(E);
11862 if (Locator.isInvalid())
11864 Locators.push_back(Locator.get());
11866 return getDerived().RebuildOMPAffinityClause(
11867 C->getBeginLoc(),
C->getLParenLoc(),
C->getColonLoc(),
C->getEndLoc(),
11868 ModifierRes.get(), Locators);
11871template <
typename Derived>
11874 C->getKind(),
C->getKindKwLoc(),
C->getBeginLoc(),
C->getLParenLoc(),
11875 C->getEndLoc(),
C->getModifier(),
C->getModifierKwLoc());
11878template <
typename Derived>
11881 C->getBindKind(),
C->getBindKindLoc(),
C->getBeginLoc(),
11882 C->getLParenLoc(),
C->getEndLoc());
11885template <
typename Derived>
11887 OMPXDynCGroupMemClause *
C) {
11889 if (
Size.isInvalid())
11891 return getDerived().RebuildOMPXDynCGroupMemClause(
11892 Size.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11895template <
typename Derived>
11897 OMPDynGroupprivateClause *
C) {
11899 if (
Size.isInvalid())
11901 return getDerived().RebuildOMPDynGroupprivateClause(
11902 C->getDynGroupprivateModifier(),
C->getDynGroupprivateFallbackModifier(),
11903 Size.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11904 C->getDynGroupprivateModifierLoc(),
11905 C->getDynGroupprivateFallbackModifierLoc(),
C->getEndLoc());
11908template <
typename Derived>
11912 Vars.reserve(
C->varlist_size());
11913 for (
auto *
VE :
C->varlist()) {
11915 if (EVar.isInvalid())
11917 Vars.push_back(EVar.get());
11919 return getDerived().RebuildOMPDoacrossClause(
11920 C->getDependenceType(),
C->getDependenceLoc(),
C->getColonLoc(), Vars,
11921 C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11924template <
typename Derived>
11928 for (
auto *A :
C->getAttrs())
11929 NewAttrs.push_back(getDerived().TransformAttr(A));
11930 return getDerived().RebuildOMPXAttributeClause(
11931 NewAttrs,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11934template <
typename Derived>
11943template <
typename Derived>
11944class OpenACCClauseTransform final
11946 TreeTransform<Derived> &Self;
11947 ArrayRef<const OpenACCClause *> ExistingClauses;
11948 SemaOpenACC::OpenACCParsedClause &ParsedClause;
11949 OpenACCClause *NewClause =
nullptr;
11952 ExprResult Res = Self.TransformExpr(VarRef);
11954 if (!Res.isUsable())
11957 Res = Self.getSema().OpenACC().ActOnVar(ParsedClause.getDirectiveKind(),
11958 ParsedClause.getClauseKind(),
11964 llvm::SmallVector<Expr *> VisitVarList(ArrayRef<Expr *> VarList) {
11965 llvm::SmallVector<Expr *> InstantiatedVarList;
11966 for (Expr *CurVar : VarList) {
11969 if (VarRef.isUsable())
11970 InstantiatedVarList.push_back(VarRef.get());
11973 return InstantiatedVarList;
11977 OpenACCClauseTransform(TreeTransform<Derived> &Self,
11978 ArrayRef<const OpenACCClause *> ExistingClauses,
11979 SemaOpenACC::OpenACCParsedClause &PC)
11980 : Self(Self), ExistingClauses(ExistingClauses), ParsedClause(PC) {}
11982 OpenACCClause *CreatedClause()
const {
return NewClause; }
11984#define VISIT_CLAUSE(CLAUSE_NAME) \
11985 void Visit##CLAUSE_NAME##Clause(const OpenACC##CLAUSE_NAME##Clause &Clause);
11986#include "clang/Basic/OpenACCClauses.def"
11989template <
typename Derived>
11990void OpenACCClauseTransform<Derived>::VisitDefaultClause(
11992 ParsedClause.setDefaultDetails(
C.getDefaultClauseKind());
11995 Self.getSema().getASTContext(), ParsedClause.getDefaultClauseKind(),
11996 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
11997 ParsedClause.getEndLoc());
12000template <
typename Derived>
12001void OpenACCClauseTransform<Derived>::VisitIfClause(
const OpenACCIfClause &
C) {
12003 assert(
Cond &&
"If constructed with invalid Condition");
12007 if (Res.isInvalid() || !Res.get().second)
12010 ParsedClause.setConditionDetails(Res.get().second);
12013 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12014 ParsedClause.getLParenLoc(), ParsedClause.getConditionExpr(),
12015 ParsedClause.getEndLoc());
12018template <
typename Derived>
12019void OpenACCClauseTransform<Derived>::VisitSelfClause(
12025 for (
Expr *CurVar :
C.getVarList()) {
12028 if (!Res.isUsable())
12031 Res =
Self.getSema().OpenACC().ActOnVar(ParsedClause.getDirectiveKind(),
12032 ParsedClause.getClauseKind(),
12035 if (Res.isUsable())
12036 InstantiatedVarList.push_back(Res.get());
12039 ParsedClause.setVarListDetails(InstantiatedVarList,
12043 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12044 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12045 ParsedClause.getEndLoc());
12048 if (
C.hasConditionExpr()) {
12051 Self.TransformCondition(
Cond->getExprLoc(),
nullptr,
Cond,
12054 if (Res.isInvalid() || !Res.get().second)
12057 ParsedClause.setConditionDetails(Res.get().second);
12061 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12062 ParsedClause.getLParenLoc(), ParsedClause.getConditionExpr(),
12063 ParsedClause.getEndLoc());
12067template <
typename Derived>
12068void OpenACCClauseTransform<Derived>::VisitNumGangsClause(
12072 for (
Expr *CurIntExpr :
C.getIntExprs()) {
12075 if (!Res.isUsable())
12080 C.getBeginLoc(), Res.get());
12081 if (!Res.isUsable())
12084 InstantiatedIntExprs.push_back(Res.get());
12087 ParsedClause.setIntExprDetails(InstantiatedIntExprs);
12089 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12090 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs(),
12091 ParsedClause.getEndLoc());
12094template <
typename Derived>
12095void OpenACCClauseTransform<Derived>::VisitPrivateClause(
12100 for (
const auto [RefExpr, InitRecipe] :
12101 llvm::zip(
C.getVarList(),
C.getInitRecipes())) {
12104 if (VarRef.isUsable()) {
12105 InstantiatedVarList.push_back(VarRef.get());
12109 if (InitRecipe.isSet())
12110 InitRecipes.push_back(InitRecipe);
12112 InitRecipes.push_back(
12113 Self.getSema().OpenACC().CreatePrivateInitRecipe(VarRef.get()));
12116 ParsedClause.setVarListDetails(InstantiatedVarList,
12120 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12121 ParsedClause.getLParenLoc(), ParsedClause.getVarList(), InitRecipes,
12122 ParsedClause.getEndLoc());
12125template <
typename Derived>
12126void OpenACCClauseTransform<Derived>::VisitHostClause(
12128 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12132 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12133 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12134 ParsedClause.getEndLoc());
12137template <
typename Derived>
12138void OpenACCClauseTransform<Derived>::VisitDeviceClause(
12140 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12144 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12145 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12146 ParsedClause.getEndLoc());
12149template <
typename Derived>
12150void OpenACCClauseTransform<Derived>::VisitFirstPrivateClause(
12155 for (
const auto [RefExpr, InitRecipe] :
12156 llvm::zip(
C.getVarList(),
C.getInitRecipes())) {
12159 if (VarRef.isUsable()) {
12160 InstantiatedVarList.push_back(VarRef.get());
12164 if (InitRecipe.isSet())
12165 InitRecipes.push_back(InitRecipe);
12167 InitRecipes.push_back(
12168 Self.getSema().OpenACC().CreateFirstPrivateInitRecipe(
12172 ParsedClause.setVarListDetails(InstantiatedVarList,
12176 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12177 ParsedClause.getLParenLoc(), ParsedClause.getVarList(), InitRecipes,
12178 ParsedClause.getEndLoc());
12181template <
typename Derived>
12182void OpenACCClauseTransform<Derived>::VisitNoCreateClause(
12184 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12188 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12189 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12190 ParsedClause.getEndLoc());
12193template <
typename Derived>
12194void OpenACCClauseTransform<Derived>::VisitPresentClause(
12196 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12200 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12201 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12202 ParsedClause.getEndLoc());
12205template <
typename Derived>
12206void OpenACCClauseTransform<Derived>::VisitCopyClause(
12208 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12209 C.getModifierList());
12212 Self.getSema().getASTContext(), ParsedClause.getClauseKind(),
12213 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12214 ParsedClause.getModifierList(), ParsedClause.getVarList(),
12215 ParsedClause.getEndLoc());
12218template <
typename Derived>
12219void OpenACCClauseTransform<Derived>::VisitLinkClause(
12221 llvm_unreachable(
"link clause not valid unless a decl transform");
12224template <
typename Derived>
12225void OpenACCClauseTransform<Derived>::VisitDeviceResidentClause(
12227 llvm_unreachable(
"device_resident clause not valid unless a decl transform");
12229template <
typename Derived>
12230void OpenACCClauseTransform<Derived>::VisitNoHostClause(
12232 llvm_unreachable(
"nohost clause not valid unless a decl transform");
12234template <
typename Derived>
12235void OpenACCClauseTransform<Derived>::VisitBindClause(
12237 llvm_unreachable(
"bind clause not valid unless a decl transform");
12240template <
typename Derived>
12241void OpenACCClauseTransform<Derived>::VisitCopyInClause(
12243 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12244 C.getModifierList());
12247 Self.getSema().getASTContext(), ParsedClause.getClauseKind(),
12248 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12249 ParsedClause.getModifierList(), ParsedClause.getVarList(),
12250 ParsedClause.getEndLoc());
12253template <
typename Derived>
12254void OpenACCClauseTransform<Derived>::VisitCopyOutClause(
12256 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12257 C.getModifierList());
12260 Self.getSema().getASTContext(), ParsedClause.getClauseKind(),
12261 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12262 ParsedClause.getModifierList(), ParsedClause.getVarList(),
12263 ParsedClause.getEndLoc());
12266template <
typename Derived>
12267void OpenACCClauseTransform<Derived>::VisitCreateClause(
12269 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12270 C.getModifierList());
12273 Self.getSema().getASTContext(), ParsedClause.getClauseKind(),
12274 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12275 ParsedClause.getModifierList(), ParsedClause.getVarList(),
12276 ParsedClause.getEndLoc());
12278template <
typename Derived>
12279void OpenACCClauseTransform<Derived>::VisitAttachClause(
12284 llvm::erase_if(VarList, [&](
Expr *E) {
12285 return Self.getSema().OpenACC().CheckVarIsPointerType(
12291 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12292 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12293 ParsedClause.getEndLoc());
12296template <
typename Derived>
12297void OpenACCClauseTransform<Derived>::VisitDetachClause(
12302 llvm::erase_if(VarList, [&](
Expr *E) {
12303 return Self.getSema().OpenACC().CheckVarIsPointerType(
12309 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12310 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12311 ParsedClause.getEndLoc());
12314template <
typename Derived>
12315void OpenACCClauseTransform<Derived>::VisitDeleteClause(
12317 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12320 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12321 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12322 ParsedClause.getEndLoc());
12325template <
typename Derived>
12326void OpenACCClauseTransform<Derived>::VisitUseDeviceClause(
12328 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12331 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12332 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12333 ParsedClause.getEndLoc());
12336template <
typename Derived>
12337void OpenACCClauseTransform<Derived>::VisitDevicePtrClause(
12342 llvm::erase_if(VarList, [&](
Expr *E) {
12343 return Self.getSema().OpenACC().CheckVarIsPointerType(
12349 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12350 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12351 ParsedClause.getEndLoc());
12354template <
typename Derived>
12355void OpenACCClauseTransform<Derived>::VisitNumWorkersClause(
12357 Expr *IntExpr =
const_cast<Expr *
>(
C.getIntExpr());
12358 assert(IntExpr &&
"num_workers clause constructed with invalid int expr");
12361 if (!Res.isUsable())
12366 C.getBeginLoc(), Res.get());
12367 if (!Res.isUsable())
12370 ParsedClause.setIntExprDetails(Res.get());
12372 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12373 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs()[0],
12374 ParsedClause.getEndLoc());
12377template <
typename Derived>
12378void OpenACCClauseTransform<Derived>::VisitDeviceNumClause (
12380 Expr *IntExpr =
const_cast<Expr *
>(
C.getIntExpr());
12381 assert(IntExpr &&
"device_num clause constructed with invalid int expr");
12384 if (!Res.isUsable())
12389 C.getBeginLoc(), Res.get());
12390 if (!Res.isUsable())
12393 ParsedClause.setIntExprDetails(Res.get());
12395 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12396 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs()[0],
12397 ParsedClause.getEndLoc());
12400template <
typename Derived>
12401void OpenACCClauseTransform<Derived>::VisitDefaultAsyncClause(
12403 Expr *IntExpr =
const_cast<Expr *
>(
C.getIntExpr());
12404 assert(IntExpr &&
"default_async clause constructed with invalid int expr");
12407 if (!Res.isUsable())
12412 C.getBeginLoc(), Res.get());
12413 if (!Res.isUsable())
12416 ParsedClause.setIntExprDetails(Res.get());
12418 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12419 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs()[0],
12420 ParsedClause.getEndLoc());
12423template <
typename Derived>
12424void OpenACCClauseTransform<Derived>::VisitVectorLengthClause(
12426 Expr *IntExpr =
const_cast<Expr *
>(
C.getIntExpr());
12427 assert(IntExpr &&
"vector_length clause constructed with invalid int expr");
12430 if (!Res.isUsable())
12435 C.getBeginLoc(), Res.get());
12436 if (!Res.isUsable())
12439 ParsedClause.setIntExprDetails(Res.get());
12441 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12442 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs()[0],
12443 ParsedClause.getEndLoc());
12446template <
typename Derived>
12447void OpenACCClauseTransform<Derived>::VisitAsyncClause(
12449 if (
C.hasIntExpr()) {
12451 if (!Res.isUsable())
12456 C.getBeginLoc(), Res.get());
12457 if (!Res.isUsable())
12459 ParsedClause.setIntExprDetails(Res.get());
12463 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12464 ParsedClause.getLParenLoc(),
12465 ParsedClause.getNumIntExprs() != 0 ? ParsedClause.getIntExprs()[0]
12467 ParsedClause.getEndLoc());
12470template <
typename Derived>
12471void OpenACCClauseTransform<Derived>::VisitWorkerClause(
12473 if (
C.hasIntExpr()) {
12478 if (!Res.isUsable())
12483 C.getBeginLoc(), Res.get());
12484 if (!Res.isUsable())
12486 ParsedClause.setIntExprDetails(Res.get());
12490 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12491 ParsedClause.getLParenLoc(),
12492 ParsedClause.getNumIntExprs() != 0 ? ParsedClause.getIntExprs()[0]
12494 ParsedClause.getEndLoc());
12497template <
typename Derived>
12498void OpenACCClauseTransform<Derived>::VisitVectorClause(
12500 if (
C.hasIntExpr()) {
12505 if (!Res.isUsable())
12510 C.getBeginLoc(), Res.get());
12511 if (!Res.isUsable())
12513 ParsedClause.setIntExprDetails(Res.get());
12517 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12518 ParsedClause.getLParenLoc(),
12519 ParsedClause.getNumIntExprs() != 0 ? ParsedClause.getIntExprs()[0]
12521 ParsedClause.getEndLoc());
12524template <
typename Derived>
12525void OpenACCClauseTransform<Derived>::VisitWaitClause(
12527 if (
C.hasExprs()) {
12528 Expr *DevNumExpr =
nullptr;
12532 if (
C.getDevNumExpr()) {
12534 if (!Res.isUsable())
12538 C.getBeginLoc(), Res.get());
12539 if (!Res.isUsable())
12542 DevNumExpr = Res.get();
12546 for (
Expr *CurQueueIdExpr :
C.getQueueIdExprs()) {
12548 if (!Res.isUsable())
12552 C.getBeginLoc(), Res.get());
12553 if (!Res.isUsable())
12556 InstantiatedQueueIdExprs.push_back(Res.get());
12559 ParsedClause.setWaitDetails(DevNumExpr,
C.getQueuesLoc(),
12560 std::move(InstantiatedQueueIdExprs));
12564 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12565 ParsedClause.getLParenLoc(), ParsedClause.getDevNumExpr(),
12566 ParsedClause.getQueuesLoc(), ParsedClause.getQueueIdExprs(),
12567 ParsedClause.getEndLoc());
12570template <
typename Derived>
12571void OpenACCClauseTransform<Derived>::VisitDeviceTypeClause(
12575 Self.getSema().getASTContext(),
C.getClauseKind(),
12576 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12577 C.getArchitectures(), ParsedClause.getEndLoc());
12580template <
typename Derived>
12581void OpenACCClauseTransform<Derived>::VisitAutoClause(
12585 ParsedClause.getBeginLoc(),
12586 ParsedClause.getEndLoc());
12589template <
typename Derived>
12590void OpenACCClauseTransform<Derived>::VisitIndependentClause(
12593 ParsedClause.getBeginLoc(),
12594 ParsedClause.getEndLoc());
12597template <
typename Derived>
12598void OpenACCClauseTransform<Derived>::VisitSeqClause(
12601 ParsedClause.getBeginLoc(),
12602 ParsedClause.getEndLoc());
12604template <
typename Derived>
12605void OpenACCClauseTransform<Derived>::VisitFinalizeClause(
12608 ParsedClause.getBeginLoc(),
12609 ParsedClause.getEndLoc());
12612template <
typename Derived>
12613void OpenACCClauseTransform<Derived>::VisitIfPresentClause(
12616 ParsedClause.getBeginLoc(),
12617 ParsedClause.getEndLoc());
12620template <
typename Derived>
12621void OpenACCClauseTransform<Derived>::VisitReductionClause(
12627 for (
const auto [Var, OrigRecipe] :
12628 llvm::zip(TransformedVars,
C.getRecipes())) {
12630 ParsedClause.getDirectiveKind(),
C.getReductionOp(), Var);
12631 if (Res.isUsable()) {
12632 ValidVars.push_back(Res.get());
12634 if (OrigRecipe.isSet())
12635 Recipes.emplace_back(OrigRecipe.AllocaDecl, OrigRecipe.CombinerRecipes);
12637 Recipes.push_back(
Self.getSema().OpenACC().CreateReductionInitRecipe(
12638 C.getReductionOp(), Res.get()));
12642 NewClause =
Self.getSema().OpenACC().CheckReductionClause(
12643 ExistingClauses, ParsedClause.getDirectiveKind(),
12644 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12645 C.getReductionOp(), ValidVars, Recipes, ParsedClause.getEndLoc());
12648template <
typename Derived>
12649void OpenACCClauseTransform<Derived>::VisitCollapseClause(
12651 Expr *LoopCount =
const_cast<Expr *
>(
C.getLoopCount());
12652 assert(LoopCount &&
"collapse clause constructed with invalid loop count");
12656 if (!NewLoopCount.isUsable())
12659 NewLoopCount =
Self.getSema().OpenACC().ActOnIntExpr(
12661 NewLoopCount.get()->getBeginLoc(), NewLoopCount.get());
12665 if (!NewLoopCount.isUsable())
12669 Self.getSema().OpenACC().CheckCollapseLoopCount(NewLoopCount.get());
12673 if (!NewLoopCount.isUsable())
12676 ParsedClause.setCollapseDetails(
C.hasForce(), NewLoopCount.get());
12678 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12679 ParsedClause.getLParenLoc(), ParsedClause.isForce(),
12680 ParsedClause.getLoopCount(), ParsedClause.getEndLoc());
12683template <
typename Derived>
12684void OpenACCClauseTransform<Derived>::VisitTileClause(
12689 for (
Expr *E :
C.getSizeExprs()) {
12692 if (!NewSizeExpr.isUsable())
12695 NewSizeExpr =
Self.getSema().OpenACC().ActOnIntExpr(
12697 NewSizeExpr.get()->getBeginLoc(), NewSizeExpr.get());
12701 if (!NewSizeExpr.isUsable())
12704 NewSizeExpr =
Self.getSema().OpenACC().CheckTileSizeExpr(NewSizeExpr.get());
12706 if (!NewSizeExpr.isUsable())
12708 TransformedExprs.push_back(NewSizeExpr.get());
12711 ParsedClause.setIntExprDetails(TransformedExprs);
12713 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12714 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs(),
12715 ParsedClause.getEndLoc());
12717template <
typename Derived>
12718void OpenACCClauseTransform<Derived>::VisitGangClause(
12723 for (
unsigned I = 0; I <
C.getNumExprs(); ++I) {
12725 if (!ER.isUsable())
12728 ER =
Self.getSema().OpenACC().CheckGangExpr(ExistingClauses,
12729 ParsedClause.getDirectiveKind(),
12730 C.getExpr(I).first, ER.get());
12731 if (!ER.isUsable())
12733 TransformedGangKinds.push_back(
C.getExpr(I).first);
12734 TransformedIntExprs.push_back(ER.get());
12737 NewClause =
Self.getSema().OpenACC().CheckGangClause(
12738 ParsedClause.getDirectiveKind(), ExistingClauses,
12739 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12740 TransformedGangKinds, TransformedIntExprs, ParsedClause.getEndLoc());
12743template <
typename Derived>
12744OpenACCClause *TreeTransform<Derived>::TransformOpenACCClause(
12749 DirKind, OldClause->getClauseKind(), OldClause->getBeginLoc());
12750 ParsedClause.setEndLoc(OldClause->getEndLoc());
12752 if (
const auto *WithParms = dyn_cast<OpenACCClauseWithParams>(OldClause))
12753 ParsedClause.setLParenLoc(WithParms->getLParenLoc());
12755 OpenACCClauseTransform<Derived> Transform{*
this, ExistingClauses,
12757 Transform.Visit(OldClause);
12759 return Transform.CreatedClause();
12762template <
typename Derived>
12764TreeTransform<Derived>::TransformOpenACCClauseList(
12767 for (
const auto *Clause : OldClauses) {
12768 if (
OpenACCClause *TransformedClause = getDerived().TransformOpenACCClause(
12769 TransformedClauses, DirKind, Clause))
12770 TransformedClauses.push_back(TransformedClause);
12772 return TransformedClauses;
12775template <
typename Derived>
12778 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12781 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12784 if (getSema().OpenACC().ActOnStartStmtDirective(
12785 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12790 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
12791 C->clauses(), TransformedClauses);
12792 StmtResult StrBlock = getDerived().TransformStmt(
C->getStructuredBlock());
12793 StrBlock = getSema().OpenACC().ActOnAssociatedStmt(
12794 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses, StrBlock);
12796 return getDerived().RebuildOpenACCComputeConstruct(
12797 C->getDirectiveKind(),
C->getBeginLoc(),
C->getDirectiveLoc(),
12798 C->getEndLoc(), TransformedClauses, StrBlock);
12801template <
typename Derived>
12805 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12808 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12811 if (getSema().OpenACC().ActOnStartStmtDirective(
12812 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12817 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
12818 C->clauses(), TransformedClauses);
12820 Loop = getSema().OpenACC().ActOnAssociatedStmt(
12821 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses,
Loop);
12823 return getDerived().RebuildOpenACCLoopConstruct(
12824 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12825 TransformedClauses,
Loop);
12828template <
typename Derived>
12830 OpenACCCombinedConstruct *
C) {
12831 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12834 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12837 if (getSema().OpenACC().ActOnStartStmtDirective(
12838 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12843 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
12844 C->clauses(), TransformedClauses);
12846 Loop = getSema().OpenACC().ActOnAssociatedStmt(
12847 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses,
Loop);
12849 return getDerived().RebuildOpenACCCombinedConstruct(
12850 C->getDirectiveKind(),
C->getBeginLoc(),
C->getDirectiveLoc(),
12851 C->getEndLoc(), TransformedClauses,
Loop);
12854template <
typename Derived>
12857 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12860 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12862 if (getSema().OpenACC().ActOnStartStmtDirective(
12863 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12867 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
12868 C->clauses(), TransformedClauses);
12869 StmtResult StrBlock = getDerived().TransformStmt(
C->getStructuredBlock());
12870 StrBlock = getSema().OpenACC().ActOnAssociatedStmt(
12871 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses, StrBlock);
12873 return getDerived().RebuildOpenACCDataConstruct(
12874 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12875 TransformedClauses, StrBlock);
12878template <
typename Derived>
12880 OpenACCEnterDataConstruct *
C) {
12881 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12884 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12886 if (getSema().OpenACC().ActOnStartStmtDirective(
12887 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12890 return getDerived().RebuildOpenACCEnterDataConstruct(
12891 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12892 TransformedClauses);
12895template <
typename Derived>
12897 OpenACCExitDataConstruct *
C) {
12898 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12901 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12903 if (getSema().OpenACC().ActOnStartStmtDirective(
12904 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12907 return getDerived().RebuildOpenACCExitDataConstruct(
12908 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12909 TransformedClauses);
12912template <
typename Derived>
12914 OpenACCHostDataConstruct *
C) {
12915 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12918 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12920 if (getSema().OpenACC().ActOnStartStmtDirective(
12921 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12925 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
12926 C->clauses(), TransformedClauses);
12927 StmtResult StrBlock = getDerived().TransformStmt(
C->getStructuredBlock());
12928 StrBlock = getSema().OpenACC().ActOnAssociatedStmt(
12929 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses, StrBlock);
12931 return getDerived().RebuildOpenACCHostDataConstruct(
12932 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12933 TransformedClauses, StrBlock);
12936template <
typename Derived>
12939 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12942 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12944 if (getSema().OpenACC().ActOnStartStmtDirective(
12945 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12948 return getDerived().RebuildOpenACCInitConstruct(
12949 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12950 TransformedClauses);
12953template <
typename Derived>
12955 OpenACCShutdownConstruct *
C) {
12956 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12959 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12961 if (getSema().OpenACC().ActOnStartStmtDirective(
12962 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12965 return getDerived().RebuildOpenACCShutdownConstruct(
12966 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12967 TransformedClauses);
12969template <
typename Derived>
12972 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12975 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12977 if (getSema().OpenACC().ActOnStartStmtDirective(
12978 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12981 return getDerived().RebuildOpenACCSetConstruct(
12982 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12983 TransformedClauses);
12986template <
typename Derived>
12988 OpenACCUpdateConstruct *
C) {
12989 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12992 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12994 if (getSema().OpenACC().ActOnStartStmtDirective(
12995 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12998 return getDerived().RebuildOpenACCUpdateConstruct(
12999 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
13000 TransformedClauses);
13003template <
typename Derived>
13006 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13009 if (
C->hasDevNumExpr()) {
13010 DevNumExpr = getDerived().TransformExpr(
C->getDevNumExpr());
13012 if (DevNumExpr.isUsable())
13013 DevNumExpr = getSema().OpenACC().ActOnIntExpr(
13015 C->getBeginLoc(), DevNumExpr.get());
13020 for (
Expr *QE :
C->getQueueIdExprs()) {
13021 assert(QE &&
"Null queue id expr?");
13022 ExprResult NewEQ = getDerived().TransformExpr(QE);
13024 if (!NewEQ.isUsable())
13028 C->getBeginLoc(), NewEQ.get());
13029 if (NewEQ.isUsable())
13030 QueueIdExprs.push_back(NewEQ.get());
13034 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
13037 if (getSema().OpenACC().ActOnStartStmtDirective(
13038 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
13041 return getDerived().RebuildOpenACCWaitConstruct(
13042 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getLParenLoc(),
13043 DevNumExpr.isUsable() ? DevNumExpr.get() :
nullptr,
C->getQueuesLoc(),
13044 QueueIdExprs,
C->getRParenLoc(),
C->getEndLoc(), TransformedClauses);
13046template <
typename Derived>
13048 OpenACCCacheConstruct *
C) {
13049 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13052 for (
Expr *Var :
C->getVarList()) {
13053 assert(Var &&
"Null var listexpr?");
13055 ExprResult NewVar = getDerived().TransformExpr(Var);
13057 if (!NewVar.isUsable())
13060 NewVar = getSema().OpenACC().ActOnVar(
13062 if (!NewVar.isUsable())
13065 TransformedVarList.push_back(NewVar.get());
13068 if (getSema().OpenACC().ActOnStartStmtDirective(
C->getDirectiveKind(),
13069 C->getBeginLoc(), {}))
13072 return getDerived().RebuildOpenACCCacheConstruct(
13073 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getLParenLoc(),
13074 C->getReadOnlyLoc(), TransformedVarList,
C->getRParenLoc(),
13078template <
typename Derived>
13080 OpenACCAtomicConstruct *
C) {
13081 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13084 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
13087 if (getSema().OpenACC().ActOnStartStmtDirective(
C->getDirectiveKind(),
13088 C->getBeginLoc(), {}))
13093 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(), {}, {});
13095 StmtResult AssocStmt = getDerived().TransformStmt(
C->getAssociatedStmt());
13096 AssocStmt = getSema().OpenACC().ActOnAssociatedStmt(
13097 C->getBeginLoc(),
C->getDirectiveKind(),
C->getAtomicKind(), {},
13100 return getDerived().RebuildOpenACCAtomicConstruct(
13101 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getAtomicKind(),
13102 C->getEndLoc(), TransformedClauses, AssocStmt);
13105template <
typename Derived>
13108 if (getDerived().AlwaysRebuild())
13117template<
typename Derived>
13120 return TransformExpr(E->getSubExpr());
13123template <
typename Derived>
13126 if (!E->isTypeDependent())
13129 TypeSourceInfo *NewT = getDerived().TransformType(E->getTypeSourceInfo());
13134 if (!getDerived().AlwaysRebuild() && E->getTypeSourceInfo() == NewT)
13137 return getDerived().RebuildSYCLUniqueStableNameExpr(
13138 E->getLocation(), E->getLParenLocation(), E->getRParenLocation(), NewT);
13141template <
typename Derived>
13145 const auto *SKEPAttr = FD->template getAttr<SYCLKernelEntryPointAttr>();
13146 if (!SKEPAttr || SKEPAttr->isInvalidAttr())
13149 ExprResult IdExpr = getDerived().TransformExpr(S->getKernelLaunchIdExpr());
13150 if (IdExpr.isInvalid())
13153 StmtResult Body = getDerived().TransformStmt(S->getOriginalStmt());
13154 if (Body.isInvalid())
13160 if (SR.isInvalid())
13166template <
typename Derived>
13169 assert(
false &&
"not implemented yet");
13173template<
typename Derived>
13176 if (!E->isTypeDependent())
13180 E->getIdentKind());
13183template<
typename Derived>
13187 if (E->getQualifierLoc()) {
13189 = getDerived().TransformNestedNameSpecifierLoc(E->getQualifierLoc());
13195 = cast_or_null<ValueDecl>(getDerived().TransformDecl(E->getLocation(),
13197 if (!ND || ND->isInvalidDecl())
13201 if (E->getFoundDecl() != E->getDecl()) {
13202 Found = cast_or_null<NamedDecl>(
13203 getDerived().TransformDecl(E->getLocation(), E->getFoundDecl()));
13209 if (NameInfo.getName()) {
13210 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
13211 if (!NameInfo.getName())
13215 if (!getDerived().AlwaysRebuild() &&
13216 !E->isCapturedByCopyInLambdaWithExplicitObjectParameter() &&
13217 QualifierLoc == E->getQualifierLoc() && ND == E->getDecl() &&
13218 Found == E->getFoundDecl() &&
13219 NameInfo.getName() == E->getDecl()->getDeclName() &&
13220 !E->hasExplicitTemplateArgs()) {
13230 if (E->hasExplicitTemplateArgs()) {
13231 TemplateArgs = &TransArgs;
13232 TransArgs.setLAngleLoc(E->getLAngleLoc());
13233 TransArgs.setRAngleLoc(E->getRAngleLoc());
13234 if (getDerived().TransformTemplateArguments(E->getTemplateArgs(),
13235 E->getNumTemplateArgs(),
13240 return getDerived().RebuildDeclRefExpr(QualifierLoc, ND, NameInfo,
13241 Found, TemplateArgs);
13244template<
typename Derived>
13250template <
typename Derived>
13256template<
typename Derived>
13262template<
typename Derived>
13268template<
typename Derived>
13274template<
typename Derived>
13280template<
typename Derived>
13283 return getDerived().TransformCallExpr(E);
13286template<
typename Derived>
13291 if (E->isExprPredicate())
13292 ControllingExpr = getDerived().TransformExpr(E->getControllingExpr());
13294 ControllingType = getDerived().TransformType(E->getControllingType());
13296 if (ControllingExpr.isInvalid() && !ControllingType)
13307 AssocTypes.push_back(AssocType);
13309 AssocTypes.push_back(
nullptr);
13313 getDerived().TransformExpr(Assoc.getAssociationExpr());
13314 if (AssocExpr.isInvalid())
13316 AssocExprs.push_back(AssocExpr.get());
13319 if (!ControllingType)
13320 return getDerived().RebuildGenericSelectionExpr(E->getGenericLoc(),
13321 E->getDefaultLoc(),
13323 ControllingExpr.get(),
13326 return getDerived().RebuildGenericSelectionExpr(
13327 E->getGenericLoc(), E->getDefaultLoc(), E->getRParenLoc(),
13328 ControllingType, AssocTypes, AssocExprs);
13331template<
typename Derived>
13334 ExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
13335 if (SubExpr.isInvalid())
13338 if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getSubExpr())
13341 return getDerived().RebuildParenExpr(SubExpr.get(), E->getLParen(),
13348template<
typename Derived>
13352 return getDerived().TransformDependentScopeDeclRefExpr(
13353 DRE,
true,
nullptr);
13355 return getDerived().TransformUnresolvedLookupExpr(
13361template<
typename Derived>
13366 SubExpr = TransformAddressOfOperand(E->
getSubExpr());
13372 if (!getDerived().AlwaysRebuild() && SubExpr.
get() == E->
getSubExpr())
13380template<
typename Derived>
13382TreeTransform<Derived>::TransformOffsetOfExpr(OffsetOfExpr *E) {
13384 TypeSourceInfo *Type = getDerived().TransformType(E->getTypeSourceInfo());
13394 bool ExprChanged =
false;
13395 typedef Sema::OffsetOfComponent Component;
13397 for (
unsigned I = 0, N = E->getNumComponents(); I != N; ++I) {
13398 const OffsetOfNode &ON = E->getComponent(I);
13400 Comp.isBrackets =
true;
13401 Comp.LocStart = ON.getSourceRange().getBegin();
13402 Comp.LocEnd = ON.getSourceRange().getEnd();
13403 switch (ON.getKind()) {
13405 Expr *FromIndex = E->getIndexExpr(ON.getArrayExprIndex());
13406 ExprResult Index = getDerived().TransformExpr(FromIndex);
13407 if (Index.isInvalid())
13410 ExprChanged = ExprChanged || Index.get() != FromIndex;
13411 Comp.isBrackets =
true;
13412 Comp.U.E = Index.get();
13418 Comp.isBrackets =
false;
13419 Comp.U.IdentInfo = ON.getFieldName();
13420 if (!
Comp.U.IdentInfo)
13430 Components.push_back(Comp);
13434 if (!getDerived().AlwaysRebuild() &&
13435 Type == E->getTypeSourceInfo() &&
13440 return getDerived().RebuildOffsetOfExpr(E->getOperatorLoc(),
Type,
13441 Components, E->getRParenLoc());
13444template<
typename Derived>
13447 assert((!E->getSourceExpr() || getDerived().AlreadyTransformed(E->getType())) &&
13448 "opaque value expression requires transformation");
13452template <
typename Derived>
13456 for (
Expr *
C : E->subExpressions()) {
13458 if (NewC.isInvalid())
13464 if (!getDerived().AlwaysRebuild() && !Changed)
13466 return getDerived().RebuildRecoveryExpr(E->getBeginLoc(), E->getEndLoc(),
13470template<
typename Derived>
13480 ExprResult result = getDerived().TransformExpr(newSyntacticForm);
13481 if (result.isInvalid())
return ExprError();
13486 if (result.get()->hasPlaceholderType(BuiltinType::PseudoObject))
13492template<
typename Derived>
13496 if (E->isArgumentType()) {
13503 if (!getDerived().AlwaysRebuild() && OldT == NewT)
13506 return getDerived().RebuildUnaryExprOrTypeTrait(NewT, E->getOperatorLoc(),
13508 E->getSourceRange());
13522 auto *PE = dyn_cast<ParenExpr>(E->getArgumentExpr());
13524 PE ? dyn_cast<DependentScopeDeclRefExpr>(PE->getSubExpr()) :
nullptr)
13525 SubExpr = getDerived().TransformParenDependentScopeDeclRefExpr(
13526 PE, DRE,
false, &RecoveryTSI);
13528 SubExpr = getDerived().TransformExpr(E->getArgumentExpr());
13531 return getDerived().RebuildUnaryExprOrTypeTrait(
13532 RecoveryTSI, E->getOperatorLoc(), E->getKind(), E->getSourceRange());
13533 }
else if (SubExpr.isInvalid())
13536 if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getArgumentExpr())
13539 return getDerived().RebuildUnaryExprOrTypeTrait(SubExpr.get(),
13540 E->getOperatorLoc(),
13542 E->getSourceRange());
13545template<
typename Derived>
13548 ExprResult LHS = getDerived().TransformExpr(E->getLHS());
13549 if (LHS.isInvalid())
13552 ExprResult RHS = getDerived().TransformExpr(E->getRHS());
13553 if (RHS.isInvalid())
13557 if (!getDerived().AlwaysRebuild() &&
13558 LHS.get() == E->getLHS() &&
13559 RHS.get() == E->getRHS())
13562 return getDerived().RebuildArraySubscriptExpr(
13564 E->getLHS()->getBeginLoc(), RHS.get(), E->getRBracketLoc());
13567template <
typename Derived>
13571 if (
Base.isInvalid())
13574 ExprResult RowIdx = getDerived().TransformExpr(E->getRowIdx());
13575 if (RowIdx.isInvalid())
13578 if (!getDerived().AlwaysRebuild() &&
Base.get() == E->getBase() &&
13579 RowIdx.get() == E->getRowIdx())
13582 return getDerived().RebuildMatrixSingleSubscriptExpr(
Base.get(), RowIdx.get(),
13583 E->getRBracketLoc());
13586template <
typename Derived>
13590 if (
Base.isInvalid())
13593 ExprResult RowIdx = getDerived().TransformExpr(E->getRowIdx());
13594 if (RowIdx.isInvalid())
13597 ExprResult ColumnIdx = getDerived().TransformExpr(E->getColumnIdx());
13598 if (ColumnIdx.isInvalid())
13601 if (!getDerived().AlwaysRebuild() &&
Base.get() == E->getBase() &&
13602 RowIdx.get() == E->getRowIdx() && ColumnIdx.get() == E->getColumnIdx())
13605 return getDerived().RebuildMatrixSubscriptExpr(
13606 Base.get(), RowIdx.get(), ColumnIdx.get(), E->getRBracketLoc());
13609template <
typename Derived>
13613 if (
Base.isInvalid())
13617 if (E->getLowerBound()) {
13618 LowerBound = getDerived().TransformExpr(E->getLowerBound());
13619 if (LowerBound.isInvalid())
13624 if (E->getLength()) {
13625 Length = getDerived().TransformExpr(E->getLength());
13626 if (Length.isInvalid())
13631 if (E->isOMPArraySection()) {
13632 if (
Expr *Str = E->getStride()) {
13633 Stride = getDerived().TransformExpr(Str);
13634 if (Stride.isInvalid())
13639 if (!getDerived().AlwaysRebuild() &&
Base.get() == E->getBase() &&
13640 LowerBound.get() == E->getLowerBound() &&
13641 Length.get() == E->getLength() &&
13642 (E->isOpenACCArraySection() || Stride.get() == E->getStride()))
13645 return getDerived().RebuildArraySectionExpr(
13646 E->isOMPArraySection(),
Base.get(), E->getBase()->getEndLoc(),
13647 LowerBound.get(), E->getColonLocFirst(),
13648 E->isOMPArraySection() ? E->getColonLocSecond() :
SourceLocation{},
13649 Length.get(), Stride.get(), E->getRBracketLoc());
13652template <
typename Derived>
13656 if (
Base.isInvalid())
13660 bool ErrorFound =
false;
13661 for (
Expr *
Dim : E->getDimensions()) {
13663 if (DimRes.isInvalid()) {
13667 Dims.push_back(DimRes.get());
13672 return getDerived().RebuildOMPArrayShapingExpr(
Base.get(), E->getLParenLoc(),
13673 E->getRParenLoc(), Dims,
13674 E->getBracketsRanges());
13677template <
typename Derived>
13680 unsigned NumIterators = E->numOfIterators();
13683 bool ErrorFound =
false;
13684 bool NeedToRebuild = getDerived().AlwaysRebuild();
13685 for (
unsigned I = 0; I < NumIterators; ++I) {
13687 Data[I].DeclIdent = D->getIdentifier();
13688 Data[I].DeclIdentLoc = D->getLocation();
13689 if (D->getLocation() == D->getBeginLoc()) {
13691 "Implicit type must be int.");
13693 TypeSourceInfo *TSI = getDerived().TransformType(D->getTypeSourceInfo());
13701 ErrorFound = ErrorFound ||
13702 !(!D->getTypeSourceInfo() || (
Data[I].
Type.getAsOpaquePtr() &&
13703 !
Data[I].Type.get().isNull())) ||
13704 Begin.isInvalid() || End.isInvalid() || Step.isInvalid();
13707 Data[I].Range.Begin = Begin.get();
13708 Data[I].Range.End = End.get();
13709 Data[I].Range.Step = Step.get();
13710 Data[I].AssignLoc = E->getAssignLoc(I);
13711 Data[I].ColonLoc = E->getColonLoc(I);
13712 Data[I].SecColonLoc = E->getSecondColonLoc(I);
13715 (D->getTypeSourceInfo() &&
Data[I].
Type.get().getTypePtrOrNull() !=
13716 D->getType().getTypePtrOrNull()) ||
13722 if (!NeedToRebuild)
13725 ExprResult Res = getDerived().RebuildOMPIteratorExpr(
13726 E->getIteratorKwLoc(), E->getLParenLoc(), E->getRParenLoc(),
Data);
13727 if (!Res.isUsable())
13730 for (
unsigned I = 0; I < NumIterators; ++I)
13731 getDerived().transformedLocalDecl(E->getIteratorDecl(I),
13732 IE->getIteratorDecl(I));
13736template<
typename Derived>
13745 bool ArgChanged =
false;
13747 if (getDerived().TransformExprs(E->getArgs(), E->getNumArgs(),
true, Args,
13751 if (!getDerived().AlwaysRebuild() &&
13752 Callee.get() == E->getCallee() &&
13758 = ((
Expr *)
Callee.get())->getSourceRange().getBegin();
13761 if (E->hasStoredFPFeatures()) {
13763 getSema().CurFPFeatures =
13765 getSema().FpPragmaStack.CurrentValue = NewOverrides;
13768 return getDerived().RebuildCallExpr(
Callee.get(), FakeLParenLoc,
13770 E->getRParenLoc());
13773template<
typename Derived>
13777 if (
Base.isInvalid())
13781 if (E->hasQualifier()) {
13783 = getDerived().TransformNestedNameSpecifierLoc(E->getQualifierLoc());
13791 = cast_or_null<ValueDecl>(getDerived().TransformDecl(E->getMemberLoc(),
13792 E->getMemberDecl()));
13796 NamedDecl *FoundDecl = E->getFoundDecl();
13797 if (FoundDecl == E->getMemberDecl()) {
13800 FoundDecl = cast_or_null<NamedDecl>(
13801 getDerived().TransformDecl(E->getMemberLoc(), FoundDecl));
13806 if (!getDerived().AlwaysRebuild() &&
13807 Base.get() == E->getBase() &&
13808 QualifierLoc == E->getQualifierLoc() &&
13809 Member == E->getMemberDecl() &&
13810 FoundDecl == E->getFoundDecl() &&
13811 !E->hasExplicitTemplateArgs()) {
13816 getSema().OpenMP().isOpenMPRebuildMemberExpr(
13826 if (E->hasExplicitTemplateArgs()) {
13827 TransArgs.setLAngleLoc(E->getLAngleLoc());
13828 TransArgs.setRAngleLoc(E->getRAngleLoc());
13829 if (getDerived().TransformTemplateArguments(E->getTemplateArgs(),
13830 E->getNumTemplateArgs(),
13843 NamedDecl *FirstQualifierInScope =
nullptr;
13845 if (MemberNameInfo.getName()) {
13846 MemberNameInfo = getDerived().TransformDeclarationNameInfo(MemberNameInfo);
13847 if (!MemberNameInfo.getName())
13851 return getDerived().RebuildMemberExpr(
Base.get(), FakeOperatorLoc,
13858 (E->hasExplicitTemplateArgs()
13859 ? &TransArgs :
nullptr),
13860 FirstQualifierInScope);
13863template<
typename Derived>
13866 ExprResult LHS = getDerived().TransformExpr(E->getLHS());
13867 if (LHS.isInvalid())
13871 getDerived().TransformInitializer(E->getRHS(),
false);
13872 if (RHS.isInvalid())
13875 if (!getDerived().AlwaysRebuild() &&
13876 LHS.get() == E->getLHS() &&
13877 RHS.get() == E->getRHS())
13880 if (E->isCompoundAssignmentOp())
13882 return getDerived().RebuildBinaryOperator(
13883 E->getOperatorLoc(), E->getOpcode(), LHS.get(), RHS.get());
13886 getSema().CurFPFeatures =
13887 NewOverrides.applyOverrides(getSema().getLangOpts());
13888 getSema().FpPragmaStack.CurrentValue = NewOverrides;
13889 return getDerived().RebuildBinaryOperator(E->getOperatorLoc(), E->getOpcode(),
13890 LHS.get(), RHS.get());
13893template <
typename Derived>
13898 ExprResult LHS = getDerived().TransformExpr(
const_cast<Expr*
>(Decomp.LHS));
13899 if (LHS.isInvalid())
13902 ExprResult RHS = getDerived().TransformExpr(
const_cast<Expr*
>(Decomp.RHS));
13903 if (RHS.isInvalid())
13909 bool ChangedAnyLookups =
false;
13910 Expr *PossibleBinOps[] = {E->getSemanticForm(),
13911 const_cast<Expr *
>(Decomp.InnerBinOp)};
13912 for (
Expr *PossibleBinOp : PossibleBinOps) {
13913 auto *Op = dyn_cast<CXXOperatorCallExpr>(PossibleBinOp->IgnoreImplicit());
13916 auto *
Callee = dyn_cast<DeclRefExpr>(Op->getCallee()->IgnoreImplicit());
13922 NamedDecl *
Found = cast_or_null<NamedDecl>(getDerived().TransformDecl(
13923 E->getOperatorLoc(),
Callee->getFoundDecl()));
13927 ChangedAnyLookups =
true;
13928 UnqualLookups.addDecl(
Found);
13931 if (!getDerived().AlwaysRebuild() && !ChangedAnyLookups &&
13932 LHS.get() == Decomp.LHS && RHS.get() == Decomp.RHS) {
13938 const Expr *StopAt[] = {Decomp.LHS, Decomp.RHS};
13943 return getDerived().RebuildCXXRewrittenBinaryOperator(
13944 E->getOperatorLoc(), Decomp.Opcode, UnqualLookups, LHS.get(), RHS.get());
13947template<
typename Derived>
13953 getSema().CurFPFeatures =
13954 NewOverrides.applyOverrides(getSema().getLangOpts());
13955 getSema().FpPragmaStack.CurrentValue = NewOverrides;
13956 return getDerived().TransformBinaryOperator(E);
13959template<
typename Derived>
13965 ExprResult commonExpr = getDerived().TransformExpr(e->getCommon());
13966 if (commonExpr.isInvalid())
13969 ExprResult rhs = getDerived().TransformExpr(e->getFalseExpr());
13970 if (rhs.isInvalid())
13973 if (!getDerived().AlwaysRebuild() &&
13974 commonExpr.get() == e->getCommon() &&
13975 rhs.get() == e->getFalseExpr())
13978 return getDerived().RebuildConditionalOperator(commonExpr.get(),
13979 e->getQuestionLoc(),
13985template<
typename Derived>
13989 if (
Cond.isInvalid())
13992 ExprResult LHS = getDerived().TransformExpr(E->getLHS());
13993 if (LHS.isInvalid())
13996 ExprResult RHS = getDerived().TransformExpr(E->getRHS());
13997 if (RHS.isInvalid())
14000 if (!getDerived().AlwaysRebuild() &&
14001 Cond.get() == E->getCond() &&
14002 LHS.get() == E->getLHS() &&
14003 RHS.get() == E->getRHS())
14006 return getDerived().RebuildConditionalOperator(
Cond.get(),
14007 E->getQuestionLoc(),
14013template<
typename Derived>
14018 return getDerived().
TransformExpr(E->getSubExprAsWritten());
14021template<
typename Derived>
14029 = getDerived().TransformExpr(E->getSubExprAsWritten());
14030 if (SubExpr.isInvalid())
14033 if (!getDerived().AlwaysRebuild() &&
14034 Type == E->getTypeInfoAsWritten() &&
14035 SubExpr.get() == E->getSubExpr())
14038 return getDerived().RebuildCStyleCastExpr(E->getLParenLoc(),
14044template<
typename Derived>
14052 ExprResult Init = getDerived().TransformExpr(E->getInitializer());
14053 if (
Init.isInvalid())
14056 if (!getDerived().AlwaysRebuild() &&
14058 Init.get() == E->getInitializer())
14065 return getDerived().RebuildCompoundLiteralExpr(
14066 E->getLParenLoc(), NewT,
14067 E->getInitializer()->getEndLoc(),
Init.get());
14070template<
typename Derived>
14074 if (
Base.isInvalid())
14077 if (!getDerived().AlwaysRebuild() &&
14078 Base.get() == E->getBase())
14084 return getDerived().RebuildExtVectorOrMatrixElementExpr(
14085 Base.get(), FakeOperatorLoc, E->isArrow(), E->getAccessorLoc(),
14089template <
typename Derived>
14093 if (
Base.isInvalid())
14096 if (!getDerived().AlwaysRebuild() &&
Base.get() == E->getBase())
14102 return getDerived().RebuildExtVectorOrMatrixElementExpr(
14103 Base.get(), FakeOperatorLoc,
false, E->getAccessorLoc(),
14107template<
typename Derived>
14113 bool InitChanged =
false;
14119 if (getDerived().TransformExprs(E->getInits(), E->getNumInits(),
false,
14120 Inits, &InitChanged))
14123 if (!getDerived().AlwaysRebuild() && !InitChanged) {
14130 return getDerived().RebuildInitList(E->getLBraceLoc(),
Inits,
14131 E->getRBraceLoc(), E->isExplicit());
14134template<
typename Derived>
14141 if (
Init.isInvalid())
14146 bool ExprChanged =
false;
14148 if (D.isFieldDesignator()) {
14149 if (D.getFieldDecl()) {
14151 getDerived().TransformDecl(D.getFieldLoc(), D.getFieldDecl()));
14152 if (Field != D.getFieldDecl())
14155 ExprChanged =
true;
14156 if (
Field->isAnonymousStructOrUnion())
14162 ExprChanged =
true;
14165 D.getFieldName(), D.getDotLoc(), D.getFieldLoc()));
14169 if (D.isArrayDesignator()) {
14170 ExprResult Index = getDerived().TransformExpr(E->getArrayIndex(D));
14171 if (Index.isInvalid())
14174 Desig.AddDesignator(
14177 ExprChanged = ExprChanged || Index.get() != E->getArrayIndex(D);
14178 ArrayExprs.push_back(Index.get());
14182 assert(D.isArrayRangeDesignator() &&
"New kind of designator?");
14184 = getDerived().TransformExpr(E->getArrayRangeStart(D));
14185 if (Start.isInvalid())
14188 ExprResult End = getDerived().TransformExpr(E->getArrayRangeEnd(D));
14189 if (End.isInvalid())
14193 Start.get(), End.get(), D.getLBracketLoc(), D.getEllipsisLoc()));
14195 ExprChanged = ExprChanged || Start.get() != E->getArrayRangeStart(D) ||
14196 End.get() != E->getArrayRangeEnd(D);
14198 ArrayExprs.push_back(Start.get());
14199 ArrayExprs.push_back(End.get());
14202 if (!getDerived().AlwaysRebuild() &&
14203 Init.get() == E->getInit() &&
14207 return getDerived().RebuildDesignatedInitExpr(Desig, ArrayExprs,
14208 E->getEqualOrColonLoc(),
14209 E->usesGNUSyntax(),
Init.get());
14214template<
typename Derived>
14218 llvm_unreachable(
"Unexpected DesignatedInitUpdateExpr in syntactic form of "
14223template<
typename Derived>
14227 llvm_unreachable(
"Unexpected NoInitExpr in syntactic form of initializer");
14231template<
typename Derived>
14234 llvm_unreachable(
"Unexpected ArrayInitLoopExpr outside of initializer");
14238template<
typename Derived>
14241 llvm_unreachable(
"Unexpected ArrayInitIndexExpr outside of initializer");
14245template<
typename Derived>
14253 QualType T = getDerived().TransformType(E->getType());
14257 if (!getDerived().AlwaysRebuild() &&
14261 return getDerived().RebuildImplicitValueInitExpr(T);
14264template<
typename Derived>
14267 TypeSourceInfo *TInfo = getDerived().TransformType(E->getWrittenTypeInfo());
14271 ExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
14272 if (SubExpr.isInvalid())
14275 if (!getDerived().AlwaysRebuild() &&
14276 TInfo == E->getWrittenTypeInfo() &&
14277 SubExpr.get() == E->getSubExpr())
14280 return getDerived().RebuildVAArgExpr(E->getBuiltinLoc(), SubExpr.get(),
14281 TInfo, E->getRParenLoc());
14284template<
typename Derived>
14287 bool ArgumentChanged =
false;
14289 if (TransformExprs(E->getExprs(), E->getNumExprs(),
true,
Inits,
14293 return getDerived().RebuildParenListExpr(E->getLParenLoc(),
14295 E->getRParenLoc());
14303template<
typename Derived>
14306 Decl *LD = getDerived().TransformDecl(E->getLabel()->getLocation(),
14311 return getDerived().RebuildAddrLabelExpr(E->getAmpAmpLoc(), E->getLabelLoc(),
14315template<
typename Derived>
14320 = getDerived().TransformCompoundStmt(E->getSubStmt(),
true);
14321 if (SubStmt.isInvalid()) {
14326 unsigned OldDepth = E->getTemplateDepth();
14327 unsigned NewDepth = getDerived().TransformTemplateDepth(OldDepth);
14329 if (!getDerived().AlwaysRebuild() && OldDepth == NewDepth &&
14330 SubStmt.get() == E->getSubStmt()) {
14336 return getDerived().RebuildStmtExpr(E->getLParenLoc(), SubStmt.get(),
14337 E->getRParenLoc(), NewDepth);
14340template<
typename Derived>
14344 if (
Cond.isInvalid())
14347 ExprResult LHS = getDerived().TransformExpr(E->getLHS());
14348 if (LHS.isInvalid())
14351 ExprResult RHS = getDerived().TransformExpr(E->getRHS());
14352 if (RHS.isInvalid())
14355 if (!getDerived().AlwaysRebuild() &&
14356 Cond.get() == E->getCond() &&
14357 LHS.get() == E->getLHS() &&
14358 RHS.get() == E->getRHS())
14361 return getDerived().RebuildChooseExpr(E->getBuiltinLoc(),
14362 Cond.get(), LHS.get(), RHS.get(),
14363 E->getRParenLoc());
14366template<
typename Derived>
14372template<
typename Derived>
14375 switch (E->getOperator()) {
14379 case OO_Array_Delete:
14380 llvm_unreachable(
"new and delete operators cannot use CXXOperatorCallExpr");
14385 assert(E->getNumArgs() >= 1 &&
"Object call is missing arguments");
14398 if (FakeLParenLoc.isInvalid() && EndLoc.isValid())
14399 FakeLParenLoc = EndLoc;
14403 if (getDerived().TransformExprs(E->getArgs() + 1, E->getNumArgs() - 1,
true,
14407 if (E->getOperator() == OO_Subscript)
14408 return getDerived().RebuildCxxSubscriptExpr(
Object.get(), FakeLParenLoc,
14409 Args, E->getEndLoc());
14411 return getDerived().RebuildCallExpr(
Object.get(), FakeLParenLoc, Args,
14415#define OVERLOADED_OPERATOR(Name, Spelling, Token, Unary, Binary, MemberOnly) \
14419#define OVERLOADED_OPERATOR_MULTI(Name,Spelling,Unary,Binary,MemberOnly)
14420#include "clang/Basic/OperatorKinds.def"
14422 case OO_Conditional:
14423 llvm_unreachable(
"conditional operator is not actually overloadable");
14427 llvm_unreachable(
"not an overloaded operator?");
14431 if (E->getNumArgs() == 1 && E->getOperator() == OO_Amp)
14432 First = getDerived().TransformAddressOfOperand(E->getArg(0));
14434 First = getDerived().TransformExpr(E->getArg(0));
14435 if (
First.isInvalid())
14439 if (E->getNumArgs() == 2) {
14441 getDerived().TransformInitializer(E->getArg(1),
false);
14442 if (Second.isInvalid())
14448 getSema().CurFPFeatures =
14449 NewOverrides.applyOverrides(getSema().getLangOpts());
14450 getSema().FpPragmaStack.CurrentValue = NewOverrides;
14456 if (getDerived().TransformOverloadExprDecls(ULE, ULE->requiresADL(), R))
14459 return getDerived().RebuildCXXOperatorCallExpr(
14460 E->getOperator(), E->getOperatorLoc(),
Callee->getBeginLoc(),
14461 ULE->requiresADL(),
R.asUnresolvedSet(),
First.get(), Second.get());
14466 Callee = ICE->getSubExprAsWritten();
14468 ValueDecl *VD = cast_or_null<ValueDecl>(
14469 getDerived().TransformDecl(DR->getLocation(), DR));
14474 Functions.addDecl(VD);
14476 return getDerived().RebuildCXXOperatorCallExpr(
14477 E->getOperator(), E->getOperatorLoc(),
Callee->getBeginLoc(),
14478 false, Functions,
First.get(), Second.get());
14481template<
typename Derived>
14484 return getDerived().TransformCallExpr(E);
14487template <
typename Derived>
14490 getSema().CurContext != E->getParentContext();
14492 if (!getDerived().AlwaysRebuild() && !NeedRebuildFunc)
14495 return getDerived().RebuildSourceLocExpr(E->getIdentKind(), E->getType(),
14496 E->getBeginLoc(), E->getEndLoc(),
14497 getSema().CurContext);
14500template <
typename Derived>
14505template<
typename Derived>
14514 ExprResult EC = getDerived().TransformCallExpr(E->getConfig());
14515 if (EC.isInvalid())
14519 bool ArgChanged =
false;
14521 if (getDerived().TransformExprs(E->getArgs(), E->getNumArgs(),
true, Args,
14525 if (!getDerived().AlwaysRebuild() &&
14526 Callee.get() == E->getCallee() &&
14532 = ((
Expr *)
Callee.get())->getSourceRange().getBegin();
14533 return getDerived().RebuildCallExpr(
Callee.get(), FakeLParenLoc,
14535 E->getRParenLoc(), EC.get());
14538template<
typename Derived>
14554 return getDerived().RebuildCXXNamedCastExpr(
14561template<
typename Derived>
14570 if (Sub.isInvalid())
14573 return getDerived().RebuildBuiltinBitCastExpr(BCE->
getBeginLoc(), TSI,
14577template<
typename Derived>
14579TreeTransform<Derived>::TransformCXXStaticCastExpr(CXXStaticCastExpr *E) {
14580 return getDerived().TransformCXXNamedCastExpr(E);
14583template<
typename Derived>
14589template<
typename Derived>
14596template<
typename Derived>
14602template<
typename Derived>
14608template<
typename Derived>
14613 getDerived().TransformTypeWithDeducedTST(E->getTypeInfoAsWritten());
14618 = getDerived().TransformExpr(E->getSubExprAsWritten());
14619 if (SubExpr.isInvalid())
14622 if (!getDerived().AlwaysRebuild() &&
14623 Type == E->getTypeInfoAsWritten() &&
14624 SubExpr.get() == E->getSubExpr())
14627 return getDerived().RebuildCXXFunctionalCastExpr(
Type,
14631 E->isListInitialization());
14634template<
typename Derived>
14637 if (E->isTypeOperand()) {
14639 = getDerived().TransformType(E->getTypeOperandSourceInfo());
14643 if (!getDerived().AlwaysRebuild() &&
14644 TInfo == E->getTypeOperandSourceInfo())
14647 return getDerived().RebuildCXXTypeidExpr(E->getType(), E->getBeginLoc(),
14648 TInfo, E->getEndLoc());
14654 Expr *Op = E->getExprOperand();
14656 if (E->isGLValue()) {
14658 if (
auto *RD = OpType->getAsCXXRecordDecl()) {
14660 diag::err_incomplete_typeid))
14663 if (RD->isPolymorphic())
14671 ExprResult SubExpr = getDerived().TransformExpr(Op);
14672 if (SubExpr.isInvalid())
14675 if (!getDerived().AlwaysRebuild() &&
14676 SubExpr.get() == E->getExprOperand())
14679 return getDerived().RebuildCXXTypeidExpr(E->getType(), E->getBeginLoc(),
14680 SubExpr.get(), E->getEndLoc());
14683template<
typename Derived>
14686 if (E->isTypeOperand()) {
14688 = getDerived().TransformType(E->getTypeOperandSourceInfo());
14692 if (!getDerived().AlwaysRebuild() &&
14693 TInfo == E->getTypeOperandSourceInfo())
14696 return getDerived().RebuildCXXUuidofExpr(E->getType(), E->getBeginLoc(),
14697 TInfo, E->getEndLoc());
14703 ExprResult SubExpr = getDerived().TransformExpr(E->getExprOperand());
14704 if (SubExpr.isInvalid())
14707 if (!getDerived().AlwaysRebuild() &&
14708 SubExpr.get() == E->getExprOperand())
14711 return getDerived().RebuildCXXUuidofExpr(E->getType(), E->getBeginLoc(),
14712 SubExpr.get(), E->getEndLoc());
14715template<
typename Derived>
14721template<
typename Derived>
14728template<
typename Derived>
14744 auto &S = getSema();
14745 if (E->isCapturedByCopyInLambdaWithExplicitObjectParameter())
14746 return S.getCurrentThisType();
14747 if (S.getCurLambda())
14748 return getDerived().TransformType(E->getType());
14749 return S.getCurrentThisType();
14752 if (!getDerived().AlwaysRebuild() && T == E->getType() &&
14753 !E->isCapturedByCopyInLambdaWithExplicitObjectParameter()) {
14756 getSema().MarkThisReferenced(E);
14760 return getDerived().RebuildCXXThisExpr(E->getBeginLoc(), T, E->isImplicit());
14763template<
typename Derived>
14766 ExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
14767 if (SubExpr.isInvalid())
14770 getSema().DiagnoseExceptionUse(E->getThrowLoc(),
false);
14772 if (!getDerived().AlwaysRebuild() &&
14773 SubExpr.get() == E->getSubExpr())
14776 return getDerived().RebuildCXXThrowExpr(E->getThrowLoc(), SubExpr.get(),
14777 E->isThrownVariableInScope());
14780template<
typename Derived>
14784 getDerived().TransformDecl(E->getBeginLoc(), E->getParam()));
14789 if (E->hasRewrittenInit()) {
14790 InitRes = getDerived().TransformExpr(E->getRewrittenExpr());
14791 if (InitRes.isInvalid())
14795 if (!getDerived().AlwaysRebuild() && Param == E->getParam() &&
14796 E->getUsedContext() == SemaRef.
CurContext &&
14797 InitRes.get() == E->getRewrittenExpr())
14800 return getDerived().RebuildCXXDefaultArgExpr(E->getUsedLocation(), Param,
14804template<
typename Derived>
14808 getDerived().TransformDecl(E->getBeginLoc(), E->getField()));
14812 if (!getDerived().AlwaysRebuild() && Field == E->getField() &&
14816 return getDerived().RebuildCXXDefaultInitExpr(E->getExprLoc(), Field);
14819template<
typename Derived>
14823 TypeSourceInfo *T = getDerived().TransformType(E->getTypeSourceInfo());
14827 if (!getDerived().AlwaysRebuild() &&
14828 T == E->getTypeSourceInfo())
14831 return getDerived().RebuildCXXScalarValueInitExpr(T,
14832 T->getTypeLoc().getEndLoc(),
14833 E->getRParenLoc());
14836template<
typename Derived>
14841 getDerived().TransformTypeWithDeducedTST(E->getAllocatedTypeSourceInfo());
14842 if (!AllocTypeInfo)
14846 std::optional<Expr *> ArraySize;
14847 if (E->isArray()) {
14849 if (std::optional<Expr *> OldArraySize = E->getArraySize()) {
14850 NewArraySize = getDerived().TransformExpr(*OldArraySize);
14851 if (NewArraySize.isInvalid())
14854 ArraySize = NewArraySize.get();
14858 bool ArgumentChanged =
false;
14860 if (getDerived().TransformExprs(E->getPlacementArgs(),
14861 E->getNumPlacementArgs(),
true,
14862 PlacementArgs, &ArgumentChanged))
14866 Expr *OldInit = E->getInitializer();
14869 NewInit = getDerived().TransformInitializer(OldInit,
true);
14870 if (NewInit.isInvalid())
14875 if (E->getOperatorNew()) {
14876 OperatorNew = cast_or_null<FunctionDecl>(
14877 getDerived().TransformDecl(E->getBeginLoc(), E->getOperatorNew()));
14883 if (E->getOperatorDelete()) {
14884 OperatorDelete = cast_or_null<FunctionDecl>(
14885 getDerived().TransformDecl(E->getBeginLoc(), E->getOperatorDelete()));
14886 if (!OperatorDelete)
14890 if (!getDerived().AlwaysRebuild() &&
14891 AllocTypeInfo == E->getAllocatedTypeSourceInfo() &&
14892 ArraySize == E->getArraySize() &&
14893 NewInit.get() == OldInit &&
14894 OperatorNew == E->getOperatorNew() &&
14895 OperatorDelete == E->getOperatorDelete() &&
14896 !ArgumentChanged) {
14901 if (OperatorDelete)
14904 if (E->isArray() && !E->getAllocatedType()->isDependentType()) {
14916 QualType AllocType = AllocTypeInfo->getType();
14927 = dyn_cast<ConstantArrayType>(ArrayT)) {
14931 AllocType = ConsArrayT->getElementType();
14933 = dyn_cast<DependentSizedArrayType>(ArrayT)) {
14934 if (DepArrayT->getSizeExpr()) {
14935 ArraySize = DepArrayT->getSizeExpr();
14936 AllocType = DepArrayT->getElementType();
14941 return getDerived().RebuildCXXNewExpr(
14942 E->getBeginLoc(), E->isGlobalNew(),
14943 E->getBeginLoc(), PlacementArgs,
14944 E->getBeginLoc(), E->getTypeIdParens(), AllocType,
14945 AllocTypeInfo, ArraySize, E->getDirectInitRange(), NewInit.get());
14948template<
typename Derived>
14957 if (E->getOperatorDelete()) {
14958 OperatorDelete = cast_or_null<FunctionDecl>(
14959 getDerived().TransformDecl(E->getBeginLoc(), E->getOperatorDelete()));
14960 if (!OperatorDelete)
14964 if (!getDerived().AlwaysRebuild() &&
14965 Operand.get() == E->getArgument() &&
14966 OperatorDelete == E->getOperatorDelete()) {
14969 if (OperatorDelete)
14972 if (!E->getArgument()->isTypeDependent()) {
14974 E->getDestroyedType());
14983 return getDerived().RebuildCXXDeleteExpr(
14984 E->getBeginLoc(), E->isGlobalDelete(), E->isArrayForm(),
Operand.get());
14987template<
typename Derived>
14992 if (
Base.isInvalid())
14996 bool MayBePseudoDestructor =
false;
14998 E->getOperatorLoc(),
14999 E->isArrow()? tok::arrow : tok::period,
15001 MayBePseudoDestructor);
15002 if (
Base.isInvalid())
15005 QualType ObjectType = ObjectTypePtr.get();
15007 if (QualifierLoc) {
15009 = getDerived().TransformNestedNameSpecifierLoc(QualifierLoc, ObjectType);
15014 SS.
Adopt(QualifierLoc);
15017 if (E->getDestroyedTypeInfo()) {
15018 TypeSourceInfo *DestroyedTypeInfo = getDerived().TransformTypeInObjectScope(
15019 E->getDestroyedTypeInfo(), ObjectType,
15021 if (!DestroyedTypeInfo)
15024 }
else if (!ObjectType.isNull() && ObjectType->isDependentType()) {
15028 E->getDestroyedTypeLoc());
15032 *E->getDestroyedTypeIdentifier(), E->getDestroyedTypeLoc(),
15033 nullptr, SS, ObjectTypePtr,
false);
15039 E->getDestroyedTypeLoc());
15043 if (E->getScopeTypeInfo()) {
15044 ScopeTypeInfo = getDerived().TransformTypeInObjectScope(
15045 E->getScopeTypeInfo(), ObjectType,
nullptr);
15046 if (!ScopeTypeInfo)
15050 return getDerived().RebuildCXXPseudoDestructorExpr(
Base.get(),
15051 E->getOperatorLoc(),
15055 E->getColonColonLoc(),
15060template <
typename Derived>
15065 bool AllEmptyPacks =
true;
15066 for (
auto *OldD : Old->
decls()) {
15082 if (
auto *UPD = dyn_cast<UsingPackDecl>(InstD))
15083 Decls = UPD->expansions();
15086 for (
auto *D : Decls) {
15087 if (
auto *UD = dyn_cast<UsingDecl>(D)) {
15088 for (
auto *SD : UD->shadows())
15095 AllEmptyPacks &= Decls.empty();
15104 if (AllEmptyPacks && !RequiresADL) {
15115 NamedDecl *FoundDecl = R.getRepresentativeDecl()->getUnderlyingDecl();
15116 getSema().FilterAcceptableTemplateNames(R,
15122 getSema().Diag(R.getNameLoc(),
15123 diag::err_template_kw_refers_to_non_template)
15127 diag::note_template_kw_refers_to_non_template)
15128 << R.getLookupName();
15136template <
typename Derived>
15142template <
typename Derived>
15145 bool IsAddressOfOperand) {
15150 if (TransformOverloadExprDecls(Old, Old->
requiresADL(), R))
15157 = getDerived().TransformNestedNameSpecifierLoc(Old->
getQualifierLoc());
15161 SS.
Adopt(QualifierLoc);
15165 CXXRecordDecl *NamingClass
15166 = cast_or_null<CXXRecordDecl>(getDerived().TransformDecl(
15169 if (!NamingClass) {
15174 R.setNamingClass(NamingClass);
15195 SS, TemplateKWLoc, R,
15202 return getDerived().RebuildDeclarationNameExpr(SS, R, Old->
requiresADL());
15205 return getDerived().RebuildTemplateIdExpr(SS, TemplateKWLoc, R,
15209template<
typename Derived>
15212 bool ArgChanged =
false;
15214 for (
unsigned I = 0, N = E->getNumArgs(); I != N; ++I) {
15216 TypeLoc FromTL = From->getTypeLoc();
15219 TLB.
reserve(FromTL.getFullDataSize());
15220 QualType To = getDerived().TransformType(TLB, FromTL);
15224 if (To == From->getType())
15225 Args.push_back(From);
15227 Args.push_back(TLB.getTypeSourceInfo(SemaRef.
Context, To));
15237 TypeLoc PatternTL = ExpansionTL.getPatternLoc();
15243 bool Expand =
true;
15244 bool RetainExpansion =
false;
15246 ExpansionTL.getTypePtr()->getNumExpansions();
15248 if (getDerived().TryExpandParameterPacks(
15249 ExpansionTL.getEllipsisLoc(), PatternTL.getSourceRange(),
15250 Unexpanded,
true, Expand,
15251 RetainExpansion, NumExpansions))
15261 TLB.
reserve(From->getTypeLoc().getFullDataSize());
15263 QualType To = getDerived().TransformType(TLB, PatternTL);
15267 To = getDerived().RebuildPackExpansionType(To,
15268 PatternTL.getSourceRange(),
15269 ExpansionTL.getEllipsisLoc(),
15277 Args.push_back(TLB.getTypeSourceInfo(SemaRef.
Context, To));
15283 for (
unsigned I = 0; I != *NumExpansions; ++I) {
15286 TLB.
reserve(PatternTL.getFullDataSize());
15287 QualType To = getDerived().TransformType(TLB, PatternTL);
15291 if (To->containsUnexpandedParameterPack()) {
15292 To = getDerived().RebuildPackExpansionType(To,
15293 PatternTL.getSourceRange(),
15294 ExpansionTL.getEllipsisLoc(),
15304 Args.push_back(TLB.getTypeSourceInfo(SemaRef.
Context, To));
15307 if (!RetainExpansion)
15312 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
15315 TLB.
reserve(From->getTypeLoc().getFullDataSize());
15317 QualType To = getDerived().TransformType(TLB, PatternTL);
15321 To = getDerived().RebuildPackExpansionType(To,
15322 PatternTL.getSourceRange(),
15323 ExpansionTL.getEllipsisLoc(),
15331 Args.push_back(TLB.getTypeSourceInfo(SemaRef.
Context, To));
15334 if (!getDerived().AlwaysRebuild() && !ArgChanged)
15337 return getDerived().RebuildTypeTrait(E->getTrait(), E->getBeginLoc(), Args,
15341template<
typename Derived>
15347 if (getDerived().TransformTemplateArguments(Old->getTemplateArgs(),
15348 Old->NumTemplateArgs, TransArgs))
15351 return getDerived().RebuildConceptSpecializationExpr(
15352 E->getNestedNameSpecifierLoc(), E->getTemplateKWLoc(),
15353 E->getConceptNameInfo(), E->getFoundDecl(), E->getNamedConcept(),
15357template<
typename Derived>
15371 getSema().Context, getSema().CurContext,
15372 E->getBody()->getBeginLoc());
15376 ExprResult TypeParamResult = getDerived().TransformRequiresTypeParams(
15377 E->getRequiresKWLoc(), E->getRBraceLoc(), E, Body,
15378 E->getLocalParameters(), TransParamTypes, TransParams, ExtParamInfos);
15382 Param->setDeclContext(Body);
15388 if (!TypeParamResult.isUnset())
15389 return TypeParamResult;
15392 if (getDerived().TransformRequiresExprRequirements(E->getRequirements(),
15397 if (
auto *ER = dyn_cast<concepts::ExprRequirement>(Req)) {
15398 if (ER->getReturnTypeRequirement().isTypeConstraint()) {
15399 ER->getReturnTypeRequirement()
15400 .getTypeConstraintTemplateParameterList()->getParam(0)
15401 ->setDeclContext(Body);
15406 return getDerived().RebuildRequiresExpr(
15407 E->getRequiresKWLoc(), Body, E->getLParenLoc(), TransParams,
15408 E->getRParenLoc(), TransReqs, E->getRBraceLoc());
15411template<
typename Derived>
15417 if (
auto *TypeReq = dyn_cast<concepts::TypeRequirement>(Req))
15418 TransReq =
getDerived().TransformTypeRequirement(TypeReq);
15419 else if (
auto *ExprReq = dyn_cast<concepts::ExprRequirement>(Req))
15420 TransReq =
getDerived().TransformExprRequirement(ExprReq);
15422 TransReq =
getDerived().TransformNestedRequirement(
15426 Transformed.push_back(TransReq);
15431template<
typename Derived>
15444 return getDerived().RebuildTypeRequirement(TransType);
15447template<
typename Derived>
15450 llvm::PointerUnion<Expr *, concepts::Requirement::SubstitutionDiagnostic *> TransExpr;
15456 TransExprRes =
SemaRef.CheckPlaceholderExpr(TransExprRes.
get());
15459 TransExpr = TransExprRes.
get();
15462 std::optional<concepts::ExprRequirement::ReturnTypeRequirement> TransRetReq;
15464 if (RetReq.isEmpty())
15465 TransRetReq.emplace();
15466 else if (RetReq.isSubstitutionFailure())
15467 TransRetReq.emplace(RetReq.getSubstitutionDiagnostic());
15468 else if (RetReq.isTypeConstraint()) {
15470 RetReq.getTypeConstraintTemplateParameterList();
15472 getDerived().TransformTemplateParameterList(OrigTPL);
15475 TransRetReq.emplace(TPL);
15477 assert(TransRetReq &&
"All code paths leading here must set TransRetReq");
15478 if (
Expr *E = dyn_cast<Expr *>(TransExpr))
15481 std::move(*TransRetReq));
15487template<
typename Derived>
15493 return getDerived().RebuildNestedRequirement(
15501 return getDerived().RebuildNestedRequirement(TransConstraint.
get());
15504template<
typename Derived>
15511 if (!getDerived().AlwaysRebuild() &&
15528template<
typename Derived>
15535 SubExpr = getDerived().TransformExpr(E->getQueriedExpression());
15536 if (SubExpr.isInvalid())
15539 if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getQueriedExpression())
15543 return getDerived().RebuildExpressionTrait(E->getTrait(), E->getBeginLoc(),
15544 SubExpr.get(), E->getEndLoc());
15547template <
typename Derived>
15552 DRE, AddrTaken, RecoveryTSI);
15565template <
typename Derived>
15572template <
typename Derived>
15588 getDerived().TransformDeclarationNameInfo(E->
getNameInfo());
15593 if (!getDerived().AlwaysRebuild() && QualifierLoc == E->
getQualifierLoc() &&
15599 return getDerived().RebuildDependentScopeDeclRefExpr(
15600 QualifierLoc, TemplateKWLoc, NameInfo,
nullptr,
15601 IsAddressOfOperand, RecoveryTSI);
15605 if (getDerived().TransformTemplateArguments(
15609 return getDerived().RebuildDependentScopeDeclRefExpr(
15610 QualifierLoc, TemplateKWLoc, NameInfo, &TransArgs, IsAddressOfOperand,
15614template<
typename Derived>
15620 if (getDerived().AllowSkippingCXXConstructExpr() &&
15621 ((E->getNumArgs() == 1 ||
15622 (E->getNumArgs() > 1 && getDerived().DropCallArgument(E->getArg(1)))) &&
15623 (!getDerived().DropCallArgument(E->getArg(0))) &&
15624 !E->isListInitialization()))
15630 QualType T = getDerived().TransformType(E->getType());
15635 getDerived().TransformDecl(E->getBeginLoc(), E->getConstructor()));
15639 bool ArgumentChanged =
false;
15644 E->isListInitialization());
15645 if (getDerived().TransformExprs(E->getArgs(), E->getNumArgs(),
true, Args,
15650 if (!getDerived().AlwaysRebuild() &&
15651 T == E->getType() &&
15653 !ArgumentChanged) {
15660 return getDerived().RebuildCXXConstructExpr(
15661 T, E->getBeginLoc(),
Constructor, E->isElidable(), Args,
15662 E->hadMultipleCandidates(), E->isListInitialization(),
15663 E->isStdInitListInitialization(), E->requiresZeroInitialization(),
15664 E->getConstructionKind(), E->getParenOrBraceRange());
15667template<
typename Derived>
15670 QualType T = getDerived().TransformType(E->getType());
15675 getDerived().TransformDecl(E->getBeginLoc(), E->getConstructor()));
15679 if (!getDerived().AlwaysRebuild() &&
15680 T == E->getType() &&
15688 return getDerived().RebuildCXXInheritedCtorInitExpr(
15690 E->constructsVBase(), E->inheritedFromVBase());
15697template<
typename Derived>
15700 if (
auto *Dtor = E->getTemporary()->getDestructor())
15703 return getDerived().TransformExpr(E->getSubExpr());
15711template<
typename Derived>
15717template<
typename Derived>
15722 getDerived().TransformTypeWithDeducedTST(E->getTypeSourceInfo());
15727 getDerived().TransformDecl(E->getBeginLoc(), E->getConstructor()));
15731 bool ArgumentChanged =
false;
15733 Args.reserve(E->getNumArgs());
15737 E->isListInitialization());
15738 if (TransformExprs(E->getArgs(), E->getNumArgs(),
true, Args,
15742 if (E->isListInitialization() && !E->isStdInitListInitialization()) {
15743 ExprResult Res = RebuildInitList(E->getBeginLoc(), Args, E->getEndLoc(),
15745 if (Res.isInvalid())
15747 Args = {Res.get()};
15751 if (!getDerived().AlwaysRebuild() &&
15752 T == E->getTypeSourceInfo() &&
15754 !ArgumentChanged) {
15761 return getDerived().RebuildCXXTemporaryObjectExpr(
15762 T, LParenLoc, Args, E->getEndLoc(), E->isListInitialization());
15765template<
typename Derived>
15770 typedef std::pair<ExprResult, QualType> InitCaptureInfoTy;
15771 struct TransformedInitCapture {
15773 SourceLocation EllipsisLoc;
15775 SmallVector<InitCaptureInfoTy, 4> Expansions;
15778 InitCaptures.resize(E->explicit_capture_end() - E->explicit_capture_begin());
15780 CEnd = E->capture_end();
15782 if (!E->isInitCapture(
C))
15785 TransformedInitCapture &
Result = InitCaptures[
C - E->capture_begin()];
15790 ExprResult NewExprInitResult = getDerived().TransformInitializer(
15793 if (NewExprInitResult.isInvalid()) {
15797 Expr *NewExprInit = NewExprInitResult.get();
15800 getSema().buildLambdaInitCaptureInitialization(
15801 C->getLocation(),
C->getCaptureKind() ==
LCK_ByRef,
15802 EllipsisLoc, NumExpansions, OldVD->getIdentifier(),
15806 Result.Expansions.push_back(
15807 InitCaptureInfoTy(NewExprInit, NewInitCaptureType));
15811 if (OldVD->isParameterPack()) {
15820 bool Expand =
true;
15821 bool RetainExpansion =
false;
15823 ExpansionTL.getTypePtr()->getNumExpansions();
15825 if (getDerived().TryExpandParameterPacks(
15826 ExpansionTL.getEllipsisLoc(), OldVD->getInit()->getSourceRange(),
15827 Unexpanded,
true, Expand,
15828 RetainExpansion, NumExpansions))
15830 assert(!RetainExpansion &&
"Should not need to retain expansion after a "
15831 "capture since it cannot be extended");
15833 for (
unsigned I = 0; I != *NumExpansions; ++I) {
15838 SubstInitCapture(ExpansionTL.getEllipsisLoc(), NumExpansions);
15839 Result.EllipsisLoc = ExpansionTL.getEllipsisLoc();
15876 while (DC->isRequiresExprBody())
15878 if ((getSema().isUnevaluatedContext() ||
15879 getSema().isConstantEvaluatedContext()) &&
15880 !(dyn_cast_or_null<CXXRecordDecl>(DC->getParent()) &&
15882 (DC->isFileContext() || !DC->getParent()->isDependentContext()))
15887 E->getIntroducerRange(),
nullptr, DependencyKind,
15888 E->getCaptureDefault());
15889 getDerived().transformedLocalDecl(OldClass, {
Class});
15892 getSema().CreateLambdaCallOperator(E->getIntroducerRange(),
Class);
15895 getSema().buildLambdaScope(LSI, NewCallOperator, E->getIntroducerRange(),
15896 E->getCaptureDefault(), E->getCaptureDefaultLoc(),
15897 E->hasExplicitParameters(), E->isMutable());
15907 CEnd = E->capture_end();
15911 if (
C->isImplicit())
15915 if (
C->capturesThis()) {
15923 dyn_cast_if_present<CXXRecordDecl>(
15924 getSema().getFunctionLevelDeclContext()),
15926 getSema().CheckCXXThisCapture(
C->getLocation(),
C->isExplicit(),
15933 if (
C->capturesVLAType())
15937 if (E->isInitCapture(
C)) {
15938 TransformedInitCapture &NewC = InitCaptures[
C - E->capture_begin()];
15943 for (InitCaptureInfoTy &Info : NewC.Expansions) {
15945 QualType InitQualType = Info.second;
15946 if (
Init.isInvalid() || InitQualType.isNull()) {
15950 VarDecl *NewVD = getSema().createLambdaInitCaptureVarDecl(
15951 OldVD->getLocation(), InitQualType, NewC.EllipsisLoc,
15952 OldVD->getIdentifier(), OldVD->getInitStyle(),
Init.get(),
15953 getSema().CurContext);
15958 NewVDs.push_back(NewVD);
15959 getSema().addInitCapture(LSI, NewVD,
C->getCaptureKind() ==
LCK_ByRef);
15964 if (NewC.EllipsisLoc.isInvalid())
15965 LSI->ContainsUnexpandedParameterPack |=
15966 Init.get()->containsUnexpandedParameterPack();
15972 getDerived().transformedLocalDecl(OldVD, NewVDs);
15976 assert(
C->capturesVariable() &&
"unexpected kind of lambda capture");
15984 if (
C->isPackExpansion()) {
15986 bool ShouldExpand =
false;
15987 bool RetainExpansion =
false;
15989 if (getDerived().TryExpandParameterPacks(
15990 C->getEllipsisLoc(),
C->getLocation(), Unexpanded,
15991 true, ShouldExpand,
15992 RetainExpansion, NumExpansions)) {
15997 if (ShouldExpand) {
16002 for (
unsigned I = 0; I != *NumExpansions; ++I) {
16004 ValueDecl *CapturedVar = cast_if_present<ValueDecl>(
16005 getDerived().TransformDecl(
C->getLocation(), Pack));
16006 if (!CapturedVar) {
16012 getSema().tryCaptureVariable(CapturedVar,
C->getLocation(), Kind);
16020 EllipsisLoc =
C->getEllipsisLoc();
16024 auto *CapturedVar = cast_or_null<ValueDecl>(
16025 getDerived().TransformDecl(
C->getLocation(),
C->getCapturedVar()));
16026 if (!CapturedVar || CapturedVar->isInvalidDecl()) {
16033 if (
auto *VD = dyn_cast<VarDecl>(CapturedVar); VD && !
C->isPackExpansion())
16034 LSI->ContainsUnexpandedParameterPack |= VD->isParameterPack();
16037 getSema().tryCaptureVariable(CapturedVar,
C->getLocation(), Kind,
16040 getSema().finishLambdaExplicitCaptures(LSI);
16044 auto TPL = getDerived().TransformTemplateParameterList(
16045 E->getTemplateParameterList());
16046 LSI->GLTemplateParameterList = TPL;
16048 getSema().AddTemplateParametersToLambdaCallOperator(NewCallOperator,
Class,
16050 LSI->ContainsUnexpandedParameterPack |=
16051 TPL->containsUnexpandedParameterPack();
16056 E->getCallOperator()->getTypeSourceInfo()->getTypeLoc();
16058 getDerived().TransformType(NewCallOpTLBuilder, OldCallOpTypeLoc);
16059 if (NewCallOpType.isNull())
16061 LSI->ContainsUnexpandedParameterPack |=
16062 NewCallOpType->containsUnexpandedParameterPack();
16064 NewCallOpTLBuilder.getTypeSourceInfo(getSema().Context, NewCallOpType);
16069 assert(FPTL &&
"Not a FunctionProtoType?");
16073 ExprResult E = getDerived().TransformConstraint(
16074 const_cast<Expr *
>(TRC.ConstraintExpr));
16077 TRC.ConstraintExpr = E.get();
16082 if (TRC && TRC.ConstraintExpr->containsUnexpandedParameterPack() &&
16083 !TRC.ArgPackSubstIndex)
16086 getSema().CompleteLambdaCallOperator(
16087 NewCallOperator, E->getCallOperator()->getLocation(),
16088 E->getCallOperator()->getInnerLocStart(), TRC, NewCallOpTSI,
16089 E->getCallOperator()->getConstexprKind(),
16090 E->getCallOperator()->getStorageClass(), FPTL.getParams(),
16091 E->hasExplicitResultType());
16093 getDerived().transformAttrs(E->getCallOperator(), NewCallOperator);
16094 getDerived().transformedLocalDecl(E->getCallOperator(), {NewCallOperator});
16100 std::optional<CXXRecordDecl::LambdaNumbering> Numbering;
16101 if (getDerived().ReplacingOriginal()) {
16102 Numbering = OldClass->getLambdaNumbering();
16105 getSema().handleLambdaNumbering(
Class, NewCallOperator, Numbering);
16110 getSema().PushExpressionEvaluationContextForFunction(
16112 E->getCallOperator());
16119 C.PointOfInstantiation = E->getBody()->getBeginLoc();
16120 getSema().pushCodeSynthesisContext(
C);
16124 : getDerived().TransformLambdaBody(E, E->getBody());
16126 getSema().popCodeSynthesisContext();
16130 FuncScopeCleanup.disable();
16132 if (Body.isInvalid()) {
16133 SavedContext.pop();
16134 getSema().ActOnLambdaError(E->getBeginLoc(),
nullptr,
16139 getSema().ActOnFinishFunctionBody(NewCallOperator, Body.get(),
16142 SavedContext.pop();
16177 DependencyKind = getDerived().ComputeLambdaDependency(LSI);
16178 Class->setLambdaDependencyKind(DependencyKind);
16180 return getDerived().RebuildLambdaExpr(E->getBeginLoc(),
16181 Body.get()->getEndLoc(), LSI);
16184template<
typename Derived>
16190template<
typename Derived>
16199 if (!
C->isImplicit())
16203 if (
C->capturesThis()) {
16204 getSema().CheckCXXThisCapture(
C->getLocation(),
C->isExplicit(),
16211 if (
C->capturesVLAType())
16214 assert(
C->capturesVariable() &&
"unexpected kind of lambda capture");
16218 VarDecl *CapturedVar = cast_or_null<VarDecl>(
16224 getSema().tryCaptureVariable(CapturedVar,
C->getLocation());
16230template<
typename Derived>
16239 bool ArgumentChanged =
false;
16251 if (!getDerived().AlwaysRebuild() &&
16257 return getDerived().RebuildCXXUnresolvedConstructExpr(
16261template<
typename Derived>
16270 if (!E->isImplicitAccess()) {
16271 OldBase = E->getBase();
16272 Base = getDerived().TransformExpr(OldBase);
16273 if (
Base.isInvalid())
16278 bool MayBePseudoDestructor =
false;
16280 E->getOperatorLoc(),
16281 E->isArrow()? tok::arrow : tok::period,
16283 MayBePseudoDestructor);
16284 if (
Base.isInvalid())
16287 ObjectType = ObjectTy.get();
16288 BaseType = ((
Expr*)
Base.get())->getType();
16291 BaseType = getDerived().TransformType(E->getBaseType());
16298 = getDerived().TransformFirstQualifierInScope(
16299 E->getFirstQualifierFoundInScope(),
16300 E->getQualifierLoc().getBeginLoc());
16303 if (E->getQualifier()) {
16305 = getDerived().TransformNestedNameSpecifierLoc(E->getQualifierLoc(),
16307 FirstQualifierInScope);
16319 = getDerived().TransformDeclarationNameInfo(E->getMemberNameInfo());
16320 if (!NameInfo.getName())
16323 if (!E->hasExplicitTemplateArgs()) {
16326 if (!getDerived().AlwaysRebuild() &&
16327 Base.get() == OldBase &&
16328 BaseType == E->getBaseType() &&
16329 QualifierLoc == E->getQualifierLoc() &&
16330 NameInfo.getName() == E->getMember() &&
16331 FirstQualifierInScope == E->getFirstQualifierFoundInScope())
16334 return getDerived().RebuildCXXDependentScopeMemberExpr(
Base.get(),
16337 E->getOperatorLoc(),
16340 FirstQualifierInScope,
16346 if (getDerived().TransformTemplateArguments(E->getTemplateArgs(),
16347 E->getNumTemplateArgs(),
16351 return getDerived().RebuildCXXDependentScopeMemberExpr(
Base.get(),
16354 E->getOperatorLoc(),
16357 FirstQualifierInScope,
16362template <
typename Derived>
16368 if (!Old->isImplicitAccess()) {
16369 Base = getDerived().TransformExpr(Old->getBase());
16370 if (
Base.isInvalid())
16373 getSema().PerformMemberExprBaseConversion(
Base.get(), Old->isArrow());
16374 if (
Base.isInvalid())
16376 BaseType =
Base.get()->getType();
16378 BaseType = getDerived().TransformType(Old->getBaseType());
16382 if (Old->getQualifierLoc()) {
16384 getDerived().TransformNestedNameSpecifierLoc(Old->getQualifierLoc());
16394 if (TransformOverloadExprDecls(Old,
false, R))
16398 if (Old->getNamingClass()) {
16400 getDerived().TransformDecl(Old->getMemberLoc(), Old->getNamingClass()));
16404 R.setNamingClass(NamingClass);
16408 if (Old->hasExplicitTemplateArgs()) {
16409 TransArgs.setLAngleLoc(Old->getLAngleLoc());
16410 TransArgs.setRAngleLoc(Old->getRAngleLoc());
16411 if (getDerived().TransformTemplateArguments(
16412 Old->getTemplateArgs(), Old->getNumTemplateArgs(), TransArgs))
16420 NamedDecl *FirstQualifierInScope =
nullptr;
16422 return getDerived().RebuildUnresolvedMemberExpr(
16423 Base.get(), BaseType, Old->getOperatorLoc(), Old->isArrow(), QualifierLoc,
16424 TemplateKWLoc, FirstQualifierInScope, R,
16425 (Old->hasExplicitTemplateArgs() ? &TransArgs :
nullptr));
16428template<
typename Derived>
16433 ExprResult SubExpr = getDerived().TransformExpr(E->getOperand());
16434 if (SubExpr.isInvalid())
16437 if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getOperand())
16440 return getDerived().RebuildCXXNoexceptExpr(E->getSourceRange(),SubExpr.get());
16443template<
typename Derived>
16446 ExprResult Pattern = getDerived().TransformExpr(E->getPattern());
16447 if (Pattern.isInvalid())
16450 if (!getDerived().AlwaysRebuild() && Pattern.get() == E->getPattern())
16453 return getDerived().RebuildPackExpansion(Pattern.get(), E->getEllipsisLoc(),
16454 E->getNumExpansions());
16457template <
typename Derived>
16462 if (!Arg.isPackExpansion()) {
16474 getSema().getTemplateArgumentPackExpansionPattern(ArgLoc, Ellipsis,
16475 OrigNumExpansions);
16487 if (!NumExpansions) {
16499template<
typename Derived>
16518 bool ShouldExpand =
false;
16519 bool RetainExpansion =
false;
16521 if (getDerived().TryExpandParameterPacks(
16523 true, ShouldExpand,
16524 RetainExpansion, NumExpansions))
16529 if (ShouldExpand) {
16531 if (
auto *TTPD = dyn_cast<TemplateTypeParmDecl>(Pack)) {
16532 ArgStorage = getSema().Context.getPackExpansionType(
16533 getSema().Context.getTypeDeclType(TTPD), std::nullopt);
16534 }
else if (
auto *TTPD = dyn_cast<TemplateTemplateParmDecl>(Pack)) {
16538 ExprResult DRE = getSema().BuildDeclRefExpr(
16539 VD, VD->getType().getNonLValueExprType(getSema().Context),
16542 if (DRE.isInvalid())
16545 new (getSema().Context)
16549 PackArgs = ArgStorage;
16554 if (!PackArgs.size()) {
16555 auto *Pack = cast_or_null<NamedDecl>(
16559 return getDerived().RebuildSizeOfPackExpr(
16566 getDerived().ComputeSizeOfPackExprWithoutSubstitution(PackArgs);
16578 TemporaryBase Rebase(*
this, E->
getPackLoc(), getBaseEntity());
16581 if (TransformTemplateArguments(PackLocIterator(*
this, PackArgs.begin()),
16582 PackLocIterator(*
this, PackArgs.end()),
16583 TransformedPackArgs,
true))
16590 bool PartialSubstitution =
false;
16591 for (
auto &Loc : TransformedPackArgs.arguments()) {
16592 Args.push_back(Loc.getArgument());
16593 if (Loc.getArgument().isPackExpansion())
16594 PartialSubstitution =
true;
16597 if (PartialSubstitution)
16598 return getDerived().RebuildSizeOfPackExpr(
16600 std::nullopt, Args);
16602 return getDerived().RebuildSizeOfPackExpr(
16604 static_cast<unsigned>(Args.size()),
16608template <
typename Derived>
16611 if (!E->isValueDependent())
16619 IndexExpr = getDerived().TransformExpr(E->getIndexExpr());
16620 if (IndexExpr.isInvalid())
16625 bool FullySubstituted =
true;
16626 if (!E->expandsToEmptyPack() && E->getExpressions().empty()) {
16627 Expr *Pattern = E->getPackIdExpression();
16629 getSema().collectUnexpandedParameterPacks(E->getPackIdExpression(),
16631 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
16635 bool ShouldExpand =
true;
16636 bool RetainExpansion =
false;
16638 NumExpansions = std::nullopt;
16639 if (getDerived().TryExpandParameterPacks(
16640 E->getEllipsisLoc(), Pattern->getSourceRange(), Unexpanded,
16641 true, ShouldExpand,
16642 RetainExpansion, NumExpansions))
16644 if (!ShouldExpand) {
16646 ExprResult Pack = getDerived().TransformExpr(Pattern);
16647 if (Pack.isInvalid())
16649 return getDerived().RebuildPackIndexingExpr(
16650 E->getEllipsisLoc(), E->getRSquareLoc(), Pack.get(), IndexExpr.get(),
16653 for (
unsigned I = 0; I != *NumExpansions; ++I) {
16656 if (
Out.isInvalid())
16658 if (
Out.get()->containsUnexpandedParameterPack()) {
16659 Out = getDerived().RebuildPackExpansion(
Out.get(), E->getEllipsisLoc(),
16660 OrigNumExpansions);
16661 if (
Out.isInvalid())
16663 FullySubstituted =
false;
16665 ExpandedExprs.push_back(
Out.get());
16669 if (RetainExpansion) {
16670 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
16673 if (
Out.isInvalid())
16676 Out = getDerived().RebuildPackExpansion(
Out.get(), E->getEllipsisLoc(),
16677 OrigNumExpansions);
16678 if (
Out.isInvalid())
16680 FullySubstituted =
false;
16681 ExpandedExprs.push_back(
Out.get());
16683 }
else if (!E->expandsToEmptyPack()) {
16684 if (getDerived().TransformExprs(E->getExpressions().data(),
16685 E->getExpressions().size(),
false,
16690 return getDerived().RebuildPackIndexingExpr(
16691 E->getEllipsisLoc(), E->getRSquareLoc(), E->getPackIdExpression(),
16692 IndexExpr.get(), ExpandedExprs, FullySubstituted);
16695template <
typename Derived>
16698 if (!getSema().ArgPackSubstIndex)
16704 return getDerived().RebuildSubstNonTypeTemplateParmExpr(
16705 E->getAssociatedDecl(), E->getParameterPack(),
16706 E->getParameterPackLocation(), Arg, SemaRef.
getPackIndex(Pack),
16710template <
typename Derived>
16714 ExprResult Replacement = getDerived().TransformExpr(OrigReplacement);
16715 if (Replacement.isInvalid())
16718 Decl *AssociatedDecl =
16719 getDerived().TransformDecl(E->getNameLoc(), E->getAssociatedDecl());
16720 if (!AssociatedDecl)
16723 if (Replacement.get() == OrigReplacement &&
16724 AssociatedDecl == E->getAssociatedDecl())
16727 auto getParamAndType = [E](
Decl *AssociatedDecl)
16728 -> std::tuple<NonTypeTemplateParmDecl *, QualType> {
16729 auto [PDecl, Arg] =
16733 return {Param, Param->getType()};
16735 Arg = Arg.getPackAsArray()[*PackIndex];
16736 return {Param, Arg.getNonTypeTemplateArgumentType()};
16742 if (
auto [Param, ParamType] = getParamAndType(AssociatedDecl);
16744 ParamType, std::get<1>(getParamAndType(E->getAssociatedDecl()))) ||
16745 Replacement.get() != OrigReplacement) {
16752 Param, ParamType, Replacement.get(), SugaredConverted,
16753 CanonicalConverted,
16755 if (Replacement.isInvalid())
16759 Replacement = E->getReplacement();
16762 return getDerived().RebuildSubstNonTypeTemplateParmExpr(
16763 AssociatedDecl, E->getParameter(), E->getNameLoc(),
16765 E->getPackIndex(), E->getFinal());
16768template<
typename Derived>
16775template<
typename Derived>
16782template<
typename Derived>
16786 if (
Expr *OldCallee = E->getCallee()) {
16787 ExprResult CalleeResult = getDerived().TransformExpr(OldCallee);
16788 if (CalleeResult.isInvalid())
16793 Expr *Pattern = E->getPattern();
16796 getSema().collectUnexpandedParameterPacks(Pattern, Unexpanded);
16797 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
16801 bool Expand =
true;
16802 bool RetainExpansion =
false;
16804 NumExpansions = OrigNumExpansions;
16805 if (getDerived().TryExpandParameterPacks(
16806 E->getEllipsisLoc(), Pattern->getSourceRange(), Unexpanded,
16807 true, Expand, RetainExpansion,
16817 E->getLHS() ? getDerived().TransformExpr(E->getLHS()) :
ExprResult();
16818 if (LHS.isInvalid())
16822 E->getRHS() ? getDerived().TransformExpr(E->getRHS()) :
ExprResult();
16823 if (RHS.isInvalid())
16826 if (!getDerived().AlwaysRebuild() &&
16827 LHS.get() == E->getLHS() && RHS.get() == E->getRHS())
16830 return getDerived().RebuildCXXFoldExpr(
16831 Callee, E->getBeginLoc(), LHS.get(), E->getOperator(),
16832 E->getEllipsisLoc(), RHS.get(), E->getEndLoc(), NumExpansions);
16838 if (NumExpansions && SemaRef.
getLangOpts().BracketDepth < *NumExpansions) {
16839 SemaRef.
Diag(E->getEllipsisLoc(),
16840 clang::diag::err_fold_expression_limit_exceeded)
16841 << *NumExpansions << SemaRef.
getLangOpts().BracketDepth
16842 << E->getSourceRange();
16843 SemaRef.
Diag(E->getEllipsisLoc(), diag::note_bracket_depth);
16852 bool LeftFold = E->isLeftFold();
16856 if (!LeftFold && RetainExpansion) {
16857 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
16860 if (
Out.isInvalid())
16863 Result = getDerived().RebuildCXXFoldExpr(
16864 Callee, E->getBeginLoc(),
Out.get(), E->getOperator(),
16865 E->getEllipsisLoc(),
Result.get(), E->getEndLoc(), OrigNumExpansions);
16870 bool WarnedOnComparison =
false;
16871 for (
unsigned I = 0; I != *NumExpansions; ++I) {
16873 getSema(), LeftFold ? I : *NumExpansions - I - 1);
16875 if (
Out.isInvalid())
16878 if (
Out.get()->containsUnexpandedParameterPack()) {
16880 Result = getDerived().RebuildCXXFoldExpr(
16881 Callee, E->getBeginLoc(), LeftFold ?
Result.get() :
Out.get(),
16882 E->getOperator(), E->getEllipsisLoc(),
16883 LeftFold ?
Out.get() :
Result.get(), E->getEndLoc(),
16884 OrigNumExpansions);
16885 }
else if (
Result.isUsable()) {
16892 Result = getDerived().RebuildCXXOperatorCallExpr(
16894 E->getEllipsisLoc(),
Callee->getBeginLoc(),
Callee->requiresADL(),
16895 Functions, LHS, RHS);
16897 Result = getDerived().RebuildBinaryOperator(E->getEllipsisLoc(),
16898 E->getOperator(), LHS, RHS,
16900 if (!WarnedOnComparison &&
Result.isUsable()) {
16901 if (
auto *BO = dyn_cast<BinaryOperator>(
Result.get());
16902 BO && BO->isComparisonOp()) {
16903 WarnedOnComparison =
true;
16904 SemaRef.
Diag(BO->getBeginLoc(),
16905 diag::warn_comparison_in_fold_expression)
16906 << BO->getOpcodeStr();
16919 if (LeftFold && RetainExpansion) {
16920 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
16923 if (
Out.isInvalid())
16926 Result = getDerived().RebuildCXXFoldExpr(
16927 Callee, E->getBeginLoc(),
Result.get(), E->getOperator(),
16928 E->getEllipsisLoc(),
Out.get(), E->getEndLoc(), OrigNumExpansions);
16934 PE->setIsProducedByFoldExpansion();
16939 return getDerived().RebuildEmptyCXXFoldExpr(E->getEllipsisLoc(),
16944template <
typename Derived>
16950 QualType T = getDerived().TransformType(E->getType());
16952 bool ArgChanged =
false;
16954 if (getDerived().TransformExprs(InitExprs.data(), InitExprs.size(),
true,
16955 TransformedInits, &ArgChanged))
16958 if (!getDerived().AlwaysRebuild() && !ArgChanged && T == E->getType())
16961 return getDerived().RebuildCXXParenListInitExpr(
16962 TransformedInits, T, E->getUserSpecifiedInitExprs().size(),
16963 E->getInitLoc(), E->getBeginLoc(), E->getEndLoc());
16966template<
typename Derived>
16973template<
typename Derived>
16979template<
typename Derived>
16985template<
typename Derived>
16988 ExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
16989 if (SubExpr.isInvalid())
16992 if (!getDerived().AlwaysRebuild() &&
16993 SubExpr.get() == E->getSubExpr())
16996 return getDerived().RebuildObjCBoxedExpr(E->getSourceRange(), SubExpr.get());
16999template<
typename Derived>
17004 bool ArgChanged =
false;
17005 if (getDerived().TransformExprs(E->getElements(), E->getNumElements(),
17006 false, Elements, &ArgChanged))
17009 if (!getDerived().AlwaysRebuild() && !ArgChanged)
17012 return getDerived().RebuildObjCArrayLiteral(E->getSourceRange(),
17017template<
typename Derived>
17023 bool ArgChanged =
false;
17024 for (
unsigned I = 0, N = E->getNumElements(); I != N; ++I) {
17027 if (OrigElement.isPackExpansion()) {
17030 getSema().collectUnexpandedParameterPacks(OrigElement.Key, Unexpanded);
17031 getSema().collectUnexpandedParameterPacks(OrigElement.Value, Unexpanded);
17032 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
17036 bool Expand =
true;
17037 bool RetainExpansion =
false;
17040 SourceRange PatternRange(OrigElement.Key->getBeginLoc(),
17041 OrigElement.Value->getEndLoc());
17042 if (getDerived().TryExpandParameterPacks(
17043 OrigElement.EllipsisLoc, PatternRange, Unexpanded,
17044 true, Expand, RetainExpansion,
17053 ExprResult Key = getDerived().TransformExpr(OrigElement.Key);
17054 if (Key.isInvalid())
17057 if (Key.get() != OrigElement.Key)
17061 if (
Value.isInvalid())
17068 Key.get(),
Value.get(), OrigElement.EllipsisLoc, NumExpansions
17070 Elements.push_back(Expansion);
17080 for (
unsigned I = 0; I != *NumExpansions; ++I) {
17082 ExprResult Key = getDerived().TransformExpr(OrigElement.Key);
17083 if (Key.isInvalid())
17087 if (
Value.isInvalid())
17097 if (Key.get()->containsUnexpandedParameterPack() ||
17098 Value.get()->containsUnexpandedParameterPack())
17099 Element.EllipsisLoc = OrigElement.EllipsisLoc;
17101 Elements.push_back(Element);
17111 ExprResult Key = getDerived().TransformExpr(OrigElement.Key);
17112 if (Key.isInvalid())
17115 if (Key.get() != OrigElement.Key)
17120 = getDerived().TransformExpr(OrigElement.Value);
17121 if (
Value.isInvalid())
17129 Elements.push_back(Element);
17132 if (!getDerived().AlwaysRebuild() && !ArgChanged)
17135 return getDerived().RebuildObjCDictionaryLiteral(E->getSourceRange(),
17139template<
typename Derived>
17143 = getDerived().TransformType(E->getEncodedTypeSourceInfo());
17144 if (!EncodedTypeInfo)
17147 if (!getDerived().AlwaysRebuild() &&
17148 EncodedTypeInfo == E->getEncodedTypeSourceInfo())
17151 return getDerived().RebuildObjCEncodeExpr(E->getAtLoc(),
17153 E->getRParenLoc());
17156template<
typename Derived>
17166template<
typename Derived>
17170 = getDerived().TransformType(E->getTypeInfoAsWritten());
17178 if (!getDerived().AlwaysRebuild() &&
17179 TSInfo == E->getTypeInfoAsWritten() &&
17180 Result.get() == E->getSubExpr())
17184 E->getLParenLoc(), E->getBridgeKind(), E->getBridgeKeywordLoc(), TSInfo,
17188template <
typename Derived>
17194template<
typename Derived>
17198 bool ArgChanged =
false;
17200 Args.reserve(E->getNumArgs());
17201 if (getDerived().TransformExprs(E->getArgs(), E->getNumArgs(),
false, Args,
17208 = getDerived().TransformType(E->getClassReceiverTypeInfo());
17209 if (!ReceiverTypeInfo)
17213 if (!getDerived().AlwaysRebuild() &&
17214 ReceiverTypeInfo == E->getClassReceiverTypeInfo() && !ArgChanged)
17219 E->getSelectorLocs(SelLocs);
17220 return getDerived().RebuildObjCMessageExpr(ReceiverTypeInfo,
17223 E->getMethodDecl(),
17230 if (!E->getMethodDecl())
17235 E->getSelectorLocs(SelLocs);
17236 return getDerived().RebuildObjCMessageExpr(E->getSuperLoc(),
17239 E->getReceiverType(),
17240 E->getMethodDecl(),
17248 "Only class and instance messages may be instantiated");
17250 = getDerived().TransformExpr(E->getInstanceReceiver());
17251 if (Receiver.isInvalid())
17255 if (!getDerived().AlwaysRebuild() &&
17256 Receiver.get() == E->getInstanceReceiver() && !ArgChanged)
17261 E->getSelectorLocs(SelLocs);
17262 return getDerived().RebuildObjCMessageExpr(Receiver.get(),
17265 E->getMethodDecl(),
17271template<
typename Derived>
17277template<
typename Derived>
17283template<
typename Derived>
17288 if (
Base.isInvalid())
17294 if (!getDerived().AlwaysRebuild() &&
17295 Base.get() == E->getBase())
17298 return getDerived().RebuildObjCIvarRefExpr(
Base.get(), E->getDecl(),
17300 E->isArrow(), E->isFreeIvar());
17303template<
typename Derived>
17308 if (!E->isObjectReceiver())
17313 if (
Base.isInvalid())
17319 if (!getDerived().AlwaysRebuild() &&
17320 Base.get() == E->getBase())
17323 if (E->isExplicitProperty())
17324 return getDerived().RebuildObjCPropertyRefExpr(
Base.get(),
17325 E->getExplicitProperty(),
17328 return getDerived().RebuildObjCPropertyRefExpr(
Base.get(),
17330 E->getImplicitPropertyGetter(),
17331 E->getImplicitPropertySetter(),
17335template<
typename Derived>
17340 if (
Base.isInvalid())
17344 ExprResult Key = getDerived().TransformExpr(E->getKeyExpr());
17345 if (Key.isInvalid())
17349 if (!getDerived().AlwaysRebuild() &&
17350 Key.get() == E->getKeyExpr() &&
Base.get() == E->getBaseExpr())
17353 return getDerived().RebuildObjCSubscriptRefExpr(E->getRBracket(),
17354 Base.get(), Key.get(),
17355 E->getAtIndexMethodDecl(),
17356 E->setAtIndexMethodDecl());
17359template<
typename Derived>
17364 if (
Base.isInvalid())
17368 if (!getDerived().AlwaysRebuild() &&
17369 Base.get() == E->getBase())
17372 return getDerived().RebuildObjCIsaExpr(
Base.get(), E->getIsaMemberLoc(),
17377template<
typename Derived>
17380 bool ArgumentChanged =
false;
17382 SubExprs.reserve(E->getNumSubExprs());
17383 if (getDerived().TransformExprs(E->getSubExprs(), E->getNumSubExprs(),
false,
17384 SubExprs, &ArgumentChanged))
17387 if (!getDerived().AlwaysRebuild() &&
17391 return getDerived().RebuildShuffleVectorExpr(E->getBuiltinLoc(),
17393 E->getRParenLoc());
17396template<
typename Derived>
17399 ExprResult SrcExpr = getDerived().TransformExpr(E->getSrcExpr());
17400 if (SrcExpr.isInvalid())
17407 if (!getDerived().AlwaysRebuild() &&
17408 Type == E->getTypeSourceInfo() &&
17409 SrcExpr.get() == E->getSrcExpr())
17412 return getDerived().RebuildConvertVectorExpr(E->getBuiltinLoc(),
17413 SrcExpr.get(),
Type,
17414 E->getRParenLoc());
17417template<
typename Derived>
17420 BlockDecl *oldBlock = E->getBlockDecl();
17426 blockScope->TheDecl->setBlockMissingReturnType(
17427 oldBlock->blockMissingReturnType());
17436 if (getDerived().TransformFunctionTypeParams(
17437 E->getCaretLocation(), oldBlock->parameters(),
nullptr,
17438 exprFunctionType->getExtParameterInfosOrNull(), paramTypes, ¶ms,
17440 getSema().ActOnBlockError(E->getCaretLocation(),
nullptr);
17445 getDerived().TransformType(exprFunctionType->getReturnType());
17447 auto epi = exprFunctionType->getExtProtoInfo();
17448 epi.ExtParameterInfos = extParamInfos.getPointerOrNull(paramTypes.size());
17451 getDerived().RebuildFunctionProtoType(exprResultType, paramTypes, epi);
17455 if (!params.empty())
17456 blockScope->TheDecl->setParams(params);
17458 if (!oldBlock->blockMissingReturnType()) {
17459 blockScope->HasImplicitReturnType =
false;
17460 blockScope->ReturnType = exprResultType;
17464 StmtResult body = getDerived().TransformStmt(E->getBody());
17465 if (body.isInvalid()) {
17466 getSema().ActOnBlockError(E->getCaretLocation(),
nullptr);
17474 for (
const auto &I : oldBlock->captures()) {
17475 VarDecl *oldCapture = I.getVariable();
17478 if (oldCapture->isParameterPack())
17482 cast<VarDecl>(getDerived().TransformDecl(E->getCaretLocation(),
17484 assert(blockScope->CaptureMap.count(newCapture));
17490 assert((!blockScope->isCXXThisCaptured() || oldBlock->capturesCXXThis()) &&
17491 "this pointer isn't captured in the old block");
17499template<
typename Derived>
17502 ExprResult SrcExpr = getDerived().TransformExpr(E->getSrcExpr());
17503 if (SrcExpr.isInvalid())
17506 QualType Type = getDerived().TransformType(E->getType());
17509 E->getRParenLoc());
17512template<
typename Derived>
17515 bool ArgumentChanged =
false;
17517 SubExprs.reserve(E->getNumSubExprs());
17518 if (getDerived().TransformExprs(E->getSubExprs(), E->getNumSubExprs(),
false,
17519 SubExprs, &ArgumentChanged))
17522 if (!getDerived().AlwaysRebuild() &&
17526 return getDerived().RebuildAtomicExpr(E->getBuiltinLoc(), SubExprs,
17527 E->getOp(), E->getRParenLoc());
17534template<
typename Derived>
17537 return SemaRef.BuildPointerType(PointeeType,
Star,
17541template<
typename Derived>
17544 return SemaRef.BuildBlockPointerType(PointeeType,
Star,
17548template<
typename Derived>
17551 bool WrittenAsLValue,
17553 return SemaRef.BuildReferenceType(ReferentType, WrittenAsLValue,
17557template <
typename Derived>
17561 return SemaRef.BuildMemberPointerType(PointeeType, SS, Cls, Sigil,
17565template<
typename Derived>
17572 return SemaRef.ObjC().BuildObjCTypeParamType(
17573 Decl, ProtocolLAngleLoc, Protocols, ProtocolLocs, ProtocolRAngleLoc,
17577template<
typename Derived>
17588 return SemaRef.ObjC().BuildObjCObjectType(
17589 BaseType, Loc, TypeArgsLAngleLoc, TypeArgs, TypeArgsRAngleLoc,
17590 ProtocolLAngleLoc, Protocols, ProtocolLocs, ProtocolRAngleLoc,
17595template<
typename Derived>
17599 return SemaRef.Context.getObjCObjectPointerType(PointeeType);
17602template <
typename Derived>
17605 Expr *SizeExpr,
unsigned IndexTypeQuals,
SourceRange BracketsRange) {
17606 if (SizeExpr || !Size)
17607 return SemaRef.BuildArrayType(ElementType, SizeMod, SizeExpr,
17608 IndexTypeQuals, BracketsRange,
17612 SemaRef.Context.UnsignedCharTy,
SemaRef.Context.UnsignedShortTy,
17614 SemaRef.Context.UnsignedLongLongTy,
SemaRef.Context.UnsignedInt128Ty
17617 for (
const auto &T : Types)
17618 if (Size->getBitWidth() ==
SemaRef.Context.getIntWidth(T)) {
17628 return SemaRef.BuildArrayType(ElementType, SizeMod, ArraySize,
17629 IndexTypeQuals, BracketsRange,
17633template <
typename Derived>
17636 Expr *SizeExpr,
unsigned IndexTypeQuals,
SourceRange BracketsRange) {
17637 return getDerived().RebuildArrayType(ElementType, SizeMod, &Size, SizeExpr,
17638 IndexTypeQuals, BracketsRange);
17641template <
typename Derived>
17645 return getDerived().RebuildArrayType(ElementType, SizeMod,
nullptr,
nullptr,
17646 IndexTypeQuals, BracketsRange);
17649template <
typename Derived>
17652 unsigned IndexTypeQuals,
SourceRange BracketsRange) {
17653 return getDerived().RebuildArrayType(ElementType, SizeMod,
nullptr,
17655 IndexTypeQuals, BracketsRange);
17658template <
typename Derived>
17661 unsigned IndexTypeQuals,
SourceRange BracketsRange) {
17662 return getDerived().RebuildArrayType(ElementType, SizeMod,
nullptr,
17664 IndexTypeQuals, BracketsRange);
17667template <
typename Derived>
17670 return SemaRef.BuildAddressSpaceAttr(PointeeType, AddrSpaceExpr,
17674template <
typename Derived>
17676 unsigned NumElements,
17679 return SemaRef.Context.getVectorType(ElementType, NumElements, VecKind);
17682template <
typename Derived>
17686 return SemaRef.BuildVectorType(ElementType, SizeExpr, AttributeLoc);
17689template<
typename Derived>
17691 unsigned NumElements,
17693 llvm::APInt numElements(
SemaRef.Context.getIntWidth(
SemaRef.Context.IntTy),
17694 NumElements,
true);
17698 return SemaRef.BuildExtVectorType(ElementType, VectorSize, AttributeLoc);
17701template<
typename Derived>
17706 return SemaRef.BuildExtVectorType(ElementType, SizeExpr, AttributeLoc);
17709template <
typename Derived>
17711 QualType ElementType,
unsigned NumRows,
unsigned NumColumns) {
17712 return SemaRef.Context.getConstantMatrixType(ElementType, NumRows,
17716template <
typename Derived>
17720 return SemaRef.BuildMatrixType(ElementType, RowExpr, ColumnExpr,
17724template <
typename Derived>
17728 return SemaRef.BuildFunctionType(T, ParamTypes,
17734template<
typename Derived>
17736 return SemaRef.Context.getFunctionNoProtoType(T);
17739template <
typename Derived>
17743 assert(D &&
"no decl found");
17747 if (
auto *UPD = dyn_cast<UsingPackDecl>(D)) {
17751 if (UPD->expansions().empty()) {
17752 getSema().Diag(NameLoc, diag::err_using_pack_expansion_empty)
17753 << UPD->isCXXClassMember() << UPD;
17762 for (
auto *E : UPD->expansions()) {
17769 else if (T.isNull())
17772 assert(
getSema().Context.hasSameType(ThisT, T) &&
17773 "mismatched resolved types in using pack expansion");
17775 return T.
isNull() ? FallbackT : T;
17777 if (
auto *Using = dyn_cast<UsingDecl>(D)) {
17778 assert(Using->hasTypename() &&
17779 "UnresolvedUsingTypenameDecl transformed to non-typename using");
17782 assert(++Using->shadow_begin() == Using->shadow_end());
17787 return SemaRef.Context.getUsingType(
Keyword, Qualifier, Shadow);
17790 "UnresolvedUsingTypenameDecl transformed to non-using decl");
17791 return SemaRef.Context.getUnresolvedUsingType(
17795template <
typename Derived>
17798 return SemaRef.BuildTypeofExprType(E, Kind);
17801template<
typename Derived>
17804 return SemaRef.Context.getTypeOfType(Underlying, Kind);
17807template <
typename Derived>
17809 return SemaRef.BuildDecltypeType(E);
17812template <
typename Derived>
17817 return SemaRef.BuildPackIndexingType(Pattern, IndexExpr, Loc, EllipsisLoc,
17818 FullySubstituted, Expansions);
17821template<
typename Derived>
17823 UnaryTransformType::UTTKind UKind,
17825 return SemaRef.BuildUnaryTransformType(BaseType, UKind, Loc);
17828template <
typename Derived>
17832 return SemaRef.CheckTemplateIdType(
17837template<
typename Derived>
17840 return SemaRef.BuildAtomicType(ValueType, KWLoc);
17843template<
typename Derived>
17847 return isReadPipe ?
SemaRef.BuildReadPipeType(ValueType, KWLoc)
17848 :
SemaRef.BuildWritePipeType(ValueType, KWLoc);
17851template <
typename Derived>
17855 llvm::APInt NumBitsAP(
SemaRef.Context.getIntWidth(
SemaRef.Context.IntTy),
17859 return SemaRef.BuildBitIntType(IsUnsigned, Bits, Loc);
17862template <
typename Derived>
17865 return SemaRef.BuildBitIntType(IsUnsigned, NumBitsExpr, Loc);
17868template <
typename Derived>
17876template <
typename Derived>
17883 getSema().ActOnTemplateName(
nullptr, SS, TemplateKWLoc,
17886 AllowInjectedClassName);
17890template<
typename Derived>
17897 bool AllowInjectedClassName) {
17900 SourceLocation SymbolLocations[3] = { NameLoc, NameLoc, NameLoc };
17905 false,
Template, AllowInjectedClassName);
17909template <
typename Derived>
17914 bool isPostIncDec = Second && (Op == OO_PlusPlus || Op == OO_MinusMinus);
17919 return SemaRef.PseudoObject().checkAssignment(
nullptr, OpLoc,
17920 Opc,
First, Second);
17935 if (Op == OO_Subscript) {
17936 if (!
First->getType()->isOverloadableType() &&
17938 return getSema().CreateBuiltinArraySubscriptExpr(
First, CalleeLoc, Second,
17940 }
else if (Op == OO_Arrow) {
17943 if (
First->getType()->isDependentType())
17946 return SemaRef.BuildOverloadedArrowExpr(
nullptr,
First, OpLoc);
17947 }
else if (Second ==
nullptr || isPostIncDec) {
17948 if (!
First->getType()->isOverloadableType() ||
17949 (Op == OO_Amp &&
getSema().isQualifiedMemberAccess(
First))) {
17956 return getSema().CreateBuiltinUnaryOp(OpLoc, Opc,
First);
17960 !
First->getType()->isOverloadableType() &&
17966 =
SemaRef.CreateBuiltinBinOp(OpLoc, Opc,
First, Second);
17975 if (!Second || isPostIncDec) {
17978 return SemaRef.CreateOverloadedUnaryOp(OpLoc, Opc, Functions,
First,
17985 First, Second, RequiresADL);
17992template<
typename Derived>
18002 QualType CanonicalBaseType =
Base->getType().getCanonicalType();
18003 if (
Base->isTypeDependent() || Destroyed.getIdentifier() ||
18008 ->getAsCanonical<RecordType>())) {
18010 return SemaRef.BuildPseudoDestructorExpr(
18011 Base, OperatorLoc, isArrow ? tok::arrow : tok::period, SS, ScopeType,
18012 CCLoc, TildeLoc, Destroyed);
18024 if (!
isa<TagType>(ScopeType->getType().getCanonicalType())) {
18025 getSema().Diag(ScopeType->getTypeLoc().getBeginLoc(),
18026 diag::err_expected_class_or_namespace)
18027 << ScopeType->getType() <<
getSema().getLangOpts().CPlusPlus;
18031 SS.
Make(
SemaRef.Context, ScopeType->getTypeLoc(), CCLoc);
18035 return getSema().BuildMemberReferenceExpr(
18036 Base,
Base->getType(), OperatorLoc, isArrow, SS, TemplateKWLoc,
18042template<
typename Derived>
18050 for (
unsigned I = 0; I < NumParams; ++I) {
18051 if (I != ContextParamPos) {
18057 Params.push_back(std::make_pair(StringRef(), QualType()));
18060 getSema().ActOnCapturedRegionStart(Loc,
nullptr,
18068 if (Body.isInvalid()) {
18069 getSema().ActOnCapturedRegionError();
18073 return getSema().ActOnCapturedRegionEnd(Body.get());
18076template <
typename Derived>
18082 llvm_unreachable(
"SYCL kernel call statement cannot appear in dependent "
18086template <
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 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.
NonTypeTemplateParmDecl - Declares a non-type template parameter, e.g., "Size" in.
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.
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 BuildSubstNonTypeTemplateParmExpr(Decl *AssociatedDecl, const NonTypeTemplateParmDecl *NTTP, SourceLocation loc, TemplateArgument Replacement, UnsignedOrNone PackIndex, bool Final)
ExprResult BuildBuiltinBitCastExpr(SourceLocation KWLoc, TypeSourceInfo *TSI, Expr *Operand, SourceLocation RParenLoc)
StmtResult ActOnGotoStmt(SourceLocation GotoLoc, SourceLocation LabelLoc, LabelDecl *TheDecl)
ExprResult MaybeBindToTemporary(Expr *E)
MaybeBindToTemporary - If the passed in expression has a record type with a non-trivial destructor,...
StmtResult BuildCoreturnStmt(SourceLocation KwLoc, Expr *E, bool IsImplicit=false)
ExprResult ActOnStartCXXMemberReference(Scope *S, Expr *Base, SourceLocation OpLoc, tok::TokenKind OpKind, ParsedType &ObjectType, bool &MayBePseudoDestructor)
ExprResult ActOnCaseExpr(SourceLocation CaseLoc, ExprResult Val)
ExprResult BuildStmtExpr(SourceLocation LPLoc, Stmt *SubStmt, SourceLocation RPLoc, unsigned TemplateDepth)
ExprResult BuildResolvedCoawaitExpr(SourceLocation KwLoc, Expr *Operand, Expr *Awaiter, bool IsImplicit=false)
ExprResult BuildVAArgExpr(SourceLocation BuiltinLoc, Expr *E, TypeSourceInfo *TInfo, SourceLocation RPLoc)
@ CTAK_Specified
The template argument was specified in the code or was instantiated with some deduced template argume...
ExprResult ActOnCXXDelete(SourceLocation StartLoc, bool UseGlobal, bool ArrayForm, Expr *Operand)
ActOnCXXDelete - Parsed a C++ 'delete' expression (C++ 5.3.5), as in:
ExprResult BuildCXXTypeId(QualType TypeInfoType, SourceLocation TypeidLoc, TypeSourceInfo *Operand, SourceLocation RParenLoc)
Build a C++ typeid expression with a type operand.
ExprResult PerformMemberExprBaseConversion(Expr *Base, bool IsArrow)
Perform conversions on the LHS of a member access expression.
DiagnosticsEngine & getDiagnostics() const
ExprResult BuildPackIndexingExpr(Expr *PackExpression, SourceLocation EllipsisLoc, Expr *IndexExpr, SourceLocation RSquareLoc, ArrayRef< Expr * > ExpandedExprs={}, bool FullySubstituted=false)
ParsedType getDestructorName(const IdentifierInfo &II, SourceLocation NameLoc, Scope *S, CXXScopeSpec &SS, ParsedType ObjectType, bool EnteringContext)
ASTContext & getASTContext() const
CXXDestructorDecl * LookupDestructor(CXXRecordDecl *Class)
Look for the destructor of the given class.
ExprResult BuildUnaryOp(Scope *S, SourceLocation OpLoc, UnaryOperatorKind Opc, Expr *Input, bool IsAfterAmp=false)
ExprResult BuildTemplateIdExpr(const CXXScopeSpec &SS, SourceLocation TemplateKWLoc, LookupResult &R, bool RequiresADL, const TemplateArgumentListInfo *TemplateArgs)
ExprResult CreateOverloadedBinOp(SourceLocation OpLoc, BinaryOperatorKind Opc, const UnresolvedSetImpl &Fns, Expr *LHS, Expr *RHS, bool RequiresADL=true, bool AllowRewrittenCandidates=true, FunctionDecl *DefaultedFn=nullptr)
Create a binary operation that may resolve to an overloaded operator.
StmtResult ActOnSEHTryBlock(bool IsCXXTry, SourceLocation TryLoc, Stmt *TryBlock, Stmt *Handler)
ExprResult BuildPredefinedExpr(SourceLocation Loc, PredefinedIdentKind IK)
ExprResult CheckConceptTemplateId(const CXXScopeSpec &SS, SourceLocation TemplateKWLoc, const DeclarationNameInfo &ConceptNameInfo, NamedDecl *FoundDecl, TemplateDecl *NamedConcept, const TemplateArgumentListInfo *TemplateArgs, bool DoCheckConstraintSatisfaction=true)
ExprResult BuildCompoundLiteralExpr(SourceLocation LParenLoc, TypeSourceInfo *TInfo, SourceLocation RParenLoc, Expr *LiteralExpr)
ExprResult ActOnAddrLabel(SourceLocation OpLoc, SourceLocation LabLoc, LabelDecl *TheDecl)
ActOnAddrLabel - Parse the GNU address of label extension: "&&foo".
ExprResult ActOnParenListExpr(SourceLocation L, SourceLocation R, MultiExprArg Val)
QualType BuildCountAttributedArrayOrPointerType(QualType WrappedTy, Expr *CountExpr, bool CountInBytes, bool OrNull)
ExprResult BuildCXXNew(SourceRange Range, bool UseGlobal, SourceLocation PlacementLParen, MultiExprArg PlacementArgs, SourceLocation PlacementRParen, SourceRange TypeIdParens, QualType AllocType, TypeSourceInfo *AllocTypeInfo, std::optional< Expr * > ArraySize, SourceRange DirectInitRange, Expr *Initializer)
DeclRefExpr * BuildDeclRefExpr(ValueDecl *D, QualType Ty, ExprValueKind VK, SourceLocation Loc, const CXXScopeSpec *SS=nullptr)
ExprResult BuildCXXFoldExpr(UnresolvedLookupExpr *Callee, SourceLocation LParenLoc, Expr *LHS, BinaryOperatorKind Operator, SourceLocation EllipsisLoc, Expr *RHS, SourceLocation RParenLoc, UnsignedOrNone NumExpansions)
ExprResult CreateGenericSelectionExpr(SourceLocation KeyLoc, SourceLocation DefaultLoc, SourceLocation RParenLoc, bool PredicateIsExpr, void *ControllingExprOrType, ArrayRef< TypeSourceInfo * > Types, ArrayRef< Expr * > Exprs)
ControllingExprOrType is either a TypeSourceInfo * or an Expr *.
bool CheckTemplateArgument(NamedDecl *Param, TemplateArgumentLoc &Arg, NamedDecl *Template, SourceLocation TemplateLoc, SourceLocation RAngleLoc, unsigned ArgumentPackIndex, CheckTemplateArgumentInfo &CTAI, CheckTemplateArgumentKind CTAK)
Check that the given template argument corresponds to the given template parameter.
StmtResult ActOnFinishSwitchStmt(SourceLocation SwitchLoc, Stmt *Switch, Stmt *Body)
SourceLocation getLocForEndOfToken(SourceLocation Loc, unsigned Offset=0)
Calls Lexer::getLocForEndOfToken()
const LangOptions & getLangOpts() const
StmtResult ActOnWhileStmt(SourceLocation WhileLoc, SourceLocation LParenLoc, ConditionResult Cond, SourceLocation RParenLoc, Stmt *Body)
bool isPotentialImplicitMemberAccess(const CXXScopeSpec &SS, LookupResult &R, bool IsAddressOfOperand)
Check whether an expression might be an implicit class member access.
void collectUnexpandedParameterPacks(TemplateArgument Arg, SmallVectorImpl< UnexpandedParameterPack > &Unexpanded)
Collect the set of unexpanded parameter packs within the given template argument.
ExprResult BuildSourceLocExpr(SourceLocIdentKind Kind, QualType ResultTy, SourceLocation BuiltinLoc, SourceLocation RPLoc, DeclContext *ParentContext)
ExprResult BuildCXXTypeConstructExpr(TypeSourceInfo *Type, SourceLocation LParenLoc, MultiExprArg Exprs, SourceLocation RParenLoc, bool ListInitialization)
ExprResult BuildBuiltinOffsetOf(SourceLocation BuiltinLoc, TypeSourceInfo *TInfo, ArrayRef< OffsetOfComponent > Components, SourceLocation RParenLoc)
__builtin_offsetof(type, a.b[123][456].c)
ExprResult TemporaryMaterializationConversion(Expr *E)
If E is a prvalue denoting an unmaterialized temporary, materialize it as an xvalue.
ExprResult BuildTypeTrait(TypeTrait Kind, SourceLocation KWLoc, ArrayRef< TypeSourceInfo * > Args, SourceLocation RParenLoc)
TemplateArgument getPackSubstitutedTemplateArgument(TemplateArgument Arg) const
ExprResult BuildUnresolvedCoawaitExpr(SourceLocation KwLoc, Expr *Operand, UnresolvedLookupExpr *Lookup)
ExprResult BuildExpressionTrait(ExpressionTrait OET, SourceLocation KWLoc, Expr *Queried, SourceLocation RParen)
bool buildCoroutineParameterMoves(SourceLocation Loc)
ExprResult BuildCStyleCastExpr(SourceLocation LParenLoc, TypeSourceInfo *Ty, SourceLocation RParenLoc, Expr *Op)
ExprResult BuildCXXUuidof(QualType TypeInfoType, SourceLocation TypeidLoc, TypeSourceInfo *Operand, SourceLocation RParenLoc)
Build a Microsoft __uuidof expression with a type operand.
sema::FunctionScopeInfo * getCurFunction() const
DeclGroupPtrTy BuildDeclaratorGroup(MutableArrayRef< Decl * > Group)
BuildDeclaratorGroup - convert a list of declarations into a declaration group, performing any necess...
Expr * BuildCXXThisExpr(SourceLocation Loc, QualType Type, bool IsImplicit)
Build a CXXThisExpr and mark it referenced in the current context.
UnsignedOrNone getPackIndex(TemplateArgument Pack) const
ExprResult BuildDeclarationNameExpr(const CXXScopeSpec &SS, LookupResult &R, bool NeedsADL, bool AcceptInvalidDecl=false)
sema::BlockScopeInfo * getCurBlock()
Retrieve the current block, if any.
DeclContext * CurContext
CurContext - This is the current declaration context of parsing.
VarDecl * BuildExceptionDeclaration(Scope *S, TypeSourceInfo *TInfo, SourceLocation StartLoc, SourceLocation IdLoc, const IdentifierInfo *Id)
Perform semantic analysis for the variable declaration that occurs within a C++ catch clause,...
void MarkDeclRefReferenced(DeclRefExpr *E, const Expr *Base=nullptr)
Perform reference-marking and odr-use handling for a DeclRefExpr.
ExprResult BuildQualifiedDeclarationNameExpr(CXXScopeSpec &SS, const DeclarationNameInfo &NameInfo, bool IsAddressOfOperand, TypeSourceInfo **RecoveryTSI=nullptr)
BuildQualifiedDeclarationNameExpr - Build a C++ qualified declaration name, generally during template...
StmtResult ActOnForStmt(SourceLocation ForLoc, SourceLocation LParenLoc, Stmt *First, ConditionResult Second, FullExprArg Third, SourceLocation RParenLoc, Stmt *Body)
StmtResult ActOnIndirectGotoStmt(SourceLocation GotoLoc, SourceLocation StarLoc, Expr *DestExp)
ExprResult ActOnParenExpr(SourceLocation L, SourceLocation R, Expr *E)
ExprResult BuildCXXConstructExpr(SourceLocation ConstructLoc, QualType DeclInitType, NamedDecl *FoundDecl, CXXConstructorDecl *Constructor, MultiExprArg Exprs, bool HadMultipleCandidates, bool IsListInitialization, bool IsStdInitListInitialization, bool RequiresZeroInit, CXXConstructionKind ConstructKind, SourceRange ParenRange)
BuildCXXConstructExpr - Creates a complete call to a constructor, including handling of its default a...
ExprResult BuildAsTypeExpr(Expr *E, QualType DestTy, SourceLocation BuiltinLoc, SourceLocation RParenLoc)
Create a new AsTypeExpr node (bitcast) from the arguments.
ExprResult BuildFieldReferenceExpr(Expr *BaseExpr, bool IsArrow, SourceLocation OpLoc, const CXXScopeSpec &SS, FieldDecl *Field, DeclAccessPair FoundDecl, const DeclarationNameInfo &MemberNameInfo)
ExprResult ActOnConditionalOp(SourceLocation QuestionLoc, SourceLocation ColonLoc, Expr *CondExpr, Expr *LHSExpr, Expr *RHSExpr)
ActOnConditionalOp - Parse a ?
ExprResult BuildPossibleImplicitMemberExpr(const CXXScopeSpec &SS, SourceLocation TemplateKWLoc, LookupResult &R, const TemplateArgumentListInfo *TemplateArgs, const Scope *S)
Builds an expression which might be an implicit member expression.
UnsignedOrNone ArgPackSubstIndex
The current index into pack expansion arguments that will be used for substitution of parameter packs...
StmtResult BuildReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp, bool AllowRecovery=false)
StmtResult BuildCXXForRangeStmt(SourceLocation ForLoc, SourceLocation CoawaitLoc, Stmt *InitStmt, SourceLocation ColonLoc, Stmt *RangeDecl, Stmt *Begin, Stmt *End, Expr *Cond, Expr *Inc, Stmt *LoopVarDecl, SourceLocation RParenLoc, BuildForRangeKind Kind, ArrayRef< MaterializeTemporaryExpr * > LifetimeExtendTemps={})
BuildCXXForRangeStmt - Build or instantiate a C++11 for-range statement.
StmtResult ActOnDoStmt(SourceLocation DoLoc, Stmt *Body, SourceLocation WhileLoc, SourceLocation CondLParen, Expr *Cond, SourceLocation CondRParen)
StmtResult ActOnStartOfSwitchStmt(SourceLocation SwitchLoc, SourceLocation LParenLoc, Stmt *InitStmt, ConditionResult Cond, SourceLocation RParenLoc)
ExprResult BuildQualifiedTemplateIdExpr(CXXScopeSpec &SS, SourceLocation TemplateKWLoc, const DeclarationNameInfo &NameInfo, const TemplateArgumentListInfo *TemplateArgs, bool IsAddressOfOperand)
@ ConstantEvaluated
The current context is "potentially evaluated" in C++11 terms, but the expression is evaluated at com...
@ PotentiallyEvaluated
The current expression is potentially evaluated at run time, which means that code may be generated t...
@ Unevaluated
The current expression and its subexpressions occur within an unevaluated operand (C++11 [expr]p7),...
@ ImmediateFunctionContext
In addition of being constant evaluated, the current expression occurs in an immediate function conte...
StmtResult ActOnSEHExceptBlock(SourceLocation Loc, Expr *FilterExpr, Stmt *Block)
ExprResult CreateUnaryExprOrTypeTraitExpr(TypeSourceInfo *TInfo, SourceLocation OpLoc, UnaryExprOrTypeTrait ExprKind, SourceRange R)
Build a sizeof or alignof expression given a type operand.
StmtResult ActOnDeclStmt(DeclGroupPtrTy Decl, SourceLocation StartLoc, SourceLocation EndLoc)
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
getNamedTypeInfo - Returns the source type info associated to the name.
A FunctionEffect plus a potential boolean expression determining whether the effect is declared (e....
Holds information about the various types of exception specification.
FunctionDecl * SourceTemplate
The function template whose exception specification this is instantiated from, for EST_Uninstantiated...
ExceptionSpecificationType Type
The kind of exception specification this is.
ArrayRef< QualType > Exceptions
Explicitly-specified list of exception types.
Expr * NoexceptExpr
Noexcept expression, if this is a computed noexcept specification.
Extra information about a function prototype.
ExceptionSpecInfo ExceptionSpec
FunctionEffectsRef FunctionEffects
const ExtParameterInfo * ExtParameterInfos
const IdentifierInfo * getIdentifier() const
Returns the identifier to which this template name refers.
OverloadedOperatorKind getOperator() const
Return the overloaded operator to which this template name refers.
static TagTypeKind getTagTypeKindForKeyword(ElaboratedTypeKeyword Keyword)
Converts an elaborated type keyword into a TagTypeKind.
const NamespaceBaseDecl * Namespace
Iterator range representation begin:end[:step].
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