13#ifndef LLVM_CLANG_LIB_SEMA_TREETRANSFORM_H
14#define LLVM_CLANG_LIB_SEMA_TREETRANSFORM_H
50#include "llvm/ADT/ArrayRef.h"
51#include "llvm/Support/ErrorHandling.h"
55using namespace llvm::omp;
122template<
typename Derived>
127 class ForgetPartiallySubstitutedPackRAII {
135 ForgetPartiallySubstitutedPackRAII(Derived &
Self)
136 :
Self(
Self), ResetPackSubstIndex(
Self.getSema(), std::nullopt) {
137 Old =
Self.ForgetPartiallySubstitutedPack();
140 ~ForgetPartiallySubstitutedPackRAII() {
141 Self.RememberPartiallySubstitutedPack(Old);
143 ForgetPartiallySubstitutedPackRAII(
144 const ForgetPartiallySubstitutedPackRAII &) =
delete;
145 ForgetPartiallySubstitutedPackRAII &
146 operator=(
const ForgetPartiallySubstitutedPackRAII &) =
delete;
162 Derived &
getDerived() {
return static_cast<Derived&
>(*this); }
166 return static_cast<const Derived&
>(*this);
234 if (Location.isValid())
235 Self.getDerived().setBase(Location, Entity);
239 Self.getDerived().setBase(OldLocation, OldEntity);
314 bool FailOnPackProducingTemplates,
315 bool &ShouldExpand,
bool &RetainExpansion,
317 ShouldExpand =
false;
345 struct ForgetSubstitutionRAII {
351 Old =
Self.ForgetSubstitution();
354 ~ForgetSubstitutionRAII() {
Self.RememberSubstitution(std::move(Old)); }
454 const X##Attr *Transform##X##Attr(const X##Attr *R) { return R; }
455#include "clang/Basic/AttrList.inc"
465 const X##Attr *TransformStmt##X##Attr(const Stmt *, const Stmt *, \
466 const X##Attr *A) { \
467 return getDerived().Transform##X##Attr(A); \
469#include "clang/Basic/AttrList.inc"
515 bool *ArgChanged =
nullptr);
524 llvm::DenseMap<Decl *, Decl *>::iterator
Known
527 return Known->second;
555 assert(
New.size() == 1 &&
556 "must override transformedLocalDecl if performing pack expansion");
594 NamedDecl *FirstQualifierInScope =
nullptr);
639 NamedDecl *FirstQualifierInScope =
nullptr,
640 bool AllowInjectedClassName =
false);
655 bool Uneval =
false);
682 bool Uneval =
false) {
701 template<
typename InputIterator>
705 bool Uneval =
false);
707 template <
typename InputIterator>
711 bool Uneval =
false);
732 return SemaRef.Context.getTrivialTypeSourceInfo(
T,
736#define ABSTRACT_TYPELOC(CLASS, PARENT)
737#define TYPELOC(CLASS, PARENT) \
738 QualType Transform##CLASS##Type(TypeLocBuilder &TLB, CLASS##TypeLoc T);
739#include "clang/AST/TypeLocNodes.def"
743 bool SuppressObjCLifetime);
747 bool SuppressObjCLifetime);
749 template<
typename Fn>
767 bool AllowInjectedClassName);
795 return getDerived().TransformFunctionTypeParams(
796 Loc, Params, ParamTypes, ParamInfos, PTypes, PVars, PInfos,
nullptr);
814 KWLoc, Params,
nullptr,
815 nullptr, PTypes, &TransParams, PInfos))
829 bool ExpectParameterPack);
858 bool IsAddressOfOperand,
866 bool IsAddressOfOperand);
874#define STMT(Node, Parent) \
875 LLVM_ATTRIBUTE_NOINLINE \
876 StmtResult Transform##Node(Node *S);
877#define VALUESTMT(Node, Parent) \
878 LLVM_ATTRIBUTE_NOINLINE \
879 StmtResult Transform##Node(Node *S, StmtDiscardKind SDK);
880#define EXPR(Node, Parent) \
881 LLVM_ATTRIBUTE_NOINLINE \
882 ExprResult Transform##Node(Node *E);
883#define ABSTRACT_STMT(Stmt)
884#include "clang/AST/StmtNodes.inc"
886#define GEN_CLANG_CLAUSE_CLASS
887#define CLAUSE_CLASS(Enum, Str, Class) \
888 LLVM_ATTRIBUTE_NOINLINE \
889 OMPClause *Transform##Class(Class *S);
890#include "llvm/Frontend/OpenMP/OMP.inc"
968 const llvm::APInt *Size,
Expr *SizeExpr,
969 unsigned IndexTypeQuals,
SourceRange BracketsRange);
978 const llvm::APInt &Size,
Expr *SizeExpr,
979 unsigned IndexTypeQuals,
989 unsigned IndexTypeQuals,
999 unsigned IndexTypeQuals,
1010 unsigned IndexTypeQuals,
1048 unsigned NumColumns,
1066 Expr *AddrSpaceExpr,
1090 return SemaRef.Context.getUsingType(
Keyword, Qualifier, D, UnderlyingType);
1103 return SemaRef.Context.getMacroQualifiedType(
T, MacroII);
1113 return SemaRef.Context.getCanonicalTagType(Tag);
1130 UnaryTransformType::UTTKind UKind,
1150 return SemaRef.Context.getAutoType(
1151 DK, DeducedAsType,
Keyword, TypeConstraintConcept, TypeConstraintArgs);
1159 return SemaRef.Context.getDeducedTemplateSpecializationType(
1178 return SemaRef.BuildParenType(InnerType);
1191 bool DeducedTSTContext) {
1193 SS.
Adopt(QualifierLoc);
1197 if (!
SemaRef.computeDeclContext(SS))
1205 return SemaRef.CheckTypenameType(
Keyword, KeywordLoc, QualifierLoc,
1206 *Id, IdLoc, DeducedTSTContext);
1219 if (
SemaRef.RequireCompleteDeclContext(SS, DC))
1224 switch (
Result.getResultKind()) {
1235 llvm_unreachable(
"Tag lookup cannot find non-tags");
1247 switch (
Result.getResultKind()) {
1253 SemaRef.Diag(IdLoc, diag::err_tag_reference_non_tag)
1254 << SomeDecl << NTK << Kind;
1259 SemaRef.Diag(IdLoc, diag::err_not_tag_in_scope)
1265 if (!
SemaRef.isAcceptableTagRedeclaration(Tag, Kind,
false,
1267 SemaRef.Diag(KeywordLoc, diag::err_use_with_wrong_tag) << Id;
1268 SemaRef.Diag(Tag->getLocation(), diag::note_previous_use);
1324 bool AllowInjectedClassName);
1337 bool AllowInjectedClassName);
1343 bool AllowInjectedClassName);
1353 Decl *AssociatedDecl,
unsigned Index,
1356 ArgPack, AssociatedDecl, Index, Final);
1365 bool FullySubstituted,
1368 Pattern, IndexExpr, FullySubstituted, Expansions);
1422 return SemaRef.ActOnLabelStmt(IdentLoc, L, ColonLoc, SubStmt);
1432 if (
SemaRef.CheckRebuiltStmtAttributes(Attrs))
1434 return SemaRef.BuildAttributedStmt(AttrLoc, Attrs, SubStmt);
1446 Then, ElseLoc, Else);
1500 Inc, RParenLoc, Body);
1545 bool IsVolatile,
unsigned NumOutputs,
1552 NumInputs, Names, Constraints, Exprs,
1553 AsmString, Clobbers, NumLabels, RParenLoc);
1562 StringRef AsmString,
1563 unsigned NumOutputs,
unsigned NumInputs,
1569 NumOutputs, NumInputs,
1570 Constraints, Clobbers, Exprs, EndLoc);
1599 CoawaitLoc, Operand, OpCoawaitLookup);
1603 Suspend.
get(),
true);
1704 Kind, DirName, CancelRegion, Clauses, AStmt, StartLoc, EndLoc);
1716 TraitInfos, Variants);
1728 Kind, DirName, Clauses, AStmt, StartLoc, EndLoc);
1742 NameModifier,
Condition, StartLoc, LParenLoc, NameModifierLoc, ColonLoc,
1769 VarList, PrescriptivenessModifier, PrescriptivenessModifierLoc,
1770 DimsModifier, DimsModifierExpr, DimsModifierLoc, StartLoc, LParenLoc,
1808 std::optional<unsigned> FillIdx,
1810 unsigned FillCount = FillIdx ? 1 : 0;
1812 Counts, StartLoc, LParenLoc, EndLoc, FillIdx, FillLoc, FillCount);
1851 First, Count, StartLoc, LParenLoc, FirstLoc, CountLoc, EndLoc);
1887 Kind, KindKwLoc, VCKind, VCLoc, StartLoc, LParenLoc, EndLoc);
1900 Kind, KindKwLoc, StartLoc, LParenLoc, EndLoc);
1907 ImpexTypeArg, StartLoc, LParenLoc, EndLoc);
1920 M1, M2, Kind, ChunkSize, StartLoc, LParenLoc, M1Loc, M2Loc, KindLoc,
1982 VarList, LPKind, LPKindLoc, ColonLoc, StartLoc, LParenLoc, EndLoc);
2010 VarList, {Modifier, OriginalSharingModifier}, StartLoc, LParenLoc,
2011 ModifierLoc, ColonLoc, EndLoc, ReductionIdScopeSpec, ReductionId,
2012 UnresolvedReductions);
2026 VarList, StartLoc, LParenLoc, ColonLoc, EndLoc, ReductionIdScopeSpec,
2027 ReductionId, UnresolvedReductions);
2042 VarList, StartLoc, LParenLoc, ColonLoc, EndLoc, ReductionIdScopeSpec,
2043 ReductionId, UnresolvedReductions);
2056 VarList, Step, StartLoc, LParenLoc, Modifier, ModifierLoc, ColonLoc,
2057 StepModifierLoc, EndLoc);
2070 VarList, Alignment, StartLoc, LParenLoc, ColonLoc, EndLoc);
2130 Data, DepModifier, VarList, StartLoc, LParenLoc, EndLoc);
2143 Modifier,
Device, StartLoc, LParenLoc, ModifierLoc, EndLoc);
2158 IteratorModifier, MapTypeModifiers, MapTypeModifiersLoc,
2159 MapperIdScopeSpec, MapperId, MapType, IsMapTypeImplicit, MapLoc,
2160 ColonLoc, VarList, Locs,
2161 false, UnresolvedMappers);
2178 Allocate, Alignment, FirstModifier, FirstModifierLoc, SecondModifier,
2179 SecondModifierLoc, VarList, StartLoc, LParenLoc, ColonLoc, EndLoc);
2193 VarList, Modifier, ModifierExpr, ModifierLoc, ModifierExtra,
2194 ModifierExtraExpr, ModifierExtraLoc, StartLoc, LParenLoc, EndLoc);
2206 VarList, Modifier, ModifierExpr, ModifierLoc, StartLoc, LParenLoc,
2231 Modifier,
Device, StartLoc, LParenLoc, ModifierLoc, EndLoc);
2244 Modifier, NumTasks, StartLoc, LParenLoc, ModifierLoc, EndLoc);
2279 Kind, ChunkSize, StartLoc, LParenLoc, KindLoc, CommaLoc, EndLoc);
2294 MotionModifiers, MotionModifiersLoc, IteratorModifier,
2295 MapperIdScopeSpec, MapperId, ColonLoc, VarList, Locs,
2311 MotionModifiers, MotionModifiersLoc, IteratorModifier,
2312 MapperIdScopeSpec, MapperId, ColonLoc, VarList, Locs,
2325 VarList, Locs, FallbackModifier, FallbackModifierLoc);
2367 M, Kind, StartLoc, LParenLoc, MLoc, KindLoc, EndLoc);
2414 StartLoc, LParenLoc, EndLoc,
Data);
2427 StartLoc, LParenLoc, ColonLoc, EndLoc, Modifier, Locators);
2439 Modifier, Kind, StartLoc, LParenLoc, ModifierKwLoc, KindKwLoc, EndLoc);
2452 InteropVar, InteropInfo, StartLoc, LParenLoc, VarLoc, EndLoc);
2463 LParenLoc, VarLoc, EndLoc);
2475 InteropVar, StartLoc, LParenLoc, VarLoc, EndLoc);
2546 M1, M2, Size, StartLoc, LParenLoc, M1Loc, M2Loc, EndLoc);
2627 DepType, DepLoc, ColonLoc, VarList, StartLoc, LParenLoc, EndLoc);
2675 ForLoc, Element, Collection, RParenLoc);
2693 StartLoc, IdLoc, Id);
2730 if (
DeclStmt *RangeStmt = dyn_cast<DeclStmt>(Range)) {
2731 if (RangeStmt->isSingleDecl()) {
2732 if (
VarDecl *RangeVar = dyn_cast<VarDecl>(RangeStmt->getSingleDecl())) {
2733 if (RangeVar->isInvalidDecl())
2736 Expr *RangeExpr = RangeVar->getInit();
2743 diag::err_objc_for_range_init_stmt)
2744 <<
Init->getSourceRange();
2747 ForLoc, LoopVar, RangeExpr, RParenLoc);
2754 ForLoc, CoawaitLoc,
Init, ColonLoc, Range, Begin, End, Cond, Inc,
2768 QualifierLoc, NameInfo, Nested);
2830 SS.
Adopt(QualifierLoc);
2884 UnaryExprOrTypeTrait ExprKind,
2895 UnaryExprOrTypeTrait ExprKind,
2950 if (IsOMPArraySection)
2952 Base, LBracketLoc, LowerBound, ColonLocFirst, ColonLocSecond, Length,
2953 Stride, RBracketLoc);
2955 assert(Stride ==
nullptr && !ColonLocSecond.
isValid() &&
2956 "Stride/second colon not allowed for OpenACC");
2959 Base, LBracketLoc, LowerBound, ColonLocFirst, Length, RBracketLoc);
2971 Base, LParenLoc, RParenLoc, Dims, BracketsRanges);
2983 nullptr, IteratorKwLoc, LLoc, RLoc,
Data);
2993 Expr *ExecConfig =
nullptr) {
2995 nullptr, Callee, LParenLoc, Args, RParenLoc, ExecConfig);
3002 nullptr, Callee, LParenLoc, Args, RParenLoc);
3020 if (!
Member->getDeclName()) {
3024 assert(
Member->getType()->isRecordType() &&
3025 "unnamed member not of record type?");
3038 if (!isArrow &&
Base->isPRValue()) {
3053 SS.
Adopt(QualifierLoc);
3056 if (
Base->containsErrors())
3061 if (isArrow && !BaseType->isPointerType())
3067 R.addDecl(FoundDecl);
3070 if (
getSema().isUnevaluatedContext() &&
Base->isImplicitCXXThis() &&
3075 ->getAsCXXRecordDecl()) {
3079 if (!ThisClass->Equals(
Class) && !ThisClass->isDerivedFrom(
Class))
3087 FirstQualifierInScope,
3088 R, ExplicitTemplateArgs,
3098 bool ForFoldExpression =
false) {
3176 return SemaRef.BuildInitList(LBraceLoc,
Inits, RBraceLoc, IsExplicit);
3189 =
SemaRef.ActOnDesignatedInitializer(Desig, EqualOrColonLoc, GNUSyntax,
3229 unsigned NumUserSpecifiedExprs,
3234 InitLoc, LParenLoc, RParenLoc);
3264 return SemaRef.ActOnChooseExpr(BuiltinLoc,
3276 Expr *ControllingExpr,
3281 ControllingExpr, Types, Exprs);
3296 ControllingType, Types, Exprs);
3329 case Stmt::CXXStaticCastExprClass:
3330 return getDerived().RebuildCXXStaticCastExpr(OpLoc, LAngleLoc, TInfo,
3331 RAngleLoc, LParenLoc,
3332 SubExpr, RParenLoc);
3334 case Stmt::CXXDynamicCastExprClass:
3335 return getDerived().RebuildCXXDynamicCastExpr(OpLoc, LAngleLoc, TInfo,
3336 RAngleLoc, LParenLoc,
3337 SubExpr, RParenLoc);
3339 case Stmt::CXXReinterpretCastExprClass:
3340 return getDerived().RebuildCXXReinterpretCastExpr(OpLoc, LAngleLoc, TInfo,
3341 RAngleLoc, LParenLoc,
3345 case Stmt::CXXConstCastExprClass:
3346 return getDerived().RebuildCXXConstCastExpr(OpLoc, LAngleLoc, TInfo,
3347 RAngleLoc, LParenLoc,
3348 SubExpr, RParenLoc);
3350 case Stmt::CXXAddrspaceCastExprClass:
3351 return getDerived().RebuildCXXAddrspaceCastExpr(
3352 OpLoc, LAngleLoc, TInfo, RAngleLoc, LParenLoc, SubExpr, RParenLoc);
3355 llvm_unreachable(
"Invalid C++ named cast");
3433 OpLoc, tok::kw_addrspace_cast, TInfo, SubExpr,
3445 bool ListInitialization) {
3449 if (
auto *PLE = dyn_cast<ParenListExpr>(Sub))
3451 TInfo, LParenLoc,
MultiExprArg(PLE->getExprs(), PLE->getNumExprs()),
3452 RParenLoc, ListInitialization);
3454 if (
auto *PLE = dyn_cast<CXXParenListInitExpr>(Sub))
3456 TInfo, LParenLoc, PLE->getUserSpecifiedInitExprs(), RParenLoc,
3457 ListInitialization);
3461 ListInitialization);
3525 if (
getSema().CheckCXXThisType(ThisLoc, ThisType))
3535 bool IsThrownVariableInScope) {
3545 Expr *RewrittenExpr) {
3547 RewrittenExpr,
getSema().CurContext);
3556 Expr *RewrittenInit) {
3558 getSema().CurContext, RewrittenInit);
3582 std::optional<Expr *> ArraySize,
3601 bool IsGlobalDelete,
3652 bool IsAddressOfOperand,
3655 SS.
Adopt(QualifierLoc);
3657 if (TemplateArgs || TemplateKWLoc.
isValid())
3659 SS, TemplateKWLoc, NameInfo, TemplateArgs, IsAddressOfOperand);
3662 SS, NameInfo, IsAddressOfOperand, RecoveryTSI);
3684 bool IsElidable,
MultiExprArg Args,
bool HadMultipleCandidates,
3685 bool ListInitialization,
bool StdInitListInitialization,
3692 FoundCtor =
Constructor->getInheritedConstructor().getConstructor();
3695 if (
getSema().CompleteConstructorCall(FoundCtor,
T, Args, Loc,
3702 HadMultipleCandidates,
3704 StdInitListInitialization,
3705 RequiresZeroInit, ConstructKind,
3713 bool ConstructsVBase,
3714 bool InheritedFromVBase) {
3716 Loc,
T,
Constructor, ConstructsVBase, InheritedFromVBase);
3727 bool ListInitialization) {
3729 TSInfo, LParenOrBraceLoc, Args, RParenOrBraceLoc, ListInitialization);
3740 bool ListInitialization) {
3742 RParenLoc, ListInitialization);
3759 SS.
Adopt(QualifierLoc);
3761 return SemaRef.BuildMemberReferenceExpr(BaseE, BaseType,
3762 OperatorLoc, IsArrow,
3764 FirstQualifierInScope,
3766 TemplateArgs,
nullptr);
3782 SS.
Adopt(QualifierLoc);
3784 return SemaRef.BuildMemberReferenceExpr(BaseE, BaseType,
3785 OperatorLoc, IsArrow,
3787 FirstQualifierInScope,
3788 R, TemplateArgs,
nullptr);
3796 return SemaRef.BuildCXXNoexceptExpr(Range.getBegin(), Arg, Range.getEnd());
3809 RParenLoc, Length, PartialArgs);
3814 Expr *PackIdExpression,
Expr *IndexExpr,
3816 bool FullySubstituted =
false) {
3818 IndexExpr, RSquareLoc, ExpandedExprs,
3844 NamedConcept, TALI);
3862 LocalParameters, RParenLoc, Requirements,
3869 return SemaRef.BuildTypeRequirement(SubstDiag);
3873 return SemaRef.BuildTypeRequirement(
T);
3881 return SemaRef.BuildExprRequirement(SubstDiag, IsSimple, NoexceptLoc,
3888 return SemaRef.BuildExprRequirement(E, IsSimple, NoexceptLoc,
3900 return SemaRef.BuildNestedRequirement(Constraint);
3916 Expr **Elements,
unsigned NumElements) {
3926 RB,
Base, Key, getterMethod, setterMethod);
3945 return SemaRef.ObjC().BuildObjCEncodeExpression(AtLoc, EncodeTypeInfo,
3957 return SemaRef.ObjC().BuildClassMessage(
3958 ReceiverTypeInfo, ReceiverTypeInfo->
getType(),
3971 return SemaRef.ObjC().BuildInstanceMessage(Receiver, Receiver->
getType(),
3974 SelectorLocs, RBracLoc, Args);
3986 return Method->isInstanceMethod()
3987 ?
SemaRef.ObjC().BuildInstanceMessage(
3988 nullptr, SuperType, SuperLoc, Sel,
Method, LBracLoc,
3989 SelectorLocs, RBracLoc, Args)
3990 :
SemaRef.ObjC().BuildClassMessage(
nullptr, SuperType, SuperLoc,
3992 SelectorLocs, RBracLoc, Args);
4001 bool IsArrow,
bool IsFreeIvar) {
4010 if (IsFreeIvar &&
Result.isUsable())
4047 PropertyLoc,
Base));
4076 =
SemaRef.Context.Idents.get(
"__builtin_shufflevector");
4079 assert(!Lookup.
empty() &&
"No __builtin_shufflevector?");
4087 Callee =
SemaRef.ImpCastExprToType(Callee, CalleePtrTy,
4088 CK_BuiltinFnToFnPtr).get();
4104 return SemaRef.ConvertVectorExpr(SrcExpr, DstTInfo, BuiltinLoc, RParenLoc);
4119 EllipsisLoc, NumExpansions);
4143 llvm_unreachable(
"Pack expansion pattern has no parameter packs");
4179 EllipsisLoc, RHS, RParenLoc,
4188 Init->containsUnexpandedParameterPack();
4189 else if (PVD->hasUninstantiatedDefaultArg())
4191 PVD->getUninstantiatedDefaultArg()
4192 ->containsUnexpandedParameterPack();
4346 Exprs.push_back(DevNumExpr);
4347 llvm::append_range(Exprs, QueueIdExprs);
4384 AssociatedDecl, Index, ParamType, Loc, Arg,
PackIndex, Final);
4408 ObjectType, FirstQualifierInScope);
4414 QualType TransformDependentNameType(TypeLocBuilder &TLB,
4415 DependentNameTypeLoc TL,
4416 bool DeducibleTSTContext,
4417 QualType ObjectType = QualType(),
4418 NamedDecl *UnqualLookup =
nullptr);
4421 TransformOpenACCClauseList(OpenACCDirectiveKind DirKind,
4426 OpenACCDirectiveKind DirKind,
4427 const OpenACCClause *OldClause);
4430template <
typename Derived>
4440#define STMT(Node, Parent) \
4441 case Stmt::Node##Class: return getDerived().Transform##Node(cast<Node>(S));
4442#define VALUESTMT(Node, Parent) \
4443 case Stmt::Node##Class: \
4444 return getDerived().Transform##Node(cast<Node>(S), SDK);
4445#define ABSTRACT_STMT(Node)
4446#define EXPR(Node, Parent)
4447#include "clang/AST/StmtNodes.inc"
4450#define STMT(Node, Parent)
4451#define ABSTRACT_STMT(Stmt)
4452#define EXPR(Node, Parent) case Stmt::Node##Class:
4453#include "clang/AST/StmtNodes.inc"
4458 E =
getSema().ActOnStmtExprResult(E);
4466template<
typename Derived>
4474#define GEN_CLANG_CLAUSE_CLASS
4475#define CLAUSE_CLASS(Enum, Str, Class) \
4477 return getDerived().Transform##Class(cast<Class>(S));
4478#include "llvm/Frontend/OpenMP/OMP.inc"
4485template<
typename Derived>
4492#define STMT(Node, Parent) case Stmt::Node##Class: break;
4493#define ABSTRACT_STMT(Stmt)
4494#define EXPR(Node, Parent) \
4495 case Stmt::Node##Class: return getDerived().Transform##Node(cast<Node>(E));
4496#include "clang/AST/StmtNodes.inc"
4502template<
typename Derived>
4510 if (
auto *FE = dyn_cast<FullExpr>(
Init))
4511 Init = FE->getSubExpr();
4513 if (
auto *AIL = dyn_cast<ArrayInitLoopExpr>(
Init)) {
4519 Init = MTE->getSubExpr();
4522 Init = Binder->getSubExpr();
4525 Init = ICE->getSubExprAsWritten();
4528 dyn_cast<CXXStdInitializerListExpr>(
Init))
4565 getSema().currentEvaluationContext().InLifetimeExtendingContext =
4566 getSema().parentEvaluationContext().InLifetimeExtendingContext;
4567 getSema().currentEvaluationContext().RebuildDefaultArgOrDefaultInit =
4568 getSema().parentEvaluationContext().RebuildDefaultArgOrDefaultInit;
4570 bool ArgChanged =
false;
4572 true, NewArgs, &ArgChanged))
4583 if (
Parens.isInvalid()) {
4586 assert(NewArgs.empty() &&
4587 "no parens or braces but have direct init with arguments?");
4594template<
typename Derived>
4600 for (
unsigned I = 0; I != NumInputs; ++I) {
4610 Expr *Pattern = Expansion->getPattern();
4613 getSema().collectUnexpandedParameterPacks(Pattern, Unexpanded);
4614 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
4619 bool RetainExpansion =
false;
4620 UnsignedOrNone OrigNumExpansions = Expansion->getNumExpansions();
4624 Unexpanded,
true, Expand,
4625 RetainExpansion, NumExpansions))
4638 Expansion->getEllipsisLoc(),
4640 if (Out.isInvalid())
4645 Outputs.push_back(Out.get());
4651 if (ArgChanged) *ArgChanged =
true;
4655 for (
unsigned I = 0; I != *NumExpansions; ++I) {
4658 if (Out.isInvalid())
4661 if (Out.get()->containsUnexpandedParameterPack()) {
4663 Out.get(), Expansion->getEllipsisLoc(), OrigNumExpansions);
4664 if (Out.isInvalid())
4668 Outputs.push_back(Out.get());
4673 if (RetainExpansion) {
4674 ForgetPartiallySubstitutedPackRAII Forget(
getDerived());
4677 if (Out.isInvalid())
4681 Out.get(), Expansion->getEllipsisLoc(), OrigNumExpansions);
4682 if (Out.isInvalid())
4685 Outputs.push_back(Out.get());
4692 IsCall ?
getDerived().TransformInitializer(Inputs[I],
false)
4697 if (
Result.get() != Inputs[I] && ArgChanged)
4700 Outputs.push_back(
Result.get());
4706template <
typename Derived>
4717 VarDecl *ConditionVar = cast_or_null<VarDecl>(
4723 return getSema().ActOnConditionVariable(ConditionVar, Loc, Kind);
4732 return getSema().ActOnCondition(
nullptr, Loc, CondExpr.
get(), Kind,
4739template <
typename Derived>
4747 Qualifier = Qualifier.getAsNamespaceAndPrefix().Prefix)
4759 llvm_unreachable(
"unexpected null nested name specifier");
4790 QualifierLoc =
getDerived().TransformNestedNameSpecifierLoc(
4791 QualifierLoc, ObjectType, FirstQualifierInScope);
4795 FirstQualifierInScope =
nullptr;
4797 SS.
Adopt(QualifierLoc);
4801 if (
SemaRef.BuildCXXNestedNameSpecifier(
nullptr, IdInfo,
4803 FirstQualifierInScope,
false))
4811 T = TransformTypeInObjectScope(TLB, TL, ObjectType,
4812 FirstQualifierInScope);
4818 if (
T->isDependentType() ||
T->isRecordType() ||
4819 (
SemaRef.getLangOpts().CPlusPlus11 &&
T->isEnumeralType())) {
4820 if (
T->isEnumeralType())
4822 diag::warn_cxx98_compat_enum_nested_name_spec);
4829 if (!TTL || !TTL.
getDecl()->isInvalidDecl()) {
4853template<
typename Derived>
4873 TemplateDecl *NewTemplate = cast_or_null<TemplateDecl>(
4880 SemaRef.Context.DeclarationNames.getCXXDeductionGuideName(NewTemplate));
4890 NewTInfo =
getDerived().TransformType(OldTInfo);
4893 NewCanTy =
SemaRef.Context.getCanonicalType(NewTInfo->
getType());
4901 NewCanTy =
SemaRef.Context.getCanonicalType(NewT);
4914 llvm_unreachable(
"Unknown name kind.");
4917template <
typename Derived>
4921 QualType ObjectType,
bool AllowInjectedClassName) {
4923 return getDerived().RebuildTemplateName(SS, TemplateKWLoc, *II, NameLoc,
4924 ObjectType, AllowInjectedClassName);
4925 return getDerived().RebuildTemplateName(SS, TemplateKWLoc,
IO.getOperator(),
4926 NameLoc, ObjectType,
4927 AllowInjectedClassName);
4930template <
typename Derived>
4934 NamedDecl *FirstQualifierInScope,
bool AllowInjectedClassName) {
4936 TemplateName UnderlyingName = QTN->getUnderlyingTemplate();
4939 QualifierLoc =
getDerived().TransformNestedNameSpecifierLoc(
4940 QualifierLoc, ObjectType, FirstQualifierInScope);
4947 UnderlyingQualifier, TemplateKWLoc, UnderlyingName, NameLoc, ObjectType,
4948 FirstQualifierInScope, AllowInjectedClassName);
4949 if (NewUnderlyingName.
isNull())
4951 assert(!UnderlyingQualifier &&
"unexpected qualifier");
4955 NewUnderlyingName == UnderlyingName)
4958 SS.
Adopt(QualifierLoc);
4959 return getDerived().RebuildTemplateName(SS, QTN->hasTemplateKeyword(),
4965 QualifierLoc =
getDerived().TransformNestedNameSpecifierLoc(
4966 QualifierLoc, ObjectType, FirstQualifierInScope);
4980 SS.
Adopt(QualifierLoc);
4981 return getDerived().RebuildTemplateName(SS, TemplateKWLoc, DTN->getName(),
4982 NameLoc, ObjectType,
4983 AllowInjectedClassName);
4988 assert(!QualifierLoc &&
"Unexpected qualified SubstTemplateTemplateParm");
4995 ReplacementQualifierLoc = Builder.getWithLocInContext(
SemaRef.Context);
4999 ReplacementQualifierLoc, TemplateKWLoc, ReplacementName, NameLoc,
5000 ObjectType, FirstQualifierInScope, AllowInjectedClassName);
5003 Decl *AssociatedDecl =
5004 getDerived().TransformDecl(NameLoc, S->getAssociatedDecl());
5006 AssociatedDecl == S->getAssociatedDecl())
5008 return SemaRef.Context.getSubstTemplateTemplateParm(
5009 NewName, AssociatedDecl, S->getIndex(), S->getPackIndex(),
5014 assert(!QualifierLoc &&
"Unexpected qualified pack-index-template-name");
5020 IndexExpr =
getDerived().TransformExpr(PI->getIndexExpr());
5028 NoQualifier, TemplateKWLoc, N, NameLoc, ObjectType,
5029 FirstQualifierInScope, AllowInjectedClassName);
5036 bool NotYetExpanded = Names.empty();
5037 bool FullySubstituted =
true;
5039 if (Names.empty() && !PI->expandsToEmptyPack())
5043 if (!N.containsUnexpandedParameterPack()) {
5045 if (Transformed.
isNull())
5047 SubstitutedNames.push_back(Transformed);
5052 getSema().collectUnexpandedParameterPacks(N, Unexpanded);
5053 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
5055 bool ShouldExpand =
true;
5056 bool RetainExpansion =
false;
5061 RetainExpansion, NumExpansions))
5064 if (!ShouldExpand) {
5069 if (NotYetExpanded) {
5070 FullySubstituted =
false;
5071 return getDerived().RebuildPackIndexingTemplateName(
5072 Pack, IndexExpr.
get(), FullySubstituted);
5074 SubstitutedNames.push_back(Pack);
5078 for (
unsigned I = 0; I != *NumExpansions; ++I) {
5083 SubstitutedNames.push_back(Out);
5084 FullySubstituted &= !Out.containsUnexpandedParameterPack();
5089 if (RetainExpansion) {
5090 FullySubstituted =
false;
5091 ForgetPartiallySubstitutedPackRAII Forget(
getDerived());
5095 SubstitutedNames.push_back(Out);
5104 return getDerived().RebuildPackIndexingTemplateName(
5105 NewPattern, IndexExpr.
get(), FullySubstituted, SubstitutedNames);
5109 "DeducedTemplateName should not escape partial ordering");
5113 assert(!QualifierLoc &&
"Unexpected qualifier");
5120 assert(!QualifierLoc &&
5121 "Unexpected qualified SubstTemplateTemplateParmPack");
5123 SubstPack->getArgumentPack(), SubstPack->getAssociatedDecl(),
5124 SubstPack->getIndex(), SubstPack->getFinal());
5128 llvm_unreachable(
"overloaded function decl survived to here");
5131template <
typename Derived>
5140template <
typename Derived>
5145 QualifierLoc, TemplateKeywordLoc, Name, NameLoc);
5151template<
typename Derived>
5155 Output =
getSema().getTrivialTemplateArgumentLoc(
5159template <
typename Derived>
5167 llvm_unreachable(
"Unexpected TemplateArgument");
5190 if (NewT ==
T && D == NewD)
5207 llvm_unreachable(
"unexpected template argument kind");
5239 llvm_unreachable(
"Caller should expand pack expansions");
5255 E =
SemaRef.ActOnConstantExpression(E);
5270template<
typename Derived,
typename InputIterator>
5278 typedef typename std::iterator_traits<InputIterator>::difference_type
5293 : Self(Self), Iter(Iter) { }
5308 Self.InventTemplateArgumentLoc(*Iter,
Result);
5316 return X.Iter == Y.Iter;
5321 return X.Iter != Y.Iter;
5325template<
typename Derived>
5326template<
typename InputIterator>
5345 PackLocIterator(*
this, In.getArgument().pack_begin()),
5346 PackLocIterator(*
this, In.getArgument().pack_end()), *PackOutput,
5353 if (In.getArgument().isPackExpansion()) {
5365 std::optional<ForgetSubstitutionRAII> ForgetSubst;
5375 if (Out.getArgument().containsUnexpandedParameterPack()) {
5378 if (Out.getArgument().isNull())
5388 ForgetPartiallySubstitutedPackRAII Forget(
getDerived());
5396 if (Out.getArgument().isNull())
5415template <
typename Derived>
5416template <
typename InputIterator>
5425 return !Arg.isDependent() && Arg.isConceptOrConceptTemplateParameter();
5437 PackLocIterator(*
this, In.getArgument().pack_begin()),
5438 PackLocIterator(*
this, In.getArgument().pack_end()), Outputs,
5444 if (!isNonDependentConceptArgument(In.getArgument())) {
5459template <
typename Derived>
5470 Pattern =
getSema().getTemplateArgumentPackExpansionPattern(
5473 getSema().collectUnexpandedParameterPacks(Pattern, Unexpanded);
5474 if (IsLateExpansionAttempt) {
5481 if (!SawPackTypes) {
5486 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
5494 Info.
Ellipsis, Pattern.getSourceRange(), Unexpanded,
5500 if (ComputeInfo(In,
false, Info, Pattern))
5512 std::optional<Sema::ArgPackSubstIndexRAII> SubstIndex(
5513 std::in_place,
getSema(), std::nullopt);
5519 if (Out.getArgument().isNull())
5556 ForgetSubstitutionRAII ForgetSubst(
getDerived());
5557 if (ComputeInfo(Out,
true, Info, OutPattern))
5570template<
typename Derived>
5588template <
typename Derived>
5608template<
typename Derived>
5611 switch (
T.getTypeLocClass()) {
5612#define ABSTRACT_TYPELOC(CLASS, PARENT)
5613#define TYPELOC(CLASS, PARENT) \
5614 case TypeLoc::CLASS: \
5615 return getDerived().Transform##CLASS##Type(TLB, \
5616 T.castAs<CLASS##TypeLoc>());
5617#include "clang/AST/TypeLocNodes.def"
5620 llvm_unreachable(
"unhandled type loc!");
5623template<
typename Derived>
5636template <
typename Derived>
5674template<
typename Derived>
5679 TypeLoc UnqualTL =
T.getUnqualifiedLoc();
5680 auto SuppressObjCLifetime =
5681 T.getType().getLocalQualifiers().hasObjCLifetime();
5683 Result = getDerived().TransformTemplateTypeParmType(TLB, TTP,
5684 SuppressObjCLifetime);
5685 }
else if (
auto STTP = UnqualTL.
getAs<SubstTemplateTypeParmPackTypeLoc>()) {
5686 Result = getDerived().TransformSubstTemplateTypeParmPackType(
5687 TLB, STTP, SuppressObjCLifetime);
5689 Result = getDerived().TransformType(TLB, UnqualTL);
5708template <
typename Derived>
5718 SemaRef.Diag(Loc, diag::err_address_space_mismatch_templ_inst)
5725 if (
T.getPointerAuth().isPresent()) {
5726 SemaRef.Diag(Loc, diag::err_ptrauth_qualifier_redundant) << TL.
getType();
5729 if (!
T->isDependentType()) {
5730 if (!
T->isSignableType(
SemaRef.getASTContext())) {
5731 SemaRef.Diag(Loc, diag::err_ptrauth_qualifier_invalid_target) <<
T;
5739 if (
T->isFunctionType()) {
5740 T =
SemaRef.getASTContext().getAddrSpaceQualType(
T,
5750 if (
T->isReferenceType()) {
5760 if (!
T->isObjCLifetimeType() && !
T->isDependentType())
5762 else if (
T.getObjCLifetime()) {
5766 const AutoType *AutoTy;
5767 if ((AutoTy = dyn_cast<AutoType>(
T)) && AutoTy->isDeduced()) {
5773 SemaRef.Context.getQualifiedType(
Deduced.getUnqualifiedType(), Qs);
5775 AutoTy->getKeyword(),
5776 AutoTy->getTypeConstraintConcept(),
5777 AutoTy->getTypeConstraintArguments());
5782 SemaRef.Diag(Loc, diag::err_attr_objc_ownership_redundant) <<
T;
5788 return SemaRef.BuildQualifiedType(
T, Loc, Quals);
5791template <
typename Derived>
5792QualType TreeTransform<Derived>::TransformTypeInObjectScope(
5795 assert(!getDerived().AlreadyTransformed(TL.
getType()));
5798 case TypeLoc::TemplateSpecialization:
5799 return getDerived().TransformTemplateSpecializationType(
5801 FirstQualifierInScope,
true);
5802 case TypeLoc::DependentName:
5803 return getDerived().TransformDependentNameType(
5805 ObjectType, FirstQualifierInScope);
5809 return getDerived().TransformType(TLB, TL);
5813template <
class TyLoc>
static inline
5815 TyLoc NewT = TLB.
push<TyLoc>(
T.getType());
5816 NewT.setNameLoc(
T.getNameLoc());
5820template<
typename Derived>
5821QualType TreeTransform<Derived>::TransformBuiltinType(TypeLocBuilder &TLB,
5823 BuiltinTypeLoc NewT = TLB.push<BuiltinTypeLoc>(T.getType());
5824 NewT.setBuiltinLoc(T.getBuiltinLoc());
5825 if (T.needsExtraLocalData())
5826 NewT.getWrittenBuiltinSpecs() = T.getWrittenBuiltinSpecs();
5830template<
typename Derived>
5837template <
typename Derived>
5841 return getDerived().
TransformType(TLB, TL.getOriginalLoc());
5844template<
typename Derived>
5847 QualType OriginalType = getDerived().TransformType(TLB, TL.getOriginalLoc());
5848 if (OriginalType.isNull())
5852 if (getDerived().AlwaysRebuild() ||
5853 OriginalType != TL.getOriginalLoc().getType())
5860template <
typename Derived>
5864 QualType OriginalType = getDerived().TransformType(TLB, TL.getElementLoc());
5865 if (OriginalType.isNull())
5869 if (getDerived().AlwaysRebuild() ||
5870 OriginalType != TL.getElementLoc().getType())
5877template<
typename Derived>
5881 = getDerived().TransformType(TLB, TL.getPointeeLoc());
5882 if (PointeeType.isNull())
5886 if (PointeeType->getAs<ObjCObjectType>()) {
5898 if (getDerived().AlwaysRebuild() ||
5899 PointeeType != TL.getPointeeLoc().getType()) {
5900 Result = getDerived().RebuildPointerType(PointeeType, TL.getSigilLoc());
5907 TLB.TypeWasModifiedSafely(
Result->getPointeeType());
5914template<
typename Derived>
5919 = getDerived().TransformType(TLB, TL.getPointeeLoc());
5920 if (PointeeType.isNull())
5924 if (getDerived().AlwaysRebuild() ||
5925 PointeeType != TL.getPointeeLoc().getType()) {
5926 Result = getDerived().RebuildBlockPointerType(PointeeType,
5941template<
typename Derived>
5949 if (PointeeType.
isNull())
5954 PointeeType !=
T->getPointeeTypeAsWritten()) {
5956 T->isSpelledAsLValue(),
5978template<
typename Derived>
5982 return TransformReferenceType(TLB, TL);
5985template<
typename Derived>
5987TreeTransform<Derived>::TransformRValueReferenceType(TypeLocBuilder &TLB,
5988 RValueReferenceTypeLoc TL) {
5989 return TransformReferenceType(TLB, TL);
5992template<
typename Derived>
5996 QualType PointeeType = getDerived().TransformType(TLB, TL.getPointeeLoc());
5997 if (PointeeType.isNull())
6004 getDerived().TransformNestedNameSpecifierLoc(OldQualifierLoc);
6005 if (!NewQualifierLoc)
6008 CXXRecordDecl *OldCls =
T->getMostRecentCXXRecordDecl(), *NewCls =
nullptr;
6010 NewCls = cast_or_null<CXXRecordDecl>(
6011 getDerived().TransformDecl(TL.getStarLoc(), OldCls));
6017 if (getDerived().AlwaysRebuild() || PointeeType !=
T->getPointeeType() ||
6018 NewQualifierLoc.getNestedNameSpecifier() !=
6019 OldQualifierLoc.getNestedNameSpecifier() ||
6022 SS.
Adopt(NewQualifierLoc);
6023 Result = getDerived().RebuildMemberPointerType(PointeeType, SS, NewCls,
6032 if (MPT && PointeeType != MPT->getPointeeType()) {
6039 NewTL.setQualifierLoc(NewQualifierLoc);
6044template<
typename Derived>
6049 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
6050 if (ElementType.isNull())
6054 Expr *OldSize = TL.getSizeExpr();
6056 OldSize =
const_cast<Expr*
>(
T->getSizeExpr());
6057 Expr *NewSize =
nullptr;
6061 NewSize = getDerived().TransformExpr(OldSize).template getAs<Expr>();
6066 if (getDerived().AlwaysRebuild() ||
6067 ElementType !=
T->getElementType() ||
6068 (
T->getSizeExpr() && NewSize != OldSize)) {
6069 Result = getDerived().RebuildConstantArrayType(ElementType,
6070 T->getSizeModifier(),
6071 T->getSize(), NewSize,
6072 T->getIndexTypeCVRQualifiers(),
6073 TL.getBracketsRange());
6084 NewTL.setRBracketLoc(TL.getRBracketLoc());
6085 NewTL.setSizeExpr(NewSize);
6090template<
typename Derived>
6095 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
6096 if (ElementType.isNull())
6100 if (getDerived().AlwaysRebuild() ||
6101 ElementType !=
T->getElementType()) {
6102 Result = getDerived().RebuildIncompleteArrayType(ElementType,
6103 T->getSizeModifier(),
6104 T->getIndexTypeCVRQualifiers(),
6105 TL.getBracketsRange());
6112 NewTL.setRBracketLoc(TL.getRBracketLoc());
6113 NewTL.setSizeExpr(
nullptr);
6118template<
typename Derived>
6123 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
6124 if (ElementType.isNull())
6131 SizeResult = getDerived().TransformExpr(
T->getSizeExpr());
6133 if (SizeResult.isInvalid())
6137 if (SizeResult.isInvalid())
6143 if (getDerived().AlwaysRebuild() ||
6144 ElementType !=
T->getElementType() ||
6145 Size !=
T->getSizeExpr()) {
6146 Result = getDerived().RebuildVariableArrayType(ElementType,
6147 T->getSizeModifier(),
6149 T->getIndexTypeCVRQualifiers(),
6150 TL.getBracketsRange());
6159 NewTL.setRBracketLoc(TL.getRBracketLoc());
6160 NewTL.setSizeExpr(Size);
6165template<
typename Derived>
6170 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
6171 if (ElementType.isNull())
6179 SemaRef.
ExprEvalContexts.back().InConditionallyConstantEvaluateContext =
true;
6182 Expr *origSize = TL.getSizeExpr();
6183 if (!origSize) origSize =
T->getSizeExpr();
6186 = getDerived().TransformExpr(origSize);
6188 if (sizeResult.isInvalid())
6191 Expr *size = sizeResult.get();
6194 if (getDerived().AlwaysRebuild() ||
6195 ElementType !=
T->getElementType() ||
6197 Result = getDerived().RebuildDependentSizedArrayType(ElementType,
6198 T->getSizeModifier(),
6200 T->getIndexTypeCVRQualifiers(),
6201 TL.getBracketsRange());
6210 NewTL.setRBracketLoc(TL.getRBracketLoc());
6211 NewTL.setSizeExpr(size);
6216template <
typename Derived>
6220 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
6221 if (ElementType.isNull())
6229 if (
Size.isInvalid())
6233 if (getDerived().AlwaysRebuild() || ElementType !=
T->getElementType() ||
6234 Size.get() !=
T->getSizeExpr()) {
6235 Result = getDerived().RebuildDependentVectorType(
6236 ElementType,
Size.get(),
T->getAttributeLoc(),
T->getVectorKind());
6254template<
typename Derived>
6261 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
6262 if (ElementType.isNull())
6271 if (
Size.isInvalid())
6275 if (getDerived().AlwaysRebuild() ||
6276 ElementType !=
T->getElementType() ||
6277 Size.get() !=
T->getSizeExpr()) {
6278 Result = getDerived().RebuildDependentSizedExtVectorType(ElementType,
6280 T->getAttributeLoc());
6298template <
typename Derived>
6303 QualType ElementType = getDerived().TransformType(
T->getElementType());
6304 if (ElementType.isNull())
6308 if (getDerived().AlwaysRebuild() || ElementType !=
T->getElementType()) {
6309 Result = getDerived().RebuildConstantMatrixType(
6310 ElementType,
T->getNumRows(),
T->getNumColumns(), TL.getAttrNameLoc());
6317 NewTL.setAttrOperandParensRange(TL.getAttrOperandParensRange());
6318 NewTL.setAttrRowOperand(TL.getAttrRowOperand());
6319 NewTL.setAttrColumnOperand(TL.getAttrColumnOperand());
6324template <
typename Derived>
6329 QualType ElementType = getDerived().TransformType(
T->getElementType());
6330 if (ElementType.isNull()) {
6338 Expr *origRows = TL.getAttrRowOperand();
6340 origRows =
T->getRowExpr();
6341 Expr *origColumns = TL.getAttrColumnOperand();
6343 origColumns =
T->getColumnExpr();
6345 ExprResult rowResult = getDerived().TransformExpr(origRows);
6347 if (rowResult.isInvalid())
6350 ExprResult columnResult = getDerived().TransformExpr(origColumns);
6352 if (columnResult.isInvalid())
6355 Expr *rows = rowResult.get();
6356 Expr *columns = columnResult.get();
6359 if (getDerived().AlwaysRebuild() || ElementType !=
T->getElementType() ||
6360 rows != origRows || columns != origColumns) {
6361 Result = getDerived().RebuildDependentSizedMatrixType(
6362 ElementType, rows, columns,
T->getAttributeLoc());
6372 NewTL.setAttrOperandParensRange(TL.getAttrOperandParensRange());
6373 NewTL.setAttrRowOperand(rows);
6374 NewTL.setAttrColumnOperand(columns);
6378template <
typename Derived>
6384 getDerived().TransformType(TLB, TL.getPointeeTypeLoc());
6393 ExprResult AddrSpace = getDerived().TransformExpr(
T->getAddrSpaceExpr());
6395 if (AddrSpace.isInvalid())
6399 if (getDerived().AlwaysRebuild() ||
pointeeType !=
T->getPointeeType() ||
6400 AddrSpace.get() !=
T->getAddrSpaceExpr()) {
6401 Result = getDerived().RebuildDependentAddressSpaceType(
6413 NewTL.setAttrExprOperand(TL.getAttrExprOperand());
6414 NewTL.setAttrNameLoc(TL.getAttrNameLoc());
6417 TLB.TypeWasModifiedSafely(
Result);
6423template <
typename Derived>
6427 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
6428 if (ElementType.isNull())
6432 if (getDerived().AlwaysRebuild() ||
6433 ElementType !=
T->getElementType()) {
6434 Result = getDerived().RebuildVectorType(ElementType,
T->getNumElements(),
6435 T->getVectorKind());
6446template<
typename Derived>
6450 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
6451 if (ElementType.isNull())
6455 if (getDerived().AlwaysRebuild() ||
6456 ElementType !=
T->getElementType()) {
6457 Result = getDerived().RebuildExtVectorType(ElementType,
6458 T->getNumElements(),
6470template <
typename Derived>
6473 bool ExpectParameterPack) {
6508 if (NewTSI == OldTSI && indexAdjustment == 0)
6518 getDerived().transformedLocalDecl(OldParm, {newParm});
6522template <
typename Derived>
6530 unsigned *LastParamTransformed) {
6531 int indexAdjustment = 0;
6533 unsigned NumParams = Params.size();
6534 for (
unsigned i = 0; i != NumParams; ++i) {
6535 if (LastParamTransformed)
6536 *LastParamTransformed = i;
6538 assert(OldParm->getFunctionScopeIndex() == i);
6542 if (OldParm->isParameterPack()) {
6547 TypeLoc TL = OldParm->getTypeSourceInfo()->getTypeLoc();
6550 SemaRef.collectUnexpandedParameterPacks(Pattern, Unexpanded);
6553 bool ShouldExpand =
false;
6554 bool RetainExpansion =
false;
6556 if (Unexpanded.size() > 0) {
6557 OrigNumExpansions = ExpansionTL.
getTypePtr()->getNumExpansions();
6558 NumExpansions = OrigNumExpansions;
6562 ShouldExpand, RetainExpansion, NumExpansions)) {
6567 const AutoType *AT =
6568 Pattern.getType().getTypePtr()->getContainedAutoType();
6569 assert((AT && (!AT->isDeduced() || AT->getDeducedType().isNull())) &&
6570 "Could not find parameter packs or undeduced auto type!");
6577 getDerived().ExpandingFunctionParameterPack(OldParm);
6578 for (
unsigned I = 0; I != *NumExpansions; ++I) {
6581 =
getDerived().TransformFunctionTypeParam(OldParm,
6589 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6590 OutParamTypes.push_back(NewParm->
getType());
6592 PVars->push_back(NewParm);
6597 if (RetainExpansion) {
6598 ForgetPartiallySubstitutedPackRAII Forget(
getDerived());
6600 =
getDerived().TransformFunctionTypeParam(OldParm,
6608 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6609 OutParamTypes.push_back(NewParm->
getType());
6611 PVars->push_back(NewParm);
6627 NewParm =
getDerived().TransformFunctionTypeParam(OldParm,
6632 "Parameter pack no longer a parameter pack after "
6635 NewParm =
getDerived().TransformFunctionTypeParam(
6636 OldParm, indexAdjustment, std::nullopt,
6644 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6645 OutParamTypes.push_back(NewParm->
getType());
6647 PVars->push_back(NewParm);
6655 bool IsPackExpansion =
false;
6658 if (
const PackExpansionType *Expansion
6659 = dyn_cast<PackExpansionType>(OldType)) {
6661 QualType Pattern = Expansion->getPattern();
6663 getSema().collectUnexpandedParameterPacks(Pattern, Unexpanded);
6666 bool ShouldExpand =
false;
6667 bool RetainExpansion =
false;
6671 RetainExpansion, NumExpansions)) {
6678 for (
unsigned I = 0; I != *NumExpansions; ++I) {
6685 NewType =
getSema().getASTContext().getPackExpansionType(
6686 NewType, std::nullopt);
6693 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6694 OutParamTypes.push_back(NewType);
6696 PVars->push_back(
nullptr);
6705 if (RetainExpansion) {
6706 ForgetPartiallySubstitutedPackRAII Forget(
getDerived());
6712 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6713 OutParamTypes.push_back(NewType);
6715 PVars->push_back(
nullptr);
6720 OldType = Expansion->getPattern();
6721 IsPackExpansion =
true;
6723 NewType =
getDerived().TransformType(OldType);
6725 NewType =
getDerived().TransformType(OldType);
6731 if (IsPackExpansion)
6732 NewType =
getSema().Context.getPackExpansionType(NewType,
6736 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6737 OutParamTypes.push_back(NewType);
6739 PVars->push_back(
nullptr);
6744 for (
unsigned i = 0, e = PVars->size(); i != e; ++i)
6746 assert(parm->getFunctionScopeIndex() == i);
6753template<
typename Derived>
6758 return getDerived().TransformFunctionProtoType(
6762 ExceptionStorage, Changed);
6766template<
typename Derived>
template<
typename Fn>
6785 if (
T->hasTrailingReturn()) {
6789 T->getExtParameterInfosOrNull(),
6790 ParamTypes, &ParamDecls, ExtParamInfos))
6800 auto *RD = dyn_cast<CXXRecordDecl>(
SemaRef.getCurLexicalContext());
6802 SemaRef, !ThisContext && RD ? RD : ThisContext, ThisTypeQuals);
6817 T->getExtParameterInfosOrNull(),
6818 ParamTypes, &ParamDecls, ExtParamInfos))
6824 bool EPIChanged =
false;
6829 if (
auto NewExtParamInfos =
6845 std::optional<FunctionEffectSet> NewFX;
6857 std::optional<FunctionEffectMode> Mode =
6877 "FunctionEffectMode::None shouldn't be possible here");
6880 if (!
SemaRef.diagnoseConflictingFunctionEffect(*NewFX, NewEC,
6883 NewFX->insert(NewEC, Errs);
6884 assert(Errs.empty());
6894 Result =
getDerived().RebuildFunctionProtoType(ResultType, ParamTypes, EPI);
6905 for (
unsigned i = 0, e = NewTL.
getNumParams(); i != e; ++i)
6911template<
typename Derived>
6934 getSema().ActOnNoexceptSpec(NoexceptExpr.
get(), EST);
6949 if (
const PackExpansionType *PackExpansion =
6950 T->getAs<PackExpansionType>()) {
6955 SemaRef.collectUnexpandedParameterPacks(PackExpansion->getPattern(),
6957 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
6962 bool Expand =
false;
6963 bool RetainExpansion =
false;
6964 UnsignedOrNone NumExpansions = PackExpansion->getNumExpansions();
6969 true, Expand, RetainExpansion,
6982 U =
SemaRef.Context.getPackExpansionType(
U, NumExpansions);
6983 Exceptions.push_back(
U);
6989 for (
unsigned ArgIdx = 0; ArgIdx != *NumExpansions; ++ArgIdx) {
6993 if (
U.isNull() ||
SemaRef.CheckSpecifiedExceptionType(
U, Loc))
6996 Exceptions.push_back(
U);
7000 if (
U.isNull() ||
SemaRef.CheckSpecifiedExceptionType(
U, Loc))
7005 Exceptions.push_back(
U);
7015template<
typename Derived>
7025 if (getDerived().AlwaysRebuild() || ResultType !=
T->getReturnType())
7026 Result = getDerived().RebuildFunctionNoProtoType(ResultType);
7037template <
typename Derived>
7038QualType TreeTransform<Derived>::TransformUnresolvedUsingType(
7039 TypeLocBuilder &TLB, UnresolvedUsingTypeLoc TL) {
7041 const UnresolvedUsingType *T = TL.getTypePtr();
7042 bool Changed =
false;
7044 NestedNameSpecifierLoc QualifierLoc = TL.getQualifierLoc();
7045 if (NestedNameSpecifierLoc OldQualifierLoc = QualifierLoc) {
7046 QualifierLoc = getDerived().TransformNestedNameSpecifierLoc(QualifierLoc);
7049 Changed |= QualifierLoc != OldQualifierLoc;
7052 auto *D = getDerived().TransformDecl(TL.getNameLoc(),
T->getDecl());
7058 if (getDerived().AlwaysRebuild() || Changed) {
7059 Result = getDerived().RebuildUnresolvedUsingType(
7060 T->getKeyword(), QualifierLoc.getNestedNameSpecifier(), TL.getNameLoc(),
7068 QualifierLoc, TL.getNameLoc());
7071 QualifierLoc, TL.getNameLoc());
7075template <
typename Derived>
7083 QualifierLoc = getDerived().TransformNestedNameSpecifierLoc(QualifierLoc);
7086 Changed |= QualifierLoc != OldQualifierLoc;
7089 auto *D = cast_or_null<UsingShadowDecl>(
7090 getDerived().TransformDecl(TL.getNameLoc(),
T->getDecl()));
7095 QualType UnderlyingType = getDerived().TransformType(
T->desugar());
7096 if (UnderlyingType.isNull())
7098 Changed |= UnderlyingType !=
T->desugar();
7101 if (getDerived().AlwaysRebuild() || Changed) {
7102 Result = getDerived().RebuildUsingType(
7103 T->getKeyword(), QualifierLoc.getNestedNameSpecifier(), D,
7113template<
typename Derived>
7121 QualifierLoc = getDerived().TransformNestedNameSpecifierLoc(QualifierLoc);
7124 Changed |= QualifierLoc != OldQualifierLoc;
7127 auto *
Typedef = cast_or_null<TypedefNameDecl>(
7128 getDerived().TransformDecl(TL.getNameLoc(),
T->getDecl()));
7136 if (getDerived().AlwaysRebuild() || Changed) {
7137 Result = getDerived().RebuildTypedefType(
7138 T->getKeyword(), QualifierLoc.getNestedNameSpecifier(),
Typedef);
7144 QualifierLoc, TL.getNameLoc());
7148template<
typename Derived>
7156 ExprResult E = getDerived().TransformExpr(TL.getUnderlyingExpr());
7166 if (getDerived().AlwaysRebuild() || E.get() != TL.getUnderlyingExpr()) {
7168 getDerived().RebuildTypeOfExprType(E.get(), TL.getTypeofLoc(), Kind);
7175 NewTL.setLParenLoc(TL.getLParenLoc());
7176 NewTL.setRParenLoc(TL.getRParenLoc());
7181template<
typename Derived>
7185 TypeSourceInfo* New_Under_TI = getDerived().TransformType(Old_Under_TI);
7191 if (getDerived().AlwaysRebuild() || New_Under_TI != Old_Under_TI) {
7192 Result = getDerived().RebuildTypeOfType(New_Under_TI->getType(), Kind);
7199 NewTL.setLParenLoc(TL.getLParenLoc());
7200 NewTL.setRParenLoc(TL.getRParenLoc());
7201 NewTL.setUnmodifiedTInfo(New_Under_TI);
7206template<
typename Derived>
7209 const DecltypeType *
T = TL.getTypePtr();
7216 ExprResult E = getDerived().TransformExpr(
T->getUnderlyingExpr());
7220 E = getSema().ActOnDecltypeExpression(E.get());
7225 if (getDerived().AlwaysRebuild() ||
7226 E.get() !=
T->getUnderlyingExpr()) {
7227 Result = getDerived().RebuildDecltypeType(E.get(), TL.getDecltypeLoc());
7235 NewTL.setRParenLoc(TL.getRParenLoc());
7239template <
typename Derived>
7249 IndexExpr = getDerived().TransformExpr(TL.getIndexExpr());
7250 if (IndexExpr.isInvalid())
7253 QualType Pattern = TL.getPattern();
7255 const PackIndexingType *PIT = TL.getTypePtr();
7259 bool NotYetExpanded = Types.empty();
7260 bool FullySubstituted =
true;
7262 if (Types.empty() && !PIT->expandsToEmptyPack())
7266 if (!
T->containsUnexpandedParameterPack()) {
7267 QualType Transformed = getDerived().TransformType(
T);
7268 if (Transformed.isNull())
7270 SubtitutedTypes.push_back(Transformed);
7275 getSema().collectUnexpandedParameterPacks(
T, Unexpanded);
7276 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
7279 bool ShouldExpand =
true;
7280 bool RetainExpansion =
false;
7282 if (getDerived().TryExpandParameterPacks(
7285 RetainExpansion, NumExpansions))
7287 if (!ShouldExpand) {
7293 QualType Pack = getDerived().TransformType(TLB, TI->getTypeLoc());
7296 if (NotYetExpanded) {
7297 FullySubstituted =
false;
7298 QualType Out = getDerived().RebuildPackIndexingType(
7299 Pack, IndexExpr.get(), TL.getBeginLoc(), FullySubstituted);
7307 SubtitutedTypes.push_back(Pack);
7310 for (
unsigned I = 0; I != *NumExpansions; ++I) {
7315 SubtitutedTypes.push_back(Out);
7316 FullySubstituted &= !
Out->containsUnexpandedParameterPack();
7320 if (RetainExpansion) {
7321 FullySubstituted =
false;
7322 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
7326 SubtitutedTypes.push_back(Out);
7334 QualType Result = getDerived().TransformType(TLB, TL.getPatternLoc());
7336 QualType Out = getDerived().RebuildPackIndexingType(
7337 Result, IndexExpr.get(), TL.getBeginLoc(), FullySubstituted,
7347template<
typename Derived>
7353 if (
Result->isDependentType()) {
7354 const UnaryTransformType *
T = TL.getTypePtr();
7356 NewBaseTSI = getDerived().TransformType(TL.getUnderlyingTInfo());
7359 QualType NewBase = NewBaseTSI->getType();
7361 Result = getDerived().RebuildUnaryTransformType(NewBase,
7370 NewTL.setParensRange(TL.getParensRange());
7371 NewTL.setUnderlyingTInfo(NewBaseTSI);
7375template<
typename Derived>
7378 const DeducedTemplateSpecializationType *
T = TL.getTypePtr();
7383 TL.getTemplateNameLoc());
7387 QualType OldDeduced =
T->getDeducedType();
7389 if (!OldDeduced.isNull()) {
7390 NewDeduced = getDerived().TransformType(OldDeduced);
7391 if (NewDeduced.isNull())
7395 QualType Result = getDerived().RebuildDeducedTemplateSpecializationType(
7403 NewTL.setTemplateNameLoc(TL.getTemplateNameLoc());
7404 NewTL.setQualifierLoc(QualifierLoc);
7408template <
typename Derived>
7415 QualifierLoc =
getDerived().TransformNestedNameSpecifierLoc(QualifierLoc);
7420 auto *TD = cast_or_null<TagDecl>(
7427 TD !=
T->getDecl()) {
7428 if (
T->isCanonicalUnqualified())
7445template <
typename Derived>
7451template <
typename Derived>
7452QualType TreeTransform<Derived>::TransformRecordType(TypeLocBuilder &TLB,
7454 return getDerived().TransformTagType(TLB, TL);
7457template<
typename Derived>
7464template<
typename Derived>
7468 return getDerived().TransformTemplateTypeParmType(
7473template <
typename Derived>
7479template<
typename Derived>
7480QualType TreeTransform<Derived>::TransformSubstTemplateTypeParmType(
7481 TypeLocBuilder &TLB,
7482 SubstTemplateTypeParmTypeLoc TL) {
7483 const SubstTemplateTypeParmType *T = TL.getTypePtr();
7486 getDerived().TransformDecl(TL.getNameLoc(), T->getAssociatedDecl());
7491 TemporaryBase Rebase(*
this, TL.getNameLoc(), DeclarationName());
7492 QualType Replacement = getDerived().TransformType(T->getReplacementType());
7493 if (Replacement.isNull())
7497 Replacement, NewReplaced, T->getIndex(), T->getPackIndex(),
7501 SubstTemplateTypeParmTypeLoc NewTL
7502 = TLB.push<SubstTemplateTypeParmTypeLoc>(
Result);
7503 NewTL.setNameLoc(TL.getNameLoc());
7507template <
typename Derived>
7513template<
typename Derived>
7517 return getDerived().TransformSubstTemplateTypeParmPackType(
7521template <
typename Derived>
7527template<
typename Derived>
7528QualType TreeTransform<Derived>::TransformAtomicType(TypeLocBuilder &TLB,
7530 QualType ValueType = getDerived().TransformType(TLB, TL.getValueLoc());
7531 if (ValueType.isNull())
7534 QualType
Result = TL.getType();
7535 if (getDerived().AlwaysRebuild() ||
7536 ValueType != TL.getValueLoc().getType()) {
7537 Result = getDerived().RebuildAtomicType(ValueType, TL.getKWLoc());
7544 NewTL.setLParenLoc(TL.getLParenLoc());
7545 NewTL.setRParenLoc(TL.getRParenLoc());
7550template <
typename Derived>
7553 QualType ValueType = getDerived().TransformType(TLB, TL.getValueLoc());
7554 if (ValueType.isNull())
7558 if (getDerived().AlwaysRebuild() || ValueType != TL.getValueLoc().getType()) {
7561 Result = getDerived().RebuildPipeType(ValueType, TL.getKWLoc(), isReadPipe);
7572template <
typename Derived>
7578 if (getDerived().AlwaysRebuild()) {
7579 Result = getDerived().RebuildBitIntType(EIT->isUnsigned(),
7580 EIT->getNumBits(), TL.getNameLoc());
7590template <
typename Derived>
7597 ExprResult BitsExpr = getDerived().TransformExpr(EIT->getNumBitsExpr());
7600 if (BitsExpr.isInvalid())
7605 if (getDerived().AlwaysRebuild() || BitsExpr.get() != EIT->getNumBitsExpr()) {
7606 Result = getDerived().RebuildDependentBitIntType(
7607 EIT->isUnsigned(), BitsExpr.get(), TL.getNameLoc());
7623template <
typename Derived>
7626 llvm_unreachable(
"This type does not need to be transformed.");
7634 template<
typename ArgLocContainer>
7636 ArgLocContainer *Container;
7661 : Container(&Container), Index(Index) { }
7675 return Container->getArgLoc(Index);
7679 return pointer(Container->getArgLoc(Index));
7684 return X.Container == Y.Container &&
X.Index == Y.Index;
7693template<
typename Derived>
7694QualType TreeTransform<Derived>::TransformAutoType(TypeLocBuilder &TLB,
7696 const AutoType *T = TL.getTypePtr();
7697 QualType OldDeduced = T->getDeducedType();
7698 QualType NewDeduced;
7699 if (!OldDeduced.isNull()) {
7700 NewDeduced = getDerived().TransformType(OldDeduced);
7701 if (NewDeduced.isNull())
7708 if (
T->isConstrained()) {
7709 assert(TL.getConceptReference());
7710 NewCD = getDerived().TransformConceptTemplateName(
7711 T->getTypeConstraintConcept(), TL.getConceptNameLoc());
7715 NewTemplateArgs.setLAngleLoc(TL.getLAngleLoc());
7716 NewTemplateArgs.setRAngleLoc(TL.getRAngleLoc());
7718 if (getDerived().TransformTemplateArguments(
7719 ArgIterator(TL, 0), ArgIterator(TL, TL.getNumArgs()),
7723 if (TL.getNestedNameSpecifierLoc()) {
7725 = getDerived().TransformNestedNameSpecifierLoc(
7726 TL.getNestedNameSpecifierLoc());
7727 if (!NewNestedNameSpec)
7733 if (getDerived().AlwaysRebuild() || NewDeduced != OldDeduced ||
7734 T->isDependentType() ||
T->isConstrained()) {
7737 NewArgList.reserve(NewTemplateArgs.size());
7738 for (
const auto &ArgLoc : NewTemplateArgs.arguments())
7739 NewArgList.push_back(ArgLoc.getArgument());
7740 Result = getDerived().RebuildAutoType(
7742 NewDeduced,
T->getKeyword(), NewCD, NewArgList);
7749 NewTL.setRParenLoc(TL.getRParenLoc());
7750 NewTL.setConceptReference(
nullptr);
7752 if (
T->isConstrained()) {
7756 TL.getConceptNameLoc())
7761 SemaRef.
Context, NewNestedNameSpec, TL.getTemplateKWLoc(), DNI,
7762 TL.getFoundDecl(), TL.getTypePtr()->getTypeConstraintConcept(),
7764 NewTL.setConceptReference(CR);
7770template <
typename Derived>
7773 return getDerived().TransformTemplateSpecializationType(
7778template <
typename Derived>
7781 NamedDecl *FirstQualifierInScope,
bool AllowInjectedClassName) {
7782 const TemplateSpecializationType *
T = TL.
getTypePtr();
7788 AllowInjectedClassName);
7797 if (getDerived().TransformTemplateArguments(ArgIterator(TL, 0),
7806 QualType Result = getDerived().RebuildTemplateSpecializationType(
7819template <
typename Derived>
7823 QualType modifiedType = getDerived().TransformType(TLB, TL.getModifiedLoc());
7824 if (modifiedType.isNull())
7831 oldType->getAttrKind(), modifiedType,
7832 TL.getAttr() ? TL.getAttr()->getLocation()
7833 : TL.getModifiedLoc().getBeginLoc()))
7837 const Attr *oldAttr = TL.getAttr();
7838 const Attr *newAttr = oldAttr ? getDerived().TransformAttr(oldAttr) :
nullptr;
7839 if (oldAttr && !newAttr)
7845 if (getDerived().AlwaysRebuild() ||
7846 modifiedType != oldType->getModifiedType()) {
7859 QualType equivalentType = modifiedType;
7860 if (TL.getModifiedLoc().getType() != TL.getEquivalentTypeLoc().getType()) {
7862 AuxiliaryTLB.
reserve(TL.getFullDataSize());
7864 getDerived().TransformType(AuxiliaryTLB, TL.getEquivalentTypeLoc());
7865 if (equivalentType.isNull())
7870 if (oldType->getAttrKind() == attr::HLSLRowMajor)
7873 else if (oldType->getAttrKind() == attr::HLSLColumnMajor)
7880 if (
auto nullability = oldType->getImmediateNullability()) {
7881 if (!modifiedType->canHaveNullability()) {
7882 SemaRef.
Diag((TL.getAttr() ? TL.getAttr()->getLocation()
7883 : TL.getModifiedLoc().getBeginLoc()),
7884 diag::err_nullability_nonpointer)
7901template <
typename Derived>
7905 QualType InnerTy = getDerived().TransformType(TLB, TL.getInnerLoc());
7906 if (InnerTy.isNull())
7909 Expr *OldCount = TL.getCountExpr();
7910 Expr *NewCount =
nullptr;
7912 ExprResult CountResult = getDerived().TransformExpr(OldCount);
7913 if (CountResult.isInvalid())
7915 NewCount = CountResult.get();
7919 if (getDerived().AlwaysRebuild() || InnerTy != OldTy->desugar() ||
7920 OldCount != NewCount) {
7923 InnerTy, NewCount, OldTy->isCountInBytes(), OldTy->isOrNull());
7930template <
typename Derived>
7935 QualType InnerTy = getDerived().TransformType(TLB, TL.getInnerLoc());
7936 if (InnerTy.isNull())
7940 if (getDerived().AlwaysRebuild() || InnerTy != OldTy->getWrappedType()) {
7942 InnerTy, OldTy->getLateParsedAttribute());
7950template <
typename Derived>
7954 llvm_unreachable(
"Unexpected TreeTransform for BTFTagAttributedType");
7957template <
typename Derived>
7960 const OverflowBehaviorType *OldTy = TL.getTypePtr();
7961 QualType InnerTy = getDerived().TransformType(TLB, TL.getWrappedLoc());
7962 if (InnerTy.isNull())
7966 if (getDerived().AlwaysRebuild() || InnerTy != OldTy->getUnderlyingType()) {
7978template <
typename Derived>
7982 const HLSLAttributedResourceType *oldType = TL.getTypePtr();
7984 QualType WrappedTy = getDerived().TransformType(TLB, TL.getWrappedLoc());
7985 if (WrappedTy.isNull())
7989 QualType OldContainedTy = oldType->getContainedType();
7991 if (!OldContainedTy.isNull()) {
7992 TypeSourceInfo *oldContainedTSI = TL.getContainedTypeSourceInfo();
7993 if (!oldContainedTSI)
7994 oldContainedTSI = getSema().getASTContext().getTrivialTypeSourceInfo(
7996 ContainedTSI = getDerived().TransformType(oldContainedTSI);
7999 ContainedTy = ContainedTSI->getType();
8002 HLSLAttributedResourceType::Attributes Attrs = oldType->getAttrs();
8003 if (Attrs.SampleCountExpr) {
8005 getDerived().TransformExpr(Attrs.SampleCountExpr);
8006 if (SampleCountResult.isInvalid())
8008 Attrs.SampleCountExpr = SampleCountResult.get();
8012 if (getDerived().AlwaysRebuild() || WrappedTy != oldType->getWrappedType() ||
8013 ContainedTy != oldType->getContainedType() ||
8014 Attrs.SampleCountExpr != oldType->getSampleCountExpr()) {
8016 ContainedTy, Attrs);
8022 NewTL.setContainedTypeSourceInfo(ContainedTSI);
8026template <
typename Derived>
8030 return TL.getType();
8033template<
typename Derived>
8037 QualType Inner = getDerived().TransformType(TLB, TL.getInnerLoc());
8042 if (getDerived().AlwaysRebuild() ||
8043 Inner != TL.getInnerLoc().getType()) {
8044 Result = getDerived().RebuildParenType(Inner);
8051 NewTL.setRParenLoc(TL.getRParenLoc());
8055template <
typename Derived>
8059 QualType Inner = getDerived().TransformType(TLB, TL.getInnerLoc());
8064 if (getDerived().AlwaysRebuild() || Inner != TL.getInnerLoc().getType()) {
8066 getDerived().RebuildMacroQualifiedType(Inner, TL.getMacroIdentifier());
8076template<
typename Derived>
8077QualType TreeTransform<Derived>::TransformDependentNameType(
8079 return TransformDependentNameType(TLB, TL,
false);
8082template <
typename Derived>
8083QualType TreeTransform<Derived>::TransformDependentNameType(
8086 const DependentNameType *
T = TL.getTypePtr();
8090 QualifierLoc = getDerived().TransformNestedNameSpecifierLoc(
8091 QualifierLoc, ObjectType, UnqualLookup);
8095 assert((ObjectType.isNull() && !UnqualLookup) &&
8096 "must be transformed by TransformNestedNameSpecifierLoc");
8100 = getDerived().RebuildDependentNameType(
T->getKeyword(),
8101 TL.getElaboratedKeywordLoc(),
8112 NewTL.setQualifierLoc(QualifierLoc);
8113 NewTL.setNameLoc(TL.getNameLoc());
8117 NewTL.setTemplateNameLoc(TL.getNameLoc());
8118 NewTL.setQualifierLoc(QualifierLoc);
8121 QualifierLoc, TL.getNameLoc());
8124 NewTL.
set(TL.getElaboratedKeywordLoc(), QualifierLoc, TL.getNameLoc());
8128 NewTL.setQualifierLoc(QualifierLoc);
8129 NewTL.setNameLoc(TL.getNameLoc());
8134template<
typename Derived>
8138 = getDerived().TransformType(TLB, TL.getPatternLoc());
8139 if (Pattern.isNull())
8143 if (getDerived().AlwaysRebuild() ||
8144 Pattern != TL.getPatternLoc().getType()) {
8145 Result = getDerived().RebuildPackExpansionType(Pattern,
8146 TL.getPatternLoc().getSourceRange(),
8147 TL.getEllipsisLoc(),
8148 TL.getTypePtr()->getNumExpansions());
8158template<
typename Derived>
8163 TLB.pushFullCopy(TL);
8164 return TL.getType();
8167template<
typename Derived>
8171 const ObjCTypeParamType *
T = TL.getTypePtr();
8173 getDerived().TransformDecl(
T->getDecl()->getLocation(),
T->getDecl()));
8178 if (getDerived().AlwaysRebuild() ||
8179 OTP !=
T->getDecl()) {
8180 Result = getDerived().RebuildObjCTypeParamType(
8181 OTP, TL.getProtocolLAngleLoc(),
8182 llvm::ArrayRef(TL.getTypePtr()->qual_begin(), TL.getNumProtocols()),
8183 TL.getProtocolLocs(), TL.getProtocolRAngleLoc());
8189 if (TL.getNumProtocols()) {
8190 NewTL.setProtocolLAngleLoc(TL.getProtocolLAngleLoc());
8191 for (
unsigned i = 0, n = TL.getNumProtocols(); i != n; ++i)
8192 NewTL.setProtocolLoc(i, TL.getProtocolLoc(i));
8193 NewTL.setProtocolRAngleLoc(TL.getProtocolRAngleLoc());
8198template<
typename Derived>
8203 QualType BaseType = getDerived().TransformType(TLB, TL.getBaseLoc());
8204 if (BaseType.isNull())
8207 bool AnyChanged = BaseType != TL.getBaseLoc().getType();
8211 for (
unsigned i = 0, n = TL.getNumTypeArgs(); i != n; ++i) {
8213 TypeLoc TypeArgLoc = TypeArgInfo->getTypeLoc();
8214 QualType TypeArg = TypeArgInfo->getType();
8219 const auto *PackExpansion = PackExpansionLoc.getType()
8220 ->castAs<PackExpansionType>();
8224 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
8228 TypeLoc PatternLoc = PackExpansionLoc.getPatternLoc();
8229 bool Expand =
false;
8230 bool RetainExpansion =
false;
8231 UnsignedOrNone NumExpansions = PackExpansion->getNumExpansions();
8232 if (getDerived().TryExpandParameterPacks(
8233 PackExpansionLoc.getEllipsisLoc(), PatternLoc.getSourceRange(),
8234 Unexpanded,
true, Expand,
8235 RetainExpansion, NumExpansions))
8245 TypeArgBuilder.
reserve(PatternLoc.getFullDataSize());
8246 QualType NewPatternType = getDerived().TransformType(TypeArgBuilder,
8248 if (NewPatternType.isNull())
8252 NewPatternType, NumExpansions);
8254 NewExpansionLoc.
setEllipsisLoc(PackExpansionLoc.getEllipsisLoc());
8255 NewTypeArgInfos.push_back(
8256 TypeArgBuilder.getTypeSourceInfo(SemaRef.
Context, NewExpansionType));
8262 for (
unsigned ArgIdx = 0; ArgIdx != *NumExpansions; ++ArgIdx) {
8266 TypeArgBuilder.
reserve(PatternLoc.getFullDataSize());
8268 QualType NewTypeArg = getDerived().TransformType(TypeArgBuilder,
8270 if (NewTypeArg.isNull())
8273 NewTypeArgInfos.push_back(
8274 TypeArgBuilder.getTypeSourceInfo(SemaRef.
Context, NewTypeArg));
8281 TypeArgBuilder.
reserve(TypeArgLoc.getFullDataSize());
8283 getDerived().TransformType(TypeArgBuilder, TypeArgLoc);
8284 if (NewTypeArg.isNull())
8288 if (NewTypeArg == TypeArg) {
8289 NewTypeArgInfos.push_back(TypeArgInfo);
8293 NewTypeArgInfos.push_back(
8294 TypeArgBuilder.getTypeSourceInfo(SemaRef.
Context, NewTypeArg));
8299 if (getDerived().AlwaysRebuild() || AnyChanged) {
8301 Result = getDerived().RebuildObjCObjectType(
8302 BaseType, TL.getBeginLoc(), TL.getTypeArgsLAngleLoc(), NewTypeArgInfos,
8303 TL.getTypeArgsRAngleLoc(), TL.getProtocolLAngleLoc(),
8304 llvm::ArrayRef(TL.getTypePtr()->qual_begin(), TL.getNumProtocols()),
8305 TL.getProtocolLocs(), TL.getProtocolRAngleLoc());
8313 NewT.setTypeArgsLAngleLoc(TL.getTypeArgsLAngleLoc());
8314 for (
unsigned i = 0, n = TL.getNumTypeArgs(); i != n; ++i)
8315 NewT.setTypeArgTInfo(i, NewTypeArgInfos[i]);
8316 NewT.setTypeArgsRAngleLoc(TL.getTypeArgsRAngleLoc());
8317 NewT.setProtocolLAngleLoc(TL.getProtocolLAngleLoc());
8318 for (
unsigned i = 0, n = TL.getNumProtocols(); i != n; ++i)
8319 NewT.setProtocolLoc(i, TL.getProtocolLoc(i));
8320 NewT.setProtocolRAngleLoc(TL.getProtocolRAngleLoc());
8324template<
typename Derived>
8328 QualType PointeeType = getDerived().TransformType(TLB, TL.getPointeeLoc());
8329 if (PointeeType.isNull())
8333 if (getDerived().AlwaysRebuild() ||
8334 PointeeType != TL.getPointeeLoc().getType()) {
8335 Result = getDerived().RebuildObjCObjectPointerType(PointeeType,
8349template<
typename Derived>
8355template<
typename Derived>
8358 return getDerived().TransformCompoundStmt(S,
false);
8361template<
typename Derived>
8368 getSema().resetFPOptions(
8371 bool SubStmtInvalid =
false;
8372 bool SubStmtChanged =
false;
8374 for (
auto *B : S->
body()) {
8376 B, IsStmtExpr && B == S->
body_back() ? StmtDiscardKind::StmtExprResult
8377 : StmtDiscardKind::Discarded);
8379 if (
Result.isInvalid()) {
8386 SubStmtInvalid =
true;
8390 SubStmtChanged = SubStmtChanged ||
Result.get() != B;
8391 Statements.push_back(
Result.getAs<Stmt>());
8397 if (!getDerived().AlwaysRebuild() &&
8401 return getDerived().RebuildCompoundStmt(S->
getLBracLoc(),
8407template<
typename Derived>
8416 LHS = getDerived().TransformExpr(S->getLHS());
8418 if (LHS.isInvalid())
8422 RHS = getDerived().TransformExpr(S->getRHS());
8424 if (RHS.isInvalid())
8431 StmtResult Case = getDerived().RebuildCaseStmt(S->getCaseLoc(),
8433 S->getEllipsisLoc(),
8436 if (Case.isInvalid())
8441 getDerived().TransformStmt(S->getSubStmt());
8442 if (SubStmt.isInvalid())
8446 return getDerived().RebuildCaseStmtBody(Case.get(), SubStmt.get());
8449template <
typename Derived>
8453 getDerived().TransformStmt(S->getSubStmt());
8454 if (SubStmt.isInvalid())
8458 return getDerived().RebuildDefaultStmt(S->getDefaultLoc(), S->getColonLoc(),
8462template<
typename Derived>
8465 StmtResult SubStmt = getDerived().TransformStmt(S->getSubStmt(), SDK);
8466 if (SubStmt.isInvalid())
8469 Decl *LD = getDerived().TransformDecl(S->getDecl()->getLocation(),
8477 if (LD == S->getDecl())
8478 S->getDecl()->setStmt(
nullptr);
8481 return getDerived().RebuildLabelStmt(S->getIdentLoc(),
8486template <
typename Derived>
8491 switch (R->getKind()) {
8495 return getDerived().Transform##X##Attr(cast<X##Attr>(R));
8496#include "clang/Basic/AttrList.inc"
8501template <
typename Derived>
8508 switch (R->getKind()) {
8512 return getDerived().TransformStmt##X##Attr(OrigS, InstS, cast<X##Attr>(R));
8513#include "clang/Basic/AttrList.inc"
8518template <
typename Derived>
8521 StmtDiscardKind SDK) {
8526 bool AttrsChanged =
false;
8530 for (
const auto *I : S->
getAttrs()) {
8532 getDerived().TransformStmtAttr(S->
getSubStmt(), SubStmt.
get(), I);
8533 AttrsChanged |= (I != R);
8546 return getDerived().RebuildAttributedStmt(S->
getAttrLoc(), Attrs,
8550template<
typename Derived>
8555 if (
Init.isInvalid())
8559 if (!S->isConsteval()) {
8561 Cond = getDerived().TransformCondition(
8562 S->getIfLoc(), S->getConditionVariable(), S->getCond(),
8565 if (Cond.isInvalid())
8570 std::optional<bool> ConstexprConditionValue;
8571 if (S->isConstexpr())
8576 if (!ConstexprConditionValue || *ConstexprConditionValue) {
8580 S->isNonNegatedConsteval());
8582 Then = getDerived().TransformStmt(S->getThen());
8583 if (Then.isInvalid())
8589 Then =
new (getSema().Context)
8590 CompoundStmt(S->getThen()->getBeginLoc(), S->getThen()->getEndLoc());
8595 if (!ConstexprConditionValue || !*ConstexprConditionValue) {
8599 S->isNegatedConsteval());
8601 Else = getDerived().TransformStmt(S->getElse());
8602 if (Else.isInvalid())
8604 }
else if (S->getElse() && ConstexprConditionValue &&
8605 *ConstexprConditionValue) {
8609 Else =
new (getSema().Context)
8610 CompoundStmt(S->getElse()->getBeginLoc(), S->getElse()->getEndLoc());
8613 if (!getDerived().AlwaysRebuild() &&
8614 Init.get() == S->getInit() &&
8615 Cond.get() == std::make_pair(S->getConditionVariable(), S->getCond()) &&
8616 Then.get() == S->getThen() &&
8617 Else.get() == S->getElse())
8620 return getDerived().RebuildIfStmt(
8621 S->getIfLoc(), S->getStatementKind(), S->getLParenLoc(), Cond,
8622 S->getRParenLoc(),
Init.get(), Then.get(), S->getElseLoc(), Else.get());
8625template<
typename Derived>
8630 if (
Init.isInvalid())
8635 S->getSwitchLoc(), S->getConditionVariable(), S->getCond(),
8637 if (Cond.isInvalid())
8642 getDerived().RebuildSwitchStmtStart(S->getSwitchLoc(), S->getLParenLoc(),
8643 Init.get(), Cond, S->getRParenLoc());
8648 StmtResult Body = getDerived().TransformStmt(S->getBody());
8651 return getDerived().RebuildSwitchStmtBody(S->getSwitchLoc(),
Switch.get(),
8655template<
typename Derived>
8660 S->getWhileLoc(), S->getConditionVariable(), S->getCond(),
8662 if (Cond.isInvalid())
8671 StmtResult Body = getDerived().TransformStmt(S->getBody());
8672 if (Body.isInvalid())
8675 if (!getDerived().AlwaysRebuild() &&
8676 Cond.get() == std::make_pair(S->getConditionVariable(), S->getCond()) &&
8677 Body.get() == S->getBody())
8680 return getDerived().RebuildWhileStmt(S->getWhileLoc(), S->getLParenLoc(),
8681 Cond, S->getRParenLoc(), Body.get());
8684template<
typename Derived>
8693 StmtResult Body = getDerived().TransformStmt(S->getBody());
8694 if (Body.isInvalid())
8698 ExprResult Cond = getDerived().TransformExpr(S->getCond());
8699 if (Cond.isInvalid())
8702 if (!getDerived().AlwaysRebuild() &&
8703 Cond.get() == S->getCond() &&
8704 Body.get() == S->getBody())
8707 return getDerived().RebuildDoStmt(S->getDoLoc(), Body.get(), S->getWhileLoc(),
8708 S->getWhileLoc(), Cond.get(),
8712template<
typename Derived>
8715 if (getSema().getLangOpts().getOpenMPVersion())
8716 getSema().OpenMP().startOpenMPLoop();
8720 if (
Init.isInvalid())
8725 if (getSema().getLangOpts().getOpenMPVersion() &&
Init.isUsable())
8726 getSema().OpenMP().ActOnOpenMPLoopInitialization(S->getForLoc(),
8731 S->getForLoc(), S->getConditionVariable(), S->getCond(),
8733 if (Cond.isInvalid())
8738 if (
Inc.isInvalid())
8742 if (S->getInc() && !FullInc.get())
8749 S->getBeginLoc(), S->getInit(),
Init.get(), S->getCond(),
8750 Cond.get().second, S->getInc(),
Inc.get());
8753 StmtResult Body = getDerived().TransformStmt(S->getBody());
8754 if (Body.isInvalid())
8759 if (!getDerived().AlwaysRebuild() &&
8760 Init.get() == S->getInit() &&
8761 Cond.get() == std::make_pair(S->getConditionVariable(), S->getCond()) &&
8762 Inc.get() == S->getInc() &&
8763 Body.get() == S->getBody())
8766 return getDerived().RebuildForStmt(S->getForLoc(), S->getLParenLoc(),
8767 Init.get(), Cond, FullInc,
8768 S->getRParenLoc(), Body.get());
8771template<
typename Derived>
8774 Decl *LD = getDerived().TransformDecl(S->getLabel()->getLocation(),
8780 return getDerived().RebuildGotoStmt(S->getGotoLoc(), S->getLabelLoc(),
8784template<
typename Derived>
8792 if (!getDerived().AlwaysRebuild() &&
8793 Target.get() == S->getTarget())
8796 return getDerived().RebuildIndirectGotoStmt(S->getGotoLoc(), S->getStarLoc(),
8800template<
typename Derived>
8806 Decl *LD = getDerived().TransformDecl(S->getLabelDecl()->getLocation(),
8815template<
typename Derived>
8821 Decl *LD = getDerived().TransformDecl(S->getLabelDecl()->getLocation(),
8830template <
typename Derived>
8838template<
typename Derived>
8848 return getDerived().RebuildReturnStmt(S->getReturnLoc(),
Result.get());
8851template<
typename Derived>
8854 bool DeclChanged =
false;
8857 for (
auto *D : S->decls()) {
8858 Decl *Transformed = getDerived().TransformDefinition(D->getLocation(), D);
8862 if (Transformed != D)
8866 if (
auto *TD = dyn_cast<TypeDecl>(Transformed)) {
8867 if (
auto *TN = dyn_cast<TypedefNameDecl>(TD)) {
8868 LSI->ContainsUnexpandedParameterPack |=
8869 TN->getUnderlyingType()->containsUnexpandedParameterPack();
8871 LSI->ContainsUnexpandedParameterPack |=
8874 .getTypeDeclType(TD)
8875 ->containsUnexpandedParameterPack();
8878 if (
auto *VD = dyn_cast<VarDecl>(Transformed))
8879 LSI->ContainsUnexpandedParameterPack |=
8880 VD->getType()->containsUnexpandedParameterPack();
8883 Decls.push_back(Transformed);
8886 if (!getDerived().AlwaysRebuild() && !DeclChanged)
8889 return getDerived().RebuildDeclStmt(Decls, S->getBeginLoc(), S->getEndLoc());
8892template<
typename Derived>
8902 bool ExprsChanged =
false;
8904 auto RebuildString = [&](
Expr *E) {
8909 ExprsChanged =
true;
8916 for (
unsigned I = 0, E = S->getNumOutputs(); I != E; ++I) {
8917 Names.push_back(S->getOutputIdentifier(I));
8923 Constraints.push_back(
Result.get());
8926 Expr *OutputExpr = S->getOutputExpr(I);
8927 Result = getDerived().TransformExpr(OutputExpr);
8931 ExprsChanged |=
Result.get() != OutputExpr;
8933 Exprs.push_back(
Result.get());
8937 for (
unsigned I = 0, E = S->getNumInputs(); I != E; ++I) {
8938 Names.push_back(S->getInputIdentifier(I));
8944 Constraints.push_back(
Result.get());
8947 Expr *InputExpr = S->getInputExpr(I);
8948 Result = getDerived().TransformExpr(InputExpr);
8952 ExprsChanged |=
Result.get() != InputExpr;
8954 Exprs.push_back(
Result.get());
8958 for (
unsigned I = 0, E = S->getNumLabels(); I != E; ++I) {
8959 Names.push_back(S->getLabelIdentifier(I));
8964 ExprsChanged |=
Result.get() != S->getLabelExpr(I);
8965 Exprs.push_back(
Result.get());
8969 for (
unsigned I = 0, E = S->getNumClobbers(); I != E; ++I) {
8973 Clobbers.push_back(
Result.get());
8976 ExprResult AsmString = RebuildString(S->getAsmStringExpr());
8977 if (AsmString.isInvalid())
8980 if (!getDerived().AlwaysRebuild() && !ExprsChanged)
8983 return getDerived().RebuildGCCAsmStmt(S->getAsmLoc(), S->isSimple(),
8984 S->isVolatile(), S->getNumOutputs(),
8985 S->getNumInputs(), Names.data(),
8986 Constraints, Exprs, AsmString.get(),
8987 Clobbers, S->getNumLabels(),
8991template<
typename Derived>
8996 bool HadError =
false, HadChange =
false;
9000 TransformedExprs.reserve(SrcExprs.size());
9001 for (
unsigned i = 0, e = SrcExprs.size(); i != e; ++i) {
9003 if (!
Result.isUsable()) {
9006 HadChange |= (
Result.get() != SrcExprs[i]);
9007 TransformedExprs.push_back(
Result.get());
9012 if (!HadChange && !getDerived().AlwaysRebuild())
9015 return getDerived().RebuildMSAsmStmt(S->getAsmLoc(), S->getLBraceLoc(),
9016 AsmToks, S->getAsmString(),
9017 S->getNumOutputs(), S->getNumInputs(),
9018 S->getAllConstraints(), S->getClobbers(),
9019 TransformedExprs, S->getEndLoc());
9023template<
typename Derived>
9028 assert(FD && ScopeInfo && !ScopeInfo->CoroutinePromise &&
9029 ScopeInfo->NeedsCoroutineSuspends &&
9030 ScopeInfo->CoroutineSuspends.first ==
nullptr &&
9031 ScopeInfo->CoroutineSuspends.second ==
nullptr &&
9032 "expected clean scope info");
9036 ScopeInfo->setNeedsCoroutineSuspends(
false);
9049 getDerived().transformedLocalDecl(S->getPromiseDecl(), {Promise});
9050 ScopeInfo->CoroutinePromise = Promise;
9055 StmtResult InitSuspend = getDerived().TransformStmt(S->getInitSuspendStmt());
9056 if (InitSuspend.isInvalid())
9059 getDerived().TransformStmt(S->getFinalSuspendStmt());
9060 if (FinalSuspend.isInvalid() ||
9063 ScopeInfo->setCoroutineSuspends(InitSuspend.get(), FinalSuspend.get());
9066 StmtResult BodyRes = getDerived().TransformStmt(S->getBody());
9067 if (BodyRes.isInvalid())
9071 if (Builder.isInvalid())
9074 Expr *ReturnObject = S->getReturnValueInit();
9075 assert(ReturnObject &&
"the return object is expected to be valid");
9076 ExprResult Res = getDerived().TransformInitializer(ReturnObject,
9078 if (Res.isInvalid())
9080 Builder.ReturnValue = Res.get();
9085 if (S->hasDependentPromiseType()) {
9088 if (!Promise->getType()->isDependentType()) {
9089 assert(!S->getFallthroughHandler() && !S->getExceptionHandler() &&
9090 !S->getReturnStmtOnAllocFailure() && !S->getDeallocate() &&
9091 "these nodes should not have been built yet");
9092 if (!Builder.buildDependentStatements())
9096 if (
auto *OnFallthrough = S->getFallthroughHandler()) {
9097 StmtResult Res = getDerived().TransformStmt(OnFallthrough);
9098 if (Res.isInvalid())
9100 Builder.OnFallthrough = Res.get();
9103 if (
auto *OnException = S->getExceptionHandler()) {
9104 StmtResult Res = getDerived().TransformStmt(OnException);
9105 if (Res.isInvalid())
9107 Builder.OnException = Res.get();
9110 if (
auto *OnAllocFailure = S->getReturnStmtOnAllocFailure()) {
9111 StmtResult Res = getDerived().TransformStmt(OnAllocFailure);
9112 if (Res.isInvalid())
9114 Builder.ReturnStmtOnAllocFailure = Res.get();
9118 assert(S->getAllocate() && S->getDeallocate() &&
9119 "allocation and deallocation calls must already be built");
9120 ExprResult AllocRes = getDerived().TransformExpr(S->getAllocate());
9121 if (AllocRes.isInvalid())
9123 Builder.Allocate = AllocRes.get();
9125 ExprResult DeallocRes = getDerived().TransformExpr(S->getDeallocate());
9126 if (DeallocRes.isInvalid())
9128 Builder.Deallocate = DeallocRes.get();
9130 if (
auto *ResultDecl = S->getResultDecl()) {
9131 StmtResult Res = getDerived().TransformStmt(ResultDecl);
9132 if (Res.isInvalid())
9134 Builder.ResultDecl = Res.get();
9139 if (Res.isInvalid())
9141 Builder.ReturnStmt = Res.get();
9145 return getDerived().RebuildCoroutineBodyStmt(Builder);
9148template<
typename Derived>
9158 return getDerived().RebuildCoreturnStmt(S->getKeywordLoc(),
Result.get(),
9162template <
typename Derived>
9175 ExprResult Lookup = getSema().BuildOperatorCoawaitLookupExpr(
9176 getSema().getCurScope(), E->getKeywordLoc());
9180 return getDerived().RebuildCoawaitExpr(
9181 E->getKeywordLoc(),
Operand.get(),
9185template <
typename Derived>
9188 ExprResult OperandResult = getDerived().TransformInitializer(E->getOperand(),
9190 if (OperandResult.isInvalid())
9194 E->getOperatorCoawaitLookup());
9201 return getDerived().RebuildDependentCoawaitExpr(
9202 E->getKeywordLoc(), OperandResult.get(),
9206template<
typename Derived>
9216 return getDerived().RebuildCoyieldExpr(E->getKeywordLoc(),
Result.get());
9221template<
typename Derived>
9225 StmtResult TryBody = getDerived().TransformStmt(S->getTryBody());
9226 if (TryBody.isInvalid())
9230 bool AnyCatchChanged =
false;
9232 for (
unsigned I = 0, N = S->getNumCatchStmts(); I != N; ++I) {
9233 StmtResult Catch = getDerived().TransformStmt(S->getCatchStmt(I));
9234 if (Catch.isInvalid())
9236 if (Catch.get() != S->getCatchStmt(I))
9237 AnyCatchChanged =
true;
9238 CatchStmts.push_back(Catch.get());
9243 if (S->getFinallyStmt()) {
9244 Finally = getDerived().TransformStmt(S->getFinallyStmt());
9245 if (Finally.isInvalid())
9250 if (!getDerived().AlwaysRebuild() &&
9251 TryBody.get() == S->getTryBody() &&
9253 Finally.get() == S->getFinallyStmt())
9257 return getDerived().RebuildObjCAtTryStmt(S->getAtTryLoc(), TryBody.get(),
9258 CatchStmts, Finally.get());
9261template<
typename Derived>
9266 if (
VarDecl *FromVar = S->getCatchParamDecl()) {
9268 if (FromVar->getTypeSourceInfo()) {
9269 TSInfo = getDerived().TransformType(FromVar->getTypeSourceInfo());
9276 T = TSInfo->getType();
9278 T = getDerived().TransformType(FromVar->getType());
9283 Var = getDerived().RebuildObjCExceptionDecl(FromVar, TSInfo,
T);
9288 StmtResult Body = getDerived().TransformStmt(S->getCatchBody());
9289 if (Body.isInvalid())
9292 return getDerived().RebuildObjCAtCatchStmt(S->getAtCatchLoc(),
9297template<
typename Derived>
9301 StmtResult Body = getDerived().TransformStmt(S->getFinallyBody());
9302 if (Body.isInvalid())
9306 if (!getDerived().AlwaysRebuild() &&
9307 Body.get() == S->getFinallyBody())
9311 return getDerived().RebuildObjCAtFinallyStmt(S->getAtFinallyLoc(),
9315template<
typename Derived>
9319 if (S->getThrowExpr()) {
9320 Operand = getDerived().TransformExpr(S->getThrowExpr());
9325 if (!getDerived().AlwaysRebuild() &&
9326 Operand.get() == S->getThrowExpr())
9329 return getDerived().RebuildObjCAtThrowStmt(S->getThrowLoc(),
Operand.get());
9332template<
typename Derived>
9341 getDerived().RebuildObjCAtSynchronizedOperand(S->getAtSynchronizedLoc(),
9347 StmtResult Body = getDerived().TransformStmt(S->getSynchBody());
9348 if (Body.isInvalid())
9352 if (!getDerived().AlwaysRebuild() &&
9353 Object.get() == S->getSynchExpr() &&
9354 Body.get() == S->getSynchBody())
9358 return getDerived().RebuildObjCAtSynchronizedStmt(S->getAtSynchronizedLoc(),
9359 Object.get(), Body.get());
9362template<
typename Derived>
9367 StmtResult Body = getDerived().TransformStmt(S->getSubStmt());
9368 if (Body.isInvalid())
9372 if (!getDerived().AlwaysRebuild() &&
9373 Body.get() == S->getSubStmt())
9377 return getDerived().RebuildObjCAutoreleasePoolStmt(
9378 S->getAtLoc(), Body.get());
9381template<
typename Derived>
9386 StmtResult Element = getDerived().TransformStmt(
9387 S->getElement(), StmtDiscardKind::NotDiscarded);
9388 if (Element.isInvalid())
9392 ExprResult Collection = getDerived().TransformExpr(S->getCollection());
9393 if (Collection.isInvalid())
9397 StmtResult Body = getDerived().TransformStmt(S->getBody());
9398 if (Body.isInvalid())
9402 if (!getDerived().AlwaysRebuild() &&
9403 Element.get() == S->getElement() &&
9404 Collection.get() == S->getCollection() &&
9405 Body.get() == S->getBody())
9409 return getDerived().RebuildObjCForCollectionStmt(S->getForLoc(),
9416template <
typename Derived>
9420 if (
VarDecl *ExceptionDecl = S->getExceptionDecl()) {
9422 getDerived().TransformType(ExceptionDecl->getTypeSourceInfo());
9426 Var = getDerived().RebuildExceptionDecl(
9427 ExceptionDecl,
T, ExceptionDecl->getInnerLocStart(),
9428 ExceptionDecl->getLocation(), ExceptionDecl->getIdentifier());
9429 if (!Var || Var->isInvalidDecl())
9434 StmtResult Handler = getDerived().TransformStmt(S->getHandlerBlock());
9435 if (Handler.isInvalid())
9438 if (!getDerived().AlwaysRebuild() && !Var &&
9439 Handler.get() == S->getHandlerBlock())
9442 return getDerived().RebuildCXXCatchStmt(S->getCatchLoc(), Var, Handler.get());
9445template <
typename Derived>
9448 StmtResult TryBlock = getDerived().TransformCompoundStmt(S->getTryBlock());
9449 if (TryBlock.isInvalid())
9453 bool HandlerChanged =
false;
9455 for (
unsigned I = 0, N = S->getNumHandlers(); I != N; ++I) {
9456 StmtResult Handler = getDerived().TransformCXXCatchStmt(S->getHandler(I));
9457 if (Handler.isInvalid())
9460 HandlerChanged = HandlerChanged || Handler.get() != S->getHandler(I);
9461 Handlers.push_back(Handler.getAs<
Stmt>());
9464 getSema().DiagnoseExceptionUse(S->getTryLoc(),
true);
9466 if (!getDerived().AlwaysRebuild() && TryBlock.get() == S->getTryBlock() &&
9470 return getDerived().RebuildCXXTryStmt(S->getTryLoc(), TryBlock.get(),
9474template<
typename Derived>
9485 auto &LastRecord = getSema().currentEvaluationContext();
9486 LastRecord.InLifetimeExtendingContext =
true;
9487 LastRecord.RebuildDefaultArgOrDefaultInit =
true;
9490 S->getInit() ? getDerived().TransformStmt(S->getInit()) :
StmtResult();
9491 if (
Init.isInvalid())
9495 if (
Range.isInvalid())
9500 getSema().ExprEvalContexts.back().ForRangeLifetimeExtendTemps.empty());
9501 auto ForRangeLifetimeExtendTemps =
9502 getSema().ExprEvalContexts.back().ForRangeLifetimeExtendTemps;
9504 StmtResult Begin = getDerived().TransformStmt(S->getBeginStmt());
9505 if (Begin.isInvalid())
9507 StmtResult End = getDerived().TransformStmt(S->getEndStmt());
9508 if (End.isInvalid())
9511 ExprResult Cond = getDerived().TransformExpr(S->getCond());
9512 if (Cond.isInvalid())
9516 if (Cond.isInvalid())
9522 if (
Inc.isInvalid())
9527 StmtResult LoopVar = getDerived().TransformStmt(S->getLoopVarStmt());
9528 if (LoopVar.isInvalid())
9532 if (getDerived().AlwaysRebuild() ||
9533 Init.get() != S->getInit() ||
9534 Range.get() != S->getRangeStmt() ||
9535 Begin.get() != S->getBeginStmt() ||
9536 End.get() != S->getEndStmt() ||
9537 Cond.get() != S->getCond() ||
9538 Inc.get() != S->getInc() ||
9539 LoopVar.get() != S->getLoopVarStmt()) {
9540 NewStmt = getDerived().RebuildCXXForRangeStmt(
9541 S->getForLoc(), S->getCoawaitLoc(),
Init.get(), S->getColonLoc(),
9542 Range.get(), Begin.get(), End.get(), Cond.get(),
Inc.get(),
9543 LoopVar.get(), S->getRParenLoc(), ForRangeLifetimeExtendTemps);
9544 if (NewStmt.isInvalid() && LoopVar.get() != S->getLoopVarStmt()) {
9546 getSema().ActOnInitializerError(
9557 StmtResult Body = getDerived().TransformStmt(S->getBody());
9558 if (Body.isInvalid())
9565 if (Body.get() != S->getBody() && NewStmt.get() == S) {
9566 NewStmt = getDerived().RebuildCXXForRangeStmt(
9567 S->getForLoc(), S->getCoawaitLoc(),
Init.get(), S->getColonLoc(),
9568 Range.get(), Begin.get(), End.get(), Cond.get(),
Inc.get(),
9569 LoopVar.get(), S->getRParenLoc(), ForRangeLifetimeExtendTemps);
9570 if (NewStmt.isInvalid())
9574 if (NewStmt.get() == S)
9577 return FinishCXXForRangeStmt(NewStmt.get(), Body.get());
9580template <
typename Derived>
9586 getDerived().TransformDecl(S->getDecl()->getLocation(), S->getDecl());
9587 if (!ESD || ESD->isInvalidDecl())
9594 auto TransformStmtInParentContext = [&](
Stmt *SubStmt) ->
StmtResult {
9597 return getDerived().TransformStmt(SubStmt);
9616 if (S->isDependent() || S->isIterating()) {
9622 if (S->isDependent()) {
9628 ExpansionInitializer =
9629 getDerived().TransformExpr(S->getExpansionInitializer());
9630 if (ExpansionInitializer.isInvalid())
9632 }
else if (S->isIterating()) {
9633 Range = TransformStmtInParentContext(S->getRangeVarStmt());
9634 if (
Range.isInvalid())
9638 ExpansionInitializer =
9641 LifetimeExtendTemps =
9646 if (S->isEnumerating()) {
9648 getDerived().TransformStmt(S->getExpansionVarStmt());
9649 if (ExpansionVar.isInvalid())
9654 S->getLParenLoc(), S->getColonLoc(), S->getRParenLoc());
9655 }
else if (S->isIterating()) {
9656 StmtResult Begin = TransformStmtInParentContext(S->getBeginVarStmt());
9657 StmtResult Iter = TransformStmtInParentContext(S->getIterVarStmt());
9658 if (Begin.isInvalid() || Iter.isInvalid())
9665 getDerived().TransformStmt(S->getExpansionVarStmt());
9666 if (ExpansionVar.isInvalid())
9672 Iter.getAs<
DeclStmt>(), S->getLParenLoc(), S->getColonLoc(),
9676 NewPattern->getRangeVar(), LifetimeExtendTemps);
9677 }
else if (S->isDependent()) {
9679 getDerived().TransformStmt(S->getExpansionVarStmt());
9680 if (ExpansionVar.isInvalid())
9685 ExpansionInitializer.get(), S->getLParenLoc(), S->getColonLoc(),
9686 S->getRParenLoc(), LifetimeExtendTemps);
9688 if (Res.isInvalid())
9698 llvm_unreachable(
"destructuring pattern should never be instantiated");
9701 StmtResult Body = getDerived().TransformStmt(S->getBody());
9702 if (Body.isInvalid())
9708template <
typename Derived>
9711 bool SubStmtChanged =
false;
9714 for (
Stmt *OldDS : OldStmts) {
9715 StmtResult NewDS = getDerived().TransformStmt(OldDS);
9716 if (NewDS.isInvalid())
9719 SubStmtChanged |= NewDS.get() != OldDS;
9720 NewStmts.push_back(NewDS.get());
9727 getDerived().TransformDecl(S->getParent()->getLocation(), S->getParent());
9728 if (!ESD || ESD->isInvalidDecl())
9742 if (TransformStmts(PreambleStmts, S->getPreambleStmts()))
9745 if (S->shouldApplyLifetimeExtensionToPreamble()) {
9753 if (TransformStmts(Instantiations, S->getInstantiations()))
9756 if (!getDerived().AlwaysRebuild() && !SubStmtChanged)
9760 SemaRef.
Context, NewESD, Instantiations, PreambleStmts,
9761 S->shouldApplyLifetimeExtensionToPreamble());
9764template <
typename Derived>
9768 ExprResult Idx = getDerived().TransformExpr(E->getIndexExpr());
9769 if (
Range.isInvalid() || Idx.isInvalid())
9772 if (!getDerived().AlwaysRebuild() &&
Range.get() == E->getRangeExpr() &&
9773 Idx.get() == E->getIndexExpr())
9780template<
typename Derived>
9786 if (S->getQualifierLoc()) {
9788 = getDerived().TransformNestedNameSpecifierLoc(S->getQualifierLoc());
9795 if (NameInfo.getName()) {
9796 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
9797 if (!NameInfo.getName())
9802 if (!getDerived().AlwaysRebuild() &&
9803 QualifierLoc == S->getQualifierLoc() &&
9804 NameInfo.getName() == S->getNameInfo().getName())
9809 SS.
Adopt(QualifierLoc);
9811 switch (getSema().CheckMicrosoftIfExistsSymbol(
nullptr, SS, NameInfo)) {
9813 if (S->isIfExists())
9816 return new (getSema().Context)
NullStmt(S->getKeywordLoc());
9819 if (S->isIfNotExists())
9822 return new (getSema().Context)
NullStmt(S->getKeywordLoc());
9833 StmtResult SubStmt = getDerived().TransformCompoundStmt(S->getSubStmt());
9834 if (SubStmt.isInvalid())
9842 return getDerived().RebuildMSDependentExistsStmt(S->getKeywordLoc(),
9849template<
typename Derived>
9853 if (E->getQualifierLoc()) {
9855 = getDerived().TransformNestedNameSpecifierLoc(E->getQualifierLoc());
9861 getDerived().TransformDecl(E->getMemberLoc(), E->getPropertyDecl()));
9866 if (
Base.isInvalid())
9872 QualifierLoc, E->getMemberLoc());
9875template <
typename Derived>
9879 if (BaseRes.isInvalid())
9881 auto IdxRes = getDerived().TransformExpr(E->getIdx());
9882 if (IdxRes.isInvalid())
9885 if (!getDerived().AlwaysRebuild() &&
9886 BaseRes.get() == E->getBase() &&
9887 IdxRes.get() == E->getIdx())
9890 return getDerived().RebuildArraySubscriptExpr(
9891 BaseRes.get(),
SourceLocation(), IdxRes.get(), E->getRBracketLoc());
9894template <
typename Derived>
9896 StmtResult TryBlock = getDerived().TransformCompoundStmt(S->getTryBlock());
9897 if (TryBlock.isInvalid())
9900 StmtResult Handler = getDerived().TransformSEHHandler(S->getHandler());
9901 if (Handler.isInvalid())
9904 if (!getDerived().AlwaysRebuild() && TryBlock.get() == S->getTryBlock() &&
9905 Handler.get() == S->getHandler())
9908 return getDerived().RebuildSEHTryStmt(S->getIsCXXTry(), S->getTryLoc(),
9909 TryBlock.get(), Handler.get());
9912template <
typename Derived>
9915 if (
Block.isInvalid())
9918 return getDerived().RebuildSEHFinallyStmt(S->getFinallyLoc(),
Block.get());
9921template <
typename Derived>
9923 ExprResult FilterExpr = getDerived().TransformExpr(S->getFilterExpr());
9924 if (FilterExpr.isInvalid())
9928 if (
Block.isInvalid())
9931 return getDerived().RebuildSEHExceptStmt(S->getExceptLoc(), FilterExpr.get(),
9935template <
typename Derived>
9943template<
typename Derived>
9953template <
typename Derived>
9955TreeTransform<Derived>::TransformOMPCanonicalLoop(OMPCanonicalLoop *L) {
9959 return getDerived().TransformStmt(L->getLoopStmt());
9962template <
typename Derived>
9969 TClauses.reserve(Clauses.size());
9973 getDerived().getSema().OpenMP().StartOpenMPClause((*I)->getClauseKind());
9975 getDerived().getSema().OpenMP().EndOpenMPClause();
9977 TClauses.push_back(Clause);
9979 TClauses.push_back(
nullptr);
9983 if (D->hasAssociatedStmt() && D->getAssociatedStmt()) {
9984 getDerived().getSema().OpenMP().ActOnOpenMPRegionStart(
9985 D->getDirectiveKind(),
9991 if (D->getDirectiveKind() == OMPD_atomic ||
9992 D->getDirectiveKind() == OMPD_critical ||
9993 D->getDirectiveKind() == OMPD_section ||
9994 D->getDirectiveKind() == OMPD_master)
9995 CS = D->getAssociatedStmt();
9997 CS = D->getRawStmt();
10000 getSema().getLangOpts().OpenMPIRBuilder)
10004 getDerived().getSema().OpenMP().ActOnOpenMPRegionEnd(Body, TClauses);
10009 if (TClauses.size() != Clauses.size()) {
10015 if (D->getDirectiveKind() == OMPD_critical) {
10017 DirName =
getDerived().TransformDeclarationNameInfo(DirName);
10020 if (D->getDirectiveKind() == OMPD_cancellation_point) {
10022 }
else if (D->getDirectiveKind() == OMPD_cancel) {
10026 return getDerived().RebuildOMPExecutableDirective(
10027 D->getDirectiveKind(), DirName, CancelRegion, TClauses,
10028 AssociatedStmt.
get(), D->getBeginLoc(), D->getEndLoc());
10036template <
typename Derived>
10043 TClauses.reserve(Clauses.size());
10046 getDerived().getSema().OpenMP().StartOpenMPClause(
C->getClauseKind());
10048 getDerived().getSema().OpenMP().EndOpenMPClause();
10050 TClauses.push_back(Clause);
10052 TClauses.push_back(
nullptr);
10056 if (D->hasAssociatedStmt() && D->getAssociatedStmt()) {
10057 getDerived().getSema().OpenMP().ActOnOpenMPRegionStart(
10058 D->getDirectiveKind(),
10063 assert(D->getDirectiveKind() == OMPD_assume &&
10064 "Unexpected informational directive");
10065 Stmt *CS = D->getAssociatedStmt();
10069 getDerived().getSema().OpenMP().ActOnOpenMPRegionEnd(Body, TClauses);
10073 if (TClauses.size() != Clauses.size())
10078 return getDerived().RebuildOMPInformationalDirective(
10079 D->getDirectiveKind(), DirName, TClauses, AssociatedStmt.
get(),
10080 D->getBeginLoc(), D->getEndLoc());
10083template <
typename Derived>
10093 Variants.push_back(NewV.
get());
10100 OldTraitInfos = OldTraitInfos.drop_back();
10103 OMPTraitInfo &TI = getSema().getASTContext().getNewOMPTraitInfo();
10105 auto TransformScoreOrCondition = [&](Expr *&E,
bool IsScore) {
10108 EnterExpressionEvaluationContext Ctx(
10112 ExprResult ER = getDerived().TransformExpr(E);
10113 if (!ER.isUsable())
10120 TraitInfos.push_back(&TI);
10123 return getDerived().RebuildOMPMetaDirective(D->getBeginLoc(), D->getEndLoc(),
10124 TraitInfos, Variants);
10127template <
typename Derived>
10131 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10132 OMPD_parallel, DirName,
nullptr, D->getBeginLoc());
10133 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10134 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10138template <
typename Derived>
10142 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10143 OMPD_simd, DirName,
nullptr, D->getBeginLoc());
10144 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10145 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10149template <
typename Derived>
10153 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10154 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
10155 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10156 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10160template <
typename Derived>
10164 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10165 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
10166 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10167 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10171template <
typename Derived>
10175 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10176 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
10177 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10178 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10182template <
typename Derived>
10186 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10187 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
10188 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10189 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10193template <
typename Derived>
10195 OMPInterchangeDirective *D) {
10197 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10198 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
10199 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10200 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10204template <
typename Derived>
10208 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10209 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
10210 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10211 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10215template <
typename Derived>
10219 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10220 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
10221 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10222 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10226template <
typename Derived>
10230 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10231 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
10232 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10233 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10237template <
typename Derived>
10241 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10242 OMPD_for, DirName,
nullptr, D->getBeginLoc());
10243 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10244 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10248template <
typename Derived>
10252 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10253 OMPD_for_simd, DirName,
nullptr, D->getBeginLoc());
10254 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10255 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10259template <
typename Derived>
10263 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10264 OMPD_sections, DirName,
nullptr, D->getBeginLoc());
10265 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10266 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10270template <
typename Derived>
10274 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10275 OMPD_section, DirName,
nullptr, D->getBeginLoc());
10276 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10277 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10281template <
typename Derived>
10285 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10286 OMPD_scope, DirName,
nullptr, D->getBeginLoc());
10287 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10288 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10292template <
typename Derived>
10296 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10297 OMPD_single, DirName,
nullptr, D->getBeginLoc());
10298 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10299 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10303template <
typename Derived>
10307 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10308 OMPD_master, DirName,
nullptr, D->getBeginLoc());
10309 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10310 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10314template <
typename Derived>
10319 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10320 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10324template <
typename Derived>
10326 OMPParallelForDirective *D) {
10328 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10329 OMPD_parallel_for, DirName,
nullptr, D->getBeginLoc());
10330 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10331 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10335template <
typename Derived>
10337 OMPParallelForSimdDirective *D) {
10339 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10340 OMPD_parallel_for_simd, DirName,
nullptr, D->getBeginLoc());
10341 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10342 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10346template <
typename Derived>
10348 OMPParallelMasterDirective *D) {
10350 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10351 OMPD_parallel_master, DirName,
nullptr, D->getBeginLoc());
10352 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10353 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10357template <
typename Derived>
10359 OMPParallelMaskedDirective *D) {
10361 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10362 OMPD_parallel_masked, DirName,
nullptr, D->getBeginLoc());
10363 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10364 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10368template <
typename Derived>
10370 OMPParallelSectionsDirective *D) {
10372 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10373 OMPD_parallel_sections, DirName,
nullptr, D->getBeginLoc());
10374 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10375 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10379template <
typename Derived>
10383 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10384 OMPD_task, DirName,
nullptr, D->getBeginLoc());
10385 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10386 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10390template <
typename Derived>
10392 OMPTaskyieldDirective *D) {
10394 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10395 OMPD_taskyield, DirName,
nullptr, D->getBeginLoc());
10396 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10397 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10401template <
typename Derived>
10405 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10406 OMPD_barrier, DirName,
nullptr, D->getBeginLoc());
10407 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10408 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10412template <
typename Derived>
10416 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10417 OMPD_taskwait, DirName,
nullptr, D->getBeginLoc());
10418 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10419 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10423template <
typename Derived>
10427 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10428 OMPD_assume, DirName,
nullptr, D->getBeginLoc());
10429 StmtResult Res = getDerived().TransformOMPInformationalDirective(D);
10430 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10434template <
typename Derived>
10438 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10439 OMPD_error, DirName,
nullptr, D->getBeginLoc());
10440 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10441 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10445template <
typename Derived>
10447 OMPTaskgroupDirective *D) {
10449 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10450 OMPD_taskgroup, DirName,
nullptr, D->getBeginLoc());
10451 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10452 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10456template <
typename Derived>
10460 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10461 OMPD_flush, DirName,
nullptr, D->getBeginLoc());
10462 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10463 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10467template <
typename Derived>
10471 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10472 OMPD_depobj, DirName,
nullptr, D->getBeginLoc());
10473 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10474 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10478template <
typename Derived>
10482 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10483 OMPD_scan, DirName,
nullptr, D->getBeginLoc());
10484 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10485 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10489template <
typename Derived>
10491 OMPOrderedStandaloneDirective *D) {
10493 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10494 OMPD_ordered_standalone, DirName,
nullptr, D->getBeginLoc());
10495 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10496 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10500template <
typename Derived>
10502 OMPOrderedBlockAssocDirective *D) {
10504 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10505 OMPD_ordered_blockassoc, DirName,
nullptr, D->getBeginLoc());
10506 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10507 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10511template <
typename Derived>
10515 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10516 OMPD_atomic, DirName,
nullptr, D->getBeginLoc());
10517 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10518 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10522template <
typename Derived>
10526 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10527 OMPD_target, DirName,
nullptr, D->getBeginLoc());
10528 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10529 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10533template <
typename Derived>
10535 OMPTargetDataDirective *D) {
10537 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10538 OMPD_target_data, DirName,
nullptr, D->getBeginLoc());
10539 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10540 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10544template <
typename Derived>
10546 OMPTargetEnterDataDirective *D) {
10548 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10549 OMPD_target_enter_data, DirName,
nullptr, D->getBeginLoc());
10550 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10551 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10555template <
typename Derived>
10557 OMPTargetExitDataDirective *D) {
10559 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10560 OMPD_target_exit_data, DirName,
nullptr, D->getBeginLoc());
10561 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10562 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10566template <
typename Derived>
10568 OMPTargetParallelDirective *D) {
10570 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10571 OMPD_target_parallel, DirName,
nullptr, D->getBeginLoc());
10572 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10573 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10577template <
typename Derived>
10579 OMPTargetParallelForDirective *D) {
10581 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10582 OMPD_target_parallel_for, DirName,
nullptr, D->getBeginLoc());
10583 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10584 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10588template <
typename Derived>
10590 OMPTargetUpdateDirective *D) {
10592 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10593 OMPD_target_update, DirName,
nullptr, D->getBeginLoc());
10594 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10595 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10599template <
typename Derived>
10603 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10604 OMPD_teams, DirName,
nullptr, D->getBeginLoc());
10605 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10606 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10610template <
typename Derived>
10612 OMPCancellationPointDirective *D) {
10614 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10615 OMPD_cancellation_point, DirName,
nullptr, D->getBeginLoc());
10616 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10617 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10621template <
typename Derived>
10625 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10626 OMPD_cancel, DirName,
nullptr, D->getBeginLoc());
10627 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10628 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10632template <
typename Derived>
10636 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10637 OMPD_taskloop, DirName,
nullptr, D->getBeginLoc());
10638 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10639 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10643template <
typename Derived>
10645 OMPTaskLoopSimdDirective *D) {
10647 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10648 OMPD_taskloop_simd, DirName,
nullptr, D->getBeginLoc());
10649 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10650 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10654template <
typename Derived>
10656 OMPMasterTaskLoopDirective *D) {
10658 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10659 OMPD_master_taskloop, DirName,
nullptr, D->getBeginLoc());
10660 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10661 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10665template <
typename Derived>
10667 OMPMaskedTaskLoopDirective *D) {
10669 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10670 OMPD_masked_taskloop, DirName,
nullptr, D->getBeginLoc());
10671 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10672 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10676template <
typename Derived>
10678 OMPMasterTaskLoopSimdDirective *D) {
10680 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10681 OMPD_master_taskloop_simd, DirName,
nullptr, D->getBeginLoc());
10682 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10683 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10687template <
typename Derived>
10689 OMPMaskedTaskLoopSimdDirective *D) {
10691 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10692 OMPD_masked_taskloop_simd, DirName,
nullptr, D->getBeginLoc());
10693 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10694 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10698template <
typename Derived>
10700 OMPParallelMasterTaskLoopDirective *D) {
10702 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10703 OMPD_parallel_master_taskloop, DirName,
nullptr, D->getBeginLoc());
10704 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10705 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10709template <
typename Derived>
10711 OMPParallelMaskedTaskLoopDirective *D) {
10713 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10714 OMPD_parallel_masked_taskloop, DirName,
nullptr, D->getBeginLoc());
10715 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10716 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10720template <
typename Derived>
10723 OMPParallelMasterTaskLoopSimdDirective *D) {
10725 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10726 OMPD_parallel_master_taskloop_simd, DirName,
nullptr, D->getBeginLoc());
10727 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10728 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10732template <
typename Derived>
10735 OMPParallelMaskedTaskLoopSimdDirective *D) {
10737 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10738 OMPD_parallel_masked_taskloop_simd, DirName,
nullptr, D->getBeginLoc());
10739 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10740 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10744template <
typename Derived>
10746 OMPDistributeDirective *D) {
10748 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10749 OMPD_distribute, DirName,
nullptr, D->getBeginLoc());
10750 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10751 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10755template <
typename Derived>
10757 OMPDistributeParallelForDirective *D) {
10759 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10760 OMPD_distribute_parallel_for, DirName,
nullptr, D->getBeginLoc());
10761 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10762 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10766template <
typename Derived>
10769 OMPDistributeParallelForSimdDirective *D) {
10771 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10772 OMPD_distribute_parallel_for_simd, DirName,
nullptr, D->getBeginLoc());
10773 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10774 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10778template <
typename Derived>
10780 OMPDistributeSimdDirective *D) {
10782 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10783 OMPD_distribute_simd, DirName,
nullptr, D->getBeginLoc());
10784 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10785 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10789template <
typename Derived>
10791 OMPTargetParallelForSimdDirective *D) {
10793 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10794 OMPD_target_parallel_for_simd, DirName,
nullptr, D->getBeginLoc());
10795 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10796 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10800template <
typename Derived>
10802 OMPTargetSimdDirective *D) {
10804 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10805 OMPD_target_simd, DirName,
nullptr, D->getBeginLoc());
10806 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10807 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10811template <
typename Derived>
10813 OMPTeamsDistributeDirective *D) {
10815 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10816 OMPD_teams_distribute, DirName,
nullptr, D->getBeginLoc());
10817 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10818 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10822template <
typename Derived>
10824 OMPTeamsDistributeSimdDirective *D) {
10826 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10827 OMPD_teams_distribute_simd, DirName,
nullptr, D->getBeginLoc());
10828 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10829 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10833template <
typename Derived>
10835 OMPTeamsDistributeParallelForSimdDirective *D) {
10837 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10838 OMPD_teams_distribute_parallel_for_simd, DirName,
nullptr,
10840 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10841 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10845template <
typename Derived>
10847 OMPTeamsDistributeParallelForDirective *D) {
10849 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10850 OMPD_teams_distribute_parallel_for, DirName,
nullptr, D->getBeginLoc());
10851 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10852 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10856template <
typename Derived>
10858 OMPTargetTeamsDirective *D) {
10860 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10861 OMPD_target_teams, DirName,
nullptr, D->getBeginLoc());
10862 auto Res = getDerived().TransformOMPExecutableDirective(D);
10863 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10867template <
typename Derived>
10869 OMPTargetTeamsDistributeDirective *D) {
10871 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10872 OMPD_target_teams_distribute, DirName,
nullptr, D->getBeginLoc());
10873 auto Res = getDerived().TransformOMPExecutableDirective(D);
10874 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10878template <
typename Derived>
10881 OMPTargetTeamsDistributeParallelForDirective *D) {
10883 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10884 OMPD_target_teams_distribute_parallel_for, DirName,
nullptr,
10886 auto Res = getDerived().TransformOMPExecutableDirective(D);
10887 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10891template <
typename Derived>
10894 OMPTargetTeamsDistributeParallelForSimdDirective *D) {
10896 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10897 OMPD_target_teams_distribute_parallel_for_simd, DirName,
nullptr,
10899 auto Res = getDerived().TransformOMPExecutableDirective(D);
10900 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10904template <
typename Derived>
10907 OMPTargetTeamsDistributeSimdDirective *D) {
10909 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10910 OMPD_target_teams_distribute_simd, DirName,
nullptr, D->getBeginLoc());
10911 auto Res = getDerived().TransformOMPExecutableDirective(D);
10912 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10916template <
typename Derived>
10920 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10921 OMPD_interop, DirName,
nullptr, D->getBeginLoc());
10922 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10923 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10927template <
typename Derived>
10931 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10932 OMPD_dispatch, DirName,
nullptr, D->getBeginLoc());
10933 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10934 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10938template <
typename Derived>
10942 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10943 OMPD_masked, DirName,
nullptr, D->getBeginLoc());
10944 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10945 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10949template <
typename Derived>
10951 OMPGenericLoopDirective *D) {
10953 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10954 OMPD_loop, DirName,
nullptr, D->getBeginLoc());
10955 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10956 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10960template <
typename Derived>
10962 OMPTeamsGenericLoopDirective *D) {
10964 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10965 OMPD_teams_loop, DirName,
nullptr, D->getBeginLoc());
10966 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10967 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10971template <
typename Derived>
10973 OMPTargetTeamsGenericLoopDirective *D) {
10975 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10976 OMPD_target_teams_loop, DirName,
nullptr, D->getBeginLoc());
10977 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10978 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10982template <
typename Derived>
10984 OMPParallelGenericLoopDirective *D) {
10986 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10987 OMPD_parallel_loop, DirName,
nullptr, D->getBeginLoc());
10988 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10989 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10993template <
typename Derived>
10996 OMPTargetParallelGenericLoopDirective *D) {
10998 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10999 OMPD_target_parallel_loop, DirName,
nullptr, D->getBeginLoc());
11000 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
11001 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
11005template <
typename Derived>
11007 OMPTargetGenericLoopDirective *D) {
11009 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
11010 OMPD_target_loop, DirName,
nullptr, D->getBeginLoc());
11011 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
11012 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
11019template <
typename Derived>
11021 ExprResult Cond = getDerived().TransformExpr(
C->getCondition());
11022 if (Cond.isInvalid())
11024 return getDerived().RebuildOMPIfClause(
11025 C->getNameModifier(), Cond.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11026 C->getNameModifierLoc(),
C->getColonLoc(),
C->getEndLoc());
11029template <
typename Derived>
11031 ExprResult Cond = getDerived().TransformExpr(
C->getCondition());
11032 if (Cond.isInvalid())
11034 return getDerived().RebuildOMPFinalClause(Cond.get(),
C->getBeginLoc(),
11035 C->getLParenLoc(),
C->getEndLoc());
11038template <
typename Derived>
11042 Vars.reserve(
C->varlist_size());
11043 for (
auto *
VE :
C->varlist()) {
11045 if (EVar.isInvalid())
11047 Vars.push_back(EVar.get());
11049 Expr *DimsModifierExpr =
C->getDimsModifierExpr();
11050 if (DimsModifierExpr) {
11052 if (EVar.isInvalid())
11054 DimsModifierExpr = EVar.get();
11056 return getDerived().RebuildOMPNumThreadsClause(
11057 Vars,
C->getPrescriptivenessModifier(),
11058 C->getPrescriptivenessModifierLoc(),
C->getDimsModifier(),
11059 DimsModifierExpr,
C->getDimsModifierLoc(),
C->getBeginLoc(),
11060 C->getLParenLoc(),
C->getEndLoc());
11063template <
typename Derived>
11066 ExprResult E = getDerived().TransformExpr(
C->getSafelen());
11069 return getDerived().RebuildOMPSafelenClause(
11070 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11073template <
typename Derived>
11076 ExprResult E = getDerived().TransformExpr(
C->getAllocator());
11079 return getDerived().RebuildOMPAllocatorClause(
11080 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11083template <
typename Derived>
11086 ExprResult E = getDerived().TransformExpr(
C->getSimdlen());
11089 return getDerived().RebuildOMPSimdlenClause(
11090 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11093template <
typename Derived>
11096 TransformedSizes.reserve(
C->getNumSizes());
11098 for (
Expr *E :
C->getSizesRefs()) {
11100 TransformedSizes.push_back(
nullptr);
11109 TransformedSizes.push_back(
T.get());
11112 if (!Changed && !getDerived().AlwaysRebuild())
11114 return RebuildOMPSizesClause(TransformedSizes,
C->getBeginLoc(),
11115 C->getLParenLoc(),
C->getEndLoc());
11118template <
typename Derived>
11122 TransformedCounts.reserve(
C->getNumCounts());
11123 for (
Expr *E :
C->getCountsRefs()) {
11125 TransformedCounts.push_back(
nullptr);
11132 TransformedCounts.push_back(
T.get());
11135 return RebuildOMPCountsClause(TransformedCounts,
C->getBeginLoc(),
11136 C->getLParenLoc(),
C->getEndLoc(),
11137 C->getOmpFillIndex(),
C->getOmpFillLoc());
11140template <
typename Derived>
11144 TransformedArgs.reserve(
C->getNumLoops());
11146 for (
Expr *E :
C->getArgsRefs()) {
11148 TransformedArgs.push_back(
nullptr);
11157 TransformedArgs.push_back(
T.get());
11160 if (!Changed && !getDerived().AlwaysRebuild())
11162 return RebuildOMPPermutationClause(TransformedArgs,
C->getBeginLoc(),
11163 C->getLParenLoc(),
C->getEndLoc());
11166template <
typename Derived>
11168 if (!getDerived().AlwaysRebuild())
11170 return RebuildOMPFullClause(
C->getBeginLoc(),
C->getEndLoc());
11173template <
typename Derived>
11176 ExprResult T = getDerived().TransformExpr(
C->getFactor());
11179 Expr *Factor =
T.get();
11180 bool Changed = Factor !=
C->getFactor();
11182 if (!Changed && !getDerived().AlwaysRebuild())
11184 return RebuildOMPPartialClause(Factor,
C->getBeginLoc(),
C->getLParenLoc(),
11188template <
typename Derived>
11190 ExprResult T = getDerived().TransformExpr(
C->getDepth());
11193 Expr *Depth =
T.get();
11194 bool Changed = Depth !=
C->getDepth();
11196 if (!Changed && !getDerived().AlwaysRebuild())
11198 return RebuildOMPDepthClause(Depth,
C->getBeginLoc(),
C->getLParenLoc(),
11202template <
typename Derived>
11205 ExprResult F = getDerived().TransformExpr(
C->getFirst());
11209 ExprResult Cn = getDerived().TransformExpr(
C->getCount());
11210 if (Cn.isInvalid())
11214 Expr *Count = Cn.get();
11216 bool Changed = (
First !=
C->getFirst()) || (Count !=
C->getCount());
11219 if (!Changed && !getDerived().AlwaysRebuild())
11222 return RebuildOMPLoopRangeClause(
First, Count,
C->getBeginLoc(),
11223 C->getLParenLoc(),
C->getFirstLoc(),
11224 C->getCountLoc(),
C->getEndLoc());
11227template <
typename Derived>
11230 ExprResult E = getDerived().TransformExpr(
C->getNumForLoops());
11233 return getDerived().RebuildOMPCollapseClause(
11234 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11237template <
typename Derived>
11241 C->getDefaultKind(),
C->getDefaultKindKwLoc(),
C->getDefaultVC(),
11242 C->getDefaultVCLoc(),
C->getBeginLoc(),
C->getLParenLoc(),
11246template <
typename Derived>
11253template <
typename Derived>
11256 Expr *Impex =
C->getImpexType();
11257 ExprResult TransformedImpex = getDerived().TransformExpr(Impex);
11259 if (TransformedImpex.isInvalid())
11262 return getDerived().RebuildOMPTransparentClause(
11263 TransformedImpex.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11267template <
typename Derived>
11271 C->getProcBindKind(),
C->getProcBindKindKwLoc(),
C->getBeginLoc(),
11272 C->getLParenLoc(),
C->getEndLoc());
11275template <
typename Derived>
11278 ExprResult E = getDerived().TransformExpr(
C->getChunkSize());
11281 return getDerived().RebuildOMPScheduleClause(
11282 C->getFirstScheduleModifier(),
C->getSecondScheduleModifier(),
11283 C->getScheduleKind(), E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11284 C->getFirstScheduleModifierLoc(),
C->getSecondScheduleModifierLoc(),
11285 C->getScheduleKindLoc(),
C->getCommaLoc(),
C->getEndLoc());
11288template <
typename Derived>
11292 if (
auto *
Num =
C->getNumForLoops()) {
11293 E = getDerived().TransformExpr(
Num);
11297 return getDerived().RebuildOMPOrderedClause(
C->getBeginLoc(),
C->getEndLoc(),
11298 C->getLParenLoc(), E.get());
11301template <
typename Derived>
11305 if (
Expr *Evt =
C->getEventHandler()) {
11306 E = getDerived().TransformExpr(Evt);
11310 return getDerived().RebuildOMPDetachClause(E.get(),
C->getBeginLoc(),
11311 C->getLParenLoc(),
C->getEndLoc());
11314template <
typename Derived>
11319 Cond = getDerived().TransformExpr(
Condition);
11320 if (Cond.isInvalid())
11323 return getDerived().RebuildOMPNowaitClause(Cond.get(),
C->getBeginLoc(),
11324 C->getLParenLoc(),
C->getEndLoc());
11327template <
typename Derived>
11334template <
typename Derived>
11341template <
typename Derived>
11347template <
typename Derived>
11353template <
typename Derived>
11360template <
typename Derived>
11362 OMPUpdateDependObjectsClause *
C) {
11367template <
typename Derived>
11374template <
typename Derived>
11381template <
typename Derived>
11387template <
typename Derived>
11393template <
typename Derived>
11395 ExprResult E = getDerived().TransformExpr(
C->getExpr());
11398 return getDerived().RebuildOMPHoldsClause(E.get(),
C->getBeginLoc(),
11399 C->getLParenLoc(),
C->getEndLoc());
11402template <
typename Derived>
11408template <
typename Derived>
11413template <
typename Derived>
11415 OMPNoOpenMPRoutinesClause *
C) {
11418template <
typename Derived>
11420 OMPNoOpenMPConstructsClause *
C) {
11423template <
typename Derived>
11425 OMPNoParallelismClause *
C) {
11429template <
typename Derived>
11436template <
typename Derived>
11443template <
typename Derived>
11450template <
typename Derived>
11457template <
typename Derived>
11464template <
typename Derived>
11470template <
typename Derived>
11477template <
typename Derived>
11483template <
typename Derived>
11490template <
typename Derived>
11492 ExprResult IVR = getDerived().TransformExpr(
C->getInteropVar());
11493 if (IVR.isInvalid())
11497 for (OMPInitClause::PrefView P :
C->prefs()) {
11498 Expr *NewFr =
nullptr;
11500 ExprResult ER = getDerived().TransformExpr(P.Fr);
11501 if (ER.isInvalid())
11506 NewAttrs.reserve(P.Attrs.size());
11507 for (
Expr *A : P.Attrs) {
11508 ExprResult ER = getDerived().TransformExpr(A);
11509 if (ER.isInvalid())
11511 NewAttrs.push_back(ER.get());
11513 InteropInfo.Prefs.emplace_back(NewFr, std::move(NewAttrs));
11515 InteropInfo.HasPreferAttrs =
C->hasPreferAttrs();
11516 return getDerived().RebuildOMPInitClause(IVR.get(), InteropInfo,
11517 C->getBeginLoc(),
C->getLParenLoc(),
11518 C->getVarLoc(),
C->getEndLoc());
11521template <
typename Derived>
11523 ExprResult ER = getDerived().TransformExpr(
C->getInteropVar());
11524 if (ER.isInvalid())
11526 return getDerived().RebuildOMPUseClause(ER.get(),
C->getBeginLoc(),
11527 C->getLParenLoc(),
C->getVarLoc(),
11531template <
typename Derived>
11535 if (
Expr *IV =
C->getInteropVar()) {
11536 ER = getDerived().TransformExpr(IV);
11537 if (ER.isInvalid())
11540 return getDerived().RebuildOMPDestroyClause(ER.get(),
C->getBeginLoc(),
11541 C->getLParenLoc(),
C->getVarLoc(),
11545template <
typename Derived>
11548 ExprResult Cond = getDerived().TransformExpr(
C->getCondition());
11549 if (Cond.isInvalid())
11551 return getDerived().RebuildOMPNovariantsClause(
11552 Cond.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11555template <
typename Derived>
11558 ExprResult Cond = getDerived().TransformExpr(
C->getCondition());
11559 if (Cond.isInvalid())
11561 return getDerived().RebuildOMPNocontextClause(
11562 Cond.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11565template <
typename Derived>
11568 ExprResult ThreadID = getDerived().TransformExpr(
C->getThreadID());
11569 if (ThreadID.isInvalid())
11571 return getDerived().RebuildOMPFilterClause(ThreadID.get(),
C->getBeginLoc(),
11572 C->getLParenLoc(),
C->getEndLoc());
11575template <
typename Derived>
11577 ExprResult E = getDerived().TransformExpr(
C->getAlignment());
11580 return getDerived().RebuildOMPAlignClause(E.get(),
C->getBeginLoc(),
11581 C->getLParenLoc(),
C->getEndLoc());
11584template <
typename Derived>
11586 OMPUnifiedAddressClause *
C) {
11587 llvm_unreachable(
"unified_address clause cannot appear in dependent context");
11590template <
typename Derived>
11592 OMPUnifiedSharedMemoryClause *
C) {
11594 "unified_shared_memory clause cannot appear in dependent context");
11597template <
typename Derived>
11599 OMPReverseOffloadClause *
C) {
11600 llvm_unreachable(
"reverse_offload clause cannot appear in dependent context");
11603template <
typename Derived>
11605 OMPDynamicAllocatorsClause *
C) {
11607 "dynamic_allocators clause cannot appear in dependent context");
11610template <
typename Derived>
11612 OMPAtomicDefaultMemOrderClause *
C) {
11614 "atomic_default_mem_order clause cannot appear in dependent context");
11617template <
typename Derived>
11620 llvm_unreachable(
"self_maps clause cannot appear in dependent context");
11623template <
typename Derived>
11626 C->getBeginLoc(),
C->getLParenLoc(),
11630template <
typename Derived>
11634 C->getSeverityKind(),
C->getSeverityKindKwLoc(),
C->getBeginLoc(),
11635 C->getLParenLoc(),
C->getEndLoc());
11638template <
typename Derived>
11641 ExprResult E = getDerived().TransformExpr(
C->getMessageString());
11644 return getDerived().RebuildOMPMessageClause(
11645 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11648template <
typename Derived>
11652 Vars.reserve(
C->varlist_size());
11653 for (
auto *
VE :
C->varlist()) {
11655 if (EVar.isInvalid())
11657 Vars.push_back(EVar.get());
11659 return getDerived().RebuildOMPPrivateClause(
11660 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11663template <
typename Derived>
11665 OMPFirstprivateClause *
C) {
11667 Vars.reserve(
C->varlist_size());
11668 for (
auto *
VE :
C->varlist()) {
11670 if (EVar.isInvalid())
11672 Vars.push_back(EVar.get());
11674 return getDerived().RebuildOMPFirstprivateClause(
11675 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11678template <
typename Derived>
11682 Vars.reserve(
C->varlist_size());
11683 for (
auto *
VE :
C->varlist()) {
11685 if (EVar.isInvalid())
11687 Vars.push_back(EVar.get());
11689 return getDerived().RebuildOMPLastprivateClause(
11690 Vars,
C->getKind(),
C->getKindLoc(),
C->getColonLoc(),
C->getBeginLoc(),
11691 C->getLParenLoc(),
C->getEndLoc());
11694template <
typename Derived>
11698 Vars.reserve(
C->varlist_size());
11699 for (
auto *
VE :
C->varlist()) {
11701 if (EVar.isInvalid())
11703 Vars.push_back(EVar.get());
11705 return getDerived().RebuildOMPSharedClause(Vars,
C->getBeginLoc(),
11706 C->getLParenLoc(),
C->getEndLoc());
11709template <
typename Derived>
11713 Vars.reserve(
C->varlist_size());
11714 for (
auto *
VE :
C->varlist()) {
11716 if (EVar.isInvalid())
11718 Vars.push_back(EVar.get());
11721 ReductionIdScopeSpec.
Adopt(
C->getQualifierLoc());
11724 if (NameInfo.getName()) {
11725 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
11726 if (!NameInfo.getName())
11732 for (
auto *E :
C->reduction_ops()) {
11737 for (
auto *D : ULE->decls()) {
11740 Decls.addDecl(InstD, InstD->getAccess());
11744 ReductionIdScopeSpec.getWithLocInContext(SemaRef.
Context), NameInfo,
11745 true, Decls.begin(), Decls.end(),
11748 UnresolvedReductions.push_back(
nullptr);
11750 return getDerived().RebuildOMPReductionClause(
11751 Vars,
C->getModifier(),
C->getOriginalSharingModifier(),
C->getBeginLoc(),
11752 C->getLParenLoc(),
C->getModifierLoc(),
C->getColonLoc(),
C->getEndLoc(),
11753 ReductionIdScopeSpec, NameInfo, UnresolvedReductions);
11756template <
typename Derived>
11758 OMPTaskReductionClause *
C) {
11760 Vars.reserve(
C->varlist_size());
11761 for (
auto *
VE :
C->varlist()) {
11763 if (EVar.isInvalid())
11765 Vars.push_back(EVar.get());
11768 ReductionIdScopeSpec.
Adopt(
C->getQualifierLoc());
11771 if (NameInfo.getName()) {
11772 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
11773 if (!NameInfo.getName())
11779 for (
auto *E :
C->reduction_ops()) {
11784 for (
auto *D : ULE->decls()) {
11787 Decls.addDecl(InstD, InstD->getAccess());
11791 ReductionIdScopeSpec.getWithLocInContext(SemaRef.
Context), NameInfo,
11792 true, Decls.begin(), Decls.end(),
11795 UnresolvedReductions.push_back(
nullptr);
11797 return getDerived().RebuildOMPTaskReductionClause(
11798 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getColonLoc(),
11799 C->getEndLoc(), ReductionIdScopeSpec, NameInfo, UnresolvedReductions);
11802template <
typename Derived>
11806 Vars.reserve(
C->varlist_size());
11807 for (
auto *
VE :
C->varlist()) {
11809 if (EVar.isInvalid())
11811 Vars.push_back(EVar.get());
11814 ReductionIdScopeSpec.
Adopt(
C->getQualifierLoc());
11817 if (NameInfo.getName()) {
11818 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
11819 if (!NameInfo.getName())
11825 for (
auto *E :
C->reduction_ops()) {
11830 for (
auto *D : ULE->decls()) {
11833 Decls.addDecl(InstD, InstD->getAccess());
11837 ReductionIdScopeSpec.getWithLocInContext(SemaRef.
Context), NameInfo,
11838 true, Decls.begin(), Decls.end(),
11841 UnresolvedReductions.push_back(
nullptr);
11843 return getDerived().RebuildOMPInReductionClause(
11844 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getColonLoc(),
11845 C->getEndLoc(), ReductionIdScopeSpec, NameInfo, UnresolvedReductions);
11848template <
typename Derived>
11852 Vars.reserve(
C->varlist_size());
11853 for (
auto *
VE :
C->varlist()) {
11855 if (EVar.isInvalid())
11857 Vars.push_back(EVar.get());
11859 ExprResult Step = getDerived().TransformExpr(
C->getStep());
11860 if (Step.isInvalid())
11862 return getDerived().RebuildOMPLinearClause(
11863 Vars, Step.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getModifier(),
11864 C->getModifierLoc(),
C->getColonLoc(),
C->getStepModifierLoc(),
11868template <
typename Derived>
11872 Vars.reserve(
C->varlist_size());
11873 for (
auto *
VE :
C->varlist()) {
11875 if (EVar.isInvalid())
11877 Vars.push_back(EVar.get());
11879 ExprResult Alignment = getDerived().TransformExpr(
C->getAlignment());
11880 if (Alignment.isInvalid())
11882 return getDerived().RebuildOMPAlignedClause(
11883 Vars, Alignment.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11884 C->getColonLoc(),
C->getEndLoc());
11887template <
typename Derived>
11891 Vars.reserve(
C->varlist_size());
11892 for (
auto *
VE :
C->varlist()) {
11894 if (EVar.isInvalid())
11896 Vars.push_back(EVar.get());
11898 return getDerived().RebuildOMPCopyinClause(Vars,
C->getBeginLoc(),
11899 C->getLParenLoc(),
C->getEndLoc());
11902template <
typename Derived>
11906 Vars.reserve(
C->varlist_size());
11907 for (
auto *
VE :
C->varlist()) {
11909 if (EVar.isInvalid())
11911 Vars.push_back(EVar.get());
11913 return getDerived().RebuildOMPCopyprivateClause(
11914 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11917template <
typename Derived>
11920 Vars.reserve(
C->varlist_size());
11921 for (
auto *
VE :
C->varlist()) {
11923 if (EVar.isInvalid())
11925 Vars.push_back(EVar.get());
11927 return getDerived().RebuildOMPFlushClause(Vars,
C->getBeginLoc(),
11928 C->getLParenLoc(),
C->getEndLoc());
11931template <
typename Derived>
11934 ExprResult E = getDerived().TransformExpr(
C->getDepobj());
11937 return getDerived().RebuildOMPDepobjClause(E.get(),
C->getBeginLoc(),
11938 C->getLParenLoc(),
C->getEndLoc());
11941template <
typename Derived>
11945 Expr *DepModifier =
C->getModifier();
11947 ExprResult DepModRes = getDerived().TransformExpr(DepModifier);
11948 if (DepModRes.isInvalid())
11950 DepModifier = DepModRes.get();
11952 Vars.reserve(
C->varlist_size());
11953 for (
auto *
VE :
C->varlist()) {
11955 if (EVar.isInvalid())
11957 Vars.push_back(EVar.get());
11959 return getDerived().RebuildOMPDependClause(
11960 {
C->getDependencyKind(),
C->getDependencyLoc(),
C->getColonLoc(),
11961 C->getOmpAllMemoryLoc()},
11962 DepModifier, Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11965template <
typename Derived>
11968 ExprResult E = getDerived().TransformExpr(
C->getDevice());
11971 return getDerived().RebuildOMPDeviceClause(
11972 C->getModifier(), E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11973 C->getModifierLoc(),
C->getEndLoc());
11976template <
typename Derived,
class T>
11983 Vars.reserve(
C->varlist_size());
11984 for (
auto *
VE :
C->varlist()) {
11988 Vars.push_back(EVar.
get());
11992 if (
C->getMapperQualifierLoc()) {
11993 QualifierLoc = TT.
getDerived().TransformNestedNameSpecifierLoc(
11994 C->getMapperQualifierLoc());
11998 MapperIdScopeSpec.
Adopt(QualifierLoc);
11999 MapperIdInfo =
C->getMapperIdInfo();
12000 if (MapperIdInfo.
getName()) {
12001 MapperIdInfo = TT.
getDerived().TransformDeclarationNameInfo(MapperIdInfo);
12007 for (
auto *E :
C->mapperlists()) {
12012 for (
auto *D : ULE->decls()) {
12015 Decls.addDecl(InstD, InstD->
getAccess());
12020 MapperIdInfo,
true, Decls.begin(), Decls.end(),
12023 UnresolvedMappers.push_back(
nullptr);
12029template <
typename Derived>
12031 OMPVarListLocTy Locs(
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
12033 Expr *IteratorModifier =
C->getIteratorModifier();
12034 if (IteratorModifier) {
12035 ExprResult MapModRes = getDerived().TransformExpr(IteratorModifier);
12036 if (MapModRes.isInvalid())
12038 IteratorModifier = MapModRes.
get();
12044 *
this,
C, Vars, MapperIdScopeSpec, MapperIdInfo, UnresolvedMappers))
12046 return getDerived().RebuildOMPMapClause(
12047 IteratorModifier,
C->getMapTypeModifiers(),
C->getMapTypeModifiersLoc(),
12048 MapperIdScopeSpec, MapperIdInfo,
C->getMapType(),
C->isImplicitMapType(),
12049 C->getMapLoc(),
C->getColonLoc(), Vars, Locs, UnresolvedMappers);
12052template <
typename Derived>
12055 Expr *Allocator =
C->getAllocator();
12057 ExprResult AllocatorRes = getDerived().TransformExpr(Allocator);
12058 if (AllocatorRes.isInvalid())
12060 Allocator = AllocatorRes.get();
12062 Expr *Alignment =
C->getAlignment();
12064 ExprResult AlignmentRes = getDerived().TransformExpr(Alignment);
12065 if (AlignmentRes.isInvalid())
12067 Alignment = AlignmentRes.get();
12070 Vars.reserve(
C->varlist_size());
12071 for (
auto *
VE :
C->varlist()) {
12073 if (EVar.isInvalid())
12075 Vars.push_back(EVar.get());
12077 return getDerived().RebuildOMPAllocateClause(
12078 Allocator, Alignment,
C->getFirstAllocateModifier(),
12079 C->getFirstAllocateModifierLoc(),
C->getSecondAllocateModifier(),
12080 C->getSecondAllocateModifierLoc(), Vars,
C->getBeginLoc(),
12081 C->getLParenLoc(),
C->getColonLoc(),
C->getEndLoc());
12084template <
typename Derived>
12088 Vars.reserve(
C->varlist_size());
12089 for (
auto *
VE :
C->varlist()) {
12091 if (EVar.isInvalid())
12093 Vars.push_back(EVar.get());
12095 Expr *ModifierExpr =
C->getModifierExpr();
12096 if (ModifierExpr) {
12098 if (EVar.isInvalid())
12100 ModifierExpr = EVar.get();
12102 return getDerived().RebuildOMPNumTeamsClause(
12103 Vars,
C->getModifier(), ModifierExpr,
C->getModifierLoc(),
12105 C->getLParenLoc(),
C->getEndLoc());
12108template <
typename Derived>
12112 Vars.reserve(
C->varlist_size());
12113 for (
auto *
VE :
C->varlist()) {
12115 if (EVar.isInvalid())
12117 Vars.push_back(EVar.get());
12119 Expr *ModifierExpr =
C->getModifierExpr();
12120 if (ModifierExpr) {
12122 if (EVar.isInvalid())
12124 ModifierExpr = EVar.get();
12126 return getDerived().RebuildOMPThreadLimitClause(
12127 Vars,
C->getModifier(), ModifierExpr,
C->getModifierLoc(),
12128 C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
12131template <
typename Derived>
12134 ExprResult E = getDerived().TransformExpr(
C->getPriority());
12137 return getDerived().RebuildOMPPriorityClause(
12138 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
12141template <
typename Derived>
12144 ExprResult E = getDerived().TransformExpr(
C->getGrainsize());
12147 return getDerived().RebuildOMPGrainsizeClause(
12148 C->getModifier(), E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
12149 C->getModifierLoc(),
C->getEndLoc());
12152template <
typename Derived>
12155 ExprResult E = getDerived().TransformExpr(
C->getNumTasks());
12158 return getDerived().RebuildOMPNumTasksClause(
12159 C->getModifier(), E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
12160 C->getModifierLoc(),
C->getEndLoc());
12163template <
typename Derived>
12165 ExprResult E = getDerived().TransformExpr(
C->getHint());
12168 return getDerived().RebuildOMPHintClause(E.get(),
C->getBeginLoc(),
12169 C->getLParenLoc(),
C->getEndLoc());
12172template <
typename Derived>
12174 OMPDistScheduleClause *
C) {
12175 ExprResult E = getDerived().TransformExpr(
C->getChunkSize());
12178 return getDerived().RebuildOMPDistScheduleClause(
12179 C->getDistScheduleKind(), E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
12180 C->getDistScheduleKindLoc(),
C->getCommaLoc(),
C->getEndLoc());
12183template <
typename Derived>
12189 C->getDefaultmapKind(),
12192 C->getDefaultmapModifierLoc(),
12193 C->getDefaultmapKindLoc(),
12197template <
typename Derived>
12201 Expr *IteratorModifier =
C->getIteratorModifier();
12202 if (IteratorModifier) {
12203 ExprResult MapModRes = getDerived().TransformExpr(IteratorModifier);
12204 if (MapModRes.isInvalid())
12206 IteratorModifier = MapModRes.get();
12212 *
this,
C, Vars, MapperIdScopeSpec, MapperIdInfo, UnresolvedMappers))
12214 return getDerived().RebuildOMPToClause(
12215 C->getMotionModifiers(),
C->getMotionModifiersLoc(), IteratorModifier,
12216 MapperIdScopeSpec, MapperIdInfo,
C->getColonLoc(), Vars, Locs,
12217 UnresolvedMappers);
12220template <
typename Derived>
12224 Expr *IteratorModifier =
C->getIteratorModifier();
12225 if (IteratorModifier) {
12226 ExprResult MapModRes = getDerived().TransformExpr(IteratorModifier);
12227 if (MapModRes.isInvalid())
12229 IteratorModifier = MapModRes.get();
12235 *
this,
C, Vars, MapperIdScopeSpec, MapperIdInfo, UnresolvedMappers))
12237 return getDerived().RebuildOMPFromClause(
12238 C->getMotionModifiers(),
C->getMotionModifiersLoc(), IteratorModifier,
12239 MapperIdScopeSpec, MapperIdInfo,
C->getColonLoc(), Vars, Locs,
12240 UnresolvedMappers);
12243template <
typename Derived>
12245 OMPUseDevicePtrClause *
C) {
12247 Vars.reserve(
C->varlist_size());
12248 for (
auto *
VE :
C->varlist()) {
12250 if (EVar.isInvalid())
12252 Vars.push_back(EVar.get());
12255 return getDerived().RebuildOMPUseDevicePtrClause(
12256 Vars, Locs,
C->getFallbackModifier(),
C->getFallbackModifierLoc());
12259template <
typename Derived>
12261 OMPUseDeviceAddrClause *
C) {
12263 Vars.reserve(
C->varlist_size());
12264 for (
auto *
VE :
C->varlist()) {
12266 if (EVar.isInvalid())
12268 Vars.push_back(EVar.get());
12271 return getDerived().RebuildOMPUseDeviceAddrClause(Vars, Locs);
12274template <
typename Derived>
12278 Vars.reserve(
C->varlist_size());
12279 for (
auto *
VE :
C->varlist()) {
12281 if (EVar.isInvalid())
12283 Vars.push_back(EVar.get());
12286 return getDerived().RebuildOMPIsDevicePtrClause(Vars, Locs);
12289template <
typename Derived>
12291 OMPHasDeviceAddrClause *
C) {
12293 Vars.reserve(
C->varlist_size());
12294 for (
auto *
VE :
C->varlist()) {
12296 if (EVar.isInvalid())
12298 Vars.push_back(EVar.get());
12301 return getDerived().RebuildOMPHasDeviceAddrClause(Vars, Locs);
12304template <
typename Derived>
12308 Vars.reserve(
C->varlist_size());
12309 for (
auto *
VE :
C->varlist()) {
12311 if (EVar.isInvalid())
12313 Vars.push_back(EVar.get());
12315 return getDerived().RebuildOMPNontemporalClause(
12316 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
12319template <
typename Derived>
12323 Vars.reserve(
C->varlist_size());
12324 for (
auto *
VE :
C->varlist()) {
12326 if (EVar.isInvalid())
12328 Vars.push_back(EVar.get());
12330 return getDerived().RebuildOMPInclusiveClause(
12331 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
12334template <
typename Derived>
12338 Vars.reserve(
C->varlist_size());
12339 for (
auto *
VE :
C->varlist()) {
12341 if (EVar.isInvalid())
12343 Vars.push_back(EVar.get());
12345 return getDerived().RebuildOMPExclusiveClause(
12346 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
12349template <
typename Derived>
12351 OMPUsesAllocatorsClause *
C) {
12353 Data.reserve(
C->getNumberOfAllocators());
12354 for (
unsigned I = 0, E =
C->getNumberOfAllocators(); I < E; ++I) {
12355 OMPUsesAllocatorsClause::Data D =
C->getAllocatorData(I);
12357 if (Allocator.isInvalid())
12361 AllocatorTraits = getDerived().TransformExpr(AT);
12362 if (AllocatorTraits.isInvalid())
12366 NewD.Allocator = Allocator.get();
12367 NewD.AllocatorTraits = AllocatorTraits.get();
12371 return getDerived().RebuildOMPUsesAllocatorsClause(
12372 Data,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
12375template <
typename Derived>
12379 Locators.reserve(
C->varlist_size());
12381 if (
Expr *Modifier =
C->getModifier()) {
12382 ModifierRes = getDerived().TransformExpr(Modifier);
12383 if (ModifierRes.isInvalid())
12386 for (
Expr *E :
C->varlist()) {
12387 ExprResult Locator = getDerived().TransformExpr(E);
12388 if (Locator.isInvalid())
12390 Locators.push_back(Locator.get());
12392 return getDerived().RebuildOMPAffinityClause(
12393 C->getBeginLoc(),
C->getLParenLoc(),
C->getColonLoc(),
C->getEndLoc(),
12394 ModifierRes.get(), Locators);
12397template <
typename Derived>
12400 C->getKind(),
C->getKindKwLoc(),
C->getBeginLoc(),
C->getLParenLoc(),
12401 C->getEndLoc(),
C->getModifier(),
C->getModifierKwLoc());
12404template <
typename Derived>
12407 C->getBindKind(),
C->getBindKindLoc(),
C->getBeginLoc(),
12408 C->getLParenLoc(),
C->getEndLoc());
12411template <
typename Derived>
12413 OMPXDynCGroupMemClause *
C) {
12415 if (
Size.isInvalid())
12417 return getDerived().RebuildOMPXDynCGroupMemClause(
12418 Size.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
12421template <
typename Derived>
12423 OMPDynGroupprivateClause *
C) {
12425 if (
Size.isInvalid())
12427 return getDerived().RebuildOMPDynGroupprivateClause(
12428 C->getDynGroupprivateModifier(),
C->getDynGroupprivateFallbackModifier(),
12429 Size.get(),
C->getBeginLoc(),
C->getLParenLoc(),
12430 C->getDynGroupprivateModifierLoc(),
12431 C->getDynGroupprivateFallbackModifierLoc(),
C->getEndLoc());
12434template <
typename Derived>
12438 Vars.reserve(
C->varlist_size());
12439 for (
auto *
VE :
C->varlist()) {
12441 if (EVar.isInvalid())
12443 Vars.push_back(EVar.get());
12445 return getDerived().RebuildOMPDoacrossClause(
12446 C->getDependenceType(),
C->getDependenceLoc(),
C->getColonLoc(), Vars,
12447 C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
12450template <
typename Derived>
12454 for (
auto *A :
C->getAttrs())
12455 NewAttrs.push_back(getDerived().TransformAttr(A));
12456 return getDerived().RebuildOMPXAttributeClause(
12457 NewAttrs,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
12460template <
typename Derived>
12469template <
typename Derived>
12470class OpenACCClauseTransform final
12472 TreeTransform<Derived> &Self;
12473 ArrayRef<const OpenACCClause *> ExistingClauses;
12474 SemaOpenACC::OpenACCParsedClause &ParsedClause;
12475 OpenACCClause *NewClause =
nullptr;
12478 ExprResult Res = Self.TransformExpr(VarRef);
12480 if (!Res.isUsable())
12483 Res = Self.getSema().OpenACC().ActOnVar(ParsedClause.getDirectiveKind(),
12484 ParsedClause.getClauseKind(),
12490 llvm::SmallVector<Expr *> VisitVarList(ArrayRef<Expr *> VarList) {
12491 llvm::SmallVector<Expr *> InstantiatedVarList;
12492 for (Expr *CurVar : VarList) {
12495 if (VarRef.isUsable())
12496 InstantiatedVarList.push_back(VarRef.get());
12499 return InstantiatedVarList;
12503 OpenACCClauseTransform(TreeTransform<Derived> &Self,
12504 ArrayRef<const OpenACCClause *> ExistingClauses,
12505 SemaOpenACC::OpenACCParsedClause &PC)
12506 : Self(Self), ExistingClauses(ExistingClauses), ParsedClause(PC) {}
12508 OpenACCClause *CreatedClause()
const {
return NewClause; }
12510#define VISIT_CLAUSE(CLAUSE_NAME) \
12511 void Visit##CLAUSE_NAME##Clause(const OpenACC##CLAUSE_NAME##Clause &Clause);
12512#include "clang/Basic/OpenACCClauses.def"
12515template <
typename Derived>
12516void OpenACCClauseTransform<Derived>::VisitDefaultClause(
12518 ParsedClause.setDefaultDetails(
C.getDefaultClauseKind());
12521 Self.getSema().getASTContext(), ParsedClause.getDefaultClauseKind(),
12522 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12523 ParsedClause.getEndLoc());
12526template <
typename Derived>
12527void OpenACCClauseTransform<Derived>::VisitIfClause(
const OpenACCIfClause &
C) {
12528 Expr *Cond =
const_cast<Expr *
>(
C.getConditionExpr());
12529 assert(Cond &&
"If constructed with invalid Condition");
12533 if (Res.isInvalid() || !Res.get().second)
12536 ParsedClause.setConditionDetails(Res.get().second);
12539 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12540 ParsedClause.getLParenLoc(), ParsedClause.getConditionExpr(),
12541 ParsedClause.getEndLoc());
12544template <
typename Derived>
12545void OpenACCClauseTransform<Derived>::VisitSelfClause(
12551 for (
Expr *CurVar :
C.getVarList()) {
12554 if (!Res.isUsable())
12557 Res =
Self.getSema().OpenACC().ActOnVar(ParsedClause.getDirectiveKind(),
12558 ParsedClause.getClauseKind(),
12561 if (Res.isUsable())
12562 InstantiatedVarList.push_back(Res.get());
12565 ParsedClause.setVarListDetails(InstantiatedVarList,
12569 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12570 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12571 ParsedClause.getEndLoc());
12574 if (
C.hasConditionExpr()) {
12575 Expr *Cond =
const_cast<Expr *
>(
C.getConditionExpr());
12577 Self.TransformCondition(Cond->getExprLoc(),
nullptr, Cond,
12580 if (Res.isInvalid() || !Res.get().second)
12583 ParsedClause.setConditionDetails(Res.get().second);
12587 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12588 ParsedClause.getLParenLoc(), ParsedClause.getConditionExpr(),
12589 ParsedClause.getEndLoc());
12593template <
typename Derived>
12594void OpenACCClauseTransform<Derived>::VisitNumGangsClause(
12598 for (
Expr *CurIntExpr :
C.getIntExprs()) {
12601 if (!Res.isUsable())
12606 C.getBeginLoc(), Res.get());
12607 if (!Res.isUsable())
12610 InstantiatedIntExprs.push_back(Res.get());
12613 ParsedClause.setIntExprDetails(InstantiatedIntExprs);
12615 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12616 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs(),
12617 ParsedClause.getEndLoc());
12620template <
typename Derived>
12621void OpenACCClauseTransform<Derived>::VisitPrivateClause(
12626 for (
const auto [RefExpr, InitRecipe] :
12627 llvm::zip(
C.getVarList(),
C.getInitRecipes())) {
12630 if (VarRef.isUsable()) {
12631 InstantiatedVarList.push_back(VarRef.get());
12635 if (InitRecipe.isSet())
12636 InitRecipes.push_back(InitRecipe);
12638 InitRecipes.push_back(
12639 Self.getSema().OpenACC().CreatePrivateInitRecipe(VarRef.get()));
12642 ParsedClause.setVarListDetails(InstantiatedVarList,
12646 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12647 ParsedClause.getLParenLoc(), ParsedClause.getVarList(), InitRecipes,
12648 ParsedClause.getEndLoc());
12651template <
typename Derived>
12652void OpenACCClauseTransform<Derived>::VisitHostClause(
12654 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12658 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12659 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12660 ParsedClause.getEndLoc());
12663template <
typename Derived>
12664void OpenACCClauseTransform<Derived>::VisitDeviceClause(
12666 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12670 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12671 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12672 ParsedClause.getEndLoc());
12675template <
typename Derived>
12676void OpenACCClauseTransform<Derived>::VisitFirstPrivateClause(
12681 for (
const auto [RefExpr, InitRecipe] :
12682 llvm::zip(
C.getVarList(),
C.getInitRecipes())) {
12685 if (VarRef.isUsable()) {
12686 InstantiatedVarList.push_back(VarRef.get());
12690 if (InitRecipe.isSet())
12691 InitRecipes.push_back(InitRecipe);
12693 InitRecipes.push_back(
12694 Self.getSema().OpenACC().CreateFirstPrivateInitRecipe(
12698 ParsedClause.setVarListDetails(InstantiatedVarList,
12702 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12703 ParsedClause.getLParenLoc(), ParsedClause.getVarList(), InitRecipes,
12704 ParsedClause.getEndLoc());
12707template <
typename Derived>
12708void OpenACCClauseTransform<Derived>::VisitNoCreateClause(
12710 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12714 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12715 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12716 ParsedClause.getEndLoc());
12719template <
typename Derived>
12720void OpenACCClauseTransform<Derived>::VisitPresentClause(
12722 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12726 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12727 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12728 ParsedClause.getEndLoc());
12731template <
typename Derived>
12732void OpenACCClauseTransform<Derived>::VisitCopyClause(
12734 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12735 C.getModifierList());
12738 Self.getSema().getASTContext(), ParsedClause.getClauseKind(),
12739 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12740 ParsedClause.getModifierList(), ParsedClause.getVarList(),
12741 ParsedClause.getEndLoc());
12744template <
typename Derived>
12745void OpenACCClauseTransform<Derived>::VisitLinkClause(
12747 llvm_unreachable(
"link clause not valid unless a decl transform");
12750template <
typename Derived>
12751void OpenACCClauseTransform<Derived>::VisitDeviceResidentClause(
12753 llvm_unreachable(
"device_resident clause not valid unless a decl transform");
12755template <
typename Derived>
12756void OpenACCClauseTransform<Derived>::VisitNoHostClause(
12758 llvm_unreachable(
"nohost clause not valid unless a decl transform");
12760template <
typename Derived>
12761void OpenACCClauseTransform<Derived>::VisitBindClause(
12763 llvm_unreachable(
"bind clause not valid unless a decl transform");
12766template <
typename Derived>
12767void OpenACCClauseTransform<Derived>::VisitCopyInClause(
12769 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12770 C.getModifierList());
12773 Self.getSema().getASTContext(), ParsedClause.getClauseKind(),
12774 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12775 ParsedClause.getModifierList(), ParsedClause.getVarList(),
12776 ParsedClause.getEndLoc());
12779template <
typename Derived>
12780void OpenACCClauseTransform<Derived>::VisitCopyOutClause(
12782 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12783 C.getModifierList());
12786 Self.getSema().getASTContext(), ParsedClause.getClauseKind(),
12787 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12788 ParsedClause.getModifierList(), ParsedClause.getVarList(),
12789 ParsedClause.getEndLoc());
12792template <
typename Derived>
12793void OpenACCClauseTransform<Derived>::VisitCreateClause(
12795 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12796 C.getModifierList());
12799 Self.getSema().getASTContext(), ParsedClause.getClauseKind(),
12800 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12801 ParsedClause.getModifierList(), ParsedClause.getVarList(),
12802 ParsedClause.getEndLoc());
12804template <
typename Derived>
12805void OpenACCClauseTransform<Derived>::VisitAttachClause(
12810 llvm::erase_if(VarList, [&](
Expr *E) {
12811 return Self.getSema().OpenACC().CheckVarIsPointerType(
12817 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12818 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12819 ParsedClause.getEndLoc());
12822template <
typename Derived>
12823void OpenACCClauseTransform<Derived>::VisitDetachClause(
12828 llvm::erase_if(VarList, [&](
Expr *E) {
12829 return Self.getSema().OpenACC().CheckVarIsPointerType(
12835 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12836 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12837 ParsedClause.getEndLoc());
12840template <
typename Derived>
12841void OpenACCClauseTransform<Derived>::VisitDeleteClause(
12843 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12846 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12847 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12848 ParsedClause.getEndLoc());
12851template <
typename Derived>
12852void OpenACCClauseTransform<Derived>::VisitUseDeviceClause(
12854 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12857 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12858 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12859 ParsedClause.getEndLoc());
12862template <
typename Derived>
12863void OpenACCClauseTransform<Derived>::VisitDevicePtrClause(
12868 llvm::erase_if(VarList, [&](
Expr *E) {
12869 return Self.getSema().OpenACC().CheckVarIsPointerType(
12875 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12876 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12877 ParsedClause.getEndLoc());
12880template <
typename Derived>
12881void OpenACCClauseTransform<Derived>::VisitNumWorkersClause(
12883 Expr *IntExpr =
const_cast<Expr *
>(
C.getIntExpr());
12884 assert(IntExpr &&
"num_workers clause constructed with invalid int expr");
12887 if (!Res.isUsable())
12892 C.getBeginLoc(), Res.get());
12893 if (!Res.isUsable())
12896 ParsedClause.setIntExprDetails(Res.get());
12898 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12899 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs()[0],
12900 ParsedClause.getEndLoc());
12903template <
typename Derived>
12904void OpenACCClauseTransform<Derived>::VisitDeviceNumClause (
12906 Expr *IntExpr =
const_cast<Expr *
>(
C.getIntExpr());
12907 assert(IntExpr &&
"device_num clause constructed with invalid int expr");
12910 if (!Res.isUsable())
12915 C.getBeginLoc(), Res.get());
12916 if (!Res.isUsable())
12919 ParsedClause.setIntExprDetails(Res.get());
12921 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12922 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs()[0],
12923 ParsedClause.getEndLoc());
12926template <
typename Derived>
12927void OpenACCClauseTransform<Derived>::VisitDefaultAsyncClause(
12929 Expr *IntExpr =
const_cast<Expr *
>(
C.getIntExpr());
12930 assert(IntExpr &&
"default_async clause constructed with invalid int expr");
12933 if (!Res.isUsable())
12938 C.getBeginLoc(), Res.get());
12939 if (!Res.isUsable())
12942 ParsedClause.setIntExprDetails(Res.get());
12944 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12945 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs()[0],
12946 ParsedClause.getEndLoc());
12949template <
typename Derived>
12950void OpenACCClauseTransform<Derived>::VisitVectorLengthClause(
12952 Expr *IntExpr =
const_cast<Expr *
>(
C.getIntExpr());
12953 assert(IntExpr &&
"vector_length clause constructed with invalid int expr");
12956 if (!Res.isUsable())
12961 C.getBeginLoc(), Res.get());
12962 if (!Res.isUsable())
12965 ParsedClause.setIntExprDetails(Res.get());
12967 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12968 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs()[0],
12969 ParsedClause.getEndLoc());
12972template <
typename Derived>
12973void OpenACCClauseTransform<Derived>::VisitAsyncClause(
12975 if (
C.hasIntExpr()) {
12977 if (!Res.isUsable())
12982 C.getBeginLoc(), Res.get());
12983 if (!Res.isUsable())
12985 ParsedClause.setIntExprDetails(Res.get());
12989 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12990 ParsedClause.getLParenLoc(),
12991 ParsedClause.getNumIntExprs() != 0 ? ParsedClause.getIntExprs()[0]
12993 ParsedClause.getEndLoc());
12996template <
typename Derived>
12997void OpenACCClauseTransform<Derived>::VisitWorkerClause(
12999 if (
C.hasIntExpr()) {
13004 if (!Res.isUsable())
13009 C.getBeginLoc(), Res.get());
13010 if (!Res.isUsable())
13012 ParsedClause.setIntExprDetails(Res.get());
13016 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
13017 ParsedClause.getLParenLoc(),
13018 ParsedClause.getNumIntExprs() != 0 ? ParsedClause.getIntExprs()[0]
13020 ParsedClause.getEndLoc());
13023template <
typename Derived>
13024void OpenACCClauseTransform<Derived>::VisitVectorClause(
13026 if (
C.hasIntExpr()) {
13031 if (!Res.isUsable())
13036 C.getBeginLoc(), Res.get());
13037 if (!Res.isUsable())
13039 ParsedClause.setIntExprDetails(Res.get());
13043 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
13044 ParsedClause.getLParenLoc(),
13045 ParsedClause.getNumIntExprs() != 0 ? ParsedClause.getIntExprs()[0]
13047 ParsedClause.getEndLoc());
13050template <
typename Derived>
13051void OpenACCClauseTransform<Derived>::VisitWaitClause(
13053 if (
C.hasExprs()) {
13054 Expr *DevNumExpr =
nullptr;
13058 if (
C.getDevNumExpr()) {
13060 if (!Res.isUsable())
13064 C.getBeginLoc(), Res.get());
13065 if (!Res.isUsable())
13068 DevNumExpr = Res.get();
13072 for (
Expr *CurQueueIdExpr :
C.getQueueIdExprs()) {
13074 if (!Res.isUsable())
13078 C.getBeginLoc(), Res.get());
13079 if (!Res.isUsable())
13082 InstantiatedQueueIdExprs.push_back(Res.get());
13085 ParsedClause.setWaitDetails(DevNumExpr,
C.getQueuesLoc(),
13086 std::move(InstantiatedQueueIdExprs));
13090 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
13091 ParsedClause.getLParenLoc(), ParsedClause.getDevNumExpr(),
13092 ParsedClause.getQueuesLoc(), ParsedClause.getQueueIdExprs(),
13093 ParsedClause.getEndLoc());
13096template <
typename Derived>
13097void OpenACCClauseTransform<Derived>::VisitDeviceTypeClause(
13101 Self.getSema().getASTContext(),
C.getClauseKind(),
13102 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
13103 C.getArchitectures(), ParsedClause.getEndLoc());
13106template <
typename Derived>
13107void OpenACCClauseTransform<Derived>::VisitAutoClause(
13111 ParsedClause.getBeginLoc(),
13112 ParsedClause.getEndLoc());
13115template <
typename Derived>
13116void OpenACCClauseTransform<Derived>::VisitIndependentClause(
13119 ParsedClause.getBeginLoc(),
13120 ParsedClause.getEndLoc());
13123template <
typename Derived>
13124void OpenACCClauseTransform<Derived>::VisitSeqClause(
13127 ParsedClause.getBeginLoc(),
13128 ParsedClause.getEndLoc());
13130template <
typename Derived>
13131void OpenACCClauseTransform<Derived>::VisitFinalizeClause(
13134 ParsedClause.getBeginLoc(),
13135 ParsedClause.getEndLoc());
13138template <
typename Derived>
13139void OpenACCClauseTransform<Derived>::VisitIfPresentClause(
13142 ParsedClause.getBeginLoc(),
13143 ParsedClause.getEndLoc());
13146template <
typename Derived>
13147void OpenACCClauseTransform<Derived>::VisitReductionClause(
13153 for (
const auto [Var, OrigRecipe] :
13154 llvm::zip(TransformedVars,
C.getRecipes())) {
13156 ParsedClause.getDirectiveKind(),
C.getReductionOp(), Var);
13157 if (Res.isUsable()) {
13158 ValidVars.push_back(Res.get());
13160 if (OrigRecipe.isSet())
13161 Recipes.emplace_back(OrigRecipe.AllocaDecl, OrigRecipe.CombinerRecipes);
13163 Recipes.push_back(
Self.getSema().OpenACC().CreateReductionInitRecipe(
13164 C.getReductionOp(), Res.get()));
13168 NewClause =
Self.getSema().OpenACC().CheckReductionClause(
13169 ExistingClauses, ParsedClause.getDirectiveKind(),
13170 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
13171 C.getReductionOp(), ValidVars, Recipes, ParsedClause.getEndLoc());
13174template <
typename Derived>
13175void OpenACCClauseTransform<Derived>::VisitCollapseClause(
13177 Expr *LoopCount =
const_cast<Expr *
>(
C.getLoopCount());
13178 assert(LoopCount &&
"collapse clause constructed with invalid loop count");
13182 if (!NewLoopCount.isUsable())
13185 NewLoopCount =
Self.getSema().OpenACC().ActOnIntExpr(
13187 NewLoopCount.get()->getBeginLoc(), NewLoopCount.get());
13191 if (!NewLoopCount.isUsable())
13195 Self.getSema().OpenACC().CheckCollapseLoopCount(NewLoopCount.get());
13199 if (!NewLoopCount.isUsable())
13202 ParsedClause.setCollapseDetails(
C.hasForce(), NewLoopCount.get());
13204 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
13205 ParsedClause.getLParenLoc(), ParsedClause.isForce(),
13206 ParsedClause.getLoopCount(), ParsedClause.getEndLoc());
13209template <
typename Derived>
13210void OpenACCClauseTransform<Derived>::VisitTileClause(
13215 for (
Expr *E :
C.getSizeExprs()) {
13218 if (!NewSizeExpr.isUsable())
13221 NewSizeExpr =
Self.getSema().OpenACC().ActOnIntExpr(
13223 NewSizeExpr.get()->getBeginLoc(), NewSizeExpr.get());
13227 if (!NewSizeExpr.isUsable())
13230 NewSizeExpr =
Self.getSema().OpenACC().CheckTileSizeExpr(NewSizeExpr.get());
13232 if (!NewSizeExpr.isUsable())
13234 TransformedExprs.push_back(NewSizeExpr.get());
13237 ParsedClause.setIntExprDetails(TransformedExprs);
13239 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
13240 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs(),
13241 ParsedClause.getEndLoc());
13243template <
typename Derived>
13244void OpenACCClauseTransform<Derived>::VisitGangClause(
13249 for (
unsigned I = 0; I <
C.getNumExprs(); ++I) {
13251 if (!ER.isUsable())
13254 ER =
Self.getSema().OpenACC().CheckGangExpr(ExistingClauses,
13255 ParsedClause.getDirectiveKind(),
13256 C.getExpr(I).first, ER.get());
13257 if (!ER.isUsable())
13259 TransformedGangKinds.push_back(
C.getExpr(I).first);
13260 TransformedIntExprs.push_back(ER.get());
13263 NewClause =
Self.getSema().OpenACC().CheckGangClause(
13264 ParsedClause.getDirectiveKind(), ExistingClauses,
13265 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
13266 TransformedGangKinds, TransformedIntExprs, ParsedClause.getEndLoc());
13269template <
typename Derived>
13270OpenACCClause *TreeTransform<Derived>::TransformOpenACCClause(
13275 DirKind, OldClause->getClauseKind(), OldClause->getBeginLoc());
13276 ParsedClause.setEndLoc(OldClause->getEndLoc());
13278 if (
const auto *WithParms = dyn_cast<OpenACCClauseWithParams>(OldClause))
13279 ParsedClause.setLParenLoc(WithParms->getLParenLoc());
13281 OpenACCClauseTransform<Derived> Transform{*
this, ExistingClauses,
13283 Transform.Visit(OldClause);
13285 return Transform.CreatedClause();
13288template <
typename Derived>
13290TreeTransform<Derived>::TransformOpenACCClauseList(
13293 for (
const auto *Clause : OldClauses) {
13294 if (
OpenACCClause *TransformedClause = getDerived().TransformOpenACCClause(
13295 TransformedClauses, DirKind, Clause))
13296 TransformedClauses.push_back(TransformedClause);
13298 return TransformedClauses;
13301template <
typename Derived>
13304 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13307 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
13310 if (getSema().OpenACC().ActOnStartStmtDirective(
13311 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
13316 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
13317 C->clauses(), TransformedClauses);
13318 StmtResult StrBlock = getDerived().TransformStmt(
C->getStructuredBlock());
13319 StrBlock = getSema().OpenACC().ActOnAssociatedStmt(
13320 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses, StrBlock);
13322 return getDerived().RebuildOpenACCComputeConstruct(
13323 C->getDirectiveKind(),
C->getBeginLoc(),
C->getDirectiveLoc(),
13324 C->getEndLoc(), TransformedClauses, StrBlock);
13327template <
typename Derived>
13331 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13334 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
13337 if (getSema().OpenACC().ActOnStartStmtDirective(
13338 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
13343 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
13344 C->clauses(), TransformedClauses);
13346 Loop = getSema().OpenACC().ActOnAssociatedStmt(
13347 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses,
Loop);
13349 return getDerived().RebuildOpenACCLoopConstruct(
13350 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
13351 TransformedClauses,
Loop);
13354template <
typename Derived>
13356 OpenACCCombinedConstruct *
C) {
13357 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13360 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
13363 if (getSema().OpenACC().ActOnStartStmtDirective(
13364 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
13369 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
13370 C->clauses(), TransformedClauses);
13372 Loop = getSema().OpenACC().ActOnAssociatedStmt(
13373 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses,
Loop);
13375 return getDerived().RebuildOpenACCCombinedConstruct(
13376 C->getDirectiveKind(),
C->getBeginLoc(),
C->getDirectiveLoc(),
13377 C->getEndLoc(), TransformedClauses,
Loop);
13380template <
typename Derived>
13383 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13386 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
13388 if (getSema().OpenACC().ActOnStartStmtDirective(
13389 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
13393 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
13394 C->clauses(), TransformedClauses);
13395 StmtResult StrBlock = getDerived().TransformStmt(
C->getStructuredBlock());
13396 StrBlock = getSema().OpenACC().ActOnAssociatedStmt(
13397 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses, StrBlock);
13399 return getDerived().RebuildOpenACCDataConstruct(
13400 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
13401 TransformedClauses, StrBlock);
13404template <
typename Derived>
13406 OpenACCEnterDataConstruct *
C) {
13407 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13410 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
13412 if (getSema().OpenACC().ActOnStartStmtDirective(
13413 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
13416 return getDerived().RebuildOpenACCEnterDataConstruct(
13417 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
13418 TransformedClauses);
13421template <
typename Derived>
13423 OpenACCExitDataConstruct *
C) {
13424 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13427 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
13429 if (getSema().OpenACC().ActOnStartStmtDirective(
13430 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
13433 return getDerived().RebuildOpenACCExitDataConstruct(
13434 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
13435 TransformedClauses);
13438template <
typename Derived>
13440 OpenACCHostDataConstruct *
C) {
13441 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13444 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
13446 if (getSema().OpenACC().ActOnStartStmtDirective(
13447 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
13451 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
13452 C->clauses(), TransformedClauses);
13453 StmtResult StrBlock = getDerived().TransformStmt(
C->getStructuredBlock());
13454 StrBlock = getSema().OpenACC().ActOnAssociatedStmt(
13455 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses, StrBlock);
13457 return getDerived().RebuildOpenACCHostDataConstruct(
13458 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
13459 TransformedClauses, StrBlock);
13462template <
typename Derived>
13465 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13468 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
13470 if (getSema().OpenACC().ActOnStartStmtDirective(
13471 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
13474 return getDerived().RebuildOpenACCInitConstruct(
13475 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
13476 TransformedClauses);
13479template <
typename Derived>
13481 OpenACCShutdownConstruct *
C) {
13482 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13485 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
13487 if (getSema().OpenACC().ActOnStartStmtDirective(
13488 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
13491 return getDerived().RebuildOpenACCShutdownConstruct(
13492 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
13493 TransformedClauses);
13495template <
typename Derived>
13498 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13501 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
13503 if (getSema().OpenACC().ActOnStartStmtDirective(
13504 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
13507 return getDerived().RebuildOpenACCSetConstruct(
13508 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
13509 TransformedClauses);
13512template <
typename Derived>
13514 OpenACCUpdateConstruct *
C) {
13515 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13518 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
13520 if (getSema().OpenACC().ActOnStartStmtDirective(
13521 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
13524 return getDerived().RebuildOpenACCUpdateConstruct(
13525 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
13526 TransformedClauses);
13529template <
typename Derived>
13532 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13535 if (
C->hasDevNumExpr()) {
13536 DevNumExpr = getDerived().TransformExpr(
C->getDevNumExpr());
13538 if (DevNumExpr.isUsable())
13539 DevNumExpr = getSema().OpenACC().ActOnIntExpr(
13541 C->getBeginLoc(), DevNumExpr.get());
13546 for (
Expr *QE :
C->getQueueIdExprs()) {
13547 assert(QE &&
"Null queue id expr?");
13548 ExprResult NewEQ = getDerived().TransformExpr(QE);
13550 if (!NewEQ.isUsable())
13554 C->getBeginLoc(), NewEQ.get());
13555 if (NewEQ.isUsable())
13556 QueueIdExprs.push_back(NewEQ.get());
13560 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
13563 if (getSema().OpenACC().ActOnStartStmtDirective(
13564 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
13567 return getDerived().RebuildOpenACCWaitConstruct(
13568 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getLParenLoc(),
13569 DevNumExpr.isUsable() ? DevNumExpr.get() :
nullptr,
C->getQueuesLoc(),
13570 QueueIdExprs,
C->getRParenLoc(),
C->getEndLoc(), TransformedClauses);
13572template <
typename Derived>
13574 OpenACCCacheConstruct *
C) {
13575 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13578 for (
Expr *Var :
C->getVarList()) {
13579 assert(Var &&
"Null var listexpr?");
13581 ExprResult NewVar = getDerived().TransformExpr(Var);
13583 if (!NewVar.isUsable())
13586 NewVar = getSema().OpenACC().ActOnVar(
13588 if (!NewVar.isUsable())
13591 TransformedVarList.push_back(NewVar.get());
13594 if (getSema().OpenACC().ActOnStartStmtDirective(
C->getDirectiveKind(),
13595 C->getBeginLoc(), {}))
13598 return getDerived().RebuildOpenACCCacheConstruct(
13599 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getLParenLoc(),
13600 C->getReadOnlyLoc(), TransformedVarList,
C->getRParenLoc(),
13604template <
typename Derived>
13606 OpenACCAtomicConstruct *
C) {
13607 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13610 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
13613 if (getSema().OpenACC().ActOnStartStmtDirective(
C->getDirectiveKind(),
13614 C->getBeginLoc(), {}))
13619 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(), {}, {});
13621 StmtResult AssocStmt = getDerived().TransformStmt(
C->getAssociatedStmt());
13622 AssocStmt = getSema().OpenACC().ActOnAssociatedStmt(
13623 C->getBeginLoc(),
C->getDirectiveKind(),
C->getAtomicKind(), {},
13626 return getDerived().RebuildOpenACCAtomicConstruct(
13627 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getAtomicKind(),
13628 C->getEndLoc(), TransformedClauses, AssocStmt);
13631template <
typename Derived>
13634 if (getDerived().AlwaysRebuild())
13643template<
typename Derived>
13646 return TransformExpr(E->getSubExpr());
13649template <
typename Derived>
13652 if (!E->isTypeDependent())
13655 TypeSourceInfo *NewT = getDerived().TransformType(E->getTypeSourceInfo());
13660 if (!getDerived().AlwaysRebuild() && E->getTypeSourceInfo() == NewT)
13663 return getDerived().RebuildSYCLUniqueStableNameExpr(
13664 E->getLocation(), E->getLParenLocation(), E->getRParenLocation(), NewT);
13667template <
typename Derived>
13671 const auto *SKEPAttr = FD->template getAttr<SYCLKernelEntryPointAttr>();
13672 if (!SKEPAttr || SKEPAttr->isInvalidAttr())
13675 ExprResult IdExpr = getDerived().TransformExpr(S->getKernelLaunchIdExpr());
13676 if (IdExpr.isInvalid())
13679 StmtResult Body = getDerived().TransformStmt(S->getOriginalStmt());
13680 if (Body.isInvalid())
13686 if (SR.isInvalid())
13692template <
typename Derived>
13696 switch (E->getKind()) {
13705 llvm_unreachable(
"A null reflection should not reach here");
13708 assert(
false &&
"unknown or unimplemented reflection entities");
13712template<
typename Derived>
13715 if (!E->isTypeDependent())
13719 E->getIdentKind());
13722template<
typename Derived>
13726 if (E->getQualifierLoc()) {
13728 = getDerived().TransformNestedNameSpecifierLoc(E->getQualifierLoc());
13734 = cast_or_null<ValueDecl>(getDerived().TransformDecl(E->getLocation(),
13736 if (!ND || ND->isInvalidDecl())
13740 if (E->getFoundDecl() != E->getDecl()) {
13741 Found = cast_or_null<NamedDecl>(
13742 getDerived().TransformDecl(E->getLocation(), E->getFoundDecl()));
13748 if (NameInfo.getName()) {
13749 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
13750 if (!NameInfo.getName())
13754 if (!getDerived().AlwaysRebuild() &&
13755 !E->isCapturedByCopyInLambdaWithExplicitObjectParameter() &&
13756 QualifierLoc == E->getQualifierLoc() && ND == E->getDecl() &&
13757 Found == E->getFoundDecl() &&
13758 NameInfo.getName() == E->getDecl()->getDeclName() &&
13759 !E->hasExplicitTemplateArgs()) {
13769 if (E->hasExplicitTemplateArgs()) {
13770 TemplateArgs = &TransArgs;
13771 TransArgs.setLAngleLoc(E->getLAngleLoc());
13772 TransArgs.setRAngleLoc(E->getRAngleLoc());
13773 if (getDerived().TransformTemplateArguments(E->getTemplateArgs(),
13774 E->getNumTemplateArgs(),
13779 return getDerived().RebuildDeclRefExpr(QualifierLoc, ND, NameInfo,
13780 Found, TemplateArgs);
13783template<
typename Derived>
13789template <
typename Derived>
13795template<
typename Derived>
13801template<
typename Derived>
13807template<
typename Derived>
13813template<
typename Derived>
13819template<
typename Derived>
13822 return getDerived().TransformCallExpr(E);
13825template<
typename Derived>
13830 if (E->isExprPredicate())
13831 ControllingExpr = getDerived().TransformExpr(E->getControllingExpr());
13833 ControllingType = getDerived().TransformType(E->getControllingType());
13835 if (ControllingExpr.isInvalid() && !ControllingType)
13846 AssocTypes.push_back(AssocType);
13848 AssocTypes.push_back(
nullptr);
13852 getDerived().TransformExpr(Assoc.getAssociationExpr());
13853 if (AssocExpr.isInvalid())
13855 AssocExprs.push_back(AssocExpr.get());
13858 if (!ControllingType)
13859 return getDerived().RebuildGenericSelectionExpr(E->getGenericLoc(),
13860 E->getDefaultLoc(),
13862 ControllingExpr.get(),
13865 return getDerived().RebuildGenericSelectionExpr(
13866 E->getGenericLoc(), E->getDefaultLoc(), E->getRParenLoc(),
13867 ControllingType, AssocTypes, AssocExprs);
13870template<
typename Derived>
13873 ExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
13874 if (SubExpr.isInvalid())
13877 if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getSubExpr())
13880 return getDerived().RebuildParenExpr(SubExpr.get(), E->getLParen(),
13887template<
typename Derived>
13891 return getDerived().TransformDependentScopeDeclRefExpr(
13892 DRE,
true,
nullptr);
13894 return getDerived().TransformUnresolvedLookupExpr(
13900template<
typename Derived>
13905 SubExpr = TransformAddressOfOperand(E->
getSubExpr());
13911 if (!getDerived().AlwaysRebuild() && SubExpr.
get() == E->
getSubExpr())
13919template<
typename Derived>
13921TreeTransform<Derived>::TransformOffsetOfExpr(OffsetOfExpr *E) {
13923 TypeSourceInfo *Type = getDerived().TransformType(E->getTypeSourceInfo());
13933 bool ExprChanged =
false;
13935 for (
unsigned I = 0, N = E->getNumComponents(); I != N; ++I) {
13936 const OffsetOfNode &ON = E->getComponent(I);
13937 switch (ON.getKind()) {
13939 Expr *FromIndex = E->getIndexExpr(ON.getArrayExprIndex());
13940 ExprResult Index = getDerived().TransformExpr(FromIndex);
13941 if (Index.isInvalid())
13944 ExprChanged = ExprChanged || Index.get() != FromIndex;
13947 AD.setRBracketLoc(ON.getEndLoc());
13948 Desig.AddDesignator(AD);
13960 Desig.AddDesignator(
13972 if (!getDerived().AlwaysRebuild() &&
13973 Type == E->getTypeSourceInfo() &&
13978 return getDerived().RebuildOffsetOfExpr(E->getOperatorLoc(),
Type, Desig,
13979 E->getRParenLoc());
13982template<
typename Derived>
13985 assert((!E->getSourceExpr() || getDerived().AlreadyTransformed(E->getType())) &&
13986 "opaque value expression requires transformation");
13990template <
typename Derived>
13994 for (
Expr *
C : E->subExpressions()) {
13996 if (NewC.isInvalid())
14002 if (!getDerived().AlwaysRebuild() && !Changed)
14004 return getDerived().RebuildRecoveryExpr(E->getBeginLoc(), E->getEndLoc(),
14008template<
typename Derived>
14018 ExprResult result = getDerived().TransformExpr(newSyntacticForm);
14019 if (result.isInvalid())
return ExprError();
14024 if (result.get()->hasPlaceholderType(BuiltinType::PseudoObject))
14030template<
typename Derived>
14034 if (E->isArgumentType()) {
14041 if (!getDerived().AlwaysRebuild() && OldT == NewT)
14044 return getDerived().RebuildUnaryExprOrTypeTrait(NewT, E->getOperatorLoc(),
14046 E->getSourceRange());
14060 auto *PE = dyn_cast<ParenExpr>(E->getArgumentExpr());
14062 PE ? dyn_cast<DependentScopeDeclRefExpr>(PE->getSubExpr()) :
nullptr)
14063 SubExpr = getDerived().TransformParenDependentScopeDeclRefExpr(
14064 PE, DRE,
false, &RecoveryTSI);
14066 SubExpr = getDerived().TransformExpr(E->getArgumentExpr());
14069 return getDerived().RebuildUnaryExprOrTypeTrait(
14070 RecoveryTSI, E->getOperatorLoc(), E->getKind(), E->getSourceRange());
14071 }
else if (SubExpr.isInvalid())
14074 if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getArgumentExpr())
14077 return getDerived().RebuildUnaryExprOrTypeTrait(SubExpr.get(),
14078 E->getOperatorLoc(),
14080 E->getSourceRange());
14083template<
typename Derived>
14086 ExprResult LHS = getDerived().TransformExpr(E->getLHS());
14087 if (LHS.isInvalid())
14090 ExprResult RHS = getDerived().TransformExpr(E->getRHS());
14091 if (RHS.isInvalid())
14095 if (!getDerived().AlwaysRebuild() &&
14096 LHS.get() == E->getLHS() &&
14097 RHS.get() == E->getRHS())
14100 return getDerived().RebuildArraySubscriptExpr(
14102 E->getLHS()->getBeginLoc(), RHS.get(), E->getRBracketLoc());
14105template <
typename Derived>
14109 if (
Base.isInvalid())
14112 ExprResult RowIdx = getDerived().TransformExpr(E->getRowIdx());
14113 if (RowIdx.isInvalid())
14116 if (!getDerived().AlwaysRebuild() &&
Base.get() == E->getBase() &&
14117 RowIdx.get() == E->getRowIdx())
14120 return getDerived().RebuildMatrixSingleSubscriptExpr(
Base.get(), RowIdx.get(),
14121 E->getRBracketLoc());
14124template <
typename Derived>
14128 if (
Base.isInvalid())
14131 ExprResult RowIdx = getDerived().TransformExpr(E->getRowIdx());
14132 if (RowIdx.isInvalid())
14135 ExprResult ColumnIdx = getDerived().TransformExpr(E->getColumnIdx());
14136 if (ColumnIdx.isInvalid())
14139 if (!getDerived().AlwaysRebuild() &&
Base.get() == E->getBase() &&
14140 RowIdx.get() == E->getRowIdx() && ColumnIdx.get() == E->getColumnIdx())
14143 return getDerived().RebuildMatrixSubscriptExpr(
14144 Base.get(), RowIdx.get(), ColumnIdx.get(), E->getRBracketLoc());
14147template <
typename Derived>
14151 if (
Base.isInvalid())
14155 if (E->getLowerBound()) {
14156 LowerBound = getDerived().TransformExpr(E->getLowerBound());
14157 if (LowerBound.isInvalid())
14162 if (E->getLength()) {
14163 Length = getDerived().TransformExpr(E->getLength());
14164 if (Length.isInvalid())
14169 if (E->isOMPArraySection()) {
14170 if (
Expr *Str = E->getStride()) {
14171 Stride = getDerived().TransformExpr(Str);
14172 if (Stride.isInvalid())
14177 if (!getDerived().AlwaysRebuild() &&
Base.get() == E->getBase() &&
14178 LowerBound.get() == E->getLowerBound() &&
14179 Length.get() == E->getLength() &&
14180 (E->isOpenACCArraySection() || Stride.get() == E->getStride()))
14183 return getDerived().RebuildArraySectionExpr(
14184 E->isOMPArraySection(),
Base.get(), E->getBase()->getEndLoc(),
14185 LowerBound.get(), E->getColonLocFirst(),
14186 E->isOMPArraySection() ? E->getColonLocSecond() :
SourceLocation{},
14187 Length.get(), Stride.get(), E->getRBracketLoc());
14190template <
typename Derived>
14194 if (
Base.isInvalid())
14198 bool ErrorFound =
false;
14199 for (
Expr *
Dim : E->getDimensions()) {
14201 if (DimRes.isInvalid()) {
14205 Dims.push_back(DimRes.get());
14210 return getDerived().RebuildOMPArrayShapingExpr(
Base.get(), E->getLParenLoc(),
14211 E->getRParenLoc(), Dims,
14212 E->getBracketsRanges());
14215template <
typename Derived>
14218 unsigned NumIterators = E->numOfIterators();
14221 bool ErrorFound =
false;
14222 bool NeedToRebuild = getDerived().AlwaysRebuild();
14223 for (
unsigned I = 0; I < NumIterators; ++I) {
14225 Data[I].DeclIdent = D->getIdentifier();
14226 Data[I].DeclIdentLoc = D->getLocation();
14227 if (D->getLocation() == D->getBeginLoc()) {
14229 "Implicit type must be int.");
14231 TypeSourceInfo *TSI = getDerived().TransformType(D->getTypeSourceInfo());
14232 QualType DeclTy = getDerived().TransformType(D->getType());
14239 ErrorFound = ErrorFound ||
14240 !(!D->getTypeSourceInfo() || (
Data[I].
Type.getAsOpaquePtr() &&
14241 !
Data[I].Type.get().isNull())) ||
14242 Begin.isInvalid() || End.isInvalid() || Step.isInvalid();
14245 Data[I].Range.Begin = Begin.get();
14246 Data[I].Range.End = End.get();
14247 Data[I].Range.Step = Step.get();
14248 Data[I].AssignLoc = E->getAssignLoc(I);
14249 Data[I].ColonLoc = E->getColonLoc(I);
14250 Data[I].SecColonLoc = E->getSecondColonLoc(I);
14253 (D->getTypeSourceInfo() &&
Data[I].
Type.get().getTypePtrOrNull() !=
14254 D->getType().getTypePtrOrNull()) ||
14260 if (!NeedToRebuild)
14263 ExprResult Res = getDerived().RebuildOMPIteratorExpr(
14264 E->getIteratorKwLoc(), E->getLParenLoc(), E->getRParenLoc(),
Data);
14265 if (!Res.isUsable())
14268 for (
unsigned I = 0; I < NumIterators; ++I)
14269 getDerived().transformedLocalDecl(E->getIteratorDecl(I),
14270 IE->getIteratorDecl(I));
14274template<
typename Derived>
14283 bool ArgChanged =
false;
14285 if (getDerived().TransformExprs(E->getArgs(), E->getNumArgs(),
true, Args,
14289 if (!getDerived().AlwaysRebuild() &&
14290 Callee.get() == E->getCallee() &&
14296 = ((
Expr *)
Callee.get())->getSourceRange().getBegin();
14299 if (E->hasStoredFPFeatures()) {
14301 getSema().CurFPFeatures =
14303 getSema().FpPragmaStack.CurrentValue = NewOverrides;
14306 return getDerived().RebuildCallExpr(
Callee.get(), FakeLParenLoc,
14308 E->getRParenLoc());
14311template<
typename Derived>
14315 if (
Base.isInvalid())
14319 if (E->hasQualifier()) {
14321 = getDerived().TransformNestedNameSpecifierLoc(E->getQualifierLoc());
14329 = cast_or_null<ValueDecl>(getDerived().TransformDecl(E->getMemberLoc(),
14330 E->getMemberDecl()));
14334 NamedDecl *FoundDecl = E->getFoundDecl();
14335 if (FoundDecl == E->getMemberDecl()) {
14338 FoundDecl = cast_or_null<NamedDecl>(
14339 getDerived().TransformDecl(E->getMemberLoc(), FoundDecl));
14344 if (!getDerived().AlwaysRebuild() &&
14345 Base.get() == E->getBase() &&
14346 QualifierLoc == E->getQualifierLoc() &&
14347 Member == E->getMemberDecl() &&
14348 FoundDecl == E->getFoundDecl() &&
14349 !E->hasExplicitTemplateArgs()) {
14354 getSema().OpenMP().isOpenMPRebuildMemberExpr(
14364 if (E->hasExplicitTemplateArgs()) {
14365 TransArgs.setLAngleLoc(E->getLAngleLoc());
14366 TransArgs.setRAngleLoc(E->getRAngleLoc());
14367 if (getDerived().TransformTemplateArguments(E->getTemplateArgs(),
14368 E->getNumTemplateArgs(),
14381 NamedDecl *FirstQualifierInScope =
nullptr;
14383 if (MemberNameInfo.getName()) {
14384 MemberNameInfo = getDerived().TransformDeclarationNameInfo(MemberNameInfo);
14385 if (!MemberNameInfo.getName())
14389 return getDerived().RebuildMemberExpr(
Base.get(), FakeOperatorLoc,
14396 (E->hasExplicitTemplateArgs()
14397 ? &TransArgs :
nullptr),
14398 FirstQualifierInScope);
14401template<
typename Derived>
14404 ExprResult LHS = getDerived().TransformExpr(E->getLHS());
14405 if (LHS.isInvalid())
14409 getDerived().TransformInitializer(E->getRHS(),
false);
14410 if (RHS.isInvalid())
14413 if (!getDerived().AlwaysRebuild() &&
14414 LHS.get() == E->getLHS() &&
14415 RHS.get() == E->getRHS())
14418 if (E->isCompoundAssignmentOp())
14420 return getDerived().RebuildBinaryOperator(
14421 E->getOperatorLoc(), E->getOpcode(), LHS.get(), RHS.get());
14424 getSema().CurFPFeatures =
14425 NewOverrides.applyOverrides(getSema().getLangOpts());
14426 getSema().FpPragmaStack.CurrentValue = NewOverrides;
14427 return getDerived().RebuildBinaryOperator(E->getOperatorLoc(), E->getOpcode(),
14428 LHS.get(), RHS.get());
14431template <
typename Derived>
14436 ExprResult LHS = getDerived().TransformExpr(
const_cast<Expr*
>(Decomp.LHS));
14437 if (LHS.isInvalid())
14440 ExprResult RHS = getDerived().TransformExpr(
const_cast<Expr*
>(Decomp.RHS));
14441 if (RHS.isInvalid())
14447 bool ChangedAnyLookups =
false;
14448 Expr *PossibleBinOps[] = {E->getSemanticForm(),
14449 const_cast<Expr *
>(Decomp.InnerBinOp)};
14450 for (
Expr *PossibleBinOp : PossibleBinOps) {
14451 auto *Op = dyn_cast<CXXOperatorCallExpr>(PossibleBinOp->IgnoreImplicit());
14454 auto *
Callee = dyn_cast<DeclRefExpr>(Op->getCallee()->IgnoreImplicit());
14460 NamedDecl *
Found = cast_or_null<NamedDecl>(getDerived().TransformDecl(
14461 E->getOperatorLoc(),
Callee->getFoundDecl()));
14465 ChangedAnyLookups =
true;
14466 UnqualLookups.addDecl(
Found);
14469 if (!getDerived().AlwaysRebuild() && !ChangedAnyLookups &&
14470 LHS.get() == Decomp.LHS && RHS.get() == Decomp.RHS) {
14476 const Expr *StopAt[] = {Decomp.LHS, Decomp.RHS};
14481 return getDerived().RebuildCXXRewrittenBinaryOperator(
14482 E->getOperatorLoc(), Decomp.Opcode, UnqualLookups, LHS.get(), RHS.get());
14485template<
typename Derived>
14491 getSema().CurFPFeatures =
14492 NewOverrides.applyOverrides(getSema().getLangOpts());
14493 getSema().FpPragmaStack.CurrentValue = NewOverrides;
14494 return getDerived().TransformBinaryOperator(E);
14497template<
typename Derived>
14503 ExprResult commonExpr = getDerived().TransformExpr(e->getCommon());
14504 if (commonExpr.isInvalid())
14507 ExprResult rhs = getDerived().TransformExpr(e->getFalseExpr());
14508 if (rhs.isInvalid())
14511 if (!getDerived().AlwaysRebuild() &&
14512 commonExpr.get() == e->getCommon() &&
14513 rhs.get() == e->getFalseExpr())
14516 return getDerived().RebuildConditionalOperator(commonExpr.get(),
14517 e->getQuestionLoc(),
14523template<
typename Derived>
14526 ExprResult Cond = getDerived().TransformExpr(E->getCond());
14527 if (Cond.isInvalid())
14530 ExprResult LHS = getDerived().TransformExpr(E->getLHS());
14531 if (LHS.isInvalid())
14534 ExprResult RHS = getDerived().TransformExpr(E->getRHS());
14535 if (RHS.isInvalid())
14538 if (!getDerived().AlwaysRebuild() &&
14539 Cond.get() == E->getCond() &&
14540 LHS.get() == E->getLHS() &&
14541 RHS.get() == E->getRHS())
14544 return getDerived().RebuildConditionalOperator(Cond.get(),
14545 E->getQuestionLoc(),
14551template<
typename Derived>
14556 return getDerived().
TransformExpr(E->getSubExprAsWritten());
14559template<
typename Derived>
14567 = getDerived().TransformExpr(E->getSubExprAsWritten());
14568 if (SubExpr.isInvalid())
14571 if (!getDerived().AlwaysRebuild() &&
14572 Type == E->getTypeInfoAsWritten() &&
14573 SubExpr.get() == E->getSubExpr())
14576 return getDerived().RebuildCStyleCastExpr(E->getLParenLoc(),
14582template<
typename Derived>
14590 ExprResult Init = getDerived().TransformExpr(E->getInitializer());
14591 if (
Init.isInvalid())
14594 if (!getDerived().AlwaysRebuild() &&
14596 Init.get() == E->getInitializer())
14603 return getDerived().RebuildCompoundLiteralExpr(
14604 E->getLParenLoc(), NewT,
14605 E->getInitializer()->getEndLoc(),
Init.get());
14608template<
typename Derived>
14612 if (
Base.isInvalid())
14615 if (!getDerived().AlwaysRebuild() &&
14616 Base.get() == E->getBase())
14622 return getDerived().RebuildExtVectorOrMatrixElementExpr(
14623 Base.get(), FakeOperatorLoc, E->isArrow(), E->getAccessorLoc(),
14627template <
typename Derived>
14631 if (
Base.isInvalid())
14634 if (!getDerived().AlwaysRebuild() &&
Base.get() == E->getBase())
14640 return getDerived().RebuildExtVectorOrMatrixElementExpr(
14641 Base.get(), FakeOperatorLoc,
false, E->getAccessorLoc(),
14645template<
typename Derived>
14651 bool InitChanged =
false;
14657 if (getDerived().TransformExprs(E->getInits(), E->getNumInits(),
false,
14658 Inits, &InitChanged))
14661 if (!getDerived().AlwaysRebuild() && !InitChanged) {
14668 return getDerived().RebuildInitList(E->getLBraceLoc(),
Inits,
14669 E->getRBraceLoc(), E->isExplicit());
14672template<
typename Derived>
14679 if (
Init.isInvalid())
14684 bool ExprChanged =
false;
14686 if (D.isFieldDesignator()) {
14687 if (D.getFieldDecl()) {
14689 getDerived().TransformDecl(D.getFieldLoc(), D.getFieldDecl()));
14690 if (Field != D.getFieldDecl())
14693 ExprChanged =
true;
14694 if (
Field->isAnonymousStructOrUnion())
14700 ExprChanged =
true;
14703 D.getFieldName(), D.getDotLoc(), D.getFieldLoc()));
14707 if (D.isArrayDesignator()) {
14708 ExprResult Index = getDerived().TransformExpr(E->getArrayIndex(D));
14709 if (Index.isInvalid())
14712 Desig.AddDesignator(
14715 ExprChanged = ExprChanged || Index.get() != E->getArrayIndex(D);
14716 ArrayExprs.push_back(Index.get());
14720 assert(D.isArrayRangeDesignator() &&
"New kind of designator?");
14722 = getDerived().TransformExpr(E->getArrayRangeStart(D));
14723 if (Start.isInvalid())
14726 ExprResult End = getDerived().TransformExpr(E->getArrayRangeEnd(D));
14727 if (End.isInvalid())
14731 Start.get(), End.get(), D.getLBracketLoc(), D.getEllipsisLoc()));
14733 ExprChanged = ExprChanged || Start.get() != E->getArrayRangeStart(D) ||
14734 End.get() != E->getArrayRangeEnd(D);
14736 ArrayExprs.push_back(Start.get());
14737 ArrayExprs.push_back(End.get());
14740 if (!getDerived().AlwaysRebuild() &&
14741 Init.get() == E->getInit() &&
14745 return getDerived().RebuildDesignatedInitExpr(Desig, ArrayExprs,
14746 E->getEqualOrColonLoc(),
14747 E->usesGNUSyntax(),
Init.get());
14752template<
typename Derived>
14756 llvm_unreachable(
"Unexpected DesignatedInitUpdateExpr in syntactic form of "
14761template<
typename Derived>
14765 llvm_unreachable(
"Unexpected NoInitExpr in syntactic form of initializer");
14769template<
typename Derived>
14772 llvm_unreachable(
"Unexpected ArrayInitLoopExpr outside of initializer");
14776template<
typename Derived>
14779 llvm_unreachable(
"Unexpected ArrayInitIndexExpr outside of initializer");
14783template<
typename Derived>
14791 QualType T = getDerived().TransformType(E->getType());
14795 if (!getDerived().AlwaysRebuild() &&
14799 return getDerived().RebuildImplicitValueInitExpr(
T);
14802template<
typename Derived>
14805 TypeSourceInfo *TInfo = getDerived().TransformType(E->getWrittenTypeInfo());
14809 ExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
14810 if (SubExpr.isInvalid())
14813 if (!getDerived().AlwaysRebuild() &&
14814 TInfo == E->getWrittenTypeInfo() &&
14815 SubExpr.get() == E->getSubExpr())
14818 return getDerived().RebuildVAArgExpr(E->getBuiltinLoc(), SubExpr.get(),
14819 TInfo, E->getRParenLoc());
14822template<
typename Derived>
14825 bool ArgumentChanged =
false;
14827 if (TransformExprs(E->getExprs(), E->getNumExprs(),
true,
Inits,
14831 return getDerived().RebuildParenListExpr(E->getLParenLoc(),
14833 E->getRParenLoc());
14841template<
typename Derived>
14844 Decl *LD = getDerived().TransformDecl(E->getLabel()->getLocation(),
14849 return getDerived().RebuildAddrLabelExpr(E->getAmpAmpLoc(), E->getLabelLoc(),
14853template<
typename Derived>
14858 = getDerived().TransformCompoundStmt(E->getSubStmt(),
true);
14859 if (SubStmt.isInvalid()) {
14864 unsigned OldDepth = E->getTemplateDepth();
14865 unsigned NewDepth = getDerived().TransformTemplateDepth(OldDepth);
14867 if (!getDerived().AlwaysRebuild() && OldDepth == NewDepth &&
14868 SubStmt.get() == E->getSubStmt()) {
14874 return getDerived().RebuildStmtExpr(E->getLParenLoc(), SubStmt.get(),
14875 E->getRParenLoc(), NewDepth);
14878template<
typename Derived>
14881 ExprResult Cond = getDerived().TransformExpr(E->getCond());
14882 if (Cond.isInvalid())
14885 ExprResult LHS = getDerived().TransformExpr(E->getLHS());
14886 if (LHS.isInvalid())
14889 ExprResult RHS = getDerived().TransformExpr(E->getRHS());
14890 if (RHS.isInvalid())
14893 if (!getDerived().AlwaysRebuild() &&
14894 Cond.get() == E->getCond() &&
14895 LHS.get() == E->getLHS() &&
14896 RHS.get() == E->getRHS())
14899 return getDerived().RebuildChooseExpr(E->getBuiltinLoc(),
14900 Cond.get(), LHS.get(), RHS.get(),
14901 E->getRParenLoc());
14904template<
typename Derived>
14910template<
typename Derived>
14913 switch (E->getOperator()) {
14917 case OO_Array_Delete:
14918 llvm_unreachable(
"new and delete operators cannot use CXXOperatorCallExpr");
14923 assert(E->getNumArgs() >= 1 &&
"Object call is missing arguments");
14936 if (FakeLParenLoc.isInvalid() && EndLoc.isValid())
14937 FakeLParenLoc = EndLoc;
14941 if (getDerived().TransformExprs(E->getArgs() + 1, E->getNumArgs() - 1,
true,
14945 if (E->getOperator() == OO_Subscript)
14946 return getDerived().RebuildCxxSubscriptExpr(
Object.get(), FakeLParenLoc,
14947 Args, E->getEndLoc());
14949 return getDerived().RebuildCallExpr(
Object.get(), FakeLParenLoc, Args,
14953#define OVERLOADED_OPERATOR(Name, Spelling, Token, Unary, Binary, MemberOnly) \
14957#define OVERLOADED_OPERATOR_MULTI(Name,Spelling,Unary,Binary,MemberOnly)
14958#include "clang/Basic/OperatorKinds.def"
14960 case OO_Conditional:
14961 llvm_unreachable(
"conditional operator is not actually overloadable");
14965 llvm_unreachable(
"not an overloaded operator?");
14969 if (E->getNumArgs() == 1 && E->getOperator() == OO_Amp)
14970 First = getDerived().TransformAddressOfOperand(E->getArg(0));
14972 First = getDerived().TransformExpr(E->getArg(0));
14973 if (
First.isInvalid())
14977 if (E->getNumArgs() == 2) {
14979 getDerived().TransformInitializer(E->getArg(1),
false);
14980 if (Second.isInvalid())
14986 getSema().CurFPFeatures =
14987 NewOverrides.applyOverrides(getSema().getLangOpts());
14988 getSema().FpPragmaStack.CurrentValue = NewOverrides;
14994 if (getDerived().TransformOverloadExprDecls(ULE, ULE->requiresADL(), R))
14997 return getDerived().RebuildCXXOperatorCallExpr(
14998 E->getOperator(), E->getOperatorLoc(),
Callee->getBeginLoc(),
14999 ULE->requiresADL(),
R.asUnresolvedSet(),
First.get(), Second.get());
15004 Callee = ICE->getSubExprAsWritten();
15006 ValueDecl *VD = cast_or_null<ValueDecl>(
15007 getDerived().TransformDecl(DR->getLocation(), DR));
15012 Functions.addDecl(VD);
15014 return getDerived().RebuildCXXOperatorCallExpr(
15015 E->getOperator(), E->getOperatorLoc(),
Callee->getBeginLoc(),
15016 false, Functions,
First.get(), Second.get());
15019template<
typename Derived>
15022 return getDerived().TransformCallExpr(E);
15025template <
typename Derived>
15028 getSema().CurContext != E->getParentContext();
15030 if (!getDerived().AlwaysRebuild() && !NeedRebuildFunc)
15033 return getDerived().RebuildSourceLocExpr(E->getIdentKind(), E->getType(),
15034 E->getBeginLoc(), E->getEndLoc(),
15035 getSema().CurContext);
15038template <
typename Derived>
15043template<
typename Derived>
15052 ExprResult EC = getDerived().TransformCallExpr(E->getConfig());
15053 if (EC.isInvalid())
15057 bool ArgChanged =
false;
15059 if (getDerived().TransformExprs(E->getArgs(), E->getNumArgs(),
true, Args,
15063 if (!getDerived().AlwaysRebuild() &&
15064 Callee.get() == E->getCallee() &&
15070 = ((
Expr *)
Callee.get())->getSourceRange().getBegin();
15071 return getDerived().RebuildCallExpr(
Callee.get(), FakeLParenLoc,
15073 E->getRParenLoc(), EC.get());
15076template<
typename Derived>
15092 return getDerived().RebuildCXXNamedCastExpr(
15099template<
typename Derived>
15108 if (Sub.isInvalid())
15111 return getDerived().RebuildBuiltinBitCastExpr(BCE->
getBeginLoc(), TSI,
15115template<
typename Derived>
15117TreeTransform<Derived>::TransformCXXStaticCastExpr(CXXStaticCastExpr *E) {
15118 return getDerived().TransformCXXNamedCastExpr(E);
15121template<
typename Derived>
15127template<
typename Derived>
15134template<
typename Derived>
15140template<
typename Derived>
15146template<
typename Derived>
15151 getDerived().TransformTypeWithDeducedTST(E->getTypeInfoAsWritten());
15156 = getDerived().TransformExpr(E->getSubExprAsWritten());
15157 if (SubExpr.isInvalid())
15160 if (!getDerived().AlwaysRebuild() &&
15161 Type == E->getTypeInfoAsWritten() &&
15162 SubExpr.get() == E->getSubExpr())
15165 return getDerived().RebuildCXXFunctionalCastExpr(
Type,
15169 E->isListInitialization());
15172template<
typename Derived>
15175 if (E->isTypeOperand()) {
15177 = getDerived().TransformType(E->getTypeOperandSourceInfo());
15181 if (!getDerived().AlwaysRebuild() &&
15182 TInfo == E->getTypeOperandSourceInfo())
15185 return getDerived().RebuildCXXTypeidExpr(E->getType(), E->getBeginLoc(),
15186 TInfo, E->getEndLoc());
15192 Expr *Op = E->getExprOperand();
15194 if (E->isGLValue()) {
15196 if (
auto *RD = OpType->getAsCXXRecordDecl()) {
15198 diag::err_incomplete_typeid))
15201 if (RD->isPolymorphic())
15209 ExprResult SubExpr = getDerived().TransformExpr(Op);
15210 if (SubExpr.isInvalid())
15213 if (!getDerived().AlwaysRebuild() &&
15214 SubExpr.get() == E->getExprOperand())
15217 return getDerived().RebuildCXXTypeidExpr(E->getType(), E->getBeginLoc(),
15218 SubExpr.get(), E->getEndLoc());
15221template<
typename Derived>
15224 if (E->isTypeOperand()) {
15226 = getDerived().TransformType(E->getTypeOperandSourceInfo());
15230 if (!getDerived().AlwaysRebuild() &&
15231 TInfo == E->getTypeOperandSourceInfo())
15234 return getDerived().RebuildCXXUuidofExpr(E->getType(), E->getBeginLoc(),
15235 TInfo, E->getEndLoc());
15241 ExprResult SubExpr = getDerived().TransformExpr(E->getExprOperand());
15242 if (SubExpr.isInvalid())
15245 if (!getDerived().AlwaysRebuild() &&
15246 SubExpr.get() == E->getExprOperand())
15249 return getDerived().RebuildCXXUuidofExpr(E->getType(), E->getBeginLoc(),
15250 SubExpr.get(), E->getEndLoc());
15253template<
typename Derived>
15259template<
typename Derived>
15266template<
typename Derived>
15282 auto &S = getSema();
15283 if (E->isCapturedByCopyInLambdaWithExplicitObjectParameter())
15284 return S.getCurrentThisType();
15285 if (S.getCurLambda())
15286 return getDerived().TransformType(E->getType());
15287 return S.getCurrentThisType();
15290 if (!getDerived().AlwaysRebuild() &&
T == E->getType() &&
15291 !E->isCapturedByCopyInLambdaWithExplicitObjectParameter()) {
15294 getSema().MarkThisReferenced(E);
15298 return getDerived().RebuildCXXThisExpr(E->getBeginLoc(),
T, E->isImplicit());
15301template<
typename Derived>
15304 ExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
15305 if (SubExpr.isInvalid())
15308 getSema().DiagnoseExceptionUse(E->getThrowLoc(),
false);
15310 if (!getDerived().AlwaysRebuild() &&
15311 SubExpr.get() == E->getSubExpr())
15314 return getDerived().RebuildCXXThrowExpr(E->getThrowLoc(), SubExpr.get(),
15315 E->isThrownVariableInScope());
15318template<
typename Derived>
15322 getDerived().TransformDecl(E->getBeginLoc(), E->getParam()));
15327 if (E->hasRewrittenInit()) {
15328 InitRes = getDerived().TransformExpr(E->getRewrittenExpr());
15329 if (InitRes.isInvalid())
15333 if (!getDerived().AlwaysRebuild() && Param == E->getParam() &&
15334 E->getUsedContext() == SemaRef.
CurContext &&
15335 InitRes.get() == E->getRewrittenExpr())
15338 return getDerived().RebuildCXXDefaultArgExpr(E->getUsedLocation(), Param,
15342template<
typename Derived>
15346 getDerived().TransformDecl(E->getBeginLoc(), E->getField()));
15351 if (E->hasRewrittenInit()) {
15355 InitRes = getDerived().TransformExpr(E->getRewrittenExpr());
15356 if (InitRes.isInvalid())
15360 if (!getDerived().AlwaysRebuild() && Field == E->getField() &&
15361 E->getUsedContext() == SemaRef.
CurContext &&
15362 InitRes.get() == E->getExpr())
15365 return getDerived().RebuildCXXDefaultInitExpr(E->getExprLoc(), Field,
15369template<
typename Derived>
15373 TypeSourceInfo *
T = getDerived().TransformType(E->getTypeSourceInfo());
15377 if (!getDerived().AlwaysRebuild() &&
15378 T == E->getTypeSourceInfo())
15381 return getDerived().RebuildCXXScalarValueInitExpr(
T,
15382 T->getTypeLoc().getEndLoc(),
15383 E->getRParenLoc());
15386template<
typename Derived>
15391 getDerived().TransformTypeWithDeducedTST(E->getAllocatedTypeSourceInfo());
15392 if (!AllocTypeInfo)
15396 std::optional<Expr *> ArraySize;
15397 if (E->isArray()) {
15399 if (std::optional<Expr *> OldArraySize = E->getArraySize()) {
15400 NewArraySize = getDerived().TransformExpr(*OldArraySize);
15401 if (NewArraySize.isInvalid())
15404 ArraySize = NewArraySize.get();
15408 bool ArgumentChanged =
false;
15410 if (getDerived().TransformExprs(E->getPlacementArgs(),
15411 E->getNumPlacementArgs(),
true,
15412 PlacementArgs, &ArgumentChanged))
15416 Expr *OldInit = E->getInitializer();
15419 NewInit = getDerived().TransformInitializer(OldInit,
true);
15420 if (NewInit.isInvalid())
15425 if (E->getOperatorNew()) {
15426 OperatorNew = cast_or_null<FunctionDecl>(
15427 getDerived().TransformDecl(E->getBeginLoc(), E->getOperatorNew()));
15433 if (E->getOperatorDelete()) {
15434 OperatorDelete = cast_or_null<FunctionDecl>(
15435 getDerived().TransformDecl(E->getBeginLoc(), E->getOperatorDelete()));
15436 if (!OperatorDelete)
15440 if (!getDerived().AlwaysRebuild() &&
15441 AllocTypeInfo == E->getAllocatedTypeSourceInfo() &&
15442 ArraySize == E->getArraySize() &&
15443 NewInit.get() == OldInit &&
15444 OperatorNew == E->getOperatorNew() &&
15445 OperatorDelete == E->getOperatorDelete() &&
15446 !ArgumentChanged) {
15451 if (OperatorDelete)
15454 if (E->isArray() && !E->getAllocatedType()->isDependentType()) {
15466 QualType AllocType = AllocTypeInfo->getType();
15477 = dyn_cast<ConstantArrayType>(ArrayT)) {
15481 AllocType = ConsArrayT->getElementType();
15483 = dyn_cast<DependentSizedArrayType>(ArrayT)) {
15484 if (DepArrayT->getSizeExpr()) {
15485 ArraySize = DepArrayT->getSizeExpr();
15486 AllocType = DepArrayT->getElementType();
15491 return getDerived().RebuildCXXNewExpr(
15492 E->getBeginLoc(), E->isGlobalNew(),
15493 E->getBeginLoc(), PlacementArgs,
15494 E->getBeginLoc(), E->getTypeIdParens(), AllocType,
15495 AllocTypeInfo, ArraySize, E->getDirectInitRange(), NewInit.get());
15498template<
typename Derived>
15507 if (E->getOperatorDelete()) {
15508 OperatorDelete = cast_or_null<FunctionDecl>(
15509 getDerived().TransformDecl(E->getBeginLoc(), E->getOperatorDelete()));
15510 if (!OperatorDelete)
15514 if (!getDerived().AlwaysRebuild() &&
15515 Operand.get() == E->getArgument() &&
15516 OperatorDelete == E->getOperatorDelete()) {
15519 if (OperatorDelete)
15522 if (!E->getArgument()->isTypeDependent()) {
15524 E->getDestroyedType());
15533 return getDerived().RebuildCXXDeleteExpr(
15534 E->getBeginLoc(), E->isGlobalDelete(), E->isArrayForm(),
Operand.get());
15537template<
typename Derived>
15542 if (
Base.isInvalid())
15546 bool MayBePseudoDestructor =
false;
15548 E->getOperatorLoc(),
15549 E->isArrow()? tok::arrow : tok::period,
15551 MayBePseudoDestructor);
15552 if (
Base.isInvalid())
15555 QualType ObjectType = ObjectTypePtr.get();
15557 if (QualifierLoc) {
15559 = getDerived().TransformNestedNameSpecifierLoc(QualifierLoc, ObjectType);
15564 SS.
Adopt(QualifierLoc);
15567 if (E->getDestroyedTypeInfo()) {
15568 TypeSourceInfo *DestroyedTypeInfo = getDerived().TransformTypeInObjectScope(
15569 E->getDestroyedTypeInfo(), ObjectType,
15571 if (!DestroyedTypeInfo)
15574 }
else if (!ObjectType.isNull() && ObjectType->isDependentType()) {
15578 E->getDestroyedTypeLoc());
15582 *E->getDestroyedTypeIdentifier(), E->getDestroyedTypeLoc(),
15583 nullptr, SS, ObjectTypePtr,
false);
15589 E->getDestroyedTypeLoc());
15593 if (E->getScopeTypeInfo()) {
15594 ScopeTypeInfo = getDerived().TransformTypeInObjectScope(
15595 E->getScopeTypeInfo(), ObjectType,
nullptr);
15596 if (!ScopeTypeInfo)
15600 return getDerived().RebuildCXXPseudoDestructorExpr(
Base.get(),
15601 E->getOperatorLoc(),
15605 E->getColonColonLoc(),
15610template <
typename Derived>
15615 bool AllEmptyPacks =
true;
15616 for (
auto *OldD : Old->
decls()) {
15632 if (
auto *UPD = dyn_cast<UsingPackDecl>(InstD))
15633 Decls = UPD->expansions();
15636 for (
auto *D : Decls) {
15637 if (
auto *UD = dyn_cast<UsingDecl>(D)) {
15638 for (
auto *SD : UD->shadows())
15645 AllEmptyPacks &= Decls.empty();
15654 if (AllEmptyPacks && !RequiresADL) {
15665 NamedDecl *FoundDecl = R.getRepresentativeDecl()->getUnderlyingDecl();
15666 getSema().FilterAcceptableTemplateNames(R,
15672 getSema().Diag(R.getNameLoc(),
15673 diag::err_template_kw_refers_to_non_template)
15677 diag::note_template_kw_refers_to_non_template)
15678 << R.getLookupName();
15686template <
typename Derived>
15692template <
typename Derived>
15695 bool IsAddressOfOperand) {
15700 if (TransformOverloadExprDecls(Old, Old->
requiresADL(), R))
15707 = getDerived().TransformNestedNameSpecifierLoc(Old->
getQualifierLoc());
15711 SS.
Adopt(QualifierLoc);
15715 CXXRecordDecl *NamingClass
15716 = cast_or_null<CXXRecordDecl>(getDerived().TransformDecl(
15719 if (!NamingClass) {
15724 R.setNamingClass(NamingClass);
15745 SS, TemplateKWLoc, R,
15752 return getDerived().RebuildDeclarationNameExpr(SS, R, Old->
requiresADL());
15755 return getDerived().RebuildTemplateIdExpr(SS, TemplateKWLoc, R,
15759template<
typename Derived>
15762 bool ArgChanged =
false;
15764 for (
unsigned I = 0, N = E->getNumArgs(); I != N; ++I) {
15766 TypeLoc FromTL = From->getTypeLoc();
15769 TLB.
reserve(FromTL.getFullDataSize());
15770 QualType To = getDerived().TransformType(TLB, FromTL);
15774 if (To == From->getType())
15775 Args.push_back(From);
15777 Args.push_back(TLB.getTypeSourceInfo(SemaRef.
Context, To));
15787 TypeLoc PatternTL = ExpansionTL.getPatternLoc();
15793 bool Expand =
true;
15794 bool RetainExpansion =
false;
15796 ExpansionTL.getTypePtr()->getNumExpansions();
15798 if (getDerived().TryExpandParameterPacks(
15799 ExpansionTL.getEllipsisLoc(), PatternTL.getSourceRange(),
15800 Unexpanded,
true, Expand,
15801 RetainExpansion, NumExpansions))
15811 TLB.
reserve(From->getTypeLoc().getFullDataSize());
15813 QualType To = getDerived().TransformType(TLB, PatternTL);
15817 To = getDerived().RebuildPackExpansionType(To,
15818 PatternTL.getSourceRange(),
15819 ExpansionTL.getEllipsisLoc(),
15827 Args.push_back(TLB.getTypeSourceInfo(SemaRef.
Context, To));
15833 for (
unsigned I = 0; I != *NumExpansions; ++I) {
15836 TLB.
reserve(PatternTL.getFullDataSize());
15837 QualType To = getDerived().TransformType(TLB, PatternTL);
15841 if (To->containsUnexpandedParameterPack()) {
15842 To = getDerived().RebuildPackExpansionType(To,
15843 PatternTL.getSourceRange(),
15844 ExpansionTL.getEllipsisLoc(),
15854 Args.push_back(TLB.getTypeSourceInfo(SemaRef.
Context, To));
15857 if (!RetainExpansion)
15862 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
15865 TLB.
reserve(From->getTypeLoc().getFullDataSize());
15867 QualType To = getDerived().TransformType(TLB, PatternTL);
15871 To = getDerived().RebuildPackExpansionType(To,
15872 PatternTL.getSourceRange(),
15873 ExpansionTL.getEllipsisLoc(),
15881 Args.push_back(TLB.getTypeSourceInfo(SemaRef.
Context, To));
15884 if (!getDerived().AlwaysRebuild() && !ArgChanged)
15887 return getDerived().RebuildTypeTrait(E->getTrait(), E->getBeginLoc(), Args,
15891template<
typename Derived>
15897 if (getDerived().TransformTemplateArguments(Old->getTemplateArgs(),
15898 Old->NumTemplateArgs, TransArgs))
15901 return getDerived().RebuildConceptSpecializationExpr(
15902 E->getNestedNameSpecifierLoc(), E->getTemplateKWLoc(),
15903 E->getConceptNameInfo(), E->getFoundDecl(), E->getConceptDecl(),
15907template<
typename Derived>
15921 getSema().Context, getSema().CurContext,
15922 E->getBody()->getBeginLoc());
15926 ExprResult TypeParamResult = getDerived().TransformRequiresTypeParams(
15927 E->getRequiresKWLoc(), E->getRBraceLoc(), E, Body,
15928 E->getLocalParameters(), TransParamTypes, TransParams, ExtParamInfos);
15932 Param->setDeclContext(Body);
15938 if (!TypeParamResult.isUnset())
15939 return TypeParamResult;
15942 if (getDerived().TransformRequiresExprRequirements(E->getRequirements(),
15947 if (
auto *ER = dyn_cast<concepts::ExprRequirement>(Req)) {
15948 if (ER->getReturnTypeRequirement().isTypeConstraint()) {
15949 ER->getReturnTypeRequirement()
15950 .getTypeConstraintTemplateParameterList()->getParam(0)
15951 ->setDeclContext(Body);
15956 return getDerived().RebuildRequiresExpr(
15957 E->getRequiresKWLoc(), Body, E->getLParenLoc(), TransParams,
15958 E->getRParenLoc(), TransReqs, E->getRBraceLoc());
15961template<
typename Derived>
15967 if (
auto *TypeReq = dyn_cast<concepts::TypeRequirement>(Req))
15968 TransReq =
getDerived().TransformTypeRequirement(TypeReq);
15969 else if (
auto *ExprReq = dyn_cast<concepts::ExprRequirement>(Req))
15970 TransReq =
getDerived().TransformExprRequirement(ExprReq);
15972 TransReq =
getDerived().TransformNestedRequirement(
15976 Transformed.push_back(TransReq);
15981template<
typename Derived>
15994 return getDerived().RebuildTypeRequirement(TransType);
15997template<
typename Derived>
16000 llvm::PointerUnion<Expr *, concepts::Requirement::SubstitutionDiagnostic *> TransExpr;
16006 TransExprRes =
SemaRef.CheckPlaceholderExpr(TransExprRes.
get());
16009 TransExpr = TransExprRes.
get();
16012 std::optional<concepts::ExprRequirement::ReturnTypeRequirement> TransRetReq;
16014 if (RetReq.isEmpty())
16015 TransRetReq.emplace();
16016 else if (RetReq.isSubstitutionFailure())
16017 TransRetReq.emplace(RetReq.getSubstitutionDiagnostic());
16018 else if (RetReq.isTypeConstraint()) {
16020 RetReq.getTypeConstraintTemplateParameterList();
16022 getDerived().TransformTemplateParameterList(OrigTPL);
16025 TransRetReq.emplace(TPL);
16027 assert(TransRetReq &&
"All code paths leading here must set TransRetReq");
16028 if (
Expr *E = dyn_cast<Expr *>(TransExpr))
16031 std::move(*TransRetReq));
16037template<
typename Derived>
16043 return getDerived().RebuildNestedRequirement(
16051 return getDerived().RebuildNestedRequirement(TransConstraint.
get());
16054template<
typename Derived>
16061 if (!getDerived().AlwaysRebuild() &&
16078template<
typename Derived>
16085 SubExpr = getDerived().TransformExpr(E->getQueriedExpression());
16086 if (SubExpr.isInvalid())
16089 if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getQueriedExpression())
16093 return getDerived().RebuildExpressionTrait(E->getTrait(), E->getBeginLoc(),
16094 SubExpr.get(), E->getEndLoc());
16097template <
typename Derived>
16102 DRE, AddrTaken, RecoveryTSI);
16115template <
typename Derived>
16122template <
typename Derived>
16138 getDerived().TransformDeclarationNameInfo(E->
getNameInfo());
16143 if (!getDerived().AlwaysRebuild() && QualifierLoc == E->
getQualifierLoc() &&
16149 return getDerived().RebuildDependentScopeDeclRefExpr(
16150 QualifierLoc, TemplateKWLoc, NameInfo,
nullptr,
16151 IsAddressOfOperand, RecoveryTSI);
16155 if (getDerived().TransformTemplateArguments(
16159 return getDerived().RebuildDependentScopeDeclRefExpr(
16160 QualifierLoc, TemplateKWLoc, NameInfo, &TransArgs, IsAddressOfOperand,
16164template<
typename Derived>
16170 if (getDerived().AllowSkippingCXXConstructExpr() &&
16171 ((E->getNumArgs() == 1 ||
16172 (E->getNumArgs() > 1 && getDerived().DropCallArgument(E->getArg(1)))) &&
16173 (!getDerived().DropCallArgument(E->getArg(0))) &&
16174 !E->isListInitialization()))
16180 QualType T = getDerived().TransformType(E->getType());
16185 getDerived().TransformDecl(E->getBeginLoc(), E->getConstructor()));
16189 bool ArgumentChanged =
false;
16194 E->isListInitialization());
16195 if (getDerived().TransformExprs(E->getArgs(), E->getNumArgs(),
true, Args,
16200 if (!getDerived().AlwaysRebuild() &&
16201 T == E->getType() &&
16203 !ArgumentChanged) {
16210 return getDerived().RebuildCXXConstructExpr(
16211 T, E->getBeginLoc(),
Constructor, E->isElidable(), Args,
16212 E->hadMultipleCandidates(), E->isListInitialization(),
16213 E->isStdInitListInitialization(), E->requiresZeroInitialization(),
16214 E->getConstructionKind(), E->getParenOrBraceRange());
16217template<
typename Derived>
16220 QualType T = getDerived().TransformType(E->getType());
16225 getDerived().TransformDecl(E->getBeginLoc(), E->getConstructor()));
16229 if (!getDerived().AlwaysRebuild() &&
16230 T == E->getType() &&
16238 return getDerived().RebuildCXXInheritedCtorInitExpr(
16240 E->constructsVBase(), E->inheritedFromVBase());
16247template<
typename Derived>
16250 if (
auto *Dtor = E->getTemporary()->getDestructor())
16253 return getDerived().TransformExpr(E->getSubExpr());
16261template<
typename Derived>
16267template<
typename Derived>
16272 getDerived().TransformTypeWithDeducedTST(E->getTypeSourceInfo());
16277 getDerived().TransformDecl(E->getBeginLoc(), E->getConstructor()));
16281 bool ArgumentChanged =
false;
16283 Args.reserve(E->getNumArgs());
16287 E->isListInitialization());
16288 if (TransformExprs(E->getArgs(), E->getNumArgs(),
true, Args,
16292 if (E->isListInitialization() && !E->isStdInitListInitialization()) {
16293 ExprResult Res = RebuildInitList(E->getBeginLoc(), Args, E->getEndLoc(),
16295 if (Res.isInvalid())
16297 Args = {Res.get()};
16301 if (!getDerived().AlwaysRebuild() &&
16302 T == E->getTypeSourceInfo() &&
16304 !ArgumentChanged) {
16311 return getDerived().RebuildCXXTemporaryObjectExpr(
16312 T, LParenLoc, Args, E->getEndLoc(), E->isListInitialization());
16315template<
typename Derived>
16320 typedef std::pair<ExprResult, QualType> InitCaptureInfoTy;
16321 struct TransformedInitCapture {
16323 SourceLocation EllipsisLoc;
16325 SmallVector<InitCaptureInfoTy, 4> Expansions;
16328 InitCaptures.resize(E->explicit_capture_end() - E->explicit_capture_begin());
16330 CEnd = E->capture_end();
16332 if (!E->isInitCapture(
C))
16335 TransformedInitCapture &
Result = InitCaptures[
C - E->capture_begin()];
16340 ExprResult NewExprInitResult = getDerived().TransformInitializer(
16343 if (NewExprInitResult.isInvalid()) {
16347 Expr *NewExprInit = NewExprInitResult.get();
16350 getSema().buildLambdaInitCaptureInitialization(
16351 C->getLocation(),
C->getCaptureKind() ==
LCK_ByRef,
16352 EllipsisLoc, NumExpansions, OldVD->getIdentifier(),
16356 Result.Expansions.push_back(
16357 InitCaptureInfoTy(NewExprInit, NewInitCaptureType));
16361 if (OldVD->isParameterPack()) {
16370 bool Expand =
true;
16371 bool RetainExpansion =
false;
16373 ExpansionTL.getTypePtr()->getNumExpansions();
16375 if (getDerived().TryExpandParameterPacks(
16376 ExpansionTL.getEllipsisLoc(), OldVD->getInit()->getSourceRange(),
16377 Unexpanded,
true, Expand,
16378 RetainExpansion, NumExpansions))
16380 assert(!RetainExpansion &&
"Should not need to retain expansion after a "
16381 "capture since it cannot be extended");
16383 for (
unsigned I = 0; I != *NumExpansions; ++I) {
16388 SubstInitCapture(ExpansionTL.getEllipsisLoc(), NumExpansions);
16389 Result.EllipsisLoc = ExpansionTL.getEllipsisLoc();
16428 if ((getSema().isUnevaluatedContext() ||
16429 getSema().isConstantEvaluatedContext()) &&
16430 !(dyn_cast_or_null<CXXRecordDecl>(DC->getParent()) &&
16432 (DC->isFileContext() || !DC->getParent()->isDependentContext()))
16437 E->getIntroducerRange(),
nullptr, DependencyKind,
16438 E->getCaptureDefault());
16439 getDerived().transformedLocalDecl(OldClass, {
Class});
16442 getSema().CreateLambdaCallOperator(E->getIntroducerRange(),
Class);
16445 getSema().buildLambdaScope(LSI, NewCallOperator, E->getIntroducerRange(),
16446 E->getCaptureDefault(), E->getCaptureDefaultLoc(),
16447 E->hasExplicitParameters(), E->isMutable());
16457 CEnd = E->capture_end();
16461 if (
C->isImplicit())
16465 if (
C->capturesThis()) {
16473 dyn_cast_if_present<CXXRecordDecl>(
16474 getSema().getFunctionLevelDeclContext()),
16476 getSema().CheckCXXThisCapture(
C->getLocation(),
C->isExplicit(),
16483 if (
C->capturesVLAType())
16487 if (E->isInitCapture(
C)) {
16488 TransformedInitCapture &NewC = InitCaptures[
C - E->capture_begin()];
16493 for (InitCaptureInfoTy &Info : NewC.Expansions) {
16495 QualType InitQualType = Info.second;
16496 if (
Init.isInvalid() || InitQualType.isNull()) {
16500 VarDecl *NewVD = getSema().createLambdaInitCaptureVarDecl(
16501 OldVD->getLocation(), InitQualType, NewC.EllipsisLoc,
16502 OldVD->getIdentifier(), OldVD->getInitStyle(),
Init.get(),
16503 getSema().CurContext);
16508 NewVDs.push_back(NewVD);
16509 getSema().addInitCapture(LSI, NewVD,
C->getCaptureKind() ==
LCK_ByRef);
16514 if (NewC.EllipsisLoc.isInvalid())
16515 LSI->ContainsUnexpandedParameterPack |=
16516 Init.get()->containsUnexpandedParameterPack();
16522 getDerived().transformedLocalDecl(OldVD, NewVDs);
16526 assert(
C->capturesVariable() &&
"unexpected kind of lambda capture");
16534 if (
C->isPackExpansion()) {
16536 bool ShouldExpand =
false;
16537 bool RetainExpansion =
false;
16539 if (getDerived().TryExpandParameterPacks(
16540 C->getEllipsisLoc(),
C->getLocation(), Unexpanded,
16541 true, ShouldExpand,
16542 RetainExpansion, NumExpansions)) {
16547 if (ShouldExpand) {
16552 for (
unsigned I = 0; I != *NumExpansions; ++I) {
16554 ValueDecl *CapturedVar = cast_if_present<ValueDecl>(
16555 getDerived().TransformDecl(
C->getLocation(), Pack));
16556 if (!CapturedVar) {
16562 getSema().tryCaptureVariable(CapturedVar,
C->getLocation(), Kind);
16570 EllipsisLoc =
C->getEllipsisLoc();
16574 auto *CapturedVar = cast_or_null<ValueDecl>(
16575 getDerived().TransformDecl(
C->getLocation(),
C->getCapturedVar()));
16576 if (!CapturedVar || CapturedVar->isInvalidDecl()) {
16583 if (
auto *VD = dyn_cast<VarDecl>(CapturedVar); VD && !
C->isPackExpansion())
16584 LSI->ContainsUnexpandedParameterPack |= VD->isParameterPack();
16587 getSema().tryCaptureVariable(CapturedVar,
C->getLocation(), Kind,
16590 getSema().finishLambdaExplicitCaptures(LSI);
16594 auto TPL = getDerived().TransformTemplateParameterList(
16595 E->getTemplateParameterList());
16596 LSI->GLTemplateParameterList = TPL;
16598 getSema().AddTemplateParametersToLambdaCallOperator(NewCallOperator,
Class,
16600 LSI->ContainsUnexpandedParameterPack |=
16601 TPL->containsUnexpandedParameterPack();
16606 E->getCallOperator()->getTypeSourceInfo()->getTypeLoc();
16608 getDerived().TransformType(NewCallOpTLBuilder, OldCallOpTypeLoc);
16609 if (NewCallOpType.isNull())
16611 LSI->ContainsUnexpandedParameterPack |=
16612 NewCallOpType->containsUnexpandedParameterPack();
16614 NewCallOpTLBuilder.getTypeSourceInfo(getSema().Context, NewCallOpType);
16619 assert(FPTL &&
"Not a FunctionProtoType?");
16623 ExprResult E = getDerived().TransformLambdaConstraint(
16624 const_cast<Expr *
>(TRC.ConstraintExpr));
16627 TRC.ConstraintExpr = E.get();
16630 LSI->BeforeCompoundStatement =
false;
16631 getSema().CompleteLambdaCallOperator(
16632 NewCallOperator, E->getCallOperator()->getLocation(),
16633 E->getCallOperator()->getInnerLocStart(), TRC, NewCallOpTSI,
16634 E->getCallOperator()->getConstexprKind(),
16635 E->getCallOperator()->getStorageClass(), FPTL.getParams(),
16636 E->hasExplicitResultType());
16638 getDerived().transformAttrs(E->getCallOperator(), NewCallOperator);
16639 getDerived().transformedLocalDecl(E->getCallOperator(), {NewCallOperator});
16645 std::optional<CXXRecordDecl::LambdaNumbering> Numbering;
16646 if (getDerived().ReplacingOriginal()) {
16647 Numbering = OldClass->getLambdaNumbering();
16650 getSema().handleLambdaNumbering(
Class, NewCallOperator, Numbering);
16655 getSema().PushExpressionEvaluationContextForFunction(
16657 E->getCallOperator());
16664 C.PointOfInstantiation = E->getBody()->getBeginLoc();
16665 getSema().pushCodeSynthesisContext(
C);
16669 : getDerived().TransformLambdaBody(E, E->getBody());
16671 getSema().popCodeSynthesisContext();
16675 FuncScopeCleanup.disable();
16677 if (Body.isInvalid()) {
16678 SavedContext.pop();
16679 getSema().ActOnLambdaError(E->getBeginLoc(),
nullptr,
16684 getSema().ActOnFinishFunctionBody(NewCallOperator, Body.get(),
16687 SavedContext.pop();
16722 DependencyKind = getDerived().ComputeLambdaDependency(LSI);
16723 Class->setLambdaDependencyKind(DependencyKind);
16725 return getDerived().RebuildLambdaExpr(E->getBeginLoc(),
16726 Body.get()->getEndLoc(), LSI);
16729template<
typename Derived>
16735template<
typename Derived>
16744 if (!
C->isImplicit())
16748 if (
C->capturesThis()) {
16749 getSema().CheckCXXThisCapture(
C->getLocation(),
C->isExplicit(),
16756 if (
C->capturesVLAType())
16759 assert(
C->capturesVariable() &&
"unexpected kind of lambda capture");
16763 VarDecl *CapturedVar = cast_or_null<VarDecl>(
16769 getSema().tryCaptureVariable(CapturedVar,
C->getLocation());
16775template<
typename Derived>
16784 bool ArgumentChanged =
false;
16796 if (!getDerived().AlwaysRebuild() &&
16802 return getDerived().RebuildCXXUnresolvedConstructExpr(
16806template <
typename Derived>
16810 TemplateName Name = getDerived().TransformConceptTemplateName(
16811 E->getTemplateName(), E->getNameLoc());
16816 if (getDerived().TransformTemplateArguments(
16817 E->template_arguments().data(), E->getNumTemplateArgs(), TransArgs))
16830 return getDerived().RebuildTemplateIdExpr(
16832 false, &TransArgs);
16835template<
typename Derived>
16844 if (!E->isImplicitAccess()) {
16845 OldBase = E->getBase();
16846 Base = getDerived().TransformExpr(OldBase);
16847 if (
Base.isInvalid())
16852 bool MayBePseudoDestructor =
false;
16854 E->getOperatorLoc(),
16855 E->isArrow()? tok::arrow : tok::period,
16857 MayBePseudoDestructor);
16858 if (
Base.isInvalid())
16861 ObjectType = ObjectTy.get();
16862 BaseType = ((
Expr*)
Base.get())->getType();
16865 BaseType = getDerived().TransformType(E->getBaseType());
16872 = getDerived().TransformFirstQualifierInScope(
16873 E->getFirstQualifierFoundInScope(),
16874 E->getQualifierLoc().getBeginLoc());
16877 if (E->getQualifier()) {
16879 = getDerived().TransformNestedNameSpecifierLoc(E->getQualifierLoc(),
16881 FirstQualifierInScope);
16893 = getDerived().TransformDeclarationNameInfo(E->getMemberNameInfo());
16894 if (!NameInfo.getName())
16897 if (!E->hasExplicitTemplateArgs()) {
16900 if (!getDerived().AlwaysRebuild() &&
16901 Base.get() == OldBase &&
16902 BaseType == E->getBaseType() &&
16903 QualifierLoc == E->getQualifierLoc() &&
16904 NameInfo.getName() == E->getMember() &&
16905 FirstQualifierInScope == E->getFirstQualifierFoundInScope())
16908 return getDerived().RebuildCXXDependentScopeMemberExpr(
Base.get(),
16911 E->getOperatorLoc(),
16914 FirstQualifierInScope,
16920 if (getDerived().TransformTemplateArguments(E->getTemplateArgs(),
16921 E->getNumTemplateArgs(),
16925 return getDerived().RebuildCXXDependentScopeMemberExpr(
Base.get(),
16928 E->getOperatorLoc(),
16931 FirstQualifierInScope,
16936template <
typename Derived>
16942 if (!Old->isImplicitAccess()) {
16943 Base = getDerived().TransformExpr(Old->getBase());
16944 if (
Base.isInvalid())
16947 getSema().PerformMemberExprBaseConversion(
Base.get(), Old->isArrow());
16948 if (
Base.isInvalid())
16950 BaseType =
Base.get()->getType();
16952 BaseType = getDerived().TransformType(Old->getBaseType());
16956 if (Old->getQualifierLoc()) {
16958 getDerived().TransformNestedNameSpecifierLoc(Old->getQualifierLoc());
16968 if (TransformOverloadExprDecls(Old,
false, R))
16972 if (Old->getNamingClass()) {
16974 getDerived().TransformDecl(Old->getMemberLoc(), Old->getNamingClass()));
16978 R.setNamingClass(NamingClass);
16982 if (Old->hasExplicitTemplateArgs()) {
16983 TransArgs.setLAngleLoc(Old->getLAngleLoc());
16984 TransArgs.setRAngleLoc(Old->getRAngleLoc());
16985 if (getDerived().TransformTemplateArguments(
16986 Old->getTemplateArgs(), Old->getNumTemplateArgs(), TransArgs))
16994 NamedDecl *FirstQualifierInScope =
nullptr;
16996 return getDerived().RebuildUnresolvedMemberExpr(
16997 Base.get(), BaseType, Old->getOperatorLoc(), Old->isArrow(), QualifierLoc,
16998 TemplateKWLoc, FirstQualifierInScope, R,
16999 (Old->hasExplicitTemplateArgs() ? &TransArgs :
nullptr));
17002template<
typename Derived>
17007 ExprResult SubExpr = getDerived().TransformExpr(E->getOperand());
17008 if (SubExpr.isInvalid())
17011 if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getOperand())
17014 return getDerived().RebuildCXXNoexceptExpr(E->getSourceRange(),SubExpr.get());
17017template<
typename Derived>
17020 ExprResult Pattern = getDerived().TransformExpr(E->getPattern());
17021 if (Pattern.isInvalid())
17024 if (!getDerived().AlwaysRebuild() && Pattern.get() == E->getPattern())
17027 return getDerived().RebuildPackExpansion(Pattern.get(), E->getEllipsisLoc(),
17028 E->getNumExpansions());
17031template <
typename Derived>
17036 if (!Arg.isPackExpansion()) {
17048 getSema().getTemplateArgumentPackExpansionPattern(ArgLoc, Ellipsis,
17049 OrigNumExpansions);
17061 if (!NumExpansions) {
17073template<
typename Derived>
17092 bool ShouldExpand =
false;
17093 bool RetainExpansion =
false;
17095 if (getDerived().TryExpandParameterPacks(
17097 true, ShouldExpand,
17098 RetainExpansion, NumExpansions))
17103 if (ShouldExpand) {
17105 if (
auto *TTPD = dyn_cast<TemplateTypeParmDecl>(Pack)) {
17106 ArgStorage = getSema().Context.getPackExpansionType(
17107 getSema().Context.getTypeDeclType(TTPD), std::nullopt);
17108 }
else if (
auto *TTPD = dyn_cast<TemplateTemplateParmDecl>(Pack)) {
17112 ExprResult DRE = getSema().BuildDeclRefExpr(
17113 VD, VD->getType().getNonLValueExprType(getSema().Context),
17116 if (DRE.isInvalid())
17119 new (getSema().Context)
17123 PackArgs = ArgStorage;
17128 if (!PackArgs.size()) {
17129 auto *Pack = cast_or_null<NamedDecl>(
17133 return getDerived().RebuildSizeOfPackExpr(
17140 getDerived().ComputeSizeOfPackExprWithoutSubstitution(PackArgs);
17152 TemporaryBase Rebase(*
this, E->
getPackLoc(), getBaseEntity());
17155 if (TransformTemplateArguments(PackLocIterator(*
this, PackArgs.begin()),
17156 PackLocIterator(*
this, PackArgs.end()),
17157 TransformedPackArgs,
true))
17164 bool PartialSubstitution =
false;
17165 for (
auto &Loc : TransformedPackArgs.arguments()) {
17166 Args.push_back(Loc.getArgument());
17167 if (Loc.getArgument().isPackExpansion())
17168 PartialSubstitution =
true;
17171 if (PartialSubstitution)
17172 return getDerived().RebuildSizeOfPackExpr(
17174 std::nullopt, Args);
17176 return getDerived().RebuildSizeOfPackExpr(
17178 static_cast<unsigned>(Args.size()),
17182template <
typename Derived>
17185 if (!E->isValueDependent())
17193 IndexExpr = getDerived().TransformExpr(E->getIndexExpr());
17194 if (IndexExpr.isInvalid())
17199 bool FullySubstituted =
true;
17200 if (!E->expandsToEmptyPack() && E->getExpressions().empty()) {
17201 Expr *Pattern = E->getPackIdExpression();
17203 getSema().collectUnexpandedParameterPacks(E->getPackIdExpression(),
17205 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
17209 bool ShouldExpand =
true;
17210 bool RetainExpansion =
false;
17212 NumExpansions = std::nullopt;
17213 if (getDerived().TryExpandParameterPacks(
17214 E->getEllipsisLoc(), Pattern->getSourceRange(), Unexpanded,
17215 true, ShouldExpand,
17216 RetainExpansion, NumExpansions))
17218 if (!ShouldExpand) {
17220 ExprResult Pack = getDerived().TransformExpr(Pattern);
17221 if (Pack.isInvalid())
17223 return getDerived().RebuildPackIndexingExpr(
17224 E->getEllipsisLoc(), E->getRSquareLoc(), Pack.get(), IndexExpr.get(),
17227 for (
unsigned I = 0; I != *NumExpansions; ++I) {
17230 if (
Out.isInvalid())
17232 if (
Out.get()->containsUnexpandedParameterPack()) {
17233 Out = getDerived().RebuildPackExpansion(
Out.get(), E->getEllipsisLoc(),
17234 OrigNumExpansions);
17235 if (
Out.isInvalid())
17237 FullySubstituted =
false;
17239 ExpandedExprs.push_back(
Out.get());
17243 if (RetainExpansion) {
17244 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
17247 if (
Out.isInvalid())
17250 Out = getDerived().RebuildPackExpansion(
Out.get(), E->getEllipsisLoc(),
17251 OrigNumExpansions);
17252 if (
Out.isInvalid())
17254 FullySubstituted =
false;
17255 ExpandedExprs.push_back(
Out.get());
17257 }
else if (!E->expandsToEmptyPack()) {
17258 if (getDerived().TransformExprs(E->getExpressions().data(),
17259 E->getExpressions().size(),
false,
17264 return getDerived().RebuildPackIndexingExpr(
17265 E->getEllipsisLoc(), E->getRSquareLoc(), E->getPackIdExpression(),
17266 IndexExpr.get(), ExpandedExprs, FullySubstituted);
17269template <
typename Derived>
17272 if (!getSema().ArgPackSubstIndex)
17278 return getDerived().RebuildSubstNonTypeTemplateParmExpr(
17279 E->getAssociatedDecl(), E->getParameterPack()->getPosition(),
17280 E->getParameterPack()->getType(), E->getParameterPackLocation(), Arg,
17284template <
typename Derived>
17301 ExprResult Replacement = getDerived().TransformExpr(OrigReplacement);
17302 if (Replacement.isInvalid())
17305 Decl *AssociatedDecl =
17306 getDerived().TransformDecl(E->getNameLoc(), E->getAssociatedDecl());
17307 if (!AssociatedDecl)
17310 QualType ParamType = TransformType(E->getParameterType());
17311 if (ParamType.isNull())
17314 if (Replacement.get() == OrigReplacement &&
17315 AssociatedDecl == E->getAssociatedDecl() &&
17316 ParamType == E->getParameterType())
17319 if (Replacement.get() != OrigReplacement ||
17320 ParamType != E->getParameterType()) {
17329 Param, ParamType, Replacement.get(), SugaredConverted,
17330 CanonicalConverted,
17332 if (Replacement.isInvalid())
17336 Replacement = E->getReplacement();
17339 return getDerived().RebuildSubstNonTypeTemplateParmExpr(
17340 AssociatedDecl, E->getIndex(), ParamType, E->getNameLoc(),
17342 E->getPackIndex(), E->getFinal());
17345template<
typename Derived>
17352template<
typename Derived>
17359template<
typename Derived>
17363 if (
Expr *OldCallee = E->getCallee()) {
17364 ExprResult CalleeResult = getDerived().TransformExpr(OldCallee);
17365 if (CalleeResult.isInvalid())
17370 Expr *Pattern = E->getPattern();
17373 getSema().collectUnexpandedParameterPacks(Pattern, Unexpanded);
17374 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
17378 bool Expand =
true;
17379 bool RetainExpansion =
false;
17381 NumExpansions = OrigNumExpansions;
17382 if (getDerived().TryExpandParameterPacks(
17383 E->getEllipsisLoc(), Pattern->getSourceRange(), Unexpanded,
17384 true, Expand, RetainExpansion,
17394 E->getLHS() ? getDerived().TransformExpr(E->getLHS()) :
ExprResult();
17395 if (LHS.isInvalid())
17399 E->getRHS() ? getDerived().TransformExpr(E->getRHS()) :
ExprResult();
17400 if (RHS.isInvalid())
17403 if (!getDerived().AlwaysRebuild() &&
17404 LHS.get() == E->getLHS() && RHS.get() == E->getRHS())
17407 return getDerived().RebuildCXXFoldExpr(
17408 Callee, E->getBeginLoc(), LHS.get(), E->getOperator(),
17409 E->getEllipsisLoc(), RHS.get(), E->getEndLoc(), NumExpansions);
17415 if (NumExpansions && SemaRef.
getLangOpts().BracketDepth < *NumExpansions) {
17416 SemaRef.
Diag(E->getEllipsisLoc(),
17417 clang::diag::err_fold_expression_limit_exceeded)
17418 << *NumExpansions << SemaRef.
getLangOpts().BracketDepth
17419 << E->getSourceRange();
17420 SemaRef.
Diag(E->getEllipsisLoc(), diag::note_bracket_depth);
17429 bool LeftFold = E->isLeftFold();
17433 if (!LeftFold && RetainExpansion) {
17434 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
17437 if (
Out.isInvalid())
17440 Result = getDerived().RebuildCXXFoldExpr(
17441 Callee, E->getBeginLoc(),
Out.get(), E->getOperator(),
17442 E->getEllipsisLoc(),
Result.get(), E->getEndLoc(), OrigNumExpansions);
17447 bool WarnedOnComparison =
false;
17448 for (
unsigned I = 0; I != *NumExpansions; ++I) {
17450 getSema(), LeftFold ? I : *NumExpansions - I - 1);
17452 if (
Out.isInvalid())
17455 if (
Out.get()->containsUnexpandedParameterPack()) {
17457 Result = getDerived().RebuildCXXFoldExpr(
17458 Callee, E->getBeginLoc(), LeftFold ?
Result.get() :
Out.get(),
17459 E->getOperator(), E->getEllipsisLoc(),
17460 LeftFold ?
Out.get() :
Result.get(), E->getEndLoc(),
17461 OrigNumExpansions);
17462 }
else if (
Result.isUsable()) {
17469 Result = getDerived().RebuildCXXOperatorCallExpr(
17471 E->getEllipsisLoc(),
Callee->getBeginLoc(),
Callee->requiresADL(),
17472 Functions, LHS, RHS);
17474 Result = getDerived().RebuildBinaryOperator(E->getEllipsisLoc(),
17475 E->getOperator(), LHS, RHS,
17477 if (!WarnedOnComparison &&
Result.isUsable()) {
17478 if (
auto *BO = dyn_cast<BinaryOperator>(
Result.get());
17479 BO && BO->isComparisonOp()) {
17480 WarnedOnComparison =
true;
17481 SemaRef.
Diag(BO->getBeginLoc(),
17482 diag::warn_comparison_in_fold_expression)
17483 << BO->getOpcodeStr();
17496 if (LeftFold && RetainExpansion) {
17497 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
17500 if (
Out.isInvalid())
17503 Result = getDerived().RebuildCXXFoldExpr(
17504 Callee, E->getBeginLoc(),
Result.get(), E->getOperator(),
17505 E->getEllipsisLoc(),
Out.get(), E->getEndLoc(), OrigNumExpansions);
17511 PE->setIsProducedByFoldExpansion();
17516 return getDerived().RebuildEmptyCXXFoldExpr(E->getEllipsisLoc(),
17521template <
typename Derived>
17527 QualType T = getDerived().TransformType(E->getType());
17529 bool ArgChanged =
false;
17531 if (getDerived().TransformExprs(InitExprs.data(), InitExprs.size(),
true,
17532 TransformedInits, &ArgChanged))
17535 if (!getDerived().AlwaysRebuild() && !ArgChanged &&
T == E->getType())
17538 return getDerived().RebuildCXXParenListInitExpr(
17539 TransformedInits,
T, E->getUserSpecifiedInitExprs().size(),
17540 E->getInitLoc(), E->getBeginLoc(), E->getEndLoc());
17543template<
typename Derived>
17550template<
typename Derived>
17556template<
typename Derived>
17562template<
typename Derived>
17565 ExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
17566 if (SubExpr.isInvalid())
17569 if (!getDerived().AlwaysRebuild() &&
17570 SubExpr.get() == E->getSubExpr())
17573 return getDerived().RebuildObjCBoxedExpr(E->getSourceRange(), SubExpr.get());
17576template<
typename Derived>
17581 bool ArgChanged =
false;
17582 if (getDerived().TransformExprs(E->getElements(), E->getNumElements(),
17583 false, Elements, &ArgChanged))
17586 if (!getDerived().AlwaysRebuild() && !ArgChanged)
17589 return getDerived().RebuildObjCArrayLiteral(E->getSourceRange(),
17594template<
typename Derived>
17600 bool ArgChanged =
false;
17601 for (
unsigned I = 0, N = E->getNumElements(); I != N; ++I) {
17604 if (OrigElement.isPackExpansion()) {
17607 getSema().collectUnexpandedParameterPacks(OrigElement.Key, Unexpanded);
17608 getSema().collectUnexpandedParameterPacks(OrigElement.Value, Unexpanded);
17609 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
17613 bool Expand =
true;
17614 bool RetainExpansion =
false;
17617 SourceRange PatternRange(OrigElement.Key->getBeginLoc(),
17618 OrigElement.Value->getEndLoc());
17619 if (getDerived().TryExpandParameterPacks(
17620 OrigElement.EllipsisLoc, PatternRange, Unexpanded,
17621 true, Expand, RetainExpansion,
17630 ExprResult Key = getDerived().TransformExpr(OrigElement.Key);
17631 if (Key.isInvalid())
17634 if (Key.get() != OrigElement.Key)
17638 if (
Value.isInvalid())
17645 Key.get(),
Value.get(), OrigElement.EllipsisLoc, NumExpansions
17647 Elements.push_back(Expansion);
17657 for (
unsigned I = 0; I != *NumExpansions; ++I) {
17659 ExprResult Key = getDerived().TransformExpr(OrigElement.Key);
17660 if (Key.isInvalid())
17664 if (
Value.isInvalid())
17674 if (Key.get()->containsUnexpandedParameterPack() ||
17675 Value.get()->containsUnexpandedParameterPack())
17676 Element.EllipsisLoc = OrigElement.EllipsisLoc;
17678 Elements.push_back(Element);
17688 ExprResult Key = getDerived().TransformExpr(OrigElement.Key);
17689 if (Key.isInvalid())
17692 if (Key.get() != OrigElement.Key)
17697 = getDerived().TransformExpr(OrigElement.Value);
17698 if (
Value.isInvalid())
17706 Elements.push_back(Element);
17709 if (!getDerived().AlwaysRebuild() && !ArgChanged)
17712 return getDerived().RebuildObjCDictionaryLiteral(E->getSourceRange(),
17716template<
typename Derived>
17720 = getDerived().TransformType(E->getEncodedTypeSourceInfo());
17721 if (!EncodedTypeInfo)
17724 if (!getDerived().AlwaysRebuild() &&
17725 EncodedTypeInfo == E->getEncodedTypeSourceInfo())
17728 return getDerived().RebuildObjCEncodeExpr(E->getAtLoc(),
17730 E->getRParenLoc());
17733template<
typename Derived>
17743template<
typename Derived>
17747 = getDerived().TransformType(E->getTypeInfoAsWritten());
17755 if (!getDerived().AlwaysRebuild() &&
17756 TSInfo == E->getTypeInfoAsWritten() &&
17757 Result.get() == E->getSubExpr())
17761 E->getLParenLoc(), E->getBridgeKind(), E->getBridgeKeywordLoc(), TSInfo,
17765template <
typename Derived>
17771template<
typename Derived>
17775 bool ArgChanged =
false;
17777 Args.reserve(E->getNumArgs());
17778 if (getDerived().TransformExprs(E->getArgs(), E->getNumArgs(),
false, Args,
17785 = getDerived().TransformType(E->getClassReceiverTypeInfo());
17786 if (!ReceiverTypeInfo)
17790 if (!getDerived().AlwaysRebuild() &&
17791 ReceiverTypeInfo == E->getClassReceiverTypeInfo() && !ArgChanged)
17796 E->getSelectorLocs(SelLocs);
17797 return getDerived().RebuildObjCMessageExpr(ReceiverTypeInfo,
17800 E->getMethodDecl(),
17807 if (!E->getMethodDecl())
17812 E->getSelectorLocs(SelLocs);
17813 return getDerived().RebuildObjCMessageExpr(E->getSuperLoc(),
17816 E->getReceiverType(),
17817 E->getMethodDecl(),
17825 "Only class and instance messages may be instantiated");
17827 = getDerived().TransformExpr(E->getInstanceReceiver());
17828 if (Receiver.isInvalid())
17832 if (!getDerived().AlwaysRebuild() &&
17833 Receiver.get() == E->getInstanceReceiver() && !ArgChanged)
17838 E->getSelectorLocs(SelLocs);
17839 return getDerived().RebuildObjCMessageExpr(Receiver.get(),
17842 E->getMethodDecl(),
17848template<
typename Derived>
17854template<
typename Derived>
17860template<
typename Derived>
17865 if (
Base.isInvalid())
17871 if (!getDerived().AlwaysRebuild() &&
17872 Base.get() == E->getBase())
17875 return getDerived().RebuildObjCIvarRefExpr(
Base.get(), E->getDecl(),
17877 E->isArrow(), E->isFreeIvar());
17880template<
typename Derived>
17885 if (!E->isObjectReceiver())
17890 if (
Base.isInvalid())
17896 if (!getDerived().AlwaysRebuild() &&
17897 Base.get() == E->getBase())
17900 if (E->isExplicitProperty())
17901 return getDerived().RebuildObjCPropertyRefExpr(
Base.get(),
17902 E->getExplicitProperty(),
17905 return getDerived().RebuildObjCPropertyRefExpr(
Base.get(),
17907 E->getImplicitPropertyGetter(),
17908 E->getImplicitPropertySetter(),
17912template<
typename Derived>
17917 if (
Base.isInvalid())
17921 ExprResult Key = getDerived().TransformExpr(E->getKeyExpr());
17922 if (Key.isInvalid())
17926 if (!getDerived().AlwaysRebuild() &&
17927 Key.get() == E->getKeyExpr() &&
Base.get() == E->getBaseExpr())
17930 return getDerived().RebuildObjCSubscriptRefExpr(E->getRBracket(),
17931 Base.get(), Key.get(),
17932 E->getAtIndexMethodDecl(),
17933 E->setAtIndexMethodDecl());
17936template<
typename Derived>
17941 if (
Base.isInvalid())
17945 if (!getDerived().AlwaysRebuild() &&
17946 Base.get() == E->getBase())
17949 return getDerived().RebuildObjCIsaExpr(
Base.get(), E->getIsaMemberLoc(),
17954template<
typename Derived>
17957 bool ArgumentChanged =
false;
17959 SubExprs.reserve(E->getNumSubExprs());
17960 if (getDerived().TransformExprs(E->getSubExprs(), E->getNumSubExprs(),
false,
17961 SubExprs, &ArgumentChanged))
17964 if (!getDerived().AlwaysRebuild() &&
17968 return getDerived().RebuildShuffleVectorExpr(E->getBuiltinLoc(),
17970 E->getRParenLoc());
17973template<
typename Derived>
17976 ExprResult SrcExpr = getDerived().TransformExpr(E->getSrcExpr());
17977 if (SrcExpr.isInvalid())
17984 if (!getDerived().AlwaysRebuild() &&
17985 Type == E->getTypeSourceInfo() &&
17986 SrcExpr.get() == E->getSrcExpr())
17989 return getDerived().RebuildConvertVectorExpr(E->getBuiltinLoc(),
17990 SrcExpr.get(),
Type,
17991 E->getRParenLoc());
17994template<
typename Derived>
17997 BlockDecl *oldBlock = E->getBlockDecl();
18003 blockScope->TheDecl->setBlockMissingReturnType(
18004 oldBlock->blockMissingReturnType());
18013 if (getDerived().TransformFunctionTypeParams(
18014 E->getCaretLocation(), oldBlock->parameters(),
nullptr,
18015 exprFunctionType->getExtParameterInfosOrNull(), paramTypes, ¶ms,
18017 getSema().ActOnBlockError(E->getCaretLocation(),
nullptr);
18022 getDerived().TransformType(exprFunctionType->getReturnType());
18024 auto epi = exprFunctionType->getExtProtoInfo();
18025 epi.ExtParameterInfos = extParamInfos.getPointerOrNull(paramTypes.size());
18028 getDerived().RebuildFunctionProtoType(exprResultType, paramTypes, epi);
18032 if (!params.empty())
18033 blockScope->TheDecl->setParams(params);
18035 if (!oldBlock->blockMissingReturnType()) {
18036 blockScope->HasImplicitReturnType =
false;
18037 blockScope->ReturnType = exprResultType;
18041 StmtResult body = getDerived().TransformStmt(E->getBody());
18042 if (body.isInvalid()) {
18043 getSema().ActOnBlockError(E->getCaretLocation(),
nullptr);
18051 for (
const auto &I : oldBlock->captures()) {
18052 VarDecl *oldCapture = I.getVariable();
18055 if (oldCapture->isParameterPack())
18059 cast<VarDecl>(getDerived().TransformDecl(E->getCaretLocation(),
18061 assert(blockScope->CaptureMap.count(newCapture));
18070template<
typename Derived>
18073 ExprResult SrcExpr = getDerived().TransformExpr(E->getSrcExpr());
18074 if (SrcExpr.isInvalid())
18077 QualType Type = getDerived().TransformType(E->getType());
18080 E->getRParenLoc());
18083template<
typename Derived>
18086 bool ArgumentChanged =
false;
18088 SubExprs.reserve(E->getNumSubExprs());
18089 if (getDerived().TransformExprs(E->getSubExprs(), E->getNumSubExprs(),
false,
18090 SubExprs, &ArgumentChanged))
18093 if (!getDerived().AlwaysRebuild() &&
18097 return getDerived().RebuildAtomicExpr(E->getBuiltinLoc(), SubExprs,
18098 E->getOp(), E->getRParenLoc());
18105template<
typename Derived>
18108 return SemaRef.BuildPointerType(PointeeType,
Star,
18112template<
typename Derived>
18115 return SemaRef.BuildBlockPointerType(PointeeType,
Star,
18119template<
typename Derived>
18122 bool WrittenAsLValue,
18124 return SemaRef.BuildReferenceType(ReferentType, WrittenAsLValue,
18128template <
typename Derived>
18132 return SemaRef.BuildMemberPointerType(PointeeType, SS, Cls, Sigil,
18136template<
typename Derived>
18143 return SemaRef.ObjC().BuildObjCTypeParamType(
18144 Decl, ProtocolLAngleLoc, Protocols, ProtocolLocs, ProtocolRAngleLoc,
18148template<
typename Derived>
18159 return SemaRef.ObjC().BuildObjCObjectType(
18160 BaseType, Loc, TypeArgsLAngleLoc, TypeArgs, TypeArgsRAngleLoc,
18161 ProtocolLAngleLoc, Protocols, ProtocolLocs, ProtocolRAngleLoc,
18166template<
typename Derived>
18170 return SemaRef.Context.getObjCObjectPointerType(PointeeType);
18173template <
typename Derived>
18176 Expr *SizeExpr,
unsigned IndexTypeQuals,
SourceRange BracketsRange) {
18177 if (SizeExpr || !Size)
18178 return SemaRef.BuildArrayType(ElementType, SizeMod, SizeExpr,
18179 IndexTypeQuals, BracketsRange,
18183 SemaRef.Context.UnsignedCharTy,
SemaRef.Context.UnsignedShortTy,
18185 SemaRef.Context.UnsignedLongLongTy,
SemaRef.Context.UnsignedInt128Ty
18188 for (
const auto &
T : Types)
18189 if (Size->getBitWidth() ==
SemaRef.Context.getIntWidth(
T)) {
18199 return SemaRef.BuildArrayType(ElementType, SizeMod, ArraySize,
18200 IndexTypeQuals, BracketsRange,
18204template <
typename Derived>
18207 Expr *SizeExpr,
unsigned IndexTypeQuals,
SourceRange BracketsRange) {
18208 return getDerived().RebuildArrayType(ElementType, SizeMod, &Size, SizeExpr,
18209 IndexTypeQuals, BracketsRange);
18212template <
typename Derived>
18216 return getDerived().RebuildArrayType(ElementType, SizeMod,
nullptr,
nullptr,
18217 IndexTypeQuals, BracketsRange);
18220template <
typename Derived>
18223 unsigned IndexTypeQuals,
SourceRange BracketsRange) {
18224 return getDerived().RebuildArrayType(ElementType, SizeMod,
nullptr,
18226 IndexTypeQuals, BracketsRange);
18229template <
typename Derived>
18232 unsigned IndexTypeQuals,
SourceRange BracketsRange) {
18233 return getDerived().RebuildArrayType(ElementType, SizeMod,
nullptr,
18235 IndexTypeQuals, BracketsRange);
18238template <
typename Derived>
18241 return SemaRef.BuildAddressSpaceAttr(PointeeType, AddrSpaceExpr,
18245template <
typename Derived>
18247 unsigned NumElements,
18250 return SemaRef.Context.getVectorType(ElementType, NumElements, VecKind);
18253template <
typename Derived>
18257 return SemaRef.BuildVectorType(ElementType, SizeExpr, AttributeLoc);
18260template<
typename Derived>
18262 unsigned NumElements,
18264 llvm::APInt numElements(
SemaRef.Context.getIntWidth(
SemaRef.Context.IntTy),
18265 NumElements,
true);
18269 return SemaRef.BuildExtVectorType(ElementType, VectorSize, AttributeLoc);
18272template<
typename Derived>
18277 return SemaRef.BuildExtVectorType(ElementType, SizeExpr, AttributeLoc);
18280template <
typename Derived>
18282 QualType ElementType,
unsigned NumRows,
unsigned NumColumns,
18288 Ctx, llvm::APInt(SizeWidth, NumRows), SizeTy, AttributeLoc);
18290 Ctx, llvm::APInt(SizeWidth, NumColumns), SizeTy, AttributeLoc);
18291 return SemaRef.BuildMatrixType(ElementType, RowExpr, ColumnExpr,
18295template <
typename Derived>
18299 return SemaRef.BuildMatrixType(ElementType, RowExpr, ColumnExpr,
18303template <
typename Derived>
18307 return SemaRef.BuildFunctionType(
T, ParamTypes,
18313template<
typename Derived>
18315 return SemaRef.Context.getFunctionNoProtoType(
T);
18318template <
typename Derived>
18322 assert(D &&
"no decl found");
18326 if (
auto *UPD = dyn_cast<UsingPackDecl>(D)) {
18330 if (UPD->expansions().empty()) {
18331 getSema().Diag(NameLoc, diag::err_using_pack_expansion_empty)
18332 << UPD->isCXXClassMember() << UPD;
18341 for (
auto *E : UPD->expansions()) {
18348 else if (
T.isNull())
18351 assert(
getSema().Context.hasSameType(ThisT,
T) &&
18352 "mismatched resolved types in using pack expansion");
18354 return T.isNull() ? FallbackT :
T;
18356 if (
auto *Using = dyn_cast<UsingDecl>(D)) {
18357 assert(Using->hasTypename() &&
18358 "UnresolvedUsingTypenameDecl transformed to non-typename using");
18361 assert(++Using->shadow_begin() == Using->shadow_end());
18366 return SemaRef.Context.getUsingType(
Keyword, Qualifier, Shadow);
18369 "UnresolvedUsingTypenameDecl transformed to non-using decl");
18370 return SemaRef.Context.getUnresolvedUsingType(
18374template <
typename Derived>
18377 return SemaRef.BuildTypeofExprType(E, Kind);
18380template<
typename Derived>
18383 return SemaRef.Context.getTypeOfType(Underlying, Kind);
18386template <
typename Derived>
18388 return SemaRef.BuildDecltypeType(E);
18391template <
typename Derived>
18395 return SemaRef.BuildPackIndexingType(Pattern, IndexExpr, Loc,
18396 FullySubstituted, Expansions);
18399template<
typename Derived>
18401 UnaryTransformType::UTTKind UKind,
18403 return SemaRef.BuildUnaryTransformType(BaseType, UKind, Loc);
18406template <
typename Derived>
18410 return SemaRef.CheckTemplateIdType(
18415template<
typename Derived>
18418 return SemaRef.BuildAtomicType(ValueType, KWLoc);
18421template<
typename Derived>
18425 return isReadPipe ?
SemaRef.BuildReadPipeType(ValueType, KWLoc)
18426 :
SemaRef.BuildWritePipeType(ValueType, KWLoc);
18429template <
typename Derived>
18433 llvm::APInt NumBitsAP(
SemaRef.Context.getIntWidth(
SemaRef.Context.IntTy),
18437 return SemaRef.BuildBitIntType(IsUnsigned, Bits, Loc);
18440template <
typename Derived>
18443 return SemaRef.BuildBitIntType(IsUnsigned, NumBitsExpr, Loc);
18446template <
typename Derived>
18454template <
typename Derived>
18461 getSema().ActOnTemplateName(
nullptr, SS, TemplateKWLoc,
18464 AllowInjectedClassName);
18468template<
typename Derived>
18475 bool AllowInjectedClassName) {
18478 SourceLocation SymbolLocations[3] = { NameLoc, NameLoc, NameLoc };
18483 false,
Template, AllowInjectedClassName);
18487template <
typename Derived>
18492 bool isPostIncDec = Second && (Op == OO_PlusPlus || Op == OO_MinusMinus);
18497 return SemaRef.PseudoObject().checkAssignment(
nullptr, OpLoc,
18498 Opc,
First, Second);
18513 if (Op == OO_Subscript) {
18514 if (!
First->getType()->isOverloadableType() &&
18516 return getSema().CreateBuiltinArraySubscriptExpr(
First, CalleeLoc, Second,
18518 }
else if (Op == OO_Arrow) {
18521 if (
First->getType()->isDependentType())
18524 return SemaRef.BuildOverloadedArrowExpr(
nullptr,
First, OpLoc);
18525 }
else if (Second ==
nullptr || isPostIncDec) {
18526 if (!
First->getType()->isOverloadableType() ||
18527 (Op == OO_Amp &&
getSema().isQualifiedMemberAccess(
First))) {
18534 return getSema().CreateBuiltinUnaryOp(OpLoc, Opc,
First);
18538 !
First->getType()->isOverloadableType() &&
18544 =
SemaRef.CreateBuiltinBinOp(OpLoc, Opc,
First, Second);
18553 if (!Second || isPostIncDec) {
18556 return SemaRef.CreateOverloadedUnaryOp(OpLoc, Opc, Functions,
First,
18563 First, Second, RequiresADL);
18570template<
typename Derived>
18580 QualType CanonicalBaseType =
Base->getType().getCanonicalType();
18581 if (
Base->isTypeDependent() || Destroyed.getIdentifier() ||
18586 ->getAsCanonical<RecordType>())) {
18588 return SemaRef.BuildPseudoDestructorExpr(
18589 Base, OperatorLoc, isArrow ? tok::arrow : tok::period, SS, ScopeType,
18590 CCLoc, TildeLoc, Destroyed);
18602 if (!
isa<TagType>(ScopeType->getType().getCanonicalType())) {
18603 getSema().Diag(ScopeType->getTypeLoc().getBeginLoc(),
18604 diag::err_expected_class_or_namespace)
18605 << ScopeType->getType() <<
getSema().getLangOpts().CPlusPlus;
18609 SS.
Make(
SemaRef.Context, ScopeType->getTypeLoc(), CCLoc);
18613 return getSema().BuildMemberReferenceExpr(
18614 Base,
Base->getType(), OperatorLoc, isArrow, SS, TemplateKWLoc,
18620template<
typename Derived>
18628 for (
unsigned I = 0; I < NumParams; ++I) {
18629 if (I != ContextParamPos) {
18635 Params.push_back(std::make_pair(StringRef(), QualType()));
18638 getSema().ActOnCapturedRegionStart(Loc,
nullptr,
18646 if (Body.isInvalid()) {
18647 getSema().ActOnCapturedRegionError();
18651 return getSema().ActOnCapturedRegionEnd(Body.get());
18654template <
typename Derived>
18660 llvm_unreachable(
"SYCL kernel call statement cannot appear in dependent "
18664template <
typename Derived>
static Decl::Kind getKind(const Decl *D)
Defines the C++ template declaration subclasses.
Defines the clang::Expr interface and subclasses for C++ expressions.
Defines Expressions and AST nodes for C++2a concepts.
Result
Implement __builtin_bit_cast and related operations.
llvm::MachO::Record Record
This file defines OpenMP AST classes for clauses.
Defines some OpenMP-specific enums and functions.
This file declares semantic analysis for HLSL constructs.
This file declares semantic analysis for Objective-C.
This file declares semantic analysis for OpenACC constructs and clauses.
This file declares semantic analysis for OpenMP constructs and clauses.
This file declares semantic analysis for expressions involving.
This file declares semantic analysis for SYCL constructs.
static bool PreparePackForExpansion(Sema &S, const CXXBaseSpecifier &Base, const MultiLevelTemplateArgumentList &TemplateArgs, TypeSourceInfo *&Out, UnexpandedInfo &Info)
Defines the Objective-C statement AST node classes.
This file defines OpenACC AST classes for statement-level contructs.
This file defines OpenMP AST classes for executable directives and clauses.
This file defines SYCL AST classes used to represent calls to SYCL kernels.
static QualType getPointeeType(const MemRegion *R)
DeclarationNameInfo getDirectiveName() const
Return name of the directive.
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 '...
bool anyScoreOrCondition(llvm::function_ref< bool(Expr *&, bool)> Cond)
The result of a constraint satisfaction check, containing the necessary information to diagnose an un...
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
unsigned getIntWidth(QualType T) const
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 getLateParsedAttrType(QualType Wrapped, LateParsedTypeAttribute *LateParsedAttr) const
Return a placeholder type for a late-parsed type attribute.
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>.
DeclarationNameInfo getNameForTemplate(TemplateName Name, SourceLocation NameLoc) const
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)
QualType getMatrixTypeWithLayout(QualType T, MatrixType::LayoutKind Layout) const
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.
static CXXDefaultInitExpr * Create(const ASTContext &Ctx, SourceLocation Loc, FieldDecl *Field, DeclContext *UsedContext, Expr *RewrittenInitExpr)
Field is the non-static data member whose default initializer is used by this expression.
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]).
Helper that selects an expression from an InitListExpr depending on the current expansion index.
Represents a C++26 expansion statement declaration.
Represents the code generated for an expanded expansion statement.
static CXXExpansionStmtInstantiation * Create(ASTContext &C, CXXExpansionStmtDecl *Parent, ArrayRef< Stmt * > Instantiations, ArrayRef< Stmt * > PreambleStmts, bool ShouldApplyLifetimeExtensionToPreamble)
CXXExpansionStmtPattern - Represents an unexpanded C++ expansion statement.
static CXXExpansionStmtPattern * CreateIterating(ASTContext &Context, CXXExpansionStmtDecl *ESD, Stmt *Init, DeclStmt *ExpansionVar, DeclStmt *Range, DeclStmt *Begin, DeclStmt *Iter, SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation RParenLoc)
Create an iterating expansion statement pattern.
static CXXExpansionStmtPattern * CreateEnumerating(ASTContext &Context, CXXExpansionStmtDecl *ESD, Stmt *Init, DeclStmt *ExpansionVar, SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation RParenLoc)
Create an enumerating expansion statement pattern.
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, TemplateName 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.
An expression that occurs in a constant context and the result of evaluating the expression.
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.
bool isExpansionStmt() const
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...
A template-id naming a variable template or a concept through a template template parameter.
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.
void setAttrNameLoc(SourceLocation Loc)
Represents a placeholder type for late-parsed type attributes.
Represents the results of name lookup.
This represents a Microsoft inline-assembly statement extension.
Representation of a Microsoft __if_exists or __if_not_exists statement with a dependent name.
An instance of this class represents the declaration of a property member.
A member reference to an MSPropertyDecl.
MS property subscript expression.
void setExpansionLoc(SourceLocation Loc)
Represents a prvalue temporary that is written into memory so that a reference can bind to it.
MatrixSingleSubscriptExpr - Matrix single subscript expression for the MatrixType extension when you ...
MatrixSubscriptExpr - Matrix subscript expression for the MatrixType extension.
void setAttrNameLoc(SourceLocation loc)
MemberExpr - [C99 6.5.2.3] Structure and Union Members.
Wrapper for source info for member pointers.
A pointer to member type per C++ 8.3.3 - Pointers to members.
Data structure that captures multiple levels of template argument lists for use in template instantia...
This represents a decl that may have a name.
IdentifierInfo * getIdentifier() const
Get the identifier that names this declaration, if there is one.
StringRef getName() const
Get the name of identifier for this declaration as a StringRef.
DeclarationName getDeclName() const
Get the actual, stored name of the declaration, which may be a special name.
Represents C++ namespaces and their aliases.
Class that aids in the construction of nested-name-specifiers along with source-location information ...
void MakeTrivial(ASTContext &Context, NestedNameSpecifier Qualifier, SourceRange R)
Make a new nested-name-specifier from incomplete source-location information.
A C++ nested-name-specifier augmented with source location information.
NestedNameSpecifier getNestedNameSpecifier() const
Retrieve the nested-name-specifier to which this instance refers.
SourceLocation getLocalEndLoc() const
Retrieve the location of the end of this component of the nested-name-specifier.
SourceRange getSourceRange() const LLVM_READONLY
Retrieve the source range covering the entirety of this nested-name-specifier.
SourceLocation getEndLoc() const
Retrieve the location of the end of this nested-name-specifier.
SourceLocation getBeginLoc() const
Retrieve the location of the beginning of this nested-name-specifier.
TypeLoc castAsTypeLoc() const
For a nested-name-specifier that refers to a type, retrieve the type with source-location information...
void * getOpaqueData() const
Retrieve the opaque pointer that refers to source-location data.
SourceLocation getLocalBeginLoc() const
Retrieve the location of the beginning of this component of the nested-name-specifier.
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
NamespaceAndPrefix getAsNamespaceAndPrefix() const
CXXRecordDecl * getAsRecordDecl() const
Retrieve the record declaration stored in this nested name specifier, or null.
bool isDependent() const
Whether this nested name specifier refers to a dependent type or not.
@ MicrosoftSuper
Microsoft's '__super' specifier, stored as a CXXRecordDecl* of the class it appeared in.
@ Global
The global specifier '::'. There is no stored value.
@ Type
A type, stored as a Type*.
@ Namespace
A namespace-like entity, stored as a NamespaceBaseDecl*.
Represents a place-holder for an object not to be initialized by anything.
NullStmt - This is the null statement ";": C99 6.8.3p3.
This represents the 'align' clause in the 'pragma omp allocate' directive.
This represents clause 'allocate' in the 'pragma omp ...' directives.
This represents 'allocator' clause in the 'pragma omp ...' directive.
An explicit cast in C or a C-style cast in C++, which uses the syntax ([s1][s2]......
This is a basic class for representing single OpenMP clause.
OpenMPClauseKind getClauseKind() const
Returns kind of OpenMP clause (private, shared, reduction, etc.).
This represents 'collapse' clause in the 'pragma omp ...' directive.
This represents the 'counts' clause in the 'pragma omp split' directive.
This represents 'default' clause in the 'pragma omp ...' directive.
This represents the 'depth' clause on the 'pragma omp flatten' (and 'pragma omp fuse') loop-transform...
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
A structure for storing a pack-index-template-name ([temp.names]).
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.
Qualifiers getLocalQualifiers() const
Retrieve the set of qualifiers local to this particular QualType instance, not including any qualifie...
Represents a template name as written in source code.
Wrapper of type source information for a type with non-trivial direct qualifiers.
The collection of all-type qualifiers we support.
void removeObjCLifetime()
static Qualifiers fromCVRMask(unsigned CVR)
PointerAuthQualifier getPointerAuth() const
bool hasObjCLifetime() const
LangAS getAddressSpace() const
Frontend produces RecoveryExprs on semantic errors that prevent creating other well-formed expression...
Base for LValueReferenceType and RValueReferenceType.
QualType getPointeeTypeAsWritten() const
Represents the body of a requires-expression.
static RequiresExprBodyDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc)
C++2a [expr.prim.req]: A requires-expression provides a concise way to express requirements on templa...
static RequiresExpr * Create(ASTContext &C, SourceLocation RequiresKWLoc, RequiresExprBodyDecl *Body, SourceLocation LParenLoc, ArrayRef< ParmVarDecl * > LocalParameters, SourceLocation RParenLoc, ArrayRef< concepts::Requirement * > Requirements, SourceLocation RBraceLoc)
ReturnStmt - This represents a return, optionally of an expression: return; return 4;.
static SEHFinallyStmt * Create(const ASTContext &C, SourceLocation FinallyLoc, Stmt *Block)
Represents a __leave statement.
SYCLKernelCallStmt represents the transformation that is applied to the body of a function declared w...
Smart pointer class that efficiently represents Objective-C method names.
SemaDiagnosticBuilder Diag(SourceLocation Loc, unsigned DiagID)
Emit a diagnostic.
bool diagnoseMatrixLayoutInstantiation(attr::Kind K, QualType T, SourceLocation Loc)
VarDecl * BuildObjCExceptionDecl(TypeSourceInfo *TInfo, QualType ExceptionType, SourceLocation StartLoc, SourceLocation IdLoc, const IdentifierInfo *Id, bool Invalid=false)
Build a type-check a new Objective-C exception variable declaration.
StmtResult ActOnObjCForCollectionStmt(SourceLocation ForColLoc, Stmt *First, Expr *collection, SourceLocation RParenLoc)
StmtResult FinishObjCForCollectionStmt(Stmt *ForCollection, Stmt *Body)
FinishObjCForCollectionStmt - Attach the body to a objective-C foreach statement.
ExprResult BuildObjCDictionaryLiteral(SourceRange SR, MutableArrayRef< ObjCDictionaryElement > Elements)
StmtResult ActOnObjCAtSynchronizedStmt(SourceLocation AtLoc, Expr *SynchExpr, Stmt *SynchBody)
ExprResult BuildObjCArrayLiteral(SourceRange SR, MultiExprArg Elements)
ExprResult BuildObjCBoxedExpr(SourceRange SR, Expr *ValueExpr)
BuildObjCBoxedExpr - builds an ObjCBoxedExpr AST node for the '@' prefixed parenthesized expression.
StmtResult ActOnObjCAtTryStmt(SourceLocation AtLoc, Stmt *Try, MultiStmtArg Catch, Stmt *Finally)
StmtResult ActOnObjCAtFinallyStmt(SourceLocation AtLoc, Stmt *Body)
StmtResult BuildObjCAtThrowStmt(SourceLocation AtLoc, Expr *Throw)
ExprResult ActOnObjCAtSynchronizedOperand(SourceLocation atLoc, Expr *operand)
ExprResult BuildObjCBridgedCast(SourceLocation LParenLoc, ObjCBridgeCastKind Kind, SourceLocation BridgeKeywordLoc, TypeSourceInfo *TSInfo, Expr *SubExpr)
StmtResult ActOnObjCAtCatchStmt(SourceLocation AtLoc, SourceLocation RParen, Decl *Parm, Stmt *Body)
StmtResult ActOnObjCAutoreleasePoolStmt(SourceLocation AtLoc, Stmt *Body)
ExprResult BuildObjCSubscriptExpression(SourceLocation RB, Expr *BaseExpr, Expr *IndexExpr, ObjCMethodDecl *getterMethod, ObjCMethodDecl *setterMethod)
Build an ObjC subscript pseudo-object expression, given that that's supported by the runtime.
Helper type for the registration/assignment of constructs that need to 'know' about their parent cons...
Helper type to restore the state of various 'loop' constructs when we run into a loop (for,...
A type to represent all the data for an OpenACC Clause that has been parsed, but not yet created/sema...
void ActOnWhileStmt(SourceLocation WhileLoc)
ExprResult ActOnOpenACCAsteriskSizeExpr(SourceLocation AsteriskLoc)
void ActOnDoStmt(SourceLocation DoLoc)
void ActOnRangeForStmtBegin(SourceLocation ForLoc, const Stmt *OldRangeFor, const Stmt *RangeFor)
StmtResult ActOnEndStmtDirective(OpenACCDirectiveKind K, SourceLocation StartLoc, SourceLocation DirLoc, SourceLocation LParenLoc, SourceLocation MiscLoc, ArrayRef< Expr * > Exprs, OpenACCAtomicKind AK, SourceLocation RParenLoc, SourceLocation EndLoc, ArrayRef< OpenACCClause * > Clauses, StmtResult AssocStmt)
Called after the directive has been completely parsed, including the declaration group or associated ...
void ActOnForStmtEnd(SourceLocation ForLoc, StmtResult Body)
void ActOnForStmtBegin(SourceLocation ForLoc, const Stmt *First, const Stmt *Second, const Stmt *Third)
ExprResult ActOnArraySectionExpr(Expr *Base, SourceLocation LBLoc, Expr *LowerBound, SourceLocation ColonLocFirst, Expr *Length, SourceLocation RBLoc)
Checks and creates an Array Section used in an OpenACC construct/clause.
OMPClause * ActOnOpenMPNocontextClause(Expr *Condition, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'nocontext' clause.
OMPClause * ActOnOpenMPXDynCGroupMemClause(Expr *Size, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on a well-formed 'ompx_dyn_cgroup_mem' clause.
OMPClause * ActOnOpenMPSafelenClause(Expr *Length, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'safelen' clause.
OMPClause * ActOnOpenMPHoldsClause(Expr *E, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'holds' clause.
OMPClause * ActOnOpenMPFilterClause(Expr *ThreadID, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'filter' clause.
OMPClause * ActOnOpenMPFullClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-form 'full' clauses.
OMPClause * ActOnOpenMPDetachClause(Expr *Evt, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'detach' clause.
OMPClause * ActOnOpenMPUseClause(Expr *InteropVar, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation VarLoc, SourceLocation EndLoc)
Called on well-formed 'use' clause.
OMPClause * ActOnOpenMPPrivateClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'private' clause.
OMPClause * ActOnOpenMPOrderedClause(SourceLocation StartLoc, SourceLocation EndLoc, SourceLocation LParenLoc=SourceLocation(), Expr *NumForLoops=nullptr)
Called on well-formed 'ordered' clause.
OMPClause * ActOnOpenMPIsDevicePtrClause(ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs)
Called on well-formed 'is_device_ptr' clause.
OMPClause * ActOnOpenMPCountsClause(ArrayRef< Expr * > CountExprs, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc, std::optional< unsigned > FillIdx, SourceLocation FillLoc, unsigned FillCount)
Called on well-formed 'counts' clause after parsing its arguments.
OMPClause * ActOnOpenMPHasDeviceAddrClause(ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs)
Called on well-formed 'has_device_addr' clause.
OMPClause * ActOnOpenMPPartialClause(Expr *FactorExpr, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-form 'partial' clauses.
OMPClause * ActOnOpenMPLastprivateClause(ArrayRef< Expr * > VarList, OpenMPLastprivateModifier LPKind, SourceLocation LPKindLoc, SourceLocation ColonLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'lastprivate' clause.
OMPClause * ActOnOpenMPFirstprivateClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'firstprivate' clause.
OMPClause * ActOnOpenMPPriorityClause(Expr *Priority, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'priority' clause.
OMPClause * ActOnOpenMPDistScheduleClause(OpenMPDistScheduleClauseKind Kind, Expr *ChunkSize, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation KindLoc, SourceLocation CommaLoc, SourceLocation EndLoc)
Called on well-formed 'dist_schedule' clause.
OMPClause * ActOnOpenMPLoopRangeClause(Expr *First, Expr *Count, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation FirstLoc, SourceLocation CountLoc, SourceLocation EndLoc)
Called on well-form 'looprange' clause after parsing its arguments.
OMPClause * ActOnOpenMPPermutationClause(ArrayRef< Expr * > PermExprs, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-form 'permutation' clause after parsing its arguments.
OMPClause * ActOnOpenMPNontemporalClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'nontemporal' clause.
OMPClause * ActOnOpenMPBindClause(OpenMPBindClauseKind Kind, SourceLocation KindLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on a well-formed 'bind' clause.
OMPClause * 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 * 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 * ActOnOpenMPNumThreadsClause(ArrayRef< Expr * > VarList, OpenMPNumThreadsClauseModifier SimpleModifier, SourceLocation SimpleModifierLoc, OpenMPNumThreadsClauseModifier ComplexModifier, Expr *ComplexModifierExpr, SourceLocation ComplexModifierLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'num_threads' 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 * ActOnOpenMPThreadLimitClause(ArrayRef< Expr * > VarList, OpenMPThreadLimitClauseModifier Modifier, Expr *ModifierExpr, SourceLocation ModifierLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'thread_limit' 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.
OMPClause * ActOnOpenMPNumTeamsClause(ArrayRef< Expr * > VarList, OpenMPNumTeamsClauseModifier Modifier, Expr *ModifierExpr, SourceLocation ModifierLoc, OpenMPNumTeamsClauseModifier ModifierExtra, Expr *ModifierExtraExpr, SourceLocation ModifierExtraLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'num_teams' clause.
ExprResult ActOnOMPArrayShapingExpr(Expr *Base, SourceLocation LParenLoc, SourceLocation RParenLoc, ArrayRef< Expr * > Dims, ArrayRef< SourceRange > Brackets)
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.
StmtResult ActOnOpenMPMetaDirective(SourceLocation StartLoc, SourceLocation EndLoc, ArrayRef< OMPTraitInfo * > TraitInfos, ArrayRef< Stmt * > Variants)
Called for metadirectives with user conditions that require runtime selection.
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.
OMPClause * ActOnOpenMPDepthClause(Expr *DepthExpr, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'depth' 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.
std::optional< bool > getKnownValue() const
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'.
const ExpressionEvaluationContextRecord & currentEvaluationContext() const
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)
StmtResult BuildNonEnumeratingCXXExpansionStmtPattern(CXXExpansionStmtDecl *ESD, Stmt *Init, DeclStmt *ExpansionVarStmt, Expr *ExpansionInitializer, SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation RParenLoc, ArrayRef< MaterializeTemporaryExpr * > LifetimeExtendTemps={})
ExprResult BuildStmtExpr(SourceLocation LPLoc, Stmt *SubStmt, SourceLocation RPLoc, unsigned TemplateDepth)
TemplateName BuildPackIndexingTemplateName(TemplateName Pattern, Expr *IndexExpr, bool FullySubstituted=false, ArrayRef< TemplateName > Expansions={})
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)
ExprResult BuildBuiltinOffsetOf(SourceLocation BuiltinLoc, TypeSourceInfo *TInfo, const Designation &Desig, SourceLocation RParenLoc)
__builtin_offsetof(type, a.b[123][456].c)
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 TemporaryMaterializationConversion(Expr *E)
If E is a prvalue denoting an unmaterialized temporary, materialize it as an xvalue.
ExprResult BuildCXXReflectExpr(SourceLocation OperatorLoc, TypeSourceInfo *TSI)
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.
void ApplyForRangeOrExpansionStatementLifetimeExtension(VarDecl *RangeVar, ArrayRef< MaterializeTemporaryExpr * > Temporaries)
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 CheckVarOrConceptTemplateTemplateId(const DeclarationNameInfo &NameInfo, TemplateName Template, const TemplateArgumentListInfo *TemplateArgs)
ExprResult BuildSubstNonTypeTemplateParmExpr(Decl *AssociatedDecl, unsigned Index, QualType ParamType, SourceLocation loc, TemplateArgument Replacement, UnsignedOrNone PackIndex, bool Final)
ExprResult BuildCXXConstructExpr(SourceLocation ConstructLoc, QualType DeclInitType, NamedDecl *FoundDecl, CXXConstructorDecl *Constructor, MultiExprArg Exprs, bool HadMultipleCandidates, bool IsListInitialization, bool IsStdInitListInitialization, bool RequiresZeroInit, CXXConstructionKind ConstructKind, SourceRange ParenRange)
BuildCXXConstructExpr - Creates a complete call to a constructor, including handling of its default a...
ExprResult BuildAsTypeExpr(Expr *E, QualType DestTy, SourceLocation BuiltinLoc, SourceLocation RParenLoc)
Create a new AsTypeExpr node (bitcast) from the arguments.
ExprResult BuildFieldReferenceExpr(Expr *BaseExpr, bool IsArrow, SourceLocation OpLoc, const CXXScopeSpec &SS, FieldDecl *Field, DeclAccessPair FoundDecl, const DeclarationNameInfo &MemberNameInfo)
ExprResult ActOnConditionalOp(SourceLocation QuestionLoc, SourceLocation ColonLoc, Expr *CondExpr, Expr *LHSExpr, Expr *RHSExpr)
ActOnConditionalOp - Parse a ?
ExprResult BuildPossibleImplicitMemberExpr(const CXXScopeSpec &SS, SourceLocation TemplateKWLoc, LookupResult &R, const TemplateArgumentListInfo *TemplateArgs, const Scope *S)
Builds an expression which might be an implicit member expression.
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 BuildCXXExpansionSelectExpr(InitListExpr *Range, Expr *Idx)
ExprResult BuildBinOp(Scope *S, SourceLocation OpLoc, BinaryOperatorKind Opc, Expr *LHSExpr, Expr *RHSExpr, bool ForFoldExpression=false)
StmtResult FinishCXXExpansionStmt(Stmt *Expansion, Stmt *Body)
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.
PackIndexingTemplateStorage * getAsPackIndexingTemplate() const
Retrieve the pack-index-template-name storage, if any.
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
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 ...
Top level wrappers for InstallAPI frontend operations.
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)
OpenMPDefaultClauseVariableCategory
OpenMP variable-category for 'default' clause.
AutoTypeKeyword
Which keyword(s) were used to create an AutoType.
QualType pointeeType(QualType T)
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.
OpenMPNumTeamsClauseModifier
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...
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
const FunctionProtoType * T
bool isComputedNoexcept(ExceptionSpecificationType ESpecType)
OpenMPLastprivateModifier
OpenMP 'lastprivate' clause modifier.
@ Template
We are parsing a template declaration.
ActionResult< CXXBaseSpecifier * > BaseResult
OpenMPGrainsizeClauseModifier
OpenMPNumTasksClauseModifier
TagTypeKind
The kind of a tag type.
bool transformOMPMappableExprListClause(TreeTransform< Derived > &TT, OMPMappableExprListClause< T > *C, llvm::SmallVectorImpl< Expr * > &Vars, CXXScopeSpec &MapperIdScopeSpec, DeclarationNameInfo &MapperIdInfo, llvm::SmallVectorImpl< Expr * > &UnresolvedMappers)
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.
OpenMPThreadLimitClauseModifier
@ 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)
@ PackIndex
Index of a pack indexing expression or specifier.
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.
@ 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.
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)
DeclarationNameInfo - A collector data type for bundling together a DeclarationName and the correspon...
SourceLocation getLoc() const
getLoc - Returns the main location of the declaration name.
DeclarationName getName() const
getName - Returns the embedded declaration name.
void setNamedTypeInfo(TypeSourceInfo *TInfo)
setNamedTypeInfo - Sets the source type info associated to the name.
void setName(DeclarationName N)
setName - Sets the embedded declaration name.
TypeSourceInfo * getNamedTypeInfo() const
A FunctionEffect plus a potential boolean expression determining whether the effect is declared (e....
Holds information about the various types of exception specification.
FunctionDecl * SourceTemplate
The function template whose exception specification this is instantiated from, for EST_Uninstantiated...
ExceptionSpecificationType Type
The kind of exception specification this is.
ArrayRef< QualType > Exceptions
Explicitly-specified list of exception types.
Expr * NoexceptExpr
Noexcept expression, if this is a computed noexcept specification.
Extra information about a function prototype.
ExceptionSpecInfo ExceptionSpec
FunctionEffectsRef FunctionEffects
const ExtParameterInfo * ExtParameterInfos
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.
bool InLifetimeExtendingContext
Whether we are currently in a context in which all temporaries must be lifetime-extended,...
SmallVector< MaterializeTemporaryExpr *, 8 > ForRangeLifetimeExtendTemps
P2718R0 - Lifetime extension in range-based for loops.
bool RebuildDefaultArgOrDefaultInit
Whether we should rebuild CXXDefaultArgExpr and CXXDefaultInitExpr.
ExpressionEvaluationContext Context
The expression evaluation context.
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