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,
1054 unsigned NumRows,
unsigned NumColumns,
1072 Expr *AddrSpaceExpr,
1096 return SemaRef.Context.getUsingType(
Keyword, Qualifier, D, UnderlyingType);
1109 return SemaRef.Context.getMacroQualifiedType(T, MacroII);
1119 return SemaRef.Context.getCanonicalTagType(Tag);
1136 UnaryTransformType::UTTKind UKind,
1156 return SemaRef.Context.getAutoType(
1157 DK, DeducedAsType,
Keyword, TypeConstraintConcept, TypeConstraintArgs);
1165 return SemaRef.Context.getDeducedTemplateSpecializationType(
1184 return SemaRef.BuildParenType(InnerType);
1197 bool DeducedTSTContext) {
1199 SS.
Adopt(QualifierLoc);
1203 if (!
SemaRef.computeDeclContext(SS))
1211 return SemaRef.CheckTypenameType(
Keyword, KeywordLoc, QualifierLoc,
1212 *Id, IdLoc, DeducedTSTContext);
1225 if (
SemaRef.RequireCompleteDeclContext(SS, DC))
1230 switch (
Result.getResultKind()) {
1241 llvm_unreachable(
"Tag lookup cannot find non-tags");
1253 switch (
Result.getResultKind()) {
1259 SemaRef.Diag(IdLoc, diag::err_tag_reference_non_tag)
1260 << SomeDecl << NTK << Kind;
1265 SemaRef.Diag(IdLoc, diag::err_not_tag_in_scope)
1271 if (!
SemaRef.isAcceptableTagRedeclaration(Tag, Kind,
false,
1273 SemaRef.Diag(KeywordLoc, diag::err_use_with_wrong_tag) << Id;
1274 SemaRef.Diag(Tag->getLocation(), diag::note_previous_use);
1330 bool AllowInjectedClassName);
1343 bool AllowInjectedClassName);
1349 bool AllowInjectedClassName);
1359 Decl *AssociatedDecl,
unsigned Index,
1362 ArgPack, AssociatedDecl, Index, Final);
1371 bool FullySubstituted,
1374 Pattern, IndexExpr, FullySubstituted, Expansions);
1428 return SemaRef.ActOnLabelStmt(IdentLoc, L, ColonLoc, SubStmt);
1438 if (
SemaRef.CheckRebuiltStmtAttributes(Attrs))
1440 return SemaRef.BuildAttributedStmt(AttrLoc, Attrs, SubStmt);
1452 Then, ElseLoc, Else);
1506 Inc, RParenLoc, Body);
1551 bool IsVolatile,
unsigned NumOutputs,
1558 NumInputs, Names, Constraints, Exprs,
1559 AsmString, Clobbers, NumLabels, RParenLoc);
1568 StringRef AsmString,
1569 unsigned NumOutputs,
unsigned NumInputs,
1575 NumOutputs, NumInputs,
1576 Constraints, Clobbers, Exprs, EndLoc);
1605 CoawaitLoc, Operand, OpCoawaitLookup);
1609 Suspend.
get(),
true);
1710 Kind, DirName, CancelRegion, Clauses, AStmt, StartLoc, EndLoc);
1722 TraitInfos, Variants);
1734 Kind, DirName, Clauses, AStmt, StartLoc, EndLoc);
1748 NameModifier,
Condition, StartLoc, LParenLoc, NameModifierLoc, ColonLoc,
1775 VarList, PrescriptivenessModifier, PrescriptivenessModifierLoc,
1776 DimsModifier, DimsModifierExpr, DimsModifierLoc, StartLoc, LParenLoc,
1814 std::optional<unsigned> FillIdx,
1816 unsigned FillCount = FillIdx ? 1 : 0;
1818 Counts, StartLoc, LParenLoc, EndLoc, FillIdx, FillLoc, FillCount);
1857 First, Count, StartLoc, LParenLoc, FirstLoc, CountLoc, EndLoc);
1893 Kind, KindKwLoc, VCKind, VCLoc, StartLoc, LParenLoc, EndLoc);
1906 Kind, KindKwLoc, StartLoc, LParenLoc, EndLoc);
1913 ImpexTypeArg, StartLoc, LParenLoc, EndLoc);
1926 M1, M2, Kind, ChunkSize, StartLoc, LParenLoc, M1Loc, M2Loc, KindLoc,
1988 VarList, LPKind, LPKindLoc, ColonLoc, StartLoc, LParenLoc, EndLoc);
2016 VarList, {Modifier, OriginalSharingModifier}, StartLoc, LParenLoc,
2017 ModifierLoc, ColonLoc, EndLoc, ReductionIdScopeSpec, ReductionId,
2018 UnresolvedReductions);
2032 VarList, StartLoc, LParenLoc, ColonLoc, EndLoc, ReductionIdScopeSpec,
2033 ReductionId, UnresolvedReductions);
2048 VarList, StartLoc, LParenLoc, ColonLoc, EndLoc, ReductionIdScopeSpec,
2049 ReductionId, UnresolvedReductions);
2062 VarList, Step, StartLoc, LParenLoc, Modifier, ModifierLoc, ColonLoc,
2063 StepModifierLoc, EndLoc);
2076 VarList, Alignment, StartLoc, LParenLoc, ColonLoc, EndLoc);
2136 Data, DepModifier, VarList, StartLoc, LParenLoc, EndLoc);
2149 Modifier,
Device, StartLoc, LParenLoc, ModifierLoc, EndLoc);
2164 IteratorModifier, MapTypeModifiers, MapTypeModifiersLoc,
2165 MapperIdScopeSpec, MapperId, MapType, IsMapTypeImplicit, MapLoc,
2166 ColonLoc, VarList, Locs,
2167 false, UnresolvedMappers);
2184 Allocate, Alignment, FirstModifier, FirstModifierLoc, SecondModifier,
2185 SecondModifierLoc, VarList, StartLoc, LParenLoc, ColonLoc, EndLoc);
2199 VarList, Modifier, ModifierExpr, ModifierLoc, ModifierExtra,
2200 ModifierExtraExpr, ModifierExtraLoc, StartLoc, LParenLoc, EndLoc);
2212 VarList, Modifier, ModifierExpr, ModifierLoc, StartLoc, LParenLoc,
2237 Modifier,
Device, StartLoc, LParenLoc, ModifierLoc, EndLoc);
2250 Modifier, NumTasks, StartLoc, LParenLoc, ModifierLoc, EndLoc);
2285 Kind, ChunkSize, StartLoc, LParenLoc, KindLoc, CommaLoc, EndLoc);
2300 MotionModifiers, MotionModifiersLoc, IteratorModifier,
2301 MapperIdScopeSpec, MapperId, ColonLoc, VarList, Locs,
2317 MotionModifiers, MotionModifiersLoc, IteratorModifier,
2318 MapperIdScopeSpec, MapperId, ColonLoc, VarList, Locs,
2331 VarList, Locs, FallbackModifier, FallbackModifierLoc);
2373 M, Kind, StartLoc, LParenLoc, MLoc, KindLoc, EndLoc);
2420 StartLoc, LParenLoc, EndLoc,
Data);
2433 StartLoc, LParenLoc, ColonLoc, EndLoc, Modifier, Locators);
2445 Modifier, Kind, StartLoc, LParenLoc, ModifierKwLoc, KindKwLoc, EndLoc);
2458 InteropVar, InteropInfo, StartLoc, LParenLoc, VarLoc, EndLoc);
2469 LParenLoc, VarLoc, EndLoc);
2481 InteropVar, StartLoc, LParenLoc, VarLoc, EndLoc);
2552 M1, M2, Size, StartLoc, LParenLoc, M1Loc, M2Loc, EndLoc);
2633 DepType, DepLoc, ColonLoc, VarList, StartLoc, LParenLoc, EndLoc);
2681 ForLoc, Element, Collection, RParenLoc);
2699 StartLoc, IdLoc, Id);
2736 if (
DeclStmt *RangeStmt = dyn_cast<DeclStmt>(Range)) {
2737 if (RangeStmt->isSingleDecl()) {
2738 if (
VarDecl *RangeVar = dyn_cast<VarDecl>(RangeStmt->getSingleDecl())) {
2739 if (RangeVar->isInvalidDecl())
2742 Expr *RangeExpr = RangeVar->getInit();
2749 diag::err_objc_for_range_init_stmt)
2750 <<
Init->getSourceRange();
2753 ForLoc, LoopVar, RangeExpr, RParenLoc);
2760 ForLoc, CoawaitLoc,
Init, ColonLoc, Range, Begin, End, Cond, Inc,
2774 QualifierLoc, NameInfo, Nested);
2836 SS.
Adopt(QualifierLoc);
2890 UnaryExprOrTypeTrait ExprKind,
2901 UnaryExprOrTypeTrait ExprKind,
2956 if (IsOMPArraySection)
2958 Base, LBracketLoc, LowerBound, ColonLocFirst, ColonLocSecond, Length,
2959 Stride, RBracketLoc);
2961 assert(Stride ==
nullptr && !ColonLocSecond.
isValid() &&
2962 "Stride/second colon not allowed for OpenACC");
2965 Base, LBracketLoc, LowerBound, ColonLocFirst, Length, RBracketLoc);
2977 Base, LParenLoc, RParenLoc, Dims, BracketsRanges);
2989 nullptr, IteratorKwLoc, LLoc, RLoc,
Data);
2999 Expr *ExecConfig =
nullptr) {
3001 nullptr, Callee, LParenLoc, Args, RParenLoc, ExecConfig);
3008 nullptr, Callee, LParenLoc, Args, RParenLoc);
3026 if (!
Member->getDeclName()) {
3030 assert(
Member->getType()->isRecordType() &&
3031 "unnamed member not of record type?");
3044 if (!isArrow &&
Base->isPRValue()) {
3059 SS.
Adopt(QualifierLoc);
3062 if (
Base->containsErrors())
3067 if (isArrow && !BaseType->isPointerType())
3073 R.addDecl(FoundDecl);
3076 if (
getSema().isUnevaluatedContext() &&
Base->isImplicitCXXThis() &&
3081 ->getAsCXXRecordDecl()) {
3085 if (!ThisClass->Equals(
Class) && !ThisClass->isDerivedFrom(
Class))
3093 FirstQualifierInScope,
3094 R, ExplicitTemplateArgs,
3104 bool ForFoldExpression =
false) {
3182 return SemaRef.BuildInitList(LBraceLoc,
Inits, RBraceLoc, IsExplicit);
3195 =
SemaRef.ActOnDesignatedInitializer(Desig, EqualOrColonLoc, GNUSyntax,
3235 unsigned NumUserSpecifiedExprs,
3240 InitLoc, LParenLoc, RParenLoc);
3271 return SemaRef.ActOnChooseExpr(BuiltinLoc,
3283 Expr *ControllingExpr,
3288 ControllingExpr, Types, Exprs);
3303 ControllingType, Types, Exprs);
3336 case Stmt::CXXStaticCastExprClass:
3337 return getDerived().RebuildCXXStaticCastExpr(OpLoc, LAngleLoc, TInfo,
3338 RAngleLoc, LParenLoc,
3339 SubExpr, RParenLoc);
3341 case Stmt::CXXDynamicCastExprClass:
3342 return getDerived().RebuildCXXDynamicCastExpr(OpLoc, LAngleLoc, TInfo,
3343 RAngleLoc, LParenLoc,
3344 SubExpr, RParenLoc);
3346 case Stmt::CXXReinterpretCastExprClass:
3347 return getDerived().RebuildCXXReinterpretCastExpr(OpLoc, LAngleLoc, TInfo,
3348 RAngleLoc, LParenLoc,
3352 case Stmt::CXXConstCastExprClass:
3353 return getDerived().RebuildCXXConstCastExpr(OpLoc, LAngleLoc, TInfo,
3354 RAngleLoc, LParenLoc,
3355 SubExpr, RParenLoc);
3357 case Stmt::CXXAddrspaceCastExprClass:
3358 return getDerived().RebuildCXXAddrspaceCastExpr(
3359 OpLoc, LAngleLoc, TInfo, RAngleLoc, LParenLoc, SubExpr, RParenLoc);
3362 llvm_unreachable(
"Invalid C++ named cast");
3440 OpLoc, tok::kw_addrspace_cast, TInfo, SubExpr,
3452 bool ListInitialization) {
3456 if (
auto *PLE = dyn_cast<ParenListExpr>(Sub))
3458 TInfo, LParenLoc,
MultiExprArg(PLE->getExprs(), PLE->getNumExprs()),
3459 RParenLoc, ListInitialization);
3461 if (
auto *PLE = dyn_cast<CXXParenListInitExpr>(Sub))
3463 TInfo, LParenLoc, PLE->getUserSpecifiedInitExprs(), RParenLoc,
3464 ListInitialization);
3468 ListInitialization);
3532 if (
getSema().CheckCXXThisType(ThisLoc, ThisType))
3542 bool IsThrownVariableInScope) {
3552 Expr *RewrittenExpr) {
3554 RewrittenExpr,
getSema().CurContext);
3563 Expr *RewrittenInit) {
3565 getSema().CurContext, RewrittenInit);
3589 std::optional<Expr *> ArraySize,
3608 bool IsGlobalDelete,
3659 bool IsAddressOfOperand,
3662 SS.
Adopt(QualifierLoc);
3664 if (TemplateArgs || TemplateKWLoc.
isValid())
3666 SS, TemplateKWLoc, NameInfo, TemplateArgs, IsAddressOfOperand);
3669 SS, NameInfo, IsAddressOfOperand, RecoveryTSI);
3691 bool IsElidable,
MultiExprArg Args,
bool HadMultipleCandidates,
3692 bool ListInitialization,
bool StdInitListInitialization,
3699 FoundCtor =
Constructor->getInheritedConstructor().getConstructor();
3702 if (
getSema().CompleteConstructorCall(FoundCtor, T, Args, Loc,
3709 HadMultipleCandidates,
3711 StdInitListInitialization,
3712 RequiresZeroInit, ConstructKind,
3720 bool ConstructsVBase,
3721 bool InheritedFromVBase) {
3723 Loc, T,
Constructor, ConstructsVBase, InheritedFromVBase);
3734 bool ListInitialization) {
3736 TSInfo, LParenOrBraceLoc, Args, RParenOrBraceLoc, ListInitialization);
3747 bool ListInitialization) {
3749 RParenLoc, ListInitialization);
3766 SS.
Adopt(QualifierLoc);
3768 return SemaRef.BuildMemberReferenceExpr(BaseE, BaseType,
3769 OperatorLoc, IsArrow,
3771 FirstQualifierInScope,
3773 TemplateArgs,
nullptr);
3789 SS.
Adopt(QualifierLoc);
3791 return SemaRef.BuildMemberReferenceExpr(BaseE, BaseType,
3792 OperatorLoc, IsArrow,
3794 FirstQualifierInScope,
3795 R, TemplateArgs,
nullptr);
3803 return SemaRef.BuildCXXNoexceptExpr(Range.getBegin(), Arg, Range.getEnd());
3816 RParenLoc, Length, PartialArgs);
3821 Expr *PackIdExpression,
Expr *IndexExpr,
3823 bool FullySubstituted =
false) {
3825 IndexExpr, RSquareLoc, ExpandedExprs,
3851 NamedConcept, TALI);
3869 LocalParameters, RParenLoc, Requirements,
3876 return SemaRef.BuildTypeRequirement(SubstDiag);
3880 return SemaRef.BuildTypeRequirement(T);
3888 return SemaRef.BuildExprRequirement(SubstDiag, IsSimple, NoexceptLoc,
3895 return SemaRef.BuildExprRequirement(E, IsSimple, NoexceptLoc,
3907 return SemaRef.BuildNestedRequirement(Constraint);
3923 Expr **Elements,
unsigned NumElements) {
3933 RB,
Base, Key, getterMethod, setterMethod);
3952 return SemaRef.ObjC().BuildObjCEncodeExpression(AtLoc, EncodeTypeInfo,
3964 return SemaRef.ObjC().BuildClassMessage(
3965 ReceiverTypeInfo, ReceiverTypeInfo->
getType(),
3978 return SemaRef.ObjC().BuildInstanceMessage(Receiver, Receiver->
getType(),
3981 SelectorLocs, RBracLoc, Args);
3993 return Method->isInstanceMethod()
3994 ?
SemaRef.ObjC().BuildInstanceMessage(
3995 nullptr, SuperType, SuperLoc, Sel,
Method, LBracLoc,
3996 SelectorLocs, RBracLoc, Args)
3997 :
SemaRef.ObjC().BuildClassMessage(
nullptr, SuperType, SuperLoc,
3999 SelectorLocs, RBracLoc, Args);
4008 bool IsArrow,
bool IsFreeIvar) {
4017 if (IsFreeIvar &&
Result.isUsable())
4054 PropertyLoc,
Base));
4083 =
SemaRef.Context.Idents.get(
"__builtin_shufflevector");
4086 assert(!Lookup.
empty() &&
"No __builtin_shufflevector?");
4094 Callee =
SemaRef.ImpCastExprToType(Callee, CalleePtrTy,
4095 CK_BuiltinFnToFnPtr).get();
4111 return SemaRef.ConvertVectorExpr(SrcExpr, DstTInfo, BuiltinLoc, RParenLoc);
4126 EllipsisLoc, NumExpansions);
4150 llvm_unreachable(
"Pack expansion pattern has no parameter packs");
4186 EllipsisLoc, RHS, RParenLoc,
4195 Init->containsUnexpandedParameterPack();
4196 else if (PVD->hasUninstantiatedDefaultArg())
4198 PVD->getUninstantiatedDefaultArg()
4199 ->containsUnexpandedParameterPack();
4353 Exprs.push_back(DevNumExpr);
4354 llvm::append_range(Exprs, QueueIdExprs);
4391 AssociatedDecl, Index, ParamType, Loc, Arg,
PackIndex, Final);
4415 ObjectType, FirstQualifierInScope);
4421 QualType TransformDependentNameType(TypeLocBuilder &TLB,
4422 DependentNameTypeLoc TL,
4423 bool DeducibleTSTContext,
4424 QualType ObjectType = QualType(),
4425 NamedDecl *UnqualLookup =
nullptr);
4428 TransformOpenACCClauseList(OpenACCDirectiveKind DirKind,
4433 OpenACCDirectiveKind DirKind,
4434 const OpenACCClause *OldClause);
4437template <
typename Derived>
4447#define STMT(Node, Parent) \
4448 case Stmt::Node##Class: return getDerived().Transform##Node(cast<Node>(S));
4449#define VALUESTMT(Node, Parent) \
4450 case Stmt::Node##Class: \
4451 return getDerived().Transform##Node(cast<Node>(S), SDK);
4452#define ABSTRACT_STMT(Node)
4453#define EXPR(Node, Parent)
4454#include "clang/AST/StmtNodes.inc"
4457#define STMT(Node, Parent)
4458#define ABSTRACT_STMT(Stmt)
4459#define EXPR(Node, Parent) case Stmt::Node##Class:
4460#include "clang/AST/StmtNodes.inc"
4465 E =
getSema().ActOnStmtExprResult(E);
4473template<
typename Derived>
4481#define GEN_CLANG_CLAUSE_CLASS
4482#define CLAUSE_CLASS(Enum, Str, Class) \
4484 return getDerived().Transform##Class(cast<Class>(S));
4485#include "llvm/Frontend/OpenMP/OMP.inc"
4492template<
typename Derived>
4499#define STMT(Node, Parent) case Stmt::Node##Class: break;
4500#define ABSTRACT_STMT(Stmt)
4501#define EXPR(Node, Parent) \
4502 case Stmt::Node##Class: return getDerived().Transform##Node(cast<Node>(E));
4503#include "clang/AST/StmtNodes.inc"
4509template<
typename Derived>
4517 if (
auto *FE = dyn_cast<FullExpr>(
Init))
4518 Init = FE->getSubExpr();
4520 if (
auto *AIL = dyn_cast<ArrayInitLoopExpr>(
Init)) {
4526 Init = MTE->getSubExpr();
4529 Init = Binder->getSubExpr();
4532 Init = ICE->getSubExprAsWritten();
4535 dyn_cast<CXXStdInitializerListExpr>(
Init))
4572 getSema().currentEvaluationContext().InLifetimeExtendingContext =
4573 getSema().parentEvaluationContext().InLifetimeExtendingContext;
4574 getSema().currentEvaluationContext().RebuildDefaultArgOrDefaultInit =
4575 getSema().parentEvaluationContext().RebuildDefaultArgOrDefaultInit;
4577 bool ArgChanged =
false;
4579 true, NewArgs, &ArgChanged))
4590 if (
Parens.isInvalid()) {
4593 assert(NewArgs.empty() &&
4594 "no parens or braces but have direct init with arguments?");
4601template<
typename Derived>
4607 for (
unsigned I = 0; I != NumInputs; ++I) {
4617 Expr *Pattern = Expansion->getPattern();
4620 getSema().collectUnexpandedParameterPacks(Pattern, Unexpanded);
4621 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
4626 bool RetainExpansion =
false;
4627 UnsignedOrNone OrigNumExpansions = Expansion->getNumExpansions();
4631 Unexpanded,
true, Expand,
4632 RetainExpansion, NumExpansions))
4645 Expansion->getEllipsisLoc(),
4647 if (Out.isInvalid())
4652 Outputs.push_back(Out.get());
4658 if (ArgChanged) *ArgChanged =
true;
4662 for (
unsigned I = 0; I != *NumExpansions; ++I) {
4665 if (Out.isInvalid())
4668 if (Out.get()->containsUnexpandedParameterPack()) {
4670 Out.get(), Expansion->getEllipsisLoc(), OrigNumExpansions);
4671 if (Out.isInvalid())
4675 Outputs.push_back(Out.get());
4680 if (RetainExpansion) {
4681 ForgetPartiallySubstitutedPackRAII Forget(
getDerived());
4684 if (Out.isInvalid())
4688 Out.get(), Expansion->getEllipsisLoc(), OrigNumExpansions);
4689 if (Out.isInvalid())
4692 Outputs.push_back(Out.get());
4699 IsCall ?
getDerived().TransformInitializer(Inputs[I],
false)
4704 if (
Result.get() != Inputs[I] && ArgChanged)
4707 Outputs.push_back(
Result.get());
4713template <
typename Derived>
4724 VarDecl *ConditionVar = cast_or_null<VarDecl>(
4730 return getSema().ActOnConditionVariable(ConditionVar, Loc, Kind);
4739 return getSema().ActOnCondition(
nullptr, Loc, CondExpr.
get(), Kind,
4746template <
typename Derived>
4754 Qualifier = Qualifier.getAsNamespaceAndPrefix().Prefix)
4766 llvm_unreachable(
"unexpected null nested name specifier");
4797 QualifierLoc =
getDerived().TransformNestedNameSpecifierLoc(
4798 QualifierLoc, ObjectType, FirstQualifierInScope);
4802 FirstQualifierInScope =
nullptr;
4804 SS.
Adopt(QualifierLoc);
4808 if (
SemaRef.BuildCXXNestedNameSpecifier(
nullptr, IdInfo,
4810 FirstQualifierInScope,
false))
4818 T = TransformTypeInObjectScope(TLB, TL, ObjectType,
4819 FirstQualifierInScope);
4825 if (T->isDependentType() || T->isRecordType() ||
4826 (
SemaRef.getLangOpts().CPlusPlus11 && T->isEnumeralType())) {
4827 if (T->isEnumeralType())
4829 diag::warn_cxx98_compat_enum_nested_name_spec);
4836 if (!TTL || !TTL.
getDecl()->isInvalidDecl()) {
4860template<
typename Derived>
4880 TemplateDecl *NewTemplate = cast_or_null<TemplateDecl>(
4887 SemaRef.Context.DeclarationNames.getCXXDeductionGuideName(NewTemplate));
4897 NewTInfo =
getDerived().TransformType(OldTInfo);
4900 NewCanTy =
SemaRef.Context.getCanonicalType(NewTInfo->
getType());
4908 NewCanTy =
SemaRef.Context.getCanonicalType(NewT);
4921 llvm_unreachable(
"Unknown name kind.");
4924template <
typename Derived>
4928 QualType ObjectType,
bool AllowInjectedClassName) {
4930 return getDerived().RebuildTemplateName(SS, TemplateKWLoc, *II, NameLoc,
4931 ObjectType, AllowInjectedClassName);
4932 return getDerived().RebuildTemplateName(SS, TemplateKWLoc,
IO.getOperator(),
4933 NameLoc, ObjectType,
4934 AllowInjectedClassName);
4937template <
typename Derived>
4941 NamedDecl *FirstQualifierInScope,
bool AllowInjectedClassName) {
4943 TemplateName UnderlyingName = QTN->getUnderlyingTemplate();
4946 QualifierLoc =
getDerived().TransformNestedNameSpecifierLoc(
4947 QualifierLoc, ObjectType, FirstQualifierInScope);
4954 UnderlyingQualifier, TemplateKWLoc, UnderlyingName, NameLoc, ObjectType,
4955 FirstQualifierInScope, AllowInjectedClassName);
4956 if (NewUnderlyingName.
isNull())
4958 assert(!UnderlyingQualifier &&
"unexpected qualifier");
4962 NewUnderlyingName == UnderlyingName)
4965 SS.
Adopt(QualifierLoc);
4966 return getDerived().RebuildTemplateName(SS, QTN->hasTemplateKeyword(),
4972 QualifierLoc =
getDerived().TransformNestedNameSpecifierLoc(
4973 QualifierLoc, ObjectType, FirstQualifierInScope);
4987 SS.
Adopt(QualifierLoc);
4988 return getDerived().RebuildTemplateName(SS, TemplateKWLoc, DTN->getName(),
4989 NameLoc, ObjectType,
4990 AllowInjectedClassName);
4995 assert(!QualifierLoc &&
"Unexpected qualified SubstTemplateTemplateParm");
5002 ReplacementQualifierLoc = Builder.getWithLocInContext(
SemaRef.Context);
5006 ReplacementQualifierLoc, TemplateKWLoc, ReplacementName, NameLoc,
5007 ObjectType, FirstQualifierInScope, AllowInjectedClassName);
5010 Decl *AssociatedDecl =
5011 getDerived().TransformDecl(NameLoc, S->getAssociatedDecl());
5013 AssociatedDecl == S->getAssociatedDecl())
5015 return SemaRef.Context.getSubstTemplateTemplateParm(
5016 NewName, AssociatedDecl, S->getIndex(), S->getPackIndex(),
5021 assert(!QualifierLoc &&
"Unexpected qualified pack-index-template-name");
5027 IndexExpr =
getDerived().TransformExpr(PI->getIndexExpr());
5035 NoQualifier, TemplateKWLoc, N, NameLoc, ObjectType,
5036 FirstQualifierInScope, AllowInjectedClassName);
5043 bool NotYetExpanded = Names.empty();
5044 bool FullySubstituted =
true;
5046 if (Names.empty() && !PI->expandsToEmptyPack())
5050 if (!N.containsUnexpandedParameterPack()) {
5052 if (Transformed.
isNull())
5054 SubstitutedNames.push_back(Transformed);
5059 getSema().collectUnexpandedParameterPacks(N, Unexpanded);
5060 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
5062 bool ShouldExpand =
true;
5063 bool RetainExpansion =
false;
5068 RetainExpansion, NumExpansions))
5071 if (!ShouldExpand) {
5076 if (NotYetExpanded) {
5077 FullySubstituted =
false;
5078 return getDerived().RebuildPackIndexingTemplateName(
5079 Pack, IndexExpr.
get(), FullySubstituted);
5081 SubstitutedNames.push_back(Pack);
5085 for (
unsigned I = 0; I != *NumExpansions; ++I) {
5090 SubstitutedNames.push_back(Out);
5091 FullySubstituted &= !Out.containsUnexpandedParameterPack();
5096 if (RetainExpansion) {
5097 FullySubstituted =
false;
5098 ForgetPartiallySubstitutedPackRAII Forget(
getDerived());
5102 SubstitutedNames.push_back(Out);
5111 return getDerived().RebuildPackIndexingTemplateName(
5112 NewPattern, IndexExpr.
get(), FullySubstituted, SubstitutedNames);
5116 "DeducedTemplateName should not escape partial ordering");
5120 assert(!QualifierLoc &&
"Unexpected qualifier");
5127 assert(!QualifierLoc &&
5128 "Unexpected qualified SubstTemplateTemplateParmPack");
5130 SubstPack->getArgumentPack(), SubstPack->getAssociatedDecl(),
5131 SubstPack->getIndex(), SubstPack->getFinal());
5135 llvm_unreachable(
"overloaded function decl survived to here");
5138template <
typename Derived>
5147template <
typename Derived>
5152 QualifierLoc, TemplateKeywordLoc, Name, NameLoc);
5158template<
typename Derived>
5162 Output =
getSema().getTrivialTemplateArgumentLoc(
5166template <
typename Derived>
5174 llvm_unreachable(
"Unexpected TemplateArgument");
5197 if (NewT == T && D == NewD)
5214 llvm_unreachable(
"unexpected template argument kind");
5236 QualifierLoc, Input.getTemplateKWLoc(), Arg.
getAsTemplate(),
5237 Input.getTemplateNameLoc());
5241 QualifierLoc, Input.getTemplateNameLoc());
5246 llvm_unreachable(
"Caller should expand pack expansions");
5257 Expr *InputExpr = Input.getSourceExpression();
5259 InputExpr = Input.getArgument().getAsExpr();
5262 E =
SemaRef.ActOnConstantExpression(E);
5277template<
typename Derived,
typename InputIterator>
5285 typedef typename std::iterator_traits<InputIterator>::difference_type
5300 : Self(Self), Iter(Iter) { }
5315 Self.InventTemplateArgumentLoc(*Iter,
Result);
5323 return X.Iter == Y.Iter;
5328 return X.Iter != Y.Iter;
5332template<
typename Derived>
5333template<
typename InputIterator>
5352 PackLocIterator(*
this, In.getArgument().pack_begin()),
5353 PackLocIterator(*
this, In.getArgument().pack_end()), *PackOutput,
5360 if (In.getArgument().isPackExpansion()) {
5372 std::optional<ForgetSubstitutionRAII> ForgetSubst;
5382 if (Out.getArgument().containsUnexpandedParameterPack()) {
5385 if (Out.getArgument().isNull())
5395 ForgetPartiallySubstitutedPackRAII Forget(
getDerived());
5403 if (Out.getArgument().isNull())
5422template <
typename Derived>
5423template <
typename InputIterator>
5432 return !Arg.isDependent() && Arg.isConceptOrConceptTemplateParameter();
5444 PackLocIterator(*
this, In.getArgument().pack_begin()),
5445 PackLocIterator(*
this, In.getArgument().pack_end()), Outputs,
5451 if (!isNonDependentConceptArgument(In.getArgument())) {
5466template <
typename Derived>
5477 Pattern =
getSema().getTemplateArgumentPackExpansionPattern(
5480 getSema().collectUnexpandedParameterPacks(Pattern, Unexpanded);
5481 if (IsLateExpansionAttempt) {
5488 if (!SawPackTypes) {
5493 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
5501 Info.
Ellipsis, Pattern.getSourceRange(), Unexpanded,
5507 if (ComputeInfo(In,
false, Info, Pattern))
5519 std::optional<Sema::ArgPackSubstIndexRAII> SubstIndex(
5520 std::in_place,
getSema(), std::nullopt);
5526 if (Out.getArgument().isNull())
5563 ForgetSubstitutionRAII ForgetSubst(
getDerived());
5564 if (ComputeInfo(Out,
true, Info, OutPattern))
5577template<
typename Derived>
5595template <
typename Derived>
5615template<
typename Derived>
5618 switch (T.getTypeLocClass()) {
5619#define ABSTRACT_TYPELOC(CLASS, PARENT)
5620#define TYPELOC(CLASS, PARENT) \
5621 case TypeLoc::CLASS: \
5622 return getDerived().Transform##CLASS##Type(TLB, \
5623 T.castAs<CLASS##TypeLoc>());
5624#include "clang/AST/TypeLocNodes.def"
5627 llvm_unreachable(
"unhandled type loc!");
5630template<
typename Derived>
5643template <
typename Derived>
5681template<
typename Derived>
5687 auto SuppressObjCLifetime =
5690 Result = getDerived().TransformTemplateTypeParmType(TLB, TTP,
5691 SuppressObjCLifetime);
5692 }
else if (
auto STTP = UnqualTL.
getAs<SubstTemplateTypeParmPackTypeLoc>()) {
5693 Result = getDerived().TransformSubstTemplateTypeParmPackType(
5694 TLB, STTP, SuppressObjCLifetime);
5696 Result = getDerived().TransformType(TLB, UnqualTL);
5715template <
typename Derived>
5725 SemaRef.Diag(Loc, diag::err_address_space_mismatch_templ_inst)
5732 if (T.getPointerAuth().isPresent()) {
5733 SemaRef.Diag(Loc, diag::err_ptrauth_qualifier_redundant) << TL.
getType();
5736 if (!T->isDependentType()) {
5737 if (!T->isSignableType(
SemaRef.getASTContext())) {
5738 SemaRef.Diag(Loc, diag::err_ptrauth_qualifier_invalid_target) << T;
5746 if (T->isFunctionType()) {
5747 T =
SemaRef.getASTContext().getAddrSpaceQualType(T,
5757 if (T->isReferenceType()) {
5767 if (!T->isObjCLifetimeType() && !T->isDependentType())
5769 else if (T.getObjCLifetime()) {
5773 const AutoType *AutoTy;
5774 if ((AutoTy = dyn_cast<AutoType>(T)) && AutoTy->isDeduced()) {
5780 SemaRef.Context.getQualifiedType(
Deduced.getUnqualifiedType(), Qs);
5781 T =
SemaRef.Context.getAutoType(AutoTy->getDeducedKind(),
Deduced,
5782 AutoTy->getKeyword(),
5783 AutoTy->getTypeConstraintConcept(),
5784 AutoTy->getTypeConstraintArguments());
5789 SemaRef.Diag(Loc, diag::err_attr_objc_ownership_redundant) << T;
5795 return SemaRef.BuildQualifiedType(T, Loc, Quals);
5798template <
typename Derived>
5799QualType TreeTransform<Derived>::TransformTypeInObjectScope(
5802 assert(!getDerived().AlreadyTransformed(TL.
getType()));
5805 case TypeLoc::TemplateSpecialization:
5806 return getDerived().TransformTemplateSpecializationType(
5808 FirstQualifierInScope,
true);
5809 case TypeLoc::DependentName:
5810 return getDerived().TransformDependentNameType(
5812 ObjectType, FirstQualifierInScope);
5816 return getDerived().TransformType(TLB, TL);
5820template <
class TyLoc>
static inline
5822 TyLoc NewT = TLB.
push<TyLoc>(T.getType());
5823 NewT.setNameLoc(T.getNameLoc());
5827template<
typename Derived>
5828QualType TreeTransform<Derived>::TransformBuiltinType(TypeLocBuilder &TLB,
5830 BuiltinTypeLoc NewT = TLB.push<BuiltinTypeLoc>(T.getType());
5831 NewT.setBuiltinLoc(T.getBuiltinLoc());
5832 if (T.needsExtraLocalData())
5833 NewT.getWrittenBuiltinSpecs() = T.getWrittenBuiltinSpecs();
5837template<
typename Derived>
5844template <
typename Derived>
5848 return getDerived().
TransformType(TLB, TL.getOriginalLoc());
5851template<
typename Derived>
5854 QualType OriginalType = getDerived().TransformType(TLB, TL.getOriginalLoc());
5855 if (OriginalType.isNull())
5859 if (getDerived().AlwaysRebuild() ||
5860 OriginalType != TL.getOriginalLoc().getType())
5867template <
typename Derived>
5871 QualType OriginalType = getDerived().TransformType(TLB, TL.getElementLoc());
5872 if (OriginalType.isNull())
5876 if (getDerived().AlwaysRebuild() ||
5877 OriginalType != TL.getElementLoc().getType())
5884template<
typename Derived>
5888 = getDerived().TransformType(TLB, TL.getPointeeLoc());
5889 if (PointeeType.isNull())
5893 if (PointeeType->getAs<ObjCObjectType>()) {
5905 if (getDerived().AlwaysRebuild() ||
5906 PointeeType != TL.getPointeeLoc().getType()) {
5907 Result = getDerived().RebuildPointerType(PointeeType, TL.getSigilLoc());
5914 TLB.TypeWasModifiedSafely(
Result->getPointeeType());
5921template<
typename Derived>
5926 = getDerived().TransformType(TLB, TL.getPointeeLoc());
5927 if (PointeeType.isNull())
5931 if (getDerived().AlwaysRebuild() ||
5932 PointeeType != TL.getPointeeLoc().getType()) {
5933 Result = getDerived().RebuildBlockPointerType(PointeeType,
5948template<
typename Derived>
5956 if (PointeeType.
isNull())
5961 PointeeType != T->getPointeeTypeAsWritten()) {
5963 T->isSpelledAsLValue(),
5985template<
typename Derived>
5989 return TransformReferenceType(TLB, TL);
5992template<
typename Derived>
5994TreeTransform<Derived>::TransformRValueReferenceType(TypeLocBuilder &TLB,
5995 RValueReferenceTypeLoc TL) {
5996 return TransformReferenceType(TLB, TL);
5999template<
typename Derived>
6003 QualType PointeeType = getDerived().TransformType(TLB, TL.getPointeeLoc());
6004 if (PointeeType.isNull())
6011 getDerived().TransformNestedNameSpecifierLoc(OldQualifierLoc);
6012 if (!NewQualifierLoc)
6015 CXXRecordDecl *OldCls = T->getMostRecentCXXRecordDecl(), *NewCls =
nullptr;
6017 NewCls = cast_or_null<CXXRecordDecl>(
6018 getDerived().TransformDecl(TL.getStarLoc(), OldCls));
6024 if (getDerived().AlwaysRebuild() || PointeeType != T->getPointeeType() ||
6025 NewQualifierLoc.getNestedNameSpecifier() !=
6026 OldQualifierLoc.getNestedNameSpecifier() ||
6029 SS.
Adopt(NewQualifierLoc);
6030 Result = getDerived().RebuildMemberPointerType(PointeeType, SS, NewCls,
6039 if (MPT && PointeeType != MPT->getPointeeType()) {
6046 NewTL.setQualifierLoc(NewQualifierLoc);
6051template<
typename Derived>
6056 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
6057 if (ElementType.isNull())
6061 Expr *OldSize = TL.getSizeExpr();
6063 OldSize =
const_cast<Expr*
>(T->getSizeExpr());
6064 Expr *NewSize =
nullptr;
6068 NewSize = getDerived().TransformExpr(OldSize).template getAs<Expr>();
6073 if (getDerived().AlwaysRebuild() ||
6074 ElementType != T->getElementType() ||
6075 (T->getSizeExpr() && NewSize != OldSize)) {
6076 Result = getDerived().RebuildConstantArrayType(ElementType,
6077 T->getSizeModifier(),
6078 T->getSize(), NewSize,
6079 T->getIndexTypeCVRQualifiers(),
6080 TL.getBracketsRange());
6091 NewTL.setRBracketLoc(TL.getRBracketLoc());
6092 NewTL.setSizeExpr(NewSize);
6097template<
typename Derived>
6102 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
6103 if (ElementType.isNull())
6107 if (getDerived().AlwaysRebuild() ||
6108 ElementType != T->getElementType()) {
6109 Result = getDerived().RebuildIncompleteArrayType(ElementType,
6110 T->getSizeModifier(),
6111 T->getIndexTypeCVRQualifiers(),
6112 TL.getBracketsRange());
6119 NewTL.setRBracketLoc(TL.getRBracketLoc());
6120 NewTL.setSizeExpr(
nullptr);
6125template<
typename Derived>
6130 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
6131 if (ElementType.isNull())
6138 SizeResult = getDerived().TransformExpr(T->getSizeExpr());
6140 if (SizeResult.isInvalid())
6144 if (SizeResult.isInvalid())
6150 if (getDerived().AlwaysRebuild() ||
6151 ElementType != T->getElementType() ||
6152 Size != T->getSizeExpr()) {
6153 Result = getDerived().RebuildVariableArrayType(ElementType,
6154 T->getSizeModifier(),
6156 T->getIndexTypeCVRQualifiers(),
6157 TL.getBracketsRange());
6166 NewTL.setRBracketLoc(TL.getRBracketLoc());
6167 NewTL.setSizeExpr(Size);
6172template<
typename Derived>
6177 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
6178 if (ElementType.isNull())
6186 SemaRef.
ExprEvalContexts.back().InConditionallyConstantEvaluateContext =
true;
6189 Expr *origSize = TL.getSizeExpr();
6190 if (!origSize) origSize = T->getSizeExpr();
6193 = getDerived().TransformExpr(origSize);
6195 if (sizeResult.isInvalid())
6198 Expr *size = sizeResult.get();
6201 if (getDerived().AlwaysRebuild() ||
6202 ElementType != T->getElementType() ||
6204 Result = getDerived().RebuildDependentSizedArrayType(ElementType,
6205 T->getSizeModifier(),
6207 T->getIndexTypeCVRQualifiers(),
6208 TL.getBracketsRange());
6217 NewTL.setRBracketLoc(TL.getRBracketLoc());
6218 NewTL.setSizeExpr(size);
6223template <
typename Derived>
6227 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
6228 if (ElementType.isNull())
6234 Expr *OrigSize = TL.getSizeExpr();
6237 if (
Size.isInvalid())
6241 if (getDerived().AlwaysRebuild() || ElementType != T->getElementType() ||
6242 Size.get() != OrigSize) {
6243 Result = getDerived().RebuildDependentVectorType(
6244 ElementType,
Size.get(), T->getAttributeLoc(), T->getVectorKind());
6254 NewTL.setAttrNameLoc(TL.getAttrNameLoc());
6255 NewTL.setSizeExpr(
Size.get());
6259 NewTL.setAttrNameLoc(TL.getAttrNameLoc());
6260 NewTL.setSizeExpr(
Size.get());
6266template<
typename Derived>
6272 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
6273 if (ElementType.isNull())
6280 Expr *OrigSize = TL.getSizeExpr();
6283 if (
Size.isInvalid())
6287 if (getDerived().AlwaysRebuild() || ElementType != T->getElementType() ||
6288 Size.get() != OrigSize) {
6289 Result = getDerived().RebuildDependentSizedExtVectorType(
6290 ElementType,
Size.get(), T->getAttributeLoc());
6300 NewTL.setAttrNameLoc(TL.getAttrNameLoc());
6301 NewTL.setSizeExpr(
Size.get());
6305 NewTL.setAttrNameLoc(TL.getAttrNameLoc());
6306 NewTL.setSizeExpr(
Size.get());
6312template <
typename Derived>
6317 QualType ElementType = getDerived().TransformType(T->getElementType());
6318 if (ElementType.isNull())
6322 if (getDerived().AlwaysRebuild() || ElementType != T->getElementType()) {
6323 Result = getDerived().RebuildConstantMatrixType(
6324 ElementType, T->getNumRows(), T->getNumColumns(), TL.getAttrNameLoc());
6331 NewTL.setAttrOperandParensRange(TL.getAttrOperandParensRange());
6332 NewTL.setAttrRowOperand(TL.getAttrRowOperand());
6333 NewTL.setAttrColumnOperand(TL.getAttrColumnOperand());
6338template <
typename Derived>
6342 QualType ElementType = getDerived().TransformType(T->getElementType());
6343 if (ElementType.isNull())
6347 if (getDerived().AlwaysRebuild() || ElementType != T->getElementType()) {
6348 Result = getDerived().RebuildCooperativeMatrixType(
6349 ElementType, T->getScope(), T->getNumRows(), T->getNumColumns(),
6357 NewTL.setAttrOperandParensRange(TL.getAttrOperandParensRange());
6358 NewTL.setAttrScopeOperand(TL.getAttrScopeOperand());
6359 NewTL.setAttrRowOperand(TL.getAttrRowOperand());
6360 NewTL.setAttrColumnOperand(TL.getAttrColumnOperand());
6361 NewTL.setAttrUseOperand(TL.getAttrUseOperand());
6366template <
typename Derived>
6371 QualType ElementType = getDerived().TransformType(T->getElementType());
6372 if (ElementType.isNull()) {
6380 Expr *origRows = TL.getAttrRowOperand();
6382 origRows = T->getRowExpr();
6383 Expr *origColumns = TL.getAttrColumnOperand();
6385 origColumns = T->getColumnExpr();
6387 ExprResult rowResult = getDerived().TransformExpr(origRows);
6389 if (rowResult.isInvalid())
6392 ExprResult columnResult = getDerived().TransformExpr(origColumns);
6394 if (columnResult.isInvalid())
6397 Expr *rows = rowResult.get();
6398 Expr *columns = columnResult.get();
6401 if (getDerived().AlwaysRebuild() || ElementType != T->getElementType() ||
6402 rows != origRows || columns != origColumns) {
6403 Result = getDerived().RebuildDependentSizedMatrixType(
6404 ElementType, rows, columns, T->getAttributeLoc());
6414 NewTL.setAttrOperandParensRange(TL.getAttrOperandParensRange());
6415 NewTL.setAttrRowOperand(rows);
6416 NewTL.setAttrColumnOperand(columns);
6420template <
typename Derived>
6426 getDerived().TransformType(TLB, TL.getPointeeTypeLoc());
6435 ExprResult AddrSpace = getDerived().TransformExpr(T->getAddrSpaceExpr());
6437 if (AddrSpace.isInvalid())
6441 if (getDerived().AlwaysRebuild() ||
pointeeType != T->getPointeeType() ||
6442 AddrSpace.get() != T->getAddrSpaceExpr()) {
6443 Result = getDerived().RebuildDependentAddressSpaceType(
6444 pointeeType, AddrSpace.get(), T->getAttributeLoc());
6455 NewTL.setAttrExprOperand(TL.getAttrExprOperand());
6456 NewTL.setAttrNameLoc(TL.getAttrNameLoc());
6459 TLB.TypeWasModifiedSafely(
Result);
6465template <
typename Derived>
6469 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
6470 if (ElementType.isNull())
6474 if (getDerived().AlwaysRebuild() ||
6475 ElementType != T->getElementType()) {
6476 Result = getDerived().RebuildVectorType(ElementType, T->getNumElements(),
6477 T->getVectorKind());
6484 NewTL.setAttrNameLoc(TL.getAttrNameLoc());
6485 NewTL.setSizeExpr(TL.getSizeExpr());
6490template<
typename Derived>
6494 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
6495 if (ElementType.isNull())
6499 if (getDerived().AlwaysRebuild() ||
6500 ElementType != T->getElementType()) {
6501 Result = getDerived().RebuildExtVectorType(ElementType, T->getNumElements(),
6502 TL.getAttrNameLoc());
6509 NewTL.setAttrNameLoc(TL.getAttrNameLoc());
6510 NewTL.setSizeExpr(TL.getSizeExpr());
6515template <
typename Derived>
6518 bool ExpectParameterPack) {
6553 if (NewTSI == OldTSI && indexAdjustment == 0)
6563 getDerived().transformedLocalDecl(OldParm, {newParm});
6567template <
typename Derived>
6575 unsigned *LastParamTransformed) {
6576 int indexAdjustment = 0;
6578 unsigned NumParams = Params.size();
6579 for (
unsigned i = 0; i != NumParams; ++i) {
6580 if (LastParamTransformed)
6581 *LastParamTransformed = i;
6583 assert(OldParm->getFunctionScopeIndex() == i);
6587 if (OldParm->isParameterPack()) {
6592 TypeLoc TL = OldParm->getTypeSourceInfo()->getTypeLoc();
6595 SemaRef.collectUnexpandedParameterPacks(Pattern, Unexpanded);
6598 bool ShouldExpand =
false;
6599 bool RetainExpansion =
false;
6601 if (Unexpanded.size() > 0) {
6602 OrigNumExpansions = ExpansionTL.
getTypePtr()->getNumExpansions();
6603 NumExpansions = OrigNumExpansions;
6607 ShouldExpand, RetainExpansion, NumExpansions)) {
6612 const AutoType *AT =
6613 Pattern.getType().getTypePtr()->getContainedAutoType();
6614 assert((AT && (!AT->isDeduced() || AT->getDeducedType().isNull())) &&
6615 "Could not find parameter packs or undeduced auto type!");
6622 getDerived().ExpandingFunctionParameterPack(OldParm);
6623 for (
unsigned I = 0; I != *NumExpansions; ++I) {
6626 =
getDerived().TransformFunctionTypeParam(OldParm,
6634 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6635 OutParamTypes.push_back(NewParm->
getType());
6637 PVars->push_back(NewParm);
6642 if (RetainExpansion) {
6643 ForgetPartiallySubstitutedPackRAII Forget(
getDerived());
6645 =
getDerived().TransformFunctionTypeParam(OldParm,
6653 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6654 OutParamTypes.push_back(NewParm->
getType());
6656 PVars->push_back(NewParm);
6672 NewParm =
getDerived().TransformFunctionTypeParam(OldParm,
6677 "Parameter pack no longer a parameter pack after "
6680 NewParm =
getDerived().TransformFunctionTypeParam(
6681 OldParm, indexAdjustment, std::nullopt,
6689 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6690 OutParamTypes.push_back(NewParm->
getType());
6692 PVars->push_back(NewParm);
6700 bool IsPackExpansion =
false;
6703 if (
const PackExpansionType *Expansion
6704 = dyn_cast<PackExpansionType>(OldType)) {
6706 QualType Pattern = Expansion->getPattern();
6708 getSema().collectUnexpandedParameterPacks(Pattern, Unexpanded);
6711 bool ShouldExpand =
false;
6712 bool RetainExpansion =
false;
6716 RetainExpansion, NumExpansions)) {
6723 for (
unsigned I = 0; I != *NumExpansions; ++I) {
6730 NewType =
getSema().getASTContext().getPackExpansionType(
6731 NewType, std::nullopt);
6738 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6739 OutParamTypes.push_back(NewType);
6741 PVars->push_back(
nullptr);
6750 if (RetainExpansion) {
6751 ForgetPartiallySubstitutedPackRAII Forget(
getDerived());
6757 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6758 OutParamTypes.push_back(NewType);
6760 PVars->push_back(
nullptr);
6765 OldType = Expansion->getPattern();
6766 IsPackExpansion =
true;
6768 NewType =
getDerived().TransformType(OldType);
6770 NewType =
getDerived().TransformType(OldType);
6776 if (IsPackExpansion)
6777 NewType =
getSema().Context.getPackExpansionType(NewType,
6781 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6782 OutParamTypes.push_back(NewType);
6784 PVars->push_back(
nullptr);
6789 for (
unsigned i = 0, e = PVars->size(); i != e; ++i)
6791 assert(parm->getFunctionScopeIndex() == i);
6798template<
typename Derived>
6803 return getDerived().TransformFunctionProtoType(
6807 ExceptionStorage, Changed);
6811template<
typename Derived>
template<
typename Fn>
6830 if (T->hasTrailingReturn()) {
6834 T->getExtParameterInfosOrNull(),
6835 ParamTypes, &ParamDecls, ExtParamInfos))
6845 auto *RD = dyn_cast<CXXRecordDecl>(
SemaRef.getCurLexicalContext());
6847 SemaRef, !ThisContext && RD ? RD : ThisContext, ThisTypeQuals);
6862 T->getExtParameterInfosOrNull(),
6863 ParamTypes, &ParamDecls, ExtParamInfos))
6869 bool EPIChanged =
false;
6874 if (
auto NewExtParamInfos =
6890 std::optional<FunctionEffectSet> NewFX;
6902 std::optional<FunctionEffectMode> Mode =
6922 "FunctionEffectMode::None shouldn't be possible here");
6925 if (!
SemaRef.diagnoseConflictingFunctionEffect(*NewFX, NewEC,
6928 NewFX->insert(NewEC, Errs);
6929 assert(Errs.empty());
6938 T->getParamTypes() !=
llvm::ArrayRef(ParamTypes) || EPIChanged) {
6939 Result =
getDerived().RebuildFunctionProtoType(ResultType, ParamTypes, EPI);
6950 for (
unsigned i = 0, e = NewTL.
getNumParams(); i != e; ++i)
6956template<
typename Derived>
6979 getSema().ActOnNoexceptSpec(NoexceptExpr.
get(), EST);
6994 if (
const PackExpansionType *PackExpansion =
6995 T->getAs<PackExpansionType>()) {
7000 SemaRef.collectUnexpandedParameterPacks(PackExpansion->getPattern(),
7002 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
7007 bool Expand =
false;
7008 bool RetainExpansion =
false;
7009 UnsignedOrNone NumExpansions = PackExpansion->getNumExpansions();
7014 true, Expand, RetainExpansion,
7027 U =
SemaRef.Context.getPackExpansionType(
U, NumExpansions);
7028 Exceptions.push_back(
U);
7034 for (
unsigned ArgIdx = 0; ArgIdx != *NumExpansions; ++ArgIdx) {
7038 if (
U.isNull() ||
SemaRef.CheckSpecifiedExceptionType(
U, Loc))
7041 Exceptions.push_back(
U);
7045 if (
U.isNull() ||
SemaRef.CheckSpecifiedExceptionType(
U, Loc))
7050 Exceptions.push_back(
U);
7060template<
typename Derived>
7070 if (getDerived().AlwaysRebuild() || ResultType != T->getReturnType())
7071 Result = getDerived().RebuildFunctionNoProtoType(ResultType);
7082template <
typename Derived>
7083QualType TreeTransform<Derived>::TransformUnresolvedUsingType(
7084 TypeLocBuilder &TLB, UnresolvedUsingTypeLoc TL) {
7086 const UnresolvedUsingType *T = TL.getTypePtr();
7087 bool Changed =
false;
7089 NestedNameSpecifierLoc QualifierLoc = TL.getQualifierLoc();
7090 if (NestedNameSpecifierLoc OldQualifierLoc = QualifierLoc) {
7091 QualifierLoc = getDerived().TransformNestedNameSpecifierLoc(QualifierLoc);
7094 Changed |= QualifierLoc != OldQualifierLoc;
7097 auto *D = getDerived().TransformDecl(TL.getNameLoc(), T->getDecl());
7103 if (getDerived().AlwaysRebuild() || Changed) {
7104 Result = getDerived().RebuildUnresolvedUsingType(
7105 T->getKeyword(), QualifierLoc.getNestedNameSpecifier(), TL.getNameLoc(),
7113 QualifierLoc, TL.getNameLoc());
7116 QualifierLoc, TL.getNameLoc());
7120template <
typename Derived>
7128 QualifierLoc = getDerived().TransformNestedNameSpecifierLoc(QualifierLoc);
7131 Changed |= QualifierLoc != OldQualifierLoc;
7134 auto *D = cast_or_null<UsingShadowDecl>(
7135 getDerived().TransformDecl(TL.getNameLoc(), T->getDecl()));
7140 QualType UnderlyingType = getDerived().TransformType(T->desugar());
7141 if (UnderlyingType.isNull())
7143 Changed |= UnderlyingType != T->desugar();
7146 if (getDerived().AlwaysRebuild() || Changed) {
7147 Result = getDerived().RebuildUsingType(
7148 T->getKeyword(), QualifierLoc.getNestedNameSpecifier(), D,
7158template<
typename Derived>
7166 QualifierLoc = getDerived().TransformNestedNameSpecifierLoc(QualifierLoc);
7169 Changed |= QualifierLoc != OldQualifierLoc;
7172 auto *
Typedef = cast_or_null<TypedefNameDecl>(
7173 getDerived().TransformDecl(TL.getNameLoc(), T->getDecl()));
7181 if (getDerived().AlwaysRebuild() || Changed) {
7182 Result = getDerived().RebuildTypedefType(
7183 T->getKeyword(), QualifierLoc.getNestedNameSpecifier(),
Typedef);
7189 QualifierLoc, TL.getNameLoc());
7193template<
typename Derived>
7201 ExprResult E = getDerived().TransformExpr(TL.getUnderlyingExpr());
7211 if (getDerived().AlwaysRebuild() || E.get() != TL.getUnderlyingExpr()) {
7213 getDerived().RebuildTypeOfExprType(E.get(), TL.getTypeofLoc(), Kind);
7220 NewTL.setLParenLoc(TL.getLParenLoc());
7221 NewTL.setRParenLoc(TL.getRParenLoc());
7226template<
typename Derived>
7230 TypeSourceInfo* New_Under_TI = getDerived().TransformType(Old_Under_TI);
7236 if (getDerived().AlwaysRebuild() || New_Under_TI != Old_Under_TI) {
7237 Result = getDerived().RebuildTypeOfType(New_Under_TI->getType(), Kind);
7244 NewTL.setLParenLoc(TL.getLParenLoc());
7245 NewTL.setRParenLoc(TL.getRParenLoc());
7246 NewTL.setUnmodifiedTInfo(New_Under_TI);
7251template<
typename Derived>
7254 const DecltypeType *T = TL.getTypePtr();
7261 ExprResult E = getDerived().TransformExpr(T->getUnderlyingExpr());
7265 E = getSema().ActOnDecltypeExpression(E.get());
7270 if (getDerived().AlwaysRebuild() ||
7271 E.get() != T->getUnderlyingExpr()) {
7272 Result = getDerived().RebuildDecltypeType(E.get(), TL.getDecltypeLoc());
7280 NewTL.setRParenLoc(TL.getRParenLoc());
7284template <
typename Derived>
7294 IndexExpr = getDerived().TransformExpr(TL.getIndexExpr());
7295 if (IndexExpr.isInvalid())
7298 QualType Pattern = TL.getPattern();
7300 const PackIndexingType *PIT = TL.getTypePtr();
7304 bool NotYetExpanded = Types.empty();
7305 bool FullySubstituted =
true;
7307 if (Types.empty() && !PIT->expandsToEmptyPack())
7311 if (!T->containsUnexpandedParameterPack()) {
7312 QualType Transformed = getDerived().TransformType(T);
7313 if (Transformed.isNull())
7315 SubtitutedTypes.push_back(Transformed);
7320 getSema().collectUnexpandedParameterPacks(T, Unexpanded);
7321 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
7324 bool ShouldExpand =
true;
7325 bool RetainExpansion =
false;
7327 if (getDerived().TryExpandParameterPacks(
7330 RetainExpansion, NumExpansions))
7332 if (!ShouldExpand) {
7338 QualType Pack = getDerived().TransformType(TLB, TI->getTypeLoc());
7341 if (NotYetExpanded) {
7342 FullySubstituted =
false;
7343 QualType Out = getDerived().RebuildPackIndexingType(
7344 Pack, IndexExpr.get(), TL.getBeginLoc(), FullySubstituted);
7352 SubtitutedTypes.push_back(Pack);
7355 for (
unsigned I = 0; I != *NumExpansions; ++I) {
7360 SubtitutedTypes.push_back(Out);
7361 FullySubstituted &= !
Out->containsUnexpandedParameterPack();
7365 if (RetainExpansion) {
7366 FullySubstituted =
false;
7367 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
7371 SubtitutedTypes.push_back(Out);
7379 QualType Result = getDerived().TransformType(TLB, TL.getPatternLoc());
7381 QualType Out = getDerived().RebuildPackIndexingType(
7382 Result, IndexExpr.get(), TL.getBeginLoc(), FullySubstituted,
7392template<
typename Derived>
7398 if (
Result->isDependentType()) {
7399 const UnaryTransformType *T = TL.getTypePtr();
7401 NewBaseTSI = getDerived().TransformType(TL.getUnderlyingTInfo());
7404 QualType NewBase = NewBaseTSI->getType();
7406 Result = getDerived().RebuildUnaryTransformType(NewBase,
7415 NewTL.setParensRange(TL.getParensRange());
7416 NewTL.setUnderlyingTInfo(NewBaseTSI);
7420template<
typename Derived>
7423 const DeducedTemplateSpecializationType *T = TL.getTypePtr();
7428 TL.getTemplateNameLoc());
7432 QualType OldDeduced = T->getDeducedType();
7434 if (!OldDeduced.isNull()) {
7435 NewDeduced = getDerived().TransformType(OldDeduced);
7436 if (NewDeduced.isNull())
7440 QualType Result = getDerived().RebuildDeducedTemplateSpecializationType(
7448 NewTL.setTemplateNameLoc(TL.getTemplateNameLoc());
7449 NewTL.setQualifierLoc(QualifierLoc);
7453template <
typename Derived>
7460 QualifierLoc =
getDerived().TransformNestedNameSpecifierLoc(QualifierLoc);
7465 auto *TD = cast_or_null<TagDecl>(
7472 TD != T->getDecl()) {
7473 if (T->isCanonicalUnqualified())
7490template <
typename Derived>
7496template <
typename Derived>
7497QualType TreeTransform<Derived>::TransformRecordType(TypeLocBuilder &TLB,
7499 return getDerived().TransformTagType(TLB, TL);
7502template<
typename Derived>
7509template<
typename Derived>
7513 return getDerived().TransformTemplateTypeParmType(
7518template <
typename Derived>
7524template<
typename Derived>
7525QualType TreeTransform<Derived>::TransformSubstTemplateTypeParmType(
7526 TypeLocBuilder &TLB,
7527 SubstTemplateTypeParmTypeLoc TL) {
7528 const SubstTemplateTypeParmType *T = TL.getTypePtr();
7531 getDerived().TransformDecl(TL.getNameLoc(), T->getAssociatedDecl());
7536 TemporaryBase Rebase(*
this, TL.getNameLoc(), DeclarationName());
7537 QualType Replacement = getDerived().TransformType(T->getReplacementType());
7538 if (Replacement.isNull())
7542 Replacement, NewReplaced, T->getIndex(), T->getPackIndex(),
7546 SubstTemplateTypeParmTypeLoc NewTL
7547 = TLB.push<SubstTemplateTypeParmTypeLoc>(
Result);
7548 NewTL.setNameLoc(TL.getNameLoc());
7552template <
typename Derived>
7558template<
typename Derived>
7562 return getDerived().TransformSubstTemplateTypeParmPackType(
7566template <
typename Derived>
7572template<
typename Derived>
7573QualType TreeTransform<Derived>::TransformAtomicType(TypeLocBuilder &TLB,
7575 QualType ValueType = getDerived().TransformType(TLB, TL.getValueLoc());
7576 if (ValueType.isNull())
7579 QualType
Result = TL.getType();
7580 if (getDerived().AlwaysRebuild() ||
7581 ValueType != TL.getValueLoc().getType()) {
7582 Result = getDerived().RebuildAtomicType(ValueType, TL.getKWLoc());
7589 NewTL.setLParenLoc(TL.getLParenLoc());
7590 NewTL.setRParenLoc(TL.getRParenLoc());
7595template <
typename Derived>
7598 QualType ValueType = getDerived().TransformType(TLB, TL.getValueLoc());
7599 if (ValueType.isNull())
7603 if (getDerived().AlwaysRebuild() || ValueType != TL.getValueLoc().getType()) {
7606 Result = getDerived().RebuildPipeType(ValueType, TL.getKWLoc(), isReadPipe);
7617template <
typename Derived>
7623 if (getDerived().AlwaysRebuild()) {
7624 Result = getDerived().RebuildBitIntType(EIT->isUnsigned(),
7625 EIT->getNumBits(), TL.getNameLoc());
7635template <
typename Derived>
7642 ExprResult BitsExpr = getDerived().TransformExpr(EIT->getNumBitsExpr());
7645 if (BitsExpr.isInvalid())
7650 if (getDerived().AlwaysRebuild() || BitsExpr.get() != EIT->getNumBitsExpr()) {
7651 Result = getDerived().RebuildDependentBitIntType(
7652 EIT->isUnsigned(), BitsExpr.get(), TL.getNameLoc());
7668template <
typename Derived>
7671 llvm_unreachable(
"This type does not need to be transformed.");
7679 template<
typename ArgLocContainer>
7681 ArgLocContainer *Container;
7706 : Container(&Container), Index(Index) { }
7720 return Container->getArgLoc(Index);
7724 return pointer(Container->getArgLoc(Index));
7729 return X.Container == Y.Container &&
X.Index == Y.Index;
7738template<
typename Derived>
7739QualType TreeTransform<Derived>::TransformAutoType(TypeLocBuilder &TLB,
7741 const AutoType *T = TL.getTypePtr();
7742 QualType OldDeduced = T->getDeducedType();
7743 QualType NewDeduced;
7744 if (!OldDeduced.isNull()) {
7745 NewDeduced = getDerived().TransformType(OldDeduced);
7746 if (NewDeduced.isNull())
7753 if (T->isConstrained()) {
7754 assert(TL.getConceptReference());
7755 NewCD = getDerived().TransformConceptTemplateName(
7756 T->getTypeConstraintConcept(), TL.getConceptNameLoc());
7760 NewTemplateArgs.setLAngleLoc(TL.getLAngleLoc());
7761 NewTemplateArgs.setRAngleLoc(TL.getRAngleLoc());
7763 if (getDerived().TransformTemplateArguments(
7764 ArgIterator(TL, 0), ArgIterator(TL, TL.getNumArgs()),
7768 if (TL.getNestedNameSpecifierLoc()) {
7770 = getDerived().TransformNestedNameSpecifierLoc(
7771 TL.getNestedNameSpecifierLoc());
7772 if (!NewNestedNameSpec)
7778 if (getDerived().AlwaysRebuild() || NewDeduced != OldDeduced ||
7779 T->isDependentType() || T->isConstrained()) {
7782 NewArgList.reserve(NewTemplateArgs.size());
7783 for (
const auto &ArgLoc : NewTemplateArgs.arguments())
7784 NewArgList.push_back(ArgLoc.getArgument());
7785 Result = getDerived().RebuildAutoType(
7787 NewDeduced, T->getKeyword(), NewCD, NewArgList);
7794 NewTL.setRParenLoc(TL.getRParenLoc());
7795 NewTL.setConceptReference(
nullptr);
7797 if (T->isConstrained()) {
7801 TL.getConceptNameLoc())
7806 SemaRef.
Context, NewNestedNameSpec, TL.getTemplateKWLoc(), DNI,
7807 TL.getFoundDecl(), TL.getTypePtr()->getTypeConstraintConcept(),
7809 NewTL.setConceptReference(CR);
7815template <
typename Derived>
7818 return getDerived().TransformTemplateSpecializationType(
7823template <
typename Derived>
7826 NamedDecl *FirstQualifierInScope,
bool AllowInjectedClassName) {
7827 const TemplateSpecializationType *T = TL.
getTypePtr();
7833 AllowInjectedClassName);
7842 if (getDerived().TransformTemplateArguments(ArgIterator(TL, 0),
7851 QualType Result = getDerived().RebuildTemplateSpecializationType(
7864template <
typename Derived>
7868 QualType modifiedType = getDerived().TransformType(TLB, TL.getModifiedLoc());
7869 if (modifiedType.isNull())
7876 oldType->getAttrKind(), modifiedType,
7877 TL.getAttr() ? TL.getAttr()->getLocation()
7878 : TL.getModifiedLoc().getBeginLoc()))
7882 const Attr *oldAttr = TL.getAttr();
7883 const Attr *newAttr = oldAttr ? getDerived().TransformAttr(oldAttr) :
nullptr;
7884 if (oldAttr && !newAttr)
7890 if (getDerived().AlwaysRebuild() ||
7891 modifiedType != oldType->getModifiedType()) {
7904 QualType equivalentType = modifiedType;
7905 if (TL.getModifiedLoc().getType() != TL.getEquivalentTypeLoc().getType()) {
7907 AuxiliaryTLB.
reserve(TL.getFullDataSize());
7909 getDerived().TransformType(AuxiliaryTLB, TL.getEquivalentTypeLoc());
7910 if (equivalentType.isNull())
7915 if (oldType->getAttrKind() == attr::HLSLRowMajor)
7918 else if (oldType->getAttrKind() == attr::HLSLColumnMajor)
7925 if (
auto nullability = oldType->getImmediateNullability()) {
7926 if (!modifiedType->canHaveNullability()) {
7927 SemaRef.
Diag((TL.getAttr() ? TL.getAttr()->getLocation()
7928 : TL.getModifiedLoc().getBeginLoc()),
7929 diag::err_nullability_nonpointer)
7946template <
typename Derived>
7950 QualType InnerTy = getDerived().TransformType(TLB, TL.getInnerLoc());
7951 if (InnerTy.isNull())
7954 Expr *OldCount = TL.getCountExpr();
7955 Expr *NewCount =
nullptr;
7957 ExprResult CountResult = getDerived().TransformExpr(OldCount);
7958 if (CountResult.isInvalid())
7960 NewCount = CountResult.get();
7964 if (getDerived().AlwaysRebuild() || InnerTy != OldTy->desugar() ||
7965 OldCount != NewCount) {
7968 InnerTy, NewCount, OldTy->isCountInBytes(), OldTy->isOrNull());
7975template <
typename Derived>
7980 QualType InnerTy = getDerived().TransformType(TLB, TL.getInnerLoc());
7981 if (InnerTy.isNull())
7985 if (getDerived().AlwaysRebuild() || InnerTy != OldTy->getWrappedType()) {
7987 InnerTy, OldTy->getLateParsedAttribute());
7995template <
typename Derived>
7999 llvm_unreachable(
"Unexpected TreeTransform for BTFTagAttributedType");
8002template <
typename Derived>
8005 const OverflowBehaviorType *OldTy = TL.getTypePtr();
8006 QualType InnerTy = getDerived().TransformType(TLB, TL.getWrappedLoc());
8007 if (InnerTy.isNull())
8011 if (getDerived().AlwaysRebuild() || InnerTy != OldTy->getUnderlyingType()) {
8023template <
typename Derived>
8027 const HLSLAttributedResourceType *oldType = TL.getTypePtr();
8029 QualType WrappedTy = getDerived().TransformType(TLB, TL.getWrappedLoc());
8030 if (WrappedTy.isNull())
8034 QualType OldContainedTy = oldType->getContainedType();
8036 if (!OldContainedTy.isNull()) {
8037 TypeSourceInfo *oldContainedTSI = TL.getContainedTypeSourceInfo();
8038 if (!oldContainedTSI)
8039 oldContainedTSI = getSema().getASTContext().getTrivialTypeSourceInfo(
8041 ContainedTSI = getDerived().TransformType(oldContainedTSI);
8044 ContainedTy = ContainedTSI->getType();
8047 HLSLAttributedResourceType::Attributes Attrs = oldType->getAttrs();
8048 if (Attrs.SampleCountExpr) {
8050 getDerived().TransformExpr(Attrs.SampleCountExpr);
8051 if (SampleCountResult.isInvalid())
8053 Attrs.SampleCountExpr = SampleCountResult.get();
8057 if (getDerived().AlwaysRebuild() || WrappedTy != oldType->getWrappedType() ||
8058 ContainedTy != oldType->getContainedType() ||
8059 Attrs.SampleCountExpr != oldType->getSampleCountExpr()) {
8061 ContainedTy, Attrs);
8067 NewTL.setContainedTypeSourceInfo(ContainedTSI);
8071template <
typename Derived>
8075 return TL.getType();
8078template<
typename Derived>
8082 QualType Inner = getDerived().TransformType(TLB, TL.getInnerLoc());
8087 if (getDerived().AlwaysRebuild() ||
8088 Inner != TL.getInnerLoc().getType()) {
8089 Result = getDerived().RebuildParenType(Inner);
8096 NewTL.setRParenLoc(TL.getRParenLoc());
8100template <
typename Derived>
8104 QualType Inner = getDerived().TransformType(TLB, TL.getInnerLoc());
8109 if (getDerived().AlwaysRebuild() || Inner != TL.getInnerLoc().getType()) {
8111 getDerived().RebuildMacroQualifiedType(Inner, TL.getMacroIdentifier());
8121template<
typename Derived>
8122QualType TreeTransform<Derived>::TransformDependentNameType(
8124 return TransformDependentNameType(TLB, TL,
false);
8127template <
typename Derived>
8128QualType TreeTransform<Derived>::TransformDependentNameType(
8131 const DependentNameType *T = TL.
getTypePtr();
8135 QualifierLoc = getDerived().TransformNestedNameSpecifierLoc(
8136 QualifierLoc, ObjectType, UnqualLookup);
8140 assert((ObjectType.isNull() && !UnqualLookup) &&
8141 "must be transformed by TransformNestedNameSpecifierLoc");
8145 = getDerived().RebuildDependentNameType(T->getKeyword(),
8146 TL.getElaboratedKeywordLoc(),
8157 NewTL.setQualifierLoc(QualifierLoc);
8158 NewTL.setNameLoc(TL.getNameLoc());
8162 NewTL.setTemplateNameLoc(TL.getNameLoc());
8163 NewTL.setQualifierLoc(QualifierLoc);
8166 QualifierLoc, TL.getNameLoc());
8169 NewTL.
set(TL.getElaboratedKeywordLoc(), QualifierLoc, TL.getNameLoc());
8173 NewTL.setQualifierLoc(QualifierLoc);
8174 NewTL.setNameLoc(TL.getNameLoc());
8179template<
typename Derived>
8183 = getDerived().TransformType(TLB, TL.getPatternLoc());
8184 if (Pattern.isNull())
8188 if (getDerived().AlwaysRebuild() ||
8189 Pattern != TL.getPatternLoc().getType()) {
8190 Result = getDerived().RebuildPackExpansionType(Pattern,
8191 TL.getPatternLoc().getSourceRange(),
8192 TL.getEllipsisLoc(),
8193 TL.getTypePtr()->getNumExpansions());
8203template<
typename Derived>
8208 TLB.pushFullCopy(TL);
8209 return TL.getType();
8212template<
typename Derived>
8216 const ObjCTypeParamType *T = TL.getTypePtr();
8218 getDerived().TransformDecl(T->getDecl()->getLocation(), T->getDecl()));
8223 if (getDerived().AlwaysRebuild() ||
8224 OTP != T->getDecl()) {
8225 Result = getDerived().RebuildObjCTypeParamType(
8226 OTP, TL.getProtocolLAngleLoc(),
8227 llvm::ArrayRef(TL.getTypePtr()->qual_begin(), TL.getNumProtocols()),
8228 TL.getProtocolLocs(), TL.getProtocolRAngleLoc());
8234 if (TL.getNumProtocols()) {
8235 NewTL.setProtocolLAngleLoc(TL.getProtocolLAngleLoc());
8236 for (
unsigned i = 0, n = TL.getNumProtocols(); i != n; ++i)
8237 NewTL.setProtocolLoc(i, TL.getProtocolLoc(i));
8238 NewTL.setProtocolRAngleLoc(TL.getProtocolRAngleLoc());
8243template<
typename Derived>
8248 QualType BaseType = getDerived().TransformType(TLB, TL.getBaseLoc());
8249 if (BaseType.isNull())
8252 bool AnyChanged = BaseType != TL.getBaseLoc().getType();
8256 for (
unsigned i = 0, n = TL.getNumTypeArgs(); i != n; ++i) {
8258 TypeLoc TypeArgLoc = TypeArgInfo->getTypeLoc();
8259 QualType TypeArg = TypeArgInfo->getType();
8264 const auto *PackExpansion = PackExpansionLoc.getType()
8265 ->castAs<PackExpansionType>();
8269 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
8273 TypeLoc PatternLoc = PackExpansionLoc.getPatternLoc();
8274 bool Expand =
false;
8275 bool RetainExpansion =
false;
8276 UnsignedOrNone NumExpansions = PackExpansion->getNumExpansions();
8277 if (getDerived().TryExpandParameterPacks(
8278 PackExpansionLoc.getEllipsisLoc(), PatternLoc.getSourceRange(),
8279 Unexpanded,
true, Expand,
8280 RetainExpansion, NumExpansions))
8290 TypeArgBuilder.
reserve(PatternLoc.getFullDataSize());
8291 QualType NewPatternType = getDerived().TransformType(TypeArgBuilder,
8293 if (NewPatternType.isNull())
8297 NewPatternType, NumExpansions);
8299 NewExpansionLoc.
setEllipsisLoc(PackExpansionLoc.getEllipsisLoc());
8300 NewTypeArgInfos.push_back(
8301 TypeArgBuilder.getTypeSourceInfo(SemaRef.
Context, NewExpansionType));
8307 for (
unsigned ArgIdx = 0; ArgIdx != *NumExpansions; ++ArgIdx) {
8311 TypeArgBuilder.
reserve(PatternLoc.getFullDataSize());
8313 QualType NewTypeArg = getDerived().TransformType(TypeArgBuilder,
8315 if (NewTypeArg.isNull())
8318 NewTypeArgInfos.push_back(
8319 TypeArgBuilder.getTypeSourceInfo(SemaRef.
Context, NewTypeArg));
8326 TypeArgBuilder.
reserve(TypeArgLoc.getFullDataSize());
8328 getDerived().TransformType(TypeArgBuilder, TypeArgLoc);
8329 if (NewTypeArg.isNull())
8333 if (NewTypeArg == TypeArg) {
8334 NewTypeArgInfos.push_back(TypeArgInfo);
8338 NewTypeArgInfos.push_back(
8339 TypeArgBuilder.getTypeSourceInfo(SemaRef.
Context, NewTypeArg));
8344 if (getDerived().AlwaysRebuild() || AnyChanged) {
8346 Result = getDerived().RebuildObjCObjectType(
8347 BaseType, TL.getBeginLoc(), TL.getTypeArgsLAngleLoc(), NewTypeArgInfos,
8348 TL.getTypeArgsRAngleLoc(), TL.getProtocolLAngleLoc(),
8349 llvm::ArrayRef(TL.getTypePtr()->qual_begin(), TL.getNumProtocols()),
8350 TL.getProtocolLocs(), TL.getProtocolRAngleLoc());
8358 NewT.setTypeArgsLAngleLoc(TL.getTypeArgsLAngleLoc());
8359 for (
unsigned i = 0, n = TL.getNumTypeArgs(); i != n; ++i)
8360 NewT.setTypeArgTInfo(i, NewTypeArgInfos[i]);
8361 NewT.setTypeArgsRAngleLoc(TL.getTypeArgsRAngleLoc());
8362 NewT.setProtocolLAngleLoc(TL.getProtocolLAngleLoc());
8363 for (
unsigned i = 0, n = TL.getNumProtocols(); i != n; ++i)
8364 NewT.setProtocolLoc(i, TL.getProtocolLoc(i));
8365 NewT.setProtocolRAngleLoc(TL.getProtocolRAngleLoc());
8369template<
typename Derived>
8373 QualType PointeeType = getDerived().TransformType(TLB, TL.getPointeeLoc());
8374 if (PointeeType.isNull())
8378 if (getDerived().AlwaysRebuild() ||
8379 PointeeType != TL.getPointeeLoc().getType()) {
8380 Result = getDerived().RebuildObjCObjectPointerType(PointeeType,
8394template<
typename Derived>
8400template<
typename Derived>
8403 return getDerived().TransformCompoundStmt(S,
false);
8406template<
typename Derived>
8413 getSema().resetFPOptions(
8416 bool SubStmtInvalid =
false;
8417 bool SubStmtChanged =
false;
8419 for (
auto *B : S->
body()) {
8421 B, IsStmtExpr && B == S->
body_back() ? StmtDiscardKind::StmtExprResult
8422 : StmtDiscardKind::Discarded);
8424 if (
Result.isInvalid()) {
8431 SubStmtInvalid =
true;
8435 SubStmtChanged = SubStmtChanged ||
Result.get() != B;
8436 Statements.push_back(
Result.getAs<Stmt>());
8442 if (!getDerived().AlwaysRebuild() &&
8446 return getDerived().RebuildCompoundStmt(S->
getLBracLoc(),
8452template<
typename Derived>
8461 LHS = getDerived().TransformExpr(S->getLHS());
8463 if (LHS.isInvalid())
8467 RHS = getDerived().TransformExpr(S->getRHS());
8469 if (RHS.isInvalid())
8476 StmtResult Case = getDerived().RebuildCaseStmt(S->getCaseLoc(),
8478 S->getEllipsisLoc(),
8481 if (Case.isInvalid())
8486 getDerived().TransformStmt(S->getSubStmt());
8487 if (SubStmt.isInvalid())
8491 return getDerived().RebuildCaseStmtBody(Case.get(), SubStmt.get());
8494template <
typename Derived>
8498 getDerived().TransformStmt(S->getSubStmt());
8499 if (SubStmt.isInvalid())
8503 return getDerived().RebuildDefaultStmt(S->getDefaultLoc(), S->getColonLoc(),
8507template<
typename Derived>
8510 StmtResult SubStmt = getDerived().TransformStmt(S->getSubStmt(), SDK);
8511 if (SubStmt.isInvalid())
8514 Decl *LD = getDerived().TransformDecl(S->getDecl()->getLocation(),
8522 if (LD == S->getDecl())
8523 S->getDecl()->setStmt(
nullptr);
8526 return getDerived().RebuildLabelStmt(S->getIdentLoc(),
8531template <
typename Derived>
8536 switch (R->getKind()) {
8540 return getDerived().Transform##X##Attr(cast<X##Attr>(R));
8541#include "clang/Basic/AttrList.inc"
8546template <
typename Derived>
8553 switch (R->getKind()) {
8557 return getDerived().TransformStmt##X##Attr(OrigS, InstS, cast<X##Attr>(R));
8558#include "clang/Basic/AttrList.inc"
8563template <
typename Derived>
8566 StmtDiscardKind SDK) {
8571 bool AttrsChanged =
false;
8575 for (
const auto *I : S->
getAttrs()) {
8577 getDerived().TransformStmtAttr(S->
getSubStmt(), SubStmt.
get(), I);
8578 AttrsChanged |= (I != R);
8591 return getDerived().RebuildAttributedStmt(S->
getAttrLoc(), Attrs,
8595template<
typename Derived>
8600 if (
Init.isInvalid())
8604 if (!S->isConsteval()) {
8606 Cond = getDerived().TransformCondition(
8607 S->getIfLoc(), S->getConditionVariable(), S->getCond(),
8610 if (Cond.isInvalid())
8615 std::optional<bool> ConstexprConditionValue;
8616 if (S->isConstexpr())
8621 if (!ConstexprConditionValue || *ConstexprConditionValue) {
8625 S->isNonNegatedConsteval());
8627 Then = getDerived().TransformStmt(S->getThen());
8628 if (Then.isInvalid())
8634 Then =
new (getSema().Context)
8635 CompoundStmt(S->getThen()->getBeginLoc(), S->getThen()->getEndLoc());
8640 if (!ConstexprConditionValue || !*ConstexprConditionValue) {
8644 S->isNegatedConsteval());
8646 Else = getDerived().TransformStmt(S->getElse());
8647 if (Else.isInvalid())
8649 }
else if (S->getElse() && ConstexprConditionValue &&
8650 *ConstexprConditionValue) {
8654 Else =
new (getSema().Context)
8655 CompoundStmt(S->getElse()->getBeginLoc(), S->getElse()->getEndLoc());
8658 if (!getDerived().AlwaysRebuild() &&
8659 Init.get() == S->getInit() &&
8660 Cond.get() == std::make_pair(S->getConditionVariable(), S->getCond()) &&
8661 Then.get() == S->getThen() &&
8662 Else.get() == S->getElse())
8665 return getDerived().RebuildIfStmt(
8666 S->getIfLoc(), S->getStatementKind(), S->getLParenLoc(), Cond,
8667 S->getRParenLoc(),
Init.get(), Then.get(), S->getElseLoc(), Else.get());
8670template<
typename Derived>
8675 if (
Init.isInvalid())
8680 S->getSwitchLoc(), S->getConditionVariable(), S->getCond(),
8682 if (Cond.isInvalid())
8687 getDerived().RebuildSwitchStmtStart(S->getSwitchLoc(), S->getLParenLoc(),
8688 Init.get(), Cond, S->getRParenLoc());
8693 StmtResult Body = getDerived().TransformStmt(S->getBody());
8696 return getDerived().RebuildSwitchStmtBody(S->getSwitchLoc(),
Switch.get(),
8700template<
typename Derived>
8705 S->getWhileLoc(), S->getConditionVariable(), S->getCond(),
8707 if (Cond.isInvalid())
8716 StmtResult Body = getDerived().TransformStmt(S->getBody());
8717 if (Body.isInvalid())
8720 if (!getDerived().AlwaysRebuild() &&
8721 Cond.get() == std::make_pair(S->getConditionVariable(), S->getCond()) &&
8722 Body.get() == S->getBody())
8725 return getDerived().RebuildWhileStmt(S->getWhileLoc(), S->getLParenLoc(),
8726 Cond, S->getRParenLoc(), Body.get());
8729template<
typename Derived>
8738 StmtResult Body = getDerived().TransformStmt(S->getBody());
8739 if (Body.isInvalid())
8743 ExprResult Cond = getDerived().TransformExpr(S->getCond());
8744 if (Cond.isInvalid())
8747 if (!getDerived().AlwaysRebuild() &&
8748 Cond.get() == S->getCond() &&
8749 Body.get() == S->getBody())
8752 return getDerived().RebuildDoStmt(S->getDoLoc(), Body.get(), S->getWhileLoc(),
8753 S->getWhileLoc(), Cond.get(),
8757template<
typename Derived>
8760 if (getSema().getLangOpts().getOpenMPVersion())
8761 getSema().OpenMP().startOpenMPLoop();
8765 if (
Init.isInvalid())
8770 if (getSema().getLangOpts().getOpenMPVersion() &&
Init.isUsable())
8771 getSema().OpenMP().ActOnOpenMPLoopInitialization(S->getForLoc(),
8776 S->getForLoc(), S->getConditionVariable(), S->getCond(),
8778 if (Cond.isInvalid())
8783 if (
Inc.isInvalid())
8787 if (S->getInc() && !FullInc.get())
8794 S->getBeginLoc(), S->getInit(),
Init.get(), S->getCond(),
8795 Cond.get().second, S->getInc(),
Inc.get());
8798 StmtResult Body = getDerived().TransformStmt(S->getBody());
8799 if (Body.isInvalid())
8804 if (!getDerived().AlwaysRebuild() &&
8805 Init.get() == S->getInit() &&
8806 Cond.get() == std::make_pair(S->getConditionVariable(), S->getCond()) &&
8807 Inc.get() == S->getInc() &&
8808 Body.get() == S->getBody())
8811 return getDerived().RebuildForStmt(S->getForLoc(), S->getLParenLoc(),
8812 Init.get(), Cond, FullInc,
8813 S->getRParenLoc(), Body.get());
8816template<
typename Derived>
8819 Decl *LD = getDerived().TransformDecl(S->getLabel()->getLocation(),
8825 return getDerived().RebuildGotoStmt(S->getGotoLoc(), S->getLabelLoc(),
8829template<
typename Derived>
8837 if (!getDerived().AlwaysRebuild() &&
8838 Target.get() == S->getTarget())
8841 return getDerived().RebuildIndirectGotoStmt(S->getGotoLoc(), S->getStarLoc(),
8845template<
typename Derived>
8851 Decl *LD = getDerived().TransformDecl(S->getLabelDecl()->getLocation(),
8860template<
typename Derived>
8866 Decl *LD = getDerived().TransformDecl(S->getLabelDecl()->getLocation(),
8875template <
typename Derived>
8883template<
typename Derived>
8893 return getDerived().RebuildReturnStmt(S->getReturnLoc(),
Result.get());
8896template<
typename Derived>
8899 bool DeclChanged =
false;
8902 for (
auto *D : S->decls()) {
8903 Decl *Transformed = getDerived().TransformDefinition(D->getLocation(), D);
8907 if (Transformed != D)
8911 if (
auto *TD = dyn_cast<TypeDecl>(Transformed)) {
8912 if (
auto *TN = dyn_cast<TypedefNameDecl>(TD)) {
8913 LSI->ContainsUnexpandedParameterPack |=
8914 TN->getUnderlyingType()->containsUnexpandedParameterPack();
8916 LSI->ContainsUnexpandedParameterPack |=
8919 .getTypeDeclType(TD)
8920 ->containsUnexpandedParameterPack();
8923 if (
auto *VD = dyn_cast<VarDecl>(Transformed))
8924 LSI->ContainsUnexpandedParameterPack |=
8925 VD->getType()->containsUnexpandedParameterPack();
8928 Decls.push_back(Transformed);
8931 if (!getDerived().AlwaysRebuild() && !DeclChanged)
8934 return getDerived().RebuildDeclStmt(Decls, S->getBeginLoc(), S->getEndLoc());
8937template<
typename Derived>
8947 bool ExprsChanged =
false;
8949 auto RebuildString = [&](
Expr *E) {
8954 ExprsChanged =
true;
8961 for (
unsigned I = 0, E = S->getNumOutputs(); I != E; ++I) {
8962 Names.push_back(S->getOutputIdentifier(I));
8968 Constraints.push_back(
Result.get());
8971 Expr *OutputExpr = S->getOutputExpr(I);
8972 Result = getDerived().TransformExpr(OutputExpr);
8976 ExprsChanged |=
Result.get() != OutputExpr;
8978 Exprs.push_back(
Result.get());
8982 for (
unsigned I = 0, E = S->getNumInputs(); I != E; ++I) {
8983 Names.push_back(S->getInputIdentifier(I));
8989 Constraints.push_back(
Result.get());
8992 Expr *InputExpr = S->getInputExpr(I);
8993 Result = getDerived().TransformExpr(InputExpr);
8997 ExprsChanged |=
Result.get() != InputExpr;
8999 Exprs.push_back(
Result.get());
9003 for (
unsigned I = 0, E = S->getNumLabels(); I != E; ++I) {
9004 Names.push_back(S->getLabelIdentifier(I));
9009 ExprsChanged |=
Result.get() != S->getLabelExpr(I);
9010 Exprs.push_back(
Result.get());
9014 for (
unsigned I = 0, E = S->getNumClobbers(); I != E; ++I) {
9018 Clobbers.push_back(
Result.get());
9021 ExprResult AsmString = RebuildString(S->getAsmStringExpr());
9022 if (AsmString.isInvalid())
9025 if (!getDerived().AlwaysRebuild() && !ExprsChanged)
9028 return getDerived().RebuildGCCAsmStmt(S->getAsmLoc(), S->isSimple(),
9029 S->isVolatile(), S->getNumOutputs(),
9030 S->getNumInputs(), Names.data(),
9031 Constraints, Exprs, AsmString.get(),
9032 Clobbers, S->getNumLabels(),
9036template<
typename Derived>
9041 bool HadError =
false, HadChange =
false;
9045 TransformedExprs.reserve(SrcExprs.size());
9046 for (
unsigned i = 0, e = SrcExprs.size(); i != e; ++i) {
9048 if (!
Result.isUsable()) {
9051 HadChange |= (
Result.get() != SrcExprs[i]);
9052 TransformedExprs.push_back(
Result.get());
9057 if (!HadChange && !getDerived().AlwaysRebuild())
9060 return getDerived().RebuildMSAsmStmt(S->getAsmLoc(), S->getLBraceLoc(),
9061 AsmToks, S->getAsmString(),
9062 S->getNumOutputs(), S->getNumInputs(),
9063 S->getAllConstraints(), S->getClobbers(),
9064 TransformedExprs, S->getEndLoc());
9068template<
typename Derived>
9073 assert(FD && ScopeInfo && !ScopeInfo->CoroutinePromise &&
9074 ScopeInfo->NeedsCoroutineSuspends &&
9075 ScopeInfo->CoroutineSuspends.first ==
nullptr &&
9076 ScopeInfo->CoroutineSuspends.second ==
nullptr &&
9077 "expected clean scope info");
9081 ScopeInfo->setNeedsCoroutineSuspends(
false);
9094 getDerived().transformedLocalDecl(S->getPromiseDecl(), {Promise});
9095 ScopeInfo->CoroutinePromise = Promise;
9100 StmtResult InitSuspend = getDerived().TransformStmt(S->getInitSuspendStmt());
9101 if (InitSuspend.isInvalid())
9104 getDerived().TransformStmt(S->getFinalSuspendStmt());
9105 if (FinalSuspend.isInvalid() ||
9108 ScopeInfo->setCoroutineSuspends(InitSuspend.get(), FinalSuspend.get());
9111 StmtResult BodyRes = getDerived().TransformStmt(S->getBody());
9112 if (BodyRes.isInvalid())
9116 if (Builder.isInvalid())
9119 Expr *ReturnObject = S->getReturnValueInit();
9120 assert(ReturnObject &&
"the return object is expected to be valid");
9121 ExprResult Res = getDerived().TransformInitializer(ReturnObject,
9123 if (Res.isInvalid())
9125 Builder.ReturnValue = Res.get();
9130 if (S->hasDependentPromiseType()) {
9133 if (!Promise->getType()->isDependentType()) {
9134 assert(!S->getFallthroughHandler() && !S->getExceptionHandler() &&
9135 !S->getReturnStmtOnAllocFailure() && !S->getDeallocate() &&
9136 "these nodes should not have been built yet");
9137 if (!Builder.buildDependentStatements())
9141 if (
auto *OnFallthrough = S->getFallthroughHandler()) {
9142 StmtResult Res = getDerived().TransformStmt(OnFallthrough);
9143 if (Res.isInvalid())
9145 Builder.OnFallthrough = Res.get();
9148 if (
auto *OnException = S->getExceptionHandler()) {
9149 StmtResult Res = getDerived().TransformStmt(OnException);
9150 if (Res.isInvalid())
9152 Builder.OnException = Res.get();
9155 if (
auto *OnAllocFailure = S->getReturnStmtOnAllocFailure()) {
9156 StmtResult Res = getDerived().TransformStmt(OnAllocFailure);
9157 if (Res.isInvalid())
9159 Builder.ReturnStmtOnAllocFailure = Res.get();
9163 assert(S->getAllocate() && S->getDeallocate() &&
9164 "allocation and deallocation calls must already be built");
9165 ExprResult AllocRes = getDerived().TransformExpr(S->getAllocate());
9166 if (AllocRes.isInvalid())
9168 Builder.Allocate = AllocRes.get();
9170 ExprResult DeallocRes = getDerived().TransformExpr(S->getDeallocate());
9171 if (DeallocRes.isInvalid())
9173 Builder.Deallocate = DeallocRes.get();
9175 if (
auto *ResultDecl = S->getResultDecl()) {
9176 StmtResult Res = getDerived().TransformStmt(ResultDecl);
9177 if (Res.isInvalid())
9179 Builder.ResultDecl = Res.get();
9184 if (Res.isInvalid())
9186 Builder.ReturnStmt = Res.get();
9190 return getDerived().RebuildCoroutineBodyStmt(Builder);
9193template<
typename Derived>
9203 return getDerived().RebuildCoreturnStmt(S->getKeywordLoc(),
Result.get(),
9207template <
typename Derived>
9220 ExprResult Lookup = getSema().BuildOperatorCoawaitLookupExpr(
9221 getSema().getCurScope(), E->getKeywordLoc());
9225 return getDerived().RebuildCoawaitExpr(
9226 E->getKeywordLoc(),
Operand.get(),
9230template <
typename Derived>
9233 ExprResult OperandResult = getDerived().TransformInitializer(E->getOperand(),
9235 if (OperandResult.isInvalid())
9239 E->getOperatorCoawaitLookup());
9246 return getDerived().RebuildDependentCoawaitExpr(
9247 E->getKeywordLoc(), OperandResult.get(),
9251template<
typename Derived>
9261 return getDerived().RebuildCoyieldExpr(E->getKeywordLoc(),
Result.get());
9266template<
typename Derived>
9270 StmtResult TryBody = getDerived().TransformStmt(S->getTryBody());
9271 if (TryBody.isInvalid())
9275 bool AnyCatchChanged =
false;
9277 for (
unsigned I = 0, N = S->getNumCatchStmts(); I != N; ++I) {
9278 StmtResult Catch = getDerived().TransformStmt(S->getCatchStmt(I));
9279 if (Catch.isInvalid())
9281 if (Catch.get() != S->getCatchStmt(I))
9282 AnyCatchChanged =
true;
9283 CatchStmts.push_back(Catch.get());
9288 if (S->getFinallyStmt()) {
9289 Finally = getDerived().TransformStmt(S->getFinallyStmt());
9290 if (Finally.isInvalid())
9295 if (!getDerived().AlwaysRebuild() &&
9296 TryBody.get() == S->getTryBody() &&
9298 Finally.get() == S->getFinallyStmt())
9302 return getDerived().RebuildObjCAtTryStmt(S->getAtTryLoc(), TryBody.get(),
9303 CatchStmts, Finally.get());
9306template<
typename Derived>
9311 if (
VarDecl *FromVar = S->getCatchParamDecl()) {
9313 if (FromVar->getTypeSourceInfo()) {
9314 TSInfo = getDerived().TransformType(FromVar->getTypeSourceInfo());
9321 T = TSInfo->getType();
9323 T = getDerived().TransformType(FromVar->getType());
9328 Var = getDerived().RebuildObjCExceptionDecl(FromVar, TSInfo, T);
9333 StmtResult Body = getDerived().TransformStmt(S->getCatchBody());
9334 if (Body.isInvalid())
9337 return getDerived().RebuildObjCAtCatchStmt(S->getAtCatchLoc(),
9342template<
typename Derived>
9346 StmtResult Body = getDerived().TransformStmt(S->getFinallyBody());
9347 if (Body.isInvalid())
9351 if (!getDerived().AlwaysRebuild() &&
9352 Body.get() == S->getFinallyBody())
9356 return getDerived().RebuildObjCAtFinallyStmt(S->getAtFinallyLoc(),
9360template<
typename Derived>
9364 if (S->getThrowExpr()) {
9365 Operand = getDerived().TransformExpr(S->getThrowExpr());
9370 if (!getDerived().AlwaysRebuild() &&
9371 Operand.get() == S->getThrowExpr())
9374 return getDerived().RebuildObjCAtThrowStmt(S->getThrowLoc(),
Operand.get());
9377template<
typename Derived>
9386 getDerived().RebuildObjCAtSynchronizedOperand(S->getAtSynchronizedLoc(),
9392 StmtResult Body = getDerived().TransformStmt(S->getSynchBody());
9393 if (Body.isInvalid())
9397 if (!getDerived().AlwaysRebuild() &&
9398 Object.get() == S->getSynchExpr() &&
9399 Body.get() == S->getSynchBody())
9403 return getDerived().RebuildObjCAtSynchronizedStmt(S->getAtSynchronizedLoc(),
9404 Object.get(), Body.get());
9407template<
typename Derived>
9412 StmtResult Body = getDerived().TransformStmt(S->getSubStmt());
9413 if (Body.isInvalid())
9417 if (!getDerived().AlwaysRebuild() &&
9418 Body.get() == S->getSubStmt())
9422 return getDerived().RebuildObjCAutoreleasePoolStmt(
9423 S->getAtLoc(), Body.get());
9426template<
typename Derived>
9431 StmtResult Element = getDerived().TransformStmt(
9432 S->getElement(), StmtDiscardKind::NotDiscarded);
9433 if (Element.isInvalid())
9437 ExprResult Collection = getDerived().TransformExpr(S->getCollection());
9438 if (Collection.isInvalid())
9442 StmtResult Body = getDerived().TransformStmt(S->getBody());
9443 if (Body.isInvalid())
9447 if (!getDerived().AlwaysRebuild() &&
9448 Element.get() == S->getElement() &&
9449 Collection.get() == S->getCollection() &&
9450 Body.get() == S->getBody())
9454 return getDerived().RebuildObjCForCollectionStmt(S->getForLoc(),
9461template <
typename Derived>
9465 if (
VarDecl *ExceptionDecl = S->getExceptionDecl()) {
9467 getDerived().TransformType(ExceptionDecl->getTypeSourceInfo());
9471 Var = getDerived().RebuildExceptionDecl(
9472 ExceptionDecl, T, ExceptionDecl->getInnerLocStart(),
9473 ExceptionDecl->getLocation(), ExceptionDecl->getIdentifier());
9474 if (!Var || Var->isInvalidDecl())
9479 StmtResult Handler = getDerived().TransformStmt(S->getHandlerBlock());
9480 if (Handler.isInvalid())
9483 if (!getDerived().AlwaysRebuild() && !Var &&
9484 Handler.get() == S->getHandlerBlock())
9487 return getDerived().RebuildCXXCatchStmt(S->getCatchLoc(), Var, Handler.get());
9490template <
typename Derived>
9493 StmtResult TryBlock = getDerived().TransformCompoundStmt(S->getTryBlock());
9494 if (TryBlock.isInvalid())
9498 bool HandlerChanged =
false;
9500 for (
unsigned I = 0, N = S->getNumHandlers(); I != N; ++I) {
9501 StmtResult Handler = getDerived().TransformCXXCatchStmt(S->getHandler(I));
9502 if (Handler.isInvalid())
9505 HandlerChanged = HandlerChanged || Handler.get() != S->getHandler(I);
9506 Handlers.push_back(Handler.getAs<
Stmt>());
9509 getSema().DiagnoseExceptionUse(S->getTryLoc(),
true);
9511 if (!getDerived().AlwaysRebuild() && TryBlock.get() == S->getTryBlock() &&
9515 return getDerived().RebuildCXXTryStmt(S->getTryLoc(), TryBlock.get(),
9519template<
typename Derived>
9530 auto &LastRecord = getSema().currentEvaluationContext();
9531 LastRecord.InLifetimeExtendingContext =
true;
9532 LastRecord.RebuildDefaultArgOrDefaultInit =
true;
9535 S->getInit() ? getDerived().TransformStmt(S->getInit()) :
StmtResult();
9536 if (
Init.isInvalid())
9540 if (
Range.isInvalid())
9545 getSema().ExprEvalContexts.back().ForRangeLifetimeExtendTemps.empty());
9546 auto ForRangeLifetimeExtendTemps =
9547 getSema().ExprEvalContexts.back().ForRangeLifetimeExtendTemps;
9549 StmtResult Begin = getDerived().TransformStmt(S->getBeginStmt());
9550 if (Begin.isInvalid())
9552 StmtResult End = getDerived().TransformStmt(S->getEndStmt());
9553 if (End.isInvalid())
9556 ExprResult Cond = getDerived().TransformExpr(S->getCond());
9557 if (Cond.isInvalid())
9561 if (Cond.isInvalid())
9567 if (
Inc.isInvalid())
9572 StmtResult LoopVar = getDerived().TransformStmt(S->getLoopVarStmt());
9573 if (LoopVar.isInvalid())
9577 if (getDerived().AlwaysRebuild() ||
9578 Init.get() != S->getInit() ||
9579 Range.get() != S->getRangeStmt() ||
9580 Begin.get() != S->getBeginStmt() ||
9581 End.get() != S->getEndStmt() ||
9582 Cond.get() != S->getCond() ||
9583 Inc.get() != S->getInc() ||
9584 LoopVar.get() != S->getLoopVarStmt()) {
9585 NewStmt = getDerived().RebuildCXXForRangeStmt(
9586 S->getForLoc(), S->getCoawaitLoc(),
Init.get(), S->getColonLoc(),
9587 Range.get(), Begin.get(), End.get(), Cond.get(),
Inc.get(),
9588 LoopVar.get(), S->getRParenLoc(), ForRangeLifetimeExtendTemps);
9589 if (NewStmt.isInvalid() && LoopVar.get() != S->getLoopVarStmt()) {
9591 getSema().ActOnInitializerError(
9602 StmtResult Body = getDerived().TransformStmt(S->getBody());
9603 if (Body.isInvalid())
9610 if (Body.get() != S->getBody() && NewStmt.get() == S) {
9611 NewStmt = getDerived().RebuildCXXForRangeStmt(
9612 S->getForLoc(), S->getCoawaitLoc(),
Init.get(), S->getColonLoc(),
9613 Range.get(), Begin.get(), End.get(), Cond.get(),
Inc.get(),
9614 LoopVar.get(), S->getRParenLoc(), ForRangeLifetimeExtendTemps);
9615 if (NewStmt.isInvalid())
9619 if (NewStmt.get() == S)
9622 return FinishCXXForRangeStmt(NewStmt.get(), Body.get());
9625template <
typename Derived>
9631 getDerived().TransformDecl(S->getDecl()->getLocation(), S->getDecl());
9632 if (!ESD || ESD->isInvalidDecl())
9639 auto TransformStmtInParentContext = [&](
Stmt *SubStmt) ->
StmtResult {
9642 return getDerived().TransformStmt(SubStmt);
9661 if (S->isDependent() || S->isIterating()) {
9667 if (S->isDependent()) {
9673 ExpansionInitializer =
9674 getDerived().TransformExpr(S->getExpansionInitializer());
9675 if (ExpansionInitializer.isInvalid())
9677 }
else if (S->isIterating()) {
9678 Range = TransformStmtInParentContext(S->getRangeVarStmt());
9679 if (
Range.isInvalid())
9683 ExpansionInitializer =
9686 LifetimeExtendTemps =
9691 if (S->isEnumerating()) {
9693 getDerived().TransformStmt(S->getExpansionVarStmt());
9694 if (ExpansionVar.isInvalid())
9699 S->getLParenLoc(), S->getColonLoc(), S->getRParenLoc());
9700 }
else if (S->isIterating()) {
9701 StmtResult Begin = TransformStmtInParentContext(S->getBeginVarStmt());
9702 StmtResult Iter = TransformStmtInParentContext(S->getIterVarStmt());
9703 if (Begin.isInvalid() || Iter.isInvalid())
9710 getDerived().TransformStmt(S->getExpansionVarStmt());
9711 if (ExpansionVar.isInvalid())
9717 Iter.getAs<
DeclStmt>(), S->getLParenLoc(), S->getColonLoc(),
9721 NewPattern->getRangeVar(), LifetimeExtendTemps);
9722 }
else if (S->isDependent()) {
9724 getDerived().TransformStmt(S->getExpansionVarStmt());
9725 if (ExpansionVar.isInvalid())
9730 ExpansionInitializer.get(), S->getLParenLoc(), S->getColonLoc(),
9731 S->getRParenLoc(), LifetimeExtendTemps);
9733 if (Res.isInvalid())
9743 llvm_unreachable(
"destructuring pattern should never be instantiated");
9746 StmtResult Body = getDerived().TransformStmt(S->getBody());
9747 if (Body.isInvalid())
9753template <
typename Derived>
9756 bool SubStmtChanged =
false;
9759 for (
Stmt *OldDS : OldStmts) {
9760 StmtResult NewDS = getDerived().TransformStmt(OldDS);
9761 if (NewDS.isInvalid())
9764 SubStmtChanged |= NewDS.get() != OldDS;
9765 NewStmts.push_back(NewDS.get());
9772 getDerived().TransformDecl(S->getParent()->getLocation(), S->getParent());
9773 if (!ESD || ESD->isInvalidDecl())
9787 if (TransformStmts(PreambleStmts, S->getPreambleStmts()))
9790 if (S->shouldApplyLifetimeExtensionToPreamble()) {
9798 if (TransformStmts(Instantiations, S->getInstantiations()))
9801 if (!getDerived().AlwaysRebuild() && !SubStmtChanged)
9805 SemaRef.
Context, NewESD, Instantiations, PreambleStmts,
9806 S->shouldApplyLifetimeExtensionToPreamble());
9809template <
typename Derived>
9813 ExprResult Idx = getDerived().TransformExpr(E->getIndexExpr());
9814 if (
Range.isInvalid() || Idx.isInvalid())
9817 if (!getDerived().AlwaysRebuild() &&
Range.get() == E->getRangeExpr() &&
9818 Idx.get() == E->getIndexExpr())
9825template<
typename Derived>
9831 if (S->getQualifierLoc()) {
9833 = getDerived().TransformNestedNameSpecifierLoc(S->getQualifierLoc());
9840 if (NameInfo.getName()) {
9841 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
9842 if (!NameInfo.getName())
9847 if (!getDerived().AlwaysRebuild() &&
9848 QualifierLoc == S->getQualifierLoc() &&
9849 NameInfo.getName() == S->getNameInfo().getName())
9854 SS.
Adopt(QualifierLoc);
9856 switch (getSema().CheckMicrosoftIfExistsSymbol(
nullptr, SS, NameInfo)) {
9858 if (S->isIfExists())
9861 return new (getSema().Context)
NullStmt(S->getKeywordLoc());
9864 if (S->isIfNotExists())
9867 return new (getSema().Context)
NullStmt(S->getKeywordLoc());
9878 StmtResult SubStmt = getDerived().TransformCompoundStmt(S->getSubStmt());
9879 if (SubStmt.isInvalid())
9887 return getDerived().RebuildMSDependentExistsStmt(S->getKeywordLoc(),
9894template<
typename Derived>
9898 if (E->getQualifierLoc()) {
9900 = getDerived().TransformNestedNameSpecifierLoc(E->getQualifierLoc());
9906 getDerived().TransformDecl(E->getMemberLoc(), E->getPropertyDecl()));
9911 if (
Base.isInvalid())
9917 QualifierLoc, E->getMemberLoc());
9920template <
typename Derived>
9924 if (BaseRes.isInvalid())
9926 auto IdxRes = getDerived().TransformExpr(E->getIdx());
9927 if (IdxRes.isInvalid())
9930 if (!getDerived().AlwaysRebuild() &&
9931 BaseRes.get() == E->getBase() &&
9932 IdxRes.get() == E->getIdx())
9935 return getDerived().RebuildArraySubscriptExpr(
9936 BaseRes.get(),
SourceLocation(), IdxRes.get(), E->getRBracketLoc());
9939template <
typename Derived>
9941 StmtResult TryBlock = getDerived().TransformCompoundStmt(S->getTryBlock());
9942 if (TryBlock.isInvalid())
9945 StmtResult Handler = getDerived().TransformSEHHandler(S->getHandler());
9946 if (Handler.isInvalid())
9949 if (!getDerived().AlwaysRebuild() && TryBlock.get() == S->getTryBlock() &&
9950 Handler.get() == S->getHandler())
9953 return getDerived().RebuildSEHTryStmt(S->getIsCXXTry(), S->getTryLoc(),
9954 TryBlock.get(), Handler.get());
9957template <
typename Derived>
9960 if (
Block.isInvalid())
9963 return getDerived().RebuildSEHFinallyStmt(S->getFinallyLoc(),
Block.get());
9966template <
typename Derived>
9968 ExprResult FilterExpr = getDerived().TransformExpr(S->getFilterExpr());
9969 if (FilterExpr.isInvalid())
9973 if (
Block.isInvalid())
9976 return getDerived().RebuildSEHExceptStmt(S->getExceptLoc(), FilterExpr.get(),
9980template <
typename Derived>
9988template<
typename Derived>
9998template <
typename Derived>
10000TreeTransform<Derived>::TransformOMPCanonicalLoop(OMPCanonicalLoop *L) {
10004 return getDerived().TransformStmt(L->getLoopStmt());
10007template <
typename Derived>
10014 TClauses.reserve(Clauses.size());
10018 getDerived().getSema().OpenMP().StartOpenMPClause((*I)->getClauseKind());
10020 getDerived().getSema().OpenMP().EndOpenMPClause();
10022 TClauses.push_back(Clause);
10024 TClauses.push_back(
nullptr);
10028 if (D->hasAssociatedStmt() && D->getAssociatedStmt()) {
10029 getDerived().getSema().OpenMP().ActOnOpenMPRegionStart(
10030 D->getDirectiveKind(),
10036 if (D->getDirectiveKind() == OMPD_atomic ||
10037 D->getDirectiveKind() == OMPD_critical ||
10038 D->getDirectiveKind() == OMPD_section ||
10039 D->getDirectiveKind() == OMPD_master)
10040 CS = D->getAssociatedStmt();
10042 CS = D->getRawStmt();
10045 getSema().getLangOpts().OpenMPIRBuilder)
10049 getDerived().getSema().OpenMP().ActOnOpenMPRegionEnd(Body, TClauses);
10054 if (TClauses.size() != Clauses.size()) {
10060 if (D->getDirectiveKind() == OMPD_critical) {
10062 DirName =
getDerived().TransformDeclarationNameInfo(DirName);
10065 if (D->getDirectiveKind() == OMPD_cancellation_point) {
10067 }
else if (D->getDirectiveKind() == OMPD_cancel) {
10071 return getDerived().RebuildOMPExecutableDirective(
10072 D->getDirectiveKind(), DirName, CancelRegion, TClauses,
10073 AssociatedStmt.
get(), D->getBeginLoc(), D->getEndLoc());
10081template <
typename Derived>
10088 TClauses.reserve(Clauses.size());
10091 getDerived().getSema().OpenMP().StartOpenMPClause(
C->getClauseKind());
10093 getDerived().getSema().OpenMP().EndOpenMPClause();
10095 TClauses.push_back(Clause);
10097 TClauses.push_back(
nullptr);
10101 if (D->hasAssociatedStmt() && D->getAssociatedStmt()) {
10102 getDerived().getSema().OpenMP().ActOnOpenMPRegionStart(
10103 D->getDirectiveKind(),
10108 assert(D->getDirectiveKind() == OMPD_assume &&
10109 "Unexpected informational directive");
10110 Stmt *CS = D->getAssociatedStmt();
10114 getDerived().getSema().OpenMP().ActOnOpenMPRegionEnd(Body, TClauses);
10118 if (TClauses.size() != Clauses.size())
10123 return getDerived().RebuildOMPInformationalDirective(
10124 D->getDirectiveKind(), DirName, TClauses, AssociatedStmt.
get(),
10125 D->getBeginLoc(), D->getEndLoc());
10128template <
typename Derived>
10138 Variants.push_back(NewV.
get());
10145 OldTraitInfos = OldTraitInfos.drop_back();
10148 OMPTraitInfo &TI = getSema().getASTContext().getNewOMPTraitInfo();
10150 auto TransformScoreOrCondition = [&](Expr *&E,
bool IsScore) {
10153 EnterExpressionEvaluationContext Ctx(
10157 ExprResult ER = getDerived().TransformExpr(E);
10158 if (!ER.isUsable())
10165 TraitInfos.push_back(&TI);
10168 return getDerived().RebuildOMPMetaDirective(D->getBeginLoc(), D->getEndLoc(),
10169 TraitInfos, Variants);
10172template <
typename Derived>
10176 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10177 OMPD_parallel, DirName,
nullptr, D->getBeginLoc());
10178 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10179 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10183template <
typename Derived>
10187 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10188 OMPD_simd, DirName,
nullptr, D->getBeginLoc());
10189 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10190 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10194template <
typename Derived>
10198 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10199 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
10200 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10201 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10205template <
typename Derived>
10209 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10210 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
10211 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10212 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10216template <
typename Derived>
10220 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10221 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
10222 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10223 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10227template <
typename Derived>
10231 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10232 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
10233 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10234 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10238template <
typename Derived>
10240 OMPInterchangeDirective *D) {
10242 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10243 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
10244 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10245 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10249template <
typename Derived>
10253 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10254 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
10255 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10256 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10260template <
typename Derived>
10264 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10265 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
10266 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10267 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10271template <
typename Derived>
10275 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10276 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
10277 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10278 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10282template <
typename Derived>
10286 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10287 OMPD_for, DirName,
nullptr, D->getBeginLoc());
10288 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10289 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10293template <
typename Derived>
10297 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10298 OMPD_for_simd, DirName,
nullptr, D->getBeginLoc());
10299 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10300 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10304template <
typename Derived>
10308 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10309 OMPD_sections, DirName,
nullptr, D->getBeginLoc());
10310 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10311 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10315template <
typename Derived>
10319 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10320 OMPD_section, DirName,
nullptr, D->getBeginLoc());
10321 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10322 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10326template <
typename Derived>
10330 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10331 OMPD_scope, DirName,
nullptr, D->getBeginLoc());
10332 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10333 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10337template <
typename Derived>
10341 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10342 OMPD_single, DirName,
nullptr, D->getBeginLoc());
10343 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10344 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10348template <
typename Derived>
10352 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10353 OMPD_master, DirName,
nullptr, D->getBeginLoc());
10354 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10355 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10359template <
typename Derived>
10364 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10365 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10369template <
typename Derived>
10371 OMPParallelForDirective *D) {
10373 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10374 OMPD_parallel_for, DirName,
nullptr, D->getBeginLoc());
10375 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10376 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10380template <
typename Derived>
10382 OMPParallelForSimdDirective *D) {
10384 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10385 OMPD_parallel_for_simd, DirName,
nullptr, D->getBeginLoc());
10386 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10387 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10391template <
typename Derived>
10393 OMPParallelMasterDirective *D) {
10395 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10396 OMPD_parallel_master, DirName,
nullptr, D->getBeginLoc());
10397 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10398 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10402template <
typename Derived>
10404 OMPParallelMaskedDirective *D) {
10406 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10407 OMPD_parallel_masked, DirName,
nullptr, D->getBeginLoc());
10408 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10409 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10413template <
typename Derived>
10415 OMPParallelSectionsDirective *D) {
10417 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10418 OMPD_parallel_sections, DirName,
nullptr, D->getBeginLoc());
10419 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10420 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10424template <
typename Derived>
10428 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10429 OMPD_task, DirName,
nullptr, D->getBeginLoc());
10430 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10431 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10435template <
typename Derived>
10437 OMPTaskyieldDirective *D) {
10439 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10440 OMPD_taskyield, DirName,
nullptr, D->getBeginLoc());
10441 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10442 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10446template <
typename Derived>
10450 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10451 OMPD_barrier, DirName,
nullptr, D->getBeginLoc());
10452 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10453 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10457template <
typename Derived>
10461 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10462 OMPD_taskwait, DirName,
nullptr, D->getBeginLoc());
10463 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10464 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10468template <
typename Derived>
10472 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10473 OMPD_assume, DirName,
nullptr, D->getBeginLoc());
10474 StmtResult Res = getDerived().TransformOMPInformationalDirective(D);
10475 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10479template <
typename Derived>
10483 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10484 OMPD_error, DirName,
nullptr, D->getBeginLoc());
10485 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10486 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10490template <
typename Derived>
10492 OMPTaskgroupDirective *D) {
10494 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10495 OMPD_taskgroup, DirName,
nullptr, D->getBeginLoc());
10496 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10497 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10501template <
typename Derived>
10505 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10506 OMPD_flush, DirName,
nullptr, D->getBeginLoc());
10507 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10508 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10512template <
typename Derived>
10516 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10517 OMPD_depobj, DirName,
nullptr, D->getBeginLoc());
10518 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10519 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10523template <
typename Derived>
10527 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10528 OMPD_scan, DirName,
nullptr, D->getBeginLoc());
10529 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10530 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10534template <
typename Derived>
10536 OMPOrderedStandaloneDirective *D) {
10538 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10539 OMPD_ordered_standalone, DirName,
nullptr, D->getBeginLoc());
10540 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10541 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10545template <
typename Derived>
10547 OMPOrderedBlockAssocDirective *D) {
10549 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10550 OMPD_ordered_blockassoc, DirName,
nullptr, D->getBeginLoc());
10551 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10552 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10556template <
typename Derived>
10560 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10561 OMPD_atomic, DirName,
nullptr, D->getBeginLoc());
10562 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10563 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10567template <
typename Derived>
10571 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10572 OMPD_target, DirName,
nullptr, D->getBeginLoc());
10573 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10574 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10578template <
typename Derived>
10580 OMPTargetDataDirective *D) {
10582 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10583 OMPD_target_data, DirName,
nullptr, D->getBeginLoc());
10584 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10585 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10589template <
typename Derived>
10591 OMPTargetEnterDataDirective *D) {
10593 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10594 OMPD_target_enter_data, DirName,
nullptr, D->getBeginLoc());
10595 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10596 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10600template <
typename Derived>
10602 OMPTargetExitDataDirective *D) {
10604 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10605 OMPD_target_exit_data, DirName,
nullptr, D->getBeginLoc());
10606 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10607 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10611template <
typename Derived>
10613 OMPTargetParallelDirective *D) {
10615 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10616 OMPD_target_parallel, DirName,
nullptr, D->getBeginLoc());
10617 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10618 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10622template <
typename Derived>
10624 OMPTargetParallelForDirective *D) {
10626 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10627 OMPD_target_parallel_for, DirName,
nullptr, D->getBeginLoc());
10628 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10629 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10633template <
typename Derived>
10635 OMPTargetUpdateDirective *D) {
10637 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10638 OMPD_target_update, DirName,
nullptr, D->getBeginLoc());
10639 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10640 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10644template <
typename Derived>
10648 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10649 OMPD_teams, DirName,
nullptr, D->getBeginLoc());
10650 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10651 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10655template <
typename Derived>
10657 OMPCancellationPointDirective *D) {
10659 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10660 OMPD_cancellation_point, DirName,
nullptr, D->getBeginLoc());
10661 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10662 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10666template <
typename Derived>
10670 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10671 OMPD_cancel, DirName,
nullptr, D->getBeginLoc());
10672 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10673 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10677template <
typename Derived>
10681 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10682 OMPD_taskloop, DirName,
nullptr, D->getBeginLoc());
10683 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10684 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10688template <
typename Derived>
10690 OMPTaskLoopSimdDirective *D) {
10692 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10693 OMPD_taskloop_simd, DirName,
nullptr, D->getBeginLoc());
10694 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10695 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10699template <
typename Derived>
10701 OMPMasterTaskLoopDirective *D) {
10703 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10704 OMPD_master_taskloop, DirName,
nullptr, D->getBeginLoc());
10705 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10706 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10710template <
typename Derived>
10712 OMPMaskedTaskLoopDirective *D) {
10714 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10715 OMPD_masked_taskloop, DirName,
nullptr, D->getBeginLoc());
10716 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10717 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10721template <
typename Derived>
10723 OMPMasterTaskLoopSimdDirective *D) {
10725 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10726 OMPD_master_taskloop_simd, DirName,
nullptr, D->getBeginLoc());
10727 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10728 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10732template <
typename Derived>
10734 OMPMaskedTaskLoopSimdDirective *D) {
10736 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10737 OMPD_masked_taskloop_simd, DirName,
nullptr, D->getBeginLoc());
10738 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10739 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10743template <
typename Derived>
10745 OMPParallelMasterTaskLoopDirective *D) {
10747 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10748 OMPD_parallel_master_taskloop, DirName,
nullptr, D->getBeginLoc());
10749 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10750 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10754template <
typename Derived>
10756 OMPParallelMaskedTaskLoopDirective *D) {
10758 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10759 OMPD_parallel_masked_taskloop, DirName,
nullptr, D->getBeginLoc());
10760 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10761 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10765template <
typename Derived>
10768 OMPParallelMasterTaskLoopSimdDirective *D) {
10770 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10771 OMPD_parallel_master_taskloop_simd, DirName,
nullptr, D->getBeginLoc());
10772 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10773 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10777template <
typename Derived>
10780 OMPParallelMaskedTaskLoopSimdDirective *D) {
10782 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10783 OMPD_parallel_masked_taskloop_simd, DirName,
nullptr, D->getBeginLoc());
10784 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10785 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10789template <
typename Derived>
10791 OMPDistributeDirective *D) {
10793 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10794 OMPD_distribute, DirName,
nullptr, D->getBeginLoc());
10795 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10796 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10800template <
typename Derived>
10802 OMPDistributeParallelForDirective *D) {
10804 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10805 OMPD_distribute_parallel_for, DirName,
nullptr, D->getBeginLoc());
10806 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10807 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10811template <
typename Derived>
10814 OMPDistributeParallelForSimdDirective *D) {
10816 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10817 OMPD_distribute_parallel_for_simd, DirName,
nullptr, D->getBeginLoc());
10818 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10819 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10823template <
typename Derived>
10825 OMPDistributeSimdDirective *D) {
10827 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10828 OMPD_distribute_simd, DirName,
nullptr, D->getBeginLoc());
10829 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10830 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10834template <
typename Derived>
10836 OMPTargetParallelForSimdDirective *D) {
10838 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10839 OMPD_target_parallel_for_simd, DirName,
nullptr, D->getBeginLoc());
10840 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10841 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10845template <
typename Derived>
10847 OMPTargetSimdDirective *D) {
10849 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10850 OMPD_target_simd, DirName,
nullptr, D->getBeginLoc());
10851 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10852 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10856template <
typename Derived>
10858 OMPTeamsDistributeDirective *D) {
10860 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10861 OMPD_teams_distribute, DirName,
nullptr, D->getBeginLoc());
10862 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10863 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10867template <
typename Derived>
10869 OMPTeamsDistributeSimdDirective *D) {
10871 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10872 OMPD_teams_distribute_simd, DirName,
nullptr, D->getBeginLoc());
10873 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10874 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10878template <
typename Derived>
10880 OMPTeamsDistributeParallelForSimdDirective *D) {
10882 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10883 OMPD_teams_distribute_parallel_for_simd, DirName,
nullptr,
10885 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10886 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10890template <
typename Derived>
10892 OMPTeamsDistributeParallelForDirective *D) {
10894 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10895 OMPD_teams_distribute_parallel_for, DirName,
nullptr, D->getBeginLoc());
10896 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10897 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10901template <
typename Derived>
10903 OMPTargetTeamsDirective *D) {
10905 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10906 OMPD_target_teams, DirName,
nullptr, D->getBeginLoc());
10907 auto Res = getDerived().TransformOMPExecutableDirective(D);
10908 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10912template <
typename Derived>
10914 OMPTargetTeamsDistributeDirective *D) {
10916 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10917 OMPD_target_teams_distribute, DirName,
nullptr, D->getBeginLoc());
10918 auto Res = getDerived().TransformOMPExecutableDirective(D);
10919 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10923template <
typename Derived>
10926 OMPTargetTeamsDistributeParallelForDirective *D) {
10928 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10929 OMPD_target_teams_distribute_parallel_for, DirName,
nullptr,
10931 auto Res = getDerived().TransformOMPExecutableDirective(D);
10932 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10936template <
typename Derived>
10939 OMPTargetTeamsDistributeParallelForSimdDirective *D) {
10941 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10942 OMPD_target_teams_distribute_parallel_for_simd, DirName,
nullptr,
10944 auto Res = getDerived().TransformOMPExecutableDirective(D);
10945 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10949template <
typename Derived>
10952 OMPTargetTeamsDistributeSimdDirective *D) {
10954 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10955 OMPD_target_teams_distribute_simd, DirName,
nullptr, D->getBeginLoc());
10956 auto Res = getDerived().TransformOMPExecutableDirective(D);
10957 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10961template <
typename Derived>
10965 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10966 OMPD_interop, DirName,
nullptr, D->getBeginLoc());
10967 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10968 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10972template <
typename Derived>
10976 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10977 OMPD_dispatch, DirName,
nullptr, D->getBeginLoc());
10978 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10979 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10983template <
typename Derived>
10987 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10988 OMPD_masked, DirName,
nullptr, D->getBeginLoc());
10989 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10990 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10994template <
typename Derived>
10996 OMPGenericLoopDirective *D) {
10998 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10999 OMPD_loop, DirName,
nullptr, D->getBeginLoc());
11000 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
11001 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
11005template <
typename Derived>
11007 OMPTeamsGenericLoopDirective *D) {
11009 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
11010 OMPD_teams_loop, DirName,
nullptr, D->getBeginLoc());
11011 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
11012 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
11016template <
typename Derived>
11018 OMPTargetTeamsGenericLoopDirective *D) {
11020 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
11021 OMPD_target_teams_loop, DirName,
nullptr, D->getBeginLoc());
11022 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
11023 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
11027template <
typename Derived>
11029 OMPParallelGenericLoopDirective *D) {
11031 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
11032 OMPD_parallel_loop, DirName,
nullptr, D->getBeginLoc());
11033 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
11034 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
11038template <
typename Derived>
11041 OMPTargetParallelGenericLoopDirective *D) {
11043 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
11044 OMPD_target_parallel_loop, DirName,
nullptr, D->getBeginLoc());
11045 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
11046 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
11050template <
typename Derived>
11052 OMPTargetGenericLoopDirective *D) {
11054 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
11055 OMPD_target_loop, DirName,
nullptr, D->getBeginLoc());
11056 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
11057 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
11064template <
typename Derived>
11066 ExprResult Cond = getDerived().TransformExpr(
C->getCondition());
11067 if (Cond.isInvalid())
11069 return getDerived().RebuildOMPIfClause(
11070 C->getNameModifier(), Cond.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11071 C->getNameModifierLoc(),
C->getColonLoc(),
C->getEndLoc());
11074template <
typename Derived>
11076 ExprResult Cond = getDerived().TransformExpr(
C->getCondition());
11077 if (Cond.isInvalid())
11079 return getDerived().RebuildOMPFinalClause(Cond.get(),
C->getBeginLoc(),
11080 C->getLParenLoc(),
C->getEndLoc());
11083template <
typename Derived>
11087 Vars.reserve(
C->varlist_size());
11088 for (
auto *
VE :
C->varlist()) {
11090 if (EVar.isInvalid())
11092 Vars.push_back(EVar.get());
11094 Expr *DimsModifierExpr =
C->getDimsModifierExpr();
11095 if (DimsModifierExpr) {
11097 if (EVar.isInvalid())
11099 DimsModifierExpr = EVar.get();
11101 return getDerived().RebuildOMPNumThreadsClause(
11102 Vars,
C->getPrescriptivenessModifier(),
11103 C->getPrescriptivenessModifierLoc(),
C->getDimsModifier(),
11104 DimsModifierExpr,
C->getDimsModifierLoc(),
C->getBeginLoc(),
11105 C->getLParenLoc(),
C->getEndLoc());
11108template <
typename Derived>
11111 ExprResult E = getDerived().TransformExpr(
C->getSafelen());
11114 return getDerived().RebuildOMPSafelenClause(
11115 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11118template <
typename Derived>
11121 ExprResult E = getDerived().TransformExpr(
C->getAllocator());
11124 return getDerived().RebuildOMPAllocatorClause(
11125 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11128template <
typename Derived>
11131 ExprResult E = getDerived().TransformExpr(
C->getSimdlen());
11134 return getDerived().RebuildOMPSimdlenClause(
11135 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11138template <
typename Derived>
11141 TransformedSizes.reserve(
C->getNumSizes());
11143 for (
Expr *E :
C->getSizesRefs()) {
11145 TransformedSizes.push_back(
nullptr);
11149 ExprResult T = getDerived().TransformExpr(E);
11154 TransformedSizes.push_back(T.get());
11157 if (!Changed && !getDerived().AlwaysRebuild())
11159 return RebuildOMPSizesClause(TransformedSizes,
C->getBeginLoc(),
11160 C->getLParenLoc(),
C->getEndLoc());
11163template <
typename Derived>
11167 TransformedCounts.reserve(
C->getNumCounts());
11168 for (
Expr *E :
C->getCountsRefs()) {
11170 TransformedCounts.push_back(
nullptr);
11174 ExprResult T = getDerived().TransformExpr(E);
11177 TransformedCounts.push_back(T.get());
11180 return RebuildOMPCountsClause(TransformedCounts,
C->getBeginLoc(),
11181 C->getLParenLoc(),
C->getEndLoc(),
11182 C->getOmpFillIndex(),
C->getOmpFillLoc());
11185template <
typename Derived>
11189 TransformedArgs.reserve(
C->getNumLoops());
11191 for (
Expr *E :
C->getArgsRefs()) {
11193 TransformedArgs.push_back(
nullptr);
11197 ExprResult T = getDerived().TransformExpr(E);
11202 TransformedArgs.push_back(T.get());
11205 if (!Changed && !getDerived().AlwaysRebuild())
11207 return RebuildOMPPermutationClause(TransformedArgs,
C->getBeginLoc(),
11208 C->getLParenLoc(),
C->getEndLoc());
11211template <
typename Derived>
11213 if (!getDerived().AlwaysRebuild())
11215 return RebuildOMPFullClause(
C->getBeginLoc(),
C->getEndLoc());
11218template <
typename Derived>
11221 ExprResult T = getDerived().TransformExpr(
C->getFactor());
11224 Expr *Factor = T.get();
11225 bool Changed = Factor !=
C->getFactor();
11227 if (!Changed && !getDerived().AlwaysRebuild())
11229 return RebuildOMPPartialClause(Factor,
C->getBeginLoc(),
C->getLParenLoc(),
11233template <
typename Derived>
11235 ExprResult T = getDerived().TransformExpr(
C->getDepth());
11238 Expr *Depth = T.get();
11239 bool Changed = Depth !=
C->getDepth();
11241 if (!Changed && !getDerived().AlwaysRebuild())
11243 return RebuildOMPDepthClause(Depth,
C->getBeginLoc(),
C->getLParenLoc(),
11247template <
typename Derived>
11250 ExprResult F = getDerived().TransformExpr(
C->getFirst());
11254 ExprResult Cn = getDerived().TransformExpr(
C->getCount());
11255 if (Cn.isInvalid())
11259 Expr *Count = Cn.get();
11261 bool Changed = (
First !=
C->getFirst()) || (Count !=
C->getCount());
11264 if (!Changed && !getDerived().AlwaysRebuild())
11267 return RebuildOMPLoopRangeClause(
First, Count,
C->getBeginLoc(),
11268 C->getLParenLoc(),
C->getFirstLoc(),
11269 C->getCountLoc(),
C->getEndLoc());
11272template <
typename Derived>
11275 ExprResult E = getDerived().TransformExpr(
C->getNumForLoops());
11278 return getDerived().RebuildOMPCollapseClause(
11279 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11282template <
typename Derived>
11286 C->getDefaultKind(),
C->getDefaultKindKwLoc(),
C->getDefaultVC(),
11287 C->getDefaultVCLoc(),
C->getBeginLoc(),
C->getLParenLoc(),
11291template <
typename Derived>
11298template <
typename Derived>
11301 Expr *Impex =
C->getImpexType();
11302 ExprResult TransformedImpex = getDerived().TransformExpr(Impex);
11304 if (TransformedImpex.isInvalid())
11307 return getDerived().RebuildOMPTransparentClause(
11308 TransformedImpex.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11312template <
typename Derived>
11316 C->getProcBindKind(),
C->getProcBindKindKwLoc(),
C->getBeginLoc(),
11317 C->getLParenLoc(),
C->getEndLoc());
11320template <
typename Derived>
11323 ExprResult E = getDerived().TransformExpr(
C->getChunkSize());
11326 return getDerived().RebuildOMPScheduleClause(
11327 C->getFirstScheduleModifier(),
C->getSecondScheduleModifier(),
11328 C->getScheduleKind(), E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11329 C->getFirstScheduleModifierLoc(),
C->getSecondScheduleModifierLoc(),
11330 C->getScheduleKindLoc(),
C->getCommaLoc(),
C->getEndLoc());
11333template <
typename Derived>
11337 if (
auto *
Num =
C->getNumForLoops()) {
11338 E = getDerived().TransformExpr(
Num);
11342 return getDerived().RebuildOMPOrderedClause(
C->getBeginLoc(),
C->getEndLoc(),
11343 C->getLParenLoc(), E.get());
11346template <
typename Derived>
11350 if (
Expr *Evt =
C->getEventHandler()) {
11351 E = getDerived().TransformExpr(Evt);
11355 return getDerived().RebuildOMPDetachClause(E.get(),
C->getBeginLoc(),
11356 C->getLParenLoc(),
C->getEndLoc());
11359template <
typename Derived>
11364 Cond = getDerived().TransformExpr(
Condition);
11365 if (Cond.isInvalid())
11368 return getDerived().RebuildOMPNowaitClause(Cond.get(),
C->getBeginLoc(),
11369 C->getLParenLoc(),
C->getEndLoc());
11372template <
typename Derived>
11379template <
typename Derived>
11386template <
typename Derived>
11392template <
typename Derived>
11398template <
typename Derived>
11405template <
typename Derived>
11407 OMPUpdateDependObjectsClause *
C) {
11412template <
typename Derived>
11419template <
typename Derived>
11426template <
typename Derived>
11432template <
typename Derived>
11438template <
typename Derived>
11440 ExprResult E = getDerived().TransformExpr(
C->getExpr());
11443 return getDerived().RebuildOMPHoldsClause(E.get(),
C->getBeginLoc(),
11444 C->getLParenLoc(),
C->getEndLoc());
11447template <
typename Derived>
11453template <
typename Derived>
11458template <
typename Derived>
11460 OMPNoOpenMPRoutinesClause *
C) {
11463template <
typename Derived>
11465 OMPNoOpenMPConstructsClause *
C) {
11468template <
typename Derived>
11470 OMPNoParallelismClause *
C) {
11474template <
typename Derived>
11481template <
typename Derived>
11488template <
typename Derived>
11495template <
typename Derived>
11502template <
typename Derived>
11509template <
typename Derived>
11515template <
typename Derived>
11522template <
typename Derived>
11528template <
typename Derived>
11535template <
typename Derived>
11537 ExprResult IVR = getDerived().TransformExpr(
C->getInteropVar());
11538 if (IVR.isInvalid())
11542 for (OMPInitClause::PrefView P :
C->prefs()) {
11543 Expr *NewFr =
nullptr;
11545 ExprResult ER = getDerived().TransformExpr(P.Fr);
11546 if (ER.isInvalid())
11551 NewAttrs.reserve(P.Attrs.size());
11552 for (
Expr *A : P.Attrs) {
11553 ExprResult ER = getDerived().TransformExpr(A);
11554 if (ER.isInvalid())
11556 NewAttrs.push_back(ER.get());
11558 InteropInfo.Prefs.emplace_back(NewFr, std::move(NewAttrs));
11560 InteropInfo.HasPreferAttrs =
C->hasPreferAttrs();
11561 return getDerived().RebuildOMPInitClause(IVR.get(), InteropInfo,
11562 C->getBeginLoc(),
C->getLParenLoc(),
11563 C->getVarLoc(),
C->getEndLoc());
11566template <
typename Derived>
11568 ExprResult ER = getDerived().TransformExpr(
C->getInteropVar());
11569 if (ER.isInvalid())
11571 return getDerived().RebuildOMPUseClause(ER.get(),
C->getBeginLoc(),
11572 C->getLParenLoc(),
C->getVarLoc(),
11576template <
typename Derived>
11580 if (
Expr *IV =
C->getInteropVar()) {
11581 ER = getDerived().TransformExpr(IV);
11582 if (ER.isInvalid())
11585 return getDerived().RebuildOMPDestroyClause(ER.get(),
C->getBeginLoc(),
11586 C->getLParenLoc(),
C->getVarLoc(),
11590template <
typename Derived>
11593 ExprResult Cond = getDerived().TransformExpr(
C->getCondition());
11594 if (Cond.isInvalid())
11596 return getDerived().RebuildOMPNovariantsClause(
11597 Cond.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11600template <
typename Derived>
11603 ExprResult Cond = getDerived().TransformExpr(
C->getCondition());
11604 if (Cond.isInvalid())
11606 return getDerived().RebuildOMPNocontextClause(
11607 Cond.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11610template <
typename Derived>
11613 ExprResult ThreadID = getDerived().TransformExpr(
C->getThreadID());
11614 if (ThreadID.isInvalid())
11616 return getDerived().RebuildOMPFilterClause(ThreadID.get(),
C->getBeginLoc(),
11617 C->getLParenLoc(),
C->getEndLoc());
11620template <
typename Derived>
11622 ExprResult E = getDerived().TransformExpr(
C->getAlignment());
11625 return getDerived().RebuildOMPAlignClause(E.get(),
C->getBeginLoc(),
11626 C->getLParenLoc(),
C->getEndLoc());
11629template <
typename Derived>
11631 OMPUnifiedAddressClause *
C) {
11632 llvm_unreachable(
"unified_address clause cannot appear in dependent context");
11635template <
typename Derived>
11637 OMPUnifiedSharedMemoryClause *
C) {
11639 "unified_shared_memory clause cannot appear in dependent context");
11642template <
typename Derived>
11644 OMPReverseOffloadClause *
C) {
11645 llvm_unreachable(
"reverse_offload clause cannot appear in dependent context");
11648template <
typename Derived>
11650 OMPDynamicAllocatorsClause *
C) {
11652 "dynamic_allocators clause cannot appear in dependent context");
11655template <
typename Derived>
11657 OMPAtomicDefaultMemOrderClause *
C) {
11659 "atomic_default_mem_order clause cannot appear in dependent context");
11662template <
typename Derived>
11665 llvm_unreachable(
"self_maps clause cannot appear in dependent context");
11668template <
typename Derived>
11671 C->getBeginLoc(),
C->getLParenLoc(),
11675template <
typename Derived>
11679 C->getSeverityKind(),
C->getSeverityKindKwLoc(),
C->getBeginLoc(),
11680 C->getLParenLoc(),
C->getEndLoc());
11683template <
typename Derived>
11686 ExprResult E = getDerived().TransformExpr(
C->getMessageString());
11689 return getDerived().RebuildOMPMessageClause(
11690 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11693template <
typename Derived>
11697 Vars.reserve(
C->varlist_size());
11698 for (
auto *
VE :
C->varlist()) {
11700 if (EVar.isInvalid())
11702 Vars.push_back(EVar.get());
11704 return getDerived().RebuildOMPPrivateClause(
11705 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11708template <
typename Derived>
11710 OMPFirstprivateClause *
C) {
11712 Vars.reserve(
C->varlist_size());
11713 for (
auto *
VE :
C->varlist()) {
11715 if (EVar.isInvalid())
11717 Vars.push_back(EVar.get());
11719 return getDerived().RebuildOMPFirstprivateClause(
11720 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11723template <
typename Derived>
11727 Vars.reserve(
C->varlist_size());
11728 for (
auto *
VE :
C->varlist()) {
11730 if (EVar.isInvalid())
11732 Vars.push_back(EVar.get());
11734 return getDerived().RebuildOMPLastprivateClause(
11735 Vars,
C->getKind(),
C->getKindLoc(),
C->getColonLoc(),
C->getBeginLoc(),
11736 C->getLParenLoc(),
C->getEndLoc());
11739template <
typename Derived>
11743 Vars.reserve(
C->varlist_size());
11744 for (
auto *
VE :
C->varlist()) {
11746 if (EVar.isInvalid())
11748 Vars.push_back(EVar.get());
11750 return getDerived().RebuildOMPSharedClause(Vars,
C->getBeginLoc(),
11751 C->getLParenLoc(),
C->getEndLoc());
11754template <
typename Derived>
11758 Vars.reserve(
C->varlist_size());
11759 for (
auto *
VE :
C->varlist()) {
11761 if (EVar.isInvalid())
11763 Vars.push_back(EVar.get());
11766 ReductionIdScopeSpec.
Adopt(
C->getQualifierLoc());
11769 if (NameInfo.getName()) {
11770 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
11771 if (!NameInfo.getName())
11777 for (
auto *E :
C->reduction_ops()) {
11782 for (
auto *D : ULE->decls()) {
11785 Decls.addDecl(InstD, InstD->getAccess());
11789 ReductionIdScopeSpec.getWithLocInContext(SemaRef.
Context), NameInfo,
11790 true, Decls.begin(), Decls.end(),
11793 UnresolvedReductions.push_back(
nullptr);
11795 return getDerived().RebuildOMPReductionClause(
11796 Vars,
C->getModifier(),
C->getOriginalSharingModifier(),
C->getBeginLoc(),
11797 C->getLParenLoc(),
C->getModifierLoc(),
C->getColonLoc(),
C->getEndLoc(),
11798 ReductionIdScopeSpec, NameInfo, UnresolvedReductions);
11801template <
typename Derived>
11803 OMPTaskReductionClause *
C) {
11805 Vars.reserve(
C->varlist_size());
11806 for (
auto *
VE :
C->varlist()) {
11808 if (EVar.isInvalid())
11810 Vars.push_back(EVar.get());
11813 ReductionIdScopeSpec.
Adopt(
C->getQualifierLoc());
11816 if (NameInfo.getName()) {
11817 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
11818 if (!NameInfo.getName())
11824 for (
auto *E :
C->reduction_ops()) {
11829 for (
auto *D : ULE->decls()) {
11832 Decls.addDecl(InstD, InstD->getAccess());
11836 ReductionIdScopeSpec.getWithLocInContext(SemaRef.
Context), NameInfo,
11837 true, Decls.begin(), Decls.end(),
11840 UnresolvedReductions.push_back(
nullptr);
11842 return getDerived().RebuildOMPTaskReductionClause(
11843 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getColonLoc(),
11844 C->getEndLoc(), ReductionIdScopeSpec, NameInfo, UnresolvedReductions);
11847template <
typename Derived>
11851 Vars.reserve(
C->varlist_size());
11852 for (
auto *
VE :
C->varlist()) {
11854 if (EVar.isInvalid())
11856 Vars.push_back(EVar.get());
11859 ReductionIdScopeSpec.
Adopt(
C->getQualifierLoc());
11862 if (NameInfo.getName()) {
11863 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
11864 if (!NameInfo.getName())
11870 for (
auto *E :
C->reduction_ops()) {
11875 for (
auto *D : ULE->decls()) {
11878 Decls.addDecl(InstD, InstD->getAccess());
11882 ReductionIdScopeSpec.getWithLocInContext(SemaRef.
Context), NameInfo,
11883 true, Decls.begin(), Decls.end(),
11886 UnresolvedReductions.push_back(
nullptr);
11888 return getDerived().RebuildOMPInReductionClause(
11889 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getColonLoc(),
11890 C->getEndLoc(), ReductionIdScopeSpec, NameInfo, UnresolvedReductions);
11893template <
typename Derived>
11897 Vars.reserve(
C->varlist_size());
11898 for (
auto *
VE :
C->varlist()) {
11900 if (EVar.isInvalid())
11902 Vars.push_back(EVar.get());
11904 ExprResult Step = getDerived().TransformExpr(
C->getStep());
11905 if (Step.isInvalid())
11907 return getDerived().RebuildOMPLinearClause(
11908 Vars, Step.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getModifier(),
11909 C->getModifierLoc(),
C->getColonLoc(),
C->getStepModifierLoc(),
11913template <
typename Derived>
11917 Vars.reserve(
C->varlist_size());
11918 for (
auto *
VE :
C->varlist()) {
11920 if (EVar.isInvalid())
11922 Vars.push_back(EVar.get());
11924 ExprResult Alignment = getDerived().TransformExpr(
C->getAlignment());
11925 if (Alignment.isInvalid())
11927 return getDerived().RebuildOMPAlignedClause(
11928 Vars, Alignment.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11929 C->getColonLoc(),
C->getEndLoc());
11932template <
typename Derived>
11936 Vars.reserve(
C->varlist_size());
11937 for (
auto *
VE :
C->varlist()) {
11939 if (EVar.isInvalid())
11941 Vars.push_back(EVar.get());
11943 return getDerived().RebuildOMPCopyinClause(Vars,
C->getBeginLoc(),
11944 C->getLParenLoc(),
C->getEndLoc());
11947template <
typename Derived>
11951 Vars.reserve(
C->varlist_size());
11952 for (
auto *
VE :
C->varlist()) {
11954 if (EVar.isInvalid())
11956 Vars.push_back(EVar.get());
11958 return getDerived().RebuildOMPCopyprivateClause(
11959 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11962template <
typename Derived>
11965 Vars.reserve(
C->varlist_size());
11966 for (
auto *
VE :
C->varlist()) {
11968 if (EVar.isInvalid())
11970 Vars.push_back(EVar.get());
11972 return getDerived().RebuildOMPFlushClause(Vars,
C->getBeginLoc(),
11973 C->getLParenLoc(),
C->getEndLoc());
11976template <
typename Derived>
11979 ExprResult E = getDerived().TransformExpr(
C->getDepobj());
11982 return getDerived().RebuildOMPDepobjClause(E.get(),
C->getBeginLoc(),
11983 C->getLParenLoc(),
C->getEndLoc());
11986template <
typename Derived>
11990 Expr *DepModifier =
C->getModifier();
11992 ExprResult DepModRes = getDerived().TransformExpr(DepModifier);
11993 if (DepModRes.isInvalid())
11995 DepModifier = DepModRes.get();
11997 Vars.reserve(
C->varlist_size());
11998 for (
auto *
VE :
C->varlist()) {
12000 if (EVar.isInvalid())
12002 Vars.push_back(EVar.get());
12004 return getDerived().RebuildOMPDependClause(
12005 {
C->getDependencyKind(),
C->getDependencyLoc(),
C->getColonLoc(),
12006 C->getOmpAllMemoryLoc()},
12007 DepModifier, Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
12010template <
typename Derived>
12013 ExprResult E = getDerived().TransformExpr(
C->getDevice());
12016 return getDerived().RebuildOMPDeviceClause(
12017 C->getModifier(), E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
12018 C->getModifierLoc(),
C->getEndLoc());
12021template <
typename Derived,
class T>
12028 Vars.reserve(
C->varlist_size());
12029 for (
auto *
VE :
C->varlist()) {
12033 Vars.push_back(EVar.
get());
12037 if (
C->getMapperQualifierLoc()) {
12038 QualifierLoc = TT.
getDerived().TransformNestedNameSpecifierLoc(
12039 C->getMapperQualifierLoc());
12043 MapperIdScopeSpec.
Adopt(QualifierLoc);
12044 MapperIdInfo =
C->getMapperIdInfo();
12045 if (MapperIdInfo.
getName()) {
12046 MapperIdInfo = TT.
getDerived().TransformDeclarationNameInfo(MapperIdInfo);
12052 for (
auto *E :
C->mapperlists()) {
12057 for (
auto *D : ULE->decls()) {
12060 Decls.addDecl(InstD, InstD->
getAccess());
12065 MapperIdInfo,
true, Decls.begin(), Decls.end(),
12068 UnresolvedMappers.push_back(
nullptr);
12074template <
typename Derived>
12076 OMPVarListLocTy Locs(
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
12078 Expr *IteratorModifier =
C->getIteratorModifier();
12079 if (IteratorModifier) {
12080 ExprResult MapModRes = getDerived().TransformExpr(IteratorModifier);
12081 if (MapModRes.isInvalid())
12083 IteratorModifier = MapModRes.
get();
12089 *
this,
C, Vars, MapperIdScopeSpec, MapperIdInfo, UnresolvedMappers))
12091 return getDerived().RebuildOMPMapClause(
12092 IteratorModifier,
C->getMapTypeModifiers(),
C->getMapTypeModifiersLoc(),
12093 MapperIdScopeSpec, MapperIdInfo,
C->getMapType(),
C->isImplicitMapType(),
12094 C->getMapLoc(),
C->getColonLoc(), Vars, Locs, UnresolvedMappers);
12097template <
typename Derived>
12100 Expr *Allocator =
C->getAllocator();
12102 ExprResult AllocatorRes = getDerived().TransformExpr(Allocator);
12103 if (AllocatorRes.isInvalid())
12105 Allocator = AllocatorRes.get();
12107 Expr *Alignment =
C->getAlignment();
12109 ExprResult AlignmentRes = getDerived().TransformExpr(Alignment);
12110 if (AlignmentRes.isInvalid())
12112 Alignment = AlignmentRes.get();
12115 Vars.reserve(
C->varlist_size());
12116 for (
auto *
VE :
C->varlist()) {
12118 if (EVar.isInvalid())
12120 Vars.push_back(EVar.get());
12122 return getDerived().RebuildOMPAllocateClause(
12123 Allocator, Alignment,
C->getFirstAllocateModifier(),
12124 C->getFirstAllocateModifierLoc(),
C->getSecondAllocateModifier(),
12125 C->getSecondAllocateModifierLoc(), Vars,
C->getBeginLoc(),
12126 C->getLParenLoc(),
C->getColonLoc(),
C->getEndLoc());
12129template <
typename Derived>
12133 Vars.reserve(
C->varlist_size());
12134 for (
auto *
VE :
C->varlist()) {
12136 if (EVar.isInvalid())
12138 Vars.push_back(EVar.get());
12140 Expr *ModifierExpr =
C->getModifierExpr();
12141 if (ModifierExpr) {
12143 if (EVar.isInvalid())
12145 ModifierExpr = EVar.get();
12147 return getDerived().RebuildOMPNumTeamsClause(
12148 Vars,
C->getModifier(), ModifierExpr,
C->getModifierLoc(),
12150 C->getLParenLoc(),
C->getEndLoc());
12153template <
typename Derived>
12157 Vars.reserve(
C->varlist_size());
12158 for (
auto *
VE :
C->varlist()) {
12160 if (EVar.isInvalid())
12162 Vars.push_back(EVar.get());
12164 Expr *ModifierExpr =
C->getModifierExpr();
12165 if (ModifierExpr) {
12167 if (EVar.isInvalid())
12169 ModifierExpr = EVar.get();
12171 return getDerived().RebuildOMPThreadLimitClause(
12172 Vars,
C->getModifier(), ModifierExpr,
C->getModifierLoc(),
12173 C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
12176template <
typename Derived>
12179 ExprResult E = getDerived().TransformExpr(
C->getPriority());
12182 return getDerived().RebuildOMPPriorityClause(
12183 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
12186template <
typename Derived>
12189 ExprResult E = getDerived().TransformExpr(
C->getGrainsize());
12192 return getDerived().RebuildOMPGrainsizeClause(
12193 C->getModifier(), E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
12194 C->getModifierLoc(),
C->getEndLoc());
12197template <
typename Derived>
12200 ExprResult E = getDerived().TransformExpr(
C->getNumTasks());
12203 return getDerived().RebuildOMPNumTasksClause(
12204 C->getModifier(), E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
12205 C->getModifierLoc(),
C->getEndLoc());
12208template <
typename Derived>
12210 ExprResult E = getDerived().TransformExpr(
C->getHint());
12213 return getDerived().RebuildOMPHintClause(E.get(),
C->getBeginLoc(),
12214 C->getLParenLoc(),
C->getEndLoc());
12217template <
typename Derived>
12219 OMPDistScheduleClause *
C) {
12220 ExprResult E = getDerived().TransformExpr(
C->getChunkSize());
12223 return getDerived().RebuildOMPDistScheduleClause(
12224 C->getDistScheduleKind(), E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
12225 C->getDistScheduleKindLoc(),
C->getCommaLoc(),
C->getEndLoc());
12228template <
typename Derived>
12234 C->getDefaultmapKind(),
12237 C->getDefaultmapModifierLoc(),
12238 C->getDefaultmapKindLoc(),
12242template <
typename Derived>
12246 Expr *IteratorModifier =
C->getIteratorModifier();
12247 if (IteratorModifier) {
12248 ExprResult MapModRes = getDerived().TransformExpr(IteratorModifier);
12249 if (MapModRes.isInvalid())
12251 IteratorModifier = MapModRes.get();
12257 *
this,
C, Vars, MapperIdScopeSpec, MapperIdInfo, UnresolvedMappers))
12259 return getDerived().RebuildOMPToClause(
12260 C->getMotionModifiers(),
C->getMotionModifiersLoc(), IteratorModifier,
12261 MapperIdScopeSpec, MapperIdInfo,
C->getColonLoc(), Vars, Locs,
12262 UnresolvedMappers);
12265template <
typename Derived>
12269 Expr *IteratorModifier =
C->getIteratorModifier();
12270 if (IteratorModifier) {
12271 ExprResult MapModRes = getDerived().TransformExpr(IteratorModifier);
12272 if (MapModRes.isInvalid())
12274 IteratorModifier = MapModRes.get();
12280 *
this,
C, Vars, MapperIdScopeSpec, MapperIdInfo, UnresolvedMappers))
12282 return getDerived().RebuildOMPFromClause(
12283 C->getMotionModifiers(),
C->getMotionModifiersLoc(), IteratorModifier,
12284 MapperIdScopeSpec, MapperIdInfo,
C->getColonLoc(), Vars, Locs,
12285 UnresolvedMappers);
12288template <
typename Derived>
12290 OMPUseDevicePtrClause *
C) {
12292 Vars.reserve(
C->varlist_size());
12293 for (
auto *
VE :
C->varlist()) {
12295 if (EVar.isInvalid())
12297 Vars.push_back(EVar.get());
12300 return getDerived().RebuildOMPUseDevicePtrClause(
12301 Vars, Locs,
C->getFallbackModifier(),
C->getFallbackModifierLoc());
12304template <
typename Derived>
12306 OMPUseDeviceAddrClause *
C) {
12308 Vars.reserve(
C->varlist_size());
12309 for (
auto *
VE :
C->varlist()) {
12311 if (EVar.isInvalid())
12313 Vars.push_back(EVar.get());
12316 return getDerived().RebuildOMPUseDeviceAddrClause(Vars, Locs);
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());
12331 return getDerived().RebuildOMPIsDevicePtrClause(Vars, Locs);
12334template <
typename Derived>
12336 OMPHasDeviceAddrClause *
C) {
12338 Vars.reserve(
C->varlist_size());
12339 for (
auto *
VE :
C->varlist()) {
12341 if (EVar.isInvalid())
12343 Vars.push_back(EVar.get());
12346 return getDerived().RebuildOMPHasDeviceAddrClause(Vars, Locs);
12349template <
typename Derived>
12353 Vars.reserve(
C->varlist_size());
12354 for (
auto *
VE :
C->varlist()) {
12356 if (EVar.isInvalid())
12358 Vars.push_back(EVar.get());
12360 return getDerived().RebuildOMPNontemporalClause(
12361 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
12364template <
typename Derived>
12368 Vars.reserve(
C->varlist_size());
12369 for (
auto *
VE :
C->varlist()) {
12371 if (EVar.isInvalid())
12373 Vars.push_back(EVar.get());
12375 return getDerived().RebuildOMPInclusiveClause(
12376 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
12379template <
typename Derived>
12383 Vars.reserve(
C->varlist_size());
12384 for (
auto *
VE :
C->varlist()) {
12386 if (EVar.isInvalid())
12388 Vars.push_back(EVar.get());
12390 return getDerived().RebuildOMPExclusiveClause(
12391 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
12394template <
typename Derived>
12396 OMPUsesAllocatorsClause *
C) {
12398 Data.reserve(
C->getNumberOfAllocators());
12399 for (
unsigned I = 0, E =
C->getNumberOfAllocators(); I < E; ++I) {
12400 OMPUsesAllocatorsClause::Data D =
C->getAllocatorData(I);
12402 if (Allocator.isInvalid())
12406 AllocatorTraits = getDerived().TransformExpr(AT);
12407 if (AllocatorTraits.isInvalid())
12411 NewD.Allocator = Allocator.get();
12412 NewD.AllocatorTraits = AllocatorTraits.get();
12416 return getDerived().RebuildOMPUsesAllocatorsClause(
12417 Data,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
12420template <
typename Derived>
12424 Locators.reserve(
C->varlist_size());
12426 if (
Expr *Modifier =
C->getModifier()) {
12427 ModifierRes = getDerived().TransformExpr(Modifier);
12428 if (ModifierRes.isInvalid())
12431 for (
Expr *E :
C->varlist()) {
12432 ExprResult Locator = getDerived().TransformExpr(E);
12433 if (Locator.isInvalid())
12435 Locators.push_back(Locator.get());
12437 return getDerived().RebuildOMPAffinityClause(
12438 C->getBeginLoc(),
C->getLParenLoc(),
C->getColonLoc(),
C->getEndLoc(),
12439 ModifierRes.get(), Locators);
12442template <
typename Derived>
12445 C->getKind(),
C->getKindKwLoc(),
C->getBeginLoc(),
C->getLParenLoc(),
12446 C->getEndLoc(),
C->getModifier(),
C->getModifierKwLoc());
12449template <
typename Derived>
12452 C->getBindKind(),
C->getBindKindLoc(),
C->getBeginLoc(),
12453 C->getLParenLoc(),
C->getEndLoc());
12456template <
typename Derived>
12458 OMPXDynCGroupMemClause *
C) {
12460 if (
Size.isInvalid())
12462 return getDerived().RebuildOMPXDynCGroupMemClause(
12463 Size.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
12466template <
typename Derived>
12468 OMPDynGroupprivateClause *
C) {
12470 if (
Size.isInvalid())
12472 return getDerived().RebuildOMPDynGroupprivateClause(
12473 C->getDynGroupprivateModifier(),
C->getDynGroupprivateFallbackModifier(),
12474 Size.get(),
C->getBeginLoc(),
C->getLParenLoc(),
12475 C->getDynGroupprivateModifierLoc(),
12476 C->getDynGroupprivateFallbackModifierLoc(),
C->getEndLoc());
12479template <
typename Derived>
12483 Vars.reserve(
C->varlist_size());
12484 for (
auto *
VE :
C->varlist()) {
12486 if (EVar.isInvalid())
12488 Vars.push_back(EVar.get());
12490 return getDerived().RebuildOMPDoacrossClause(
12491 C->getDependenceType(),
C->getDependenceLoc(),
C->getColonLoc(), Vars,
12492 C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
12495template <
typename Derived>
12499 for (
auto *A :
C->getAttrs())
12500 NewAttrs.push_back(getDerived().TransformAttr(A));
12501 return getDerived().RebuildOMPXAttributeClause(
12502 NewAttrs,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
12505template <
typename Derived>
12514template <
typename Derived>
12515class OpenACCClauseTransform final
12517 TreeTransform<Derived> &Self;
12518 ArrayRef<const OpenACCClause *> ExistingClauses;
12519 SemaOpenACC::OpenACCParsedClause &ParsedClause;
12520 OpenACCClause *NewClause =
nullptr;
12523 ExprResult Res = Self.TransformExpr(VarRef);
12525 if (!Res.isUsable())
12528 Res = Self.getSema().OpenACC().ActOnVar(ParsedClause.getDirectiveKind(),
12529 ParsedClause.getClauseKind(),
12535 llvm::SmallVector<Expr *> VisitVarList(ArrayRef<Expr *> VarList) {
12536 llvm::SmallVector<Expr *> InstantiatedVarList;
12537 for (Expr *CurVar : VarList) {
12540 if (VarRef.isUsable())
12541 InstantiatedVarList.push_back(VarRef.get());
12544 return InstantiatedVarList;
12548 OpenACCClauseTransform(TreeTransform<Derived> &Self,
12549 ArrayRef<const OpenACCClause *> ExistingClauses,
12550 SemaOpenACC::OpenACCParsedClause &PC)
12551 : Self(Self), ExistingClauses(ExistingClauses), ParsedClause(PC) {}
12553 OpenACCClause *CreatedClause()
const {
return NewClause; }
12555#define VISIT_CLAUSE(CLAUSE_NAME) \
12556 void Visit##CLAUSE_NAME##Clause(const OpenACC##CLAUSE_NAME##Clause &Clause);
12557#include "clang/Basic/OpenACCClauses.def"
12560template <
typename Derived>
12561void OpenACCClauseTransform<Derived>::VisitDefaultClause(
12563 ParsedClause.setDefaultDetails(
C.getDefaultClauseKind());
12566 Self.getSema().getASTContext(), ParsedClause.getDefaultClauseKind(),
12567 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12568 ParsedClause.getEndLoc());
12571template <
typename Derived>
12572void OpenACCClauseTransform<Derived>::VisitIfClause(
const OpenACCIfClause &
C) {
12573 Expr *Cond =
const_cast<Expr *
>(
C.getConditionExpr());
12574 assert(Cond &&
"If constructed with invalid Condition");
12578 if (Res.isInvalid() || !Res.get().second)
12581 ParsedClause.setConditionDetails(Res.get().second);
12584 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12585 ParsedClause.getLParenLoc(), ParsedClause.getConditionExpr(),
12586 ParsedClause.getEndLoc());
12589template <
typename Derived>
12590void OpenACCClauseTransform<Derived>::VisitSelfClause(
12596 for (
Expr *CurVar :
C.getVarList()) {
12599 if (!Res.isUsable())
12602 Res =
Self.getSema().OpenACC().ActOnVar(ParsedClause.getDirectiveKind(),
12603 ParsedClause.getClauseKind(),
12606 if (Res.isUsable())
12607 InstantiatedVarList.push_back(Res.get());
12610 ParsedClause.setVarListDetails(InstantiatedVarList,
12614 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12615 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12616 ParsedClause.getEndLoc());
12619 if (
C.hasConditionExpr()) {
12620 Expr *Cond =
const_cast<Expr *
>(
C.getConditionExpr());
12622 Self.TransformCondition(Cond->getExprLoc(),
nullptr, Cond,
12625 if (Res.isInvalid() || !Res.get().second)
12628 ParsedClause.setConditionDetails(Res.get().second);
12632 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12633 ParsedClause.getLParenLoc(), ParsedClause.getConditionExpr(),
12634 ParsedClause.getEndLoc());
12638template <
typename Derived>
12639void OpenACCClauseTransform<Derived>::VisitNumGangsClause(
12643 for (
Expr *CurIntExpr :
C.getIntExprs()) {
12646 if (!Res.isUsable())
12651 C.getBeginLoc(), Res.get());
12652 if (!Res.isUsable())
12655 InstantiatedIntExprs.push_back(Res.get());
12658 ParsedClause.setIntExprDetails(InstantiatedIntExprs);
12660 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12661 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs(),
12662 ParsedClause.getEndLoc());
12665template <
typename Derived>
12666void OpenACCClauseTransform<Derived>::VisitPrivateClause(
12671 for (
const auto [RefExpr, InitRecipe] :
12672 llvm::zip(
C.getVarList(),
C.getInitRecipes())) {
12675 if (VarRef.isUsable()) {
12676 InstantiatedVarList.push_back(VarRef.get());
12680 if (InitRecipe.isSet())
12681 InitRecipes.push_back(InitRecipe);
12683 InitRecipes.push_back(
12684 Self.getSema().OpenACC().CreatePrivateInitRecipe(VarRef.get()));
12687 ParsedClause.setVarListDetails(InstantiatedVarList,
12691 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12692 ParsedClause.getLParenLoc(), ParsedClause.getVarList(), InitRecipes,
12693 ParsedClause.getEndLoc());
12696template <
typename Derived>
12697void OpenACCClauseTransform<Derived>::VisitHostClause(
12699 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12703 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12704 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12705 ParsedClause.getEndLoc());
12708template <
typename Derived>
12709void OpenACCClauseTransform<Derived>::VisitDeviceClause(
12711 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12715 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12716 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12717 ParsedClause.getEndLoc());
12720template <
typename Derived>
12721void OpenACCClauseTransform<Derived>::VisitFirstPrivateClause(
12726 for (
const auto [RefExpr, InitRecipe] :
12727 llvm::zip(
C.getVarList(),
C.getInitRecipes())) {
12730 if (VarRef.isUsable()) {
12731 InstantiatedVarList.push_back(VarRef.get());
12735 if (InitRecipe.isSet())
12736 InitRecipes.push_back(InitRecipe);
12738 InitRecipes.push_back(
12739 Self.getSema().OpenACC().CreateFirstPrivateInitRecipe(
12743 ParsedClause.setVarListDetails(InstantiatedVarList,
12747 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12748 ParsedClause.getLParenLoc(), ParsedClause.getVarList(), InitRecipes,
12749 ParsedClause.getEndLoc());
12752template <
typename Derived>
12753void OpenACCClauseTransform<Derived>::VisitNoCreateClause(
12755 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12759 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12760 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12761 ParsedClause.getEndLoc());
12764template <
typename Derived>
12765void OpenACCClauseTransform<Derived>::VisitPresentClause(
12767 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12771 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12772 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12773 ParsedClause.getEndLoc());
12776template <
typename Derived>
12777void OpenACCClauseTransform<Derived>::VisitCopyClause(
12779 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12780 C.getModifierList());
12783 Self.getSema().getASTContext(), ParsedClause.getClauseKind(),
12784 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12785 ParsedClause.getModifierList(), ParsedClause.getVarList(),
12786 ParsedClause.getEndLoc());
12789template <
typename Derived>
12790void OpenACCClauseTransform<Derived>::VisitLinkClause(
12792 llvm_unreachable(
"link clause not valid unless a decl transform");
12795template <
typename Derived>
12796void OpenACCClauseTransform<Derived>::VisitDeviceResidentClause(
12798 llvm_unreachable(
"device_resident clause not valid unless a decl transform");
12800template <
typename Derived>
12801void OpenACCClauseTransform<Derived>::VisitNoHostClause(
12803 llvm_unreachable(
"nohost clause not valid unless a decl transform");
12805template <
typename Derived>
12806void OpenACCClauseTransform<Derived>::VisitBindClause(
12808 llvm_unreachable(
"bind clause not valid unless a decl transform");
12811template <
typename Derived>
12812void OpenACCClauseTransform<Derived>::VisitCopyInClause(
12814 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12815 C.getModifierList());
12818 Self.getSema().getASTContext(), ParsedClause.getClauseKind(),
12819 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12820 ParsedClause.getModifierList(), ParsedClause.getVarList(),
12821 ParsedClause.getEndLoc());
12824template <
typename Derived>
12825void OpenACCClauseTransform<Derived>::VisitCopyOutClause(
12827 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12828 C.getModifierList());
12831 Self.getSema().getASTContext(), ParsedClause.getClauseKind(),
12832 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12833 ParsedClause.getModifierList(), ParsedClause.getVarList(),
12834 ParsedClause.getEndLoc());
12837template <
typename Derived>
12838void OpenACCClauseTransform<Derived>::VisitCreateClause(
12840 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12841 C.getModifierList());
12844 Self.getSema().getASTContext(), ParsedClause.getClauseKind(),
12845 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12846 ParsedClause.getModifierList(), ParsedClause.getVarList(),
12847 ParsedClause.getEndLoc());
12849template <
typename Derived>
12850void OpenACCClauseTransform<Derived>::VisitAttachClause(
12855 llvm::erase_if(VarList, [&](
Expr *E) {
12856 return Self.getSema().OpenACC().CheckVarIsPointerType(
12862 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12863 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12864 ParsedClause.getEndLoc());
12867template <
typename Derived>
12868void OpenACCClauseTransform<Derived>::VisitDetachClause(
12873 llvm::erase_if(VarList, [&](
Expr *E) {
12874 return Self.getSema().OpenACC().CheckVarIsPointerType(
12880 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12881 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12882 ParsedClause.getEndLoc());
12885template <
typename Derived>
12886void OpenACCClauseTransform<Derived>::VisitDeleteClause(
12888 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12891 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12892 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12893 ParsedClause.getEndLoc());
12896template <
typename Derived>
12897void OpenACCClauseTransform<Derived>::VisitUseDeviceClause(
12899 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12902 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12903 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12904 ParsedClause.getEndLoc());
12907template <
typename Derived>
12908void OpenACCClauseTransform<Derived>::VisitDevicePtrClause(
12913 llvm::erase_if(VarList, [&](
Expr *E) {
12914 return Self.getSema().OpenACC().CheckVarIsPointerType(
12920 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12921 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12922 ParsedClause.getEndLoc());
12925template <
typename Derived>
12926void OpenACCClauseTransform<Derived>::VisitNumWorkersClause(
12928 Expr *IntExpr =
const_cast<Expr *
>(
C.getIntExpr());
12929 assert(IntExpr &&
"num_workers clause constructed with invalid int expr");
12932 if (!Res.isUsable())
12937 C.getBeginLoc(), Res.get());
12938 if (!Res.isUsable())
12941 ParsedClause.setIntExprDetails(Res.get());
12943 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12944 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs()[0],
12945 ParsedClause.getEndLoc());
12948template <
typename Derived>
12949void OpenACCClauseTransform<Derived>::VisitDeviceNumClause (
12951 Expr *IntExpr =
const_cast<Expr *
>(
C.getIntExpr());
12952 assert(IntExpr &&
"device_num clause constructed with invalid int expr");
12955 if (!Res.isUsable())
12960 C.getBeginLoc(), Res.get());
12961 if (!Res.isUsable())
12964 ParsedClause.setIntExprDetails(Res.get());
12966 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12967 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs()[0],
12968 ParsedClause.getEndLoc());
12971template <
typename Derived>
12972void OpenACCClauseTransform<Derived>::VisitDefaultAsyncClause(
12974 Expr *IntExpr =
const_cast<Expr *
>(
C.getIntExpr());
12975 assert(IntExpr &&
"default_async clause constructed with invalid int expr");
12978 if (!Res.isUsable())
12983 C.getBeginLoc(), Res.get());
12984 if (!Res.isUsable())
12987 ParsedClause.setIntExprDetails(Res.get());
12989 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12990 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs()[0],
12991 ParsedClause.getEndLoc());
12994template <
typename Derived>
12995void OpenACCClauseTransform<Derived>::VisitVectorLengthClause(
12997 Expr *IntExpr =
const_cast<Expr *
>(
C.getIntExpr());
12998 assert(IntExpr &&
"vector_length clause constructed with invalid int expr");
13001 if (!Res.isUsable())
13006 C.getBeginLoc(), Res.get());
13007 if (!Res.isUsable())
13010 ParsedClause.setIntExprDetails(Res.get());
13012 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
13013 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs()[0],
13014 ParsedClause.getEndLoc());
13017template <
typename Derived>
13018void OpenACCClauseTransform<Derived>::VisitAsyncClause(
13020 if (
C.hasIntExpr()) {
13022 if (!Res.isUsable())
13027 C.getBeginLoc(), Res.get());
13028 if (!Res.isUsable())
13030 ParsedClause.setIntExprDetails(Res.get());
13034 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
13035 ParsedClause.getLParenLoc(),
13036 ParsedClause.getNumIntExprs() != 0 ? ParsedClause.getIntExprs()[0]
13038 ParsedClause.getEndLoc());
13041template <
typename Derived>
13042void OpenACCClauseTransform<Derived>::VisitWorkerClause(
13044 if (
C.hasIntExpr()) {
13049 if (!Res.isUsable())
13054 C.getBeginLoc(), Res.get());
13055 if (!Res.isUsable())
13057 ParsedClause.setIntExprDetails(Res.get());
13061 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
13062 ParsedClause.getLParenLoc(),
13063 ParsedClause.getNumIntExprs() != 0 ? ParsedClause.getIntExprs()[0]
13065 ParsedClause.getEndLoc());
13068template <
typename Derived>
13069void OpenACCClauseTransform<Derived>::VisitVectorClause(
13071 if (
C.hasIntExpr()) {
13076 if (!Res.isUsable())
13081 C.getBeginLoc(), Res.get());
13082 if (!Res.isUsable())
13084 ParsedClause.setIntExprDetails(Res.get());
13088 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
13089 ParsedClause.getLParenLoc(),
13090 ParsedClause.getNumIntExprs() != 0 ? ParsedClause.getIntExprs()[0]
13092 ParsedClause.getEndLoc());
13095template <
typename Derived>
13096void OpenACCClauseTransform<Derived>::VisitWaitClause(
13098 if (
C.hasExprs()) {
13099 Expr *DevNumExpr =
nullptr;
13103 if (
C.getDevNumExpr()) {
13105 if (!Res.isUsable())
13109 C.getBeginLoc(), Res.get());
13110 if (!Res.isUsable())
13113 DevNumExpr = Res.get();
13117 for (
Expr *CurQueueIdExpr :
C.getQueueIdExprs()) {
13119 if (!Res.isUsable())
13123 C.getBeginLoc(), Res.get());
13124 if (!Res.isUsable())
13127 InstantiatedQueueIdExprs.push_back(Res.get());
13130 ParsedClause.setWaitDetails(DevNumExpr,
C.getQueuesLoc(),
13131 std::move(InstantiatedQueueIdExprs));
13135 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
13136 ParsedClause.getLParenLoc(), ParsedClause.getDevNumExpr(),
13137 ParsedClause.getQueuesLoc(), ParsedClause.getQueueIdExprs(),
13138 ParsedClause.getEndLoc());
13141template <
typename Derived>
13142void OpenACCClauseTransform<Derived>::VisitDeviceTypeClause(
13146 Self.getSema().getASTContext(),
C.getClauseKind(),
13147 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
13148 C.getArchitectures(), ParsedClause.getEndLoc());
13151template <
typename Derived>
13152void OpenACCClauseTransform<Derived>::VisitAutoClause(
13156 ParsedClause.getBeginLoc(),
13157 ParsedClause.getEndLoc());
13160template <
typename Derived>
13161void OpenACCClauseTransform<Derived>::VisitIndependentClause(
13164 ParsedClause.getBeginLoc(),
13165 ParsedClause.getEndLoc());
13168template <
typename Derived>
13169void OpenACCClauseTransform<Derived>::VisitSeqClause(
13172 ParsedClause.getBeginLoc(),
13173 ParsedClause.getEndLoc());
13175template <
typename Derived>
13176void OpenACCClauseTransform<Derived>::VisitFinalizeClause(
13179 ParsedClause.getBeginLoc(),
13180 ParsedClause.getEndLoc());
13183template <
typename Derived>
13184void OpenACCClauseTransform<Derived>::VisitIfPresentClause(
13187 ParsedClause.getBeginLoc(),
13188 ParsedClause.getEndLoc());
13191template <
typename Derived>
13192void OpenACCClauseTransform<Derived>::VisitReductionClause(
13198 for (
const auto [Var, OrigRecipe] :
13199 llvm::zip(TransformedVars,
C.getRecipes())) {
13201 ParsedClause.getDirectiveKind(),
C.getReductionOp(), Var);
13202 if (Res.isUsable()) {
13203 ValidVars.push_back(Res.get());
13205 if (OrigRecipe.isSet())
13206 Recipes.emplace_back(OrigRecipe.AllocaDecl, OrigRecipe.CombinerRecipes);
13208 Recipes.push_back(
Self.getSema().OpenACC().CreateReductionInitRecipe(
13209 C.getReductionOp(), Res.get()));
13213 NewClause =
Self.getSema().OpenACC().CheckReductionClause(
13214 ExistingClauses, ParsedClause.getDirectiveKind(),
13215 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
13216 C.getReductionOp(), ValidVars, Recipes, ParsedClause.getEndLoc());
13219template <
typename Derived>
13220void OpenACCClauseTransform<Derived>::VisitCollapseClause(
13222 Expr *LoopCount =
const_cast<Expr *
>(
C.getLoopCount());
13223 assert(LoopCount &&
"collapse clause constructed with invalid loop count");
13227 if (!NewLoopCount.isUsable())
13230 NewLoopCount =
Self.getSema().OpenACC().ActOnIntExpr(
13232 NewLoopCount.get()->getBeginLoc(), NewLoopCount.get());
13236 if (!NewLoopCount.isUsable())
13240 Self.getSema().OpenACC().CheckCollapseLoopCount(NewLoopCount.get());
13244 if (!NewLoopCount.isUsable())
13247 ParsedClause.setCollapseDetails(
C.hasForce(), NewLoopCount.get());
13249 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
13250 ParsedClause.getLParenLoc(), ParsedClause.isForce(),
13251 ParsedClause.getLoopCount(), ParsedClause.getEndLoc());
13254template <
typename Derived>
13255void OpenACCClauseTransform<Derived>::VisitTileClause(
13260 for (
Expr *E :
C.getSizeExprs()) {
13263 if (!NewSizeExpr.isUsable())
13266 NewSizeExpr =
Self.getSema().OpenACC().ActOnIntExpr(
13268 NewSizeExpr.get()->getBeginLoc(), NewSizeExpr.get());
13272 if (!NewSizeExpr.isUsable())
13275 NewSizeExpr =
Self.getSema().OpenACC().CheckTileSizeExpr(NewSizeExpr.get());
13277 if (!NewSizeExpr.isUsable())
13279 TransformedExprs.push_back(NewSizeExpr.get());
13282 ParsedClause.setIntExprDetails(TransformedExprs);
13284 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
13285 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs(),
13286 ParsedClause.getEndLoc());
13288template <
typename Derived>
13289void OpenACCClauseTransform<Derived>::VisitGangClause(
13294 for (
unsigned I = 0; I <
C.getNumExprs(); ++I) {
13296 if (!ER.isUsable())
13299 ER =
Self.getSema().OpenACC().CheckGangExpr(ExistingClauses,
13300 ParsedClause.getDirectiveKind(),
13301 C.getExpr(I).first, ER.get());
13302 if (!ER.isUsable())
13304 TransformedGangKinds.push_back(
C.getExpr(I).first);
13305 TransformedIntExprs.push_back(ER.get());
13308 NewClause =
Self.getSema().OpenACC().CheckGangClause(
13309 ParsedClause.getDirectiveKind(), ExistingClauses,
13310 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
13311 TransformedGangKinds, TransformedIntExprs, ParsedClause.getEndLoc());
13314template <
typename Derived>
13315OpenACCClause *TreeTransform<Derived>::TransformOpenACCClause(
13320 DirKind, OldClause->getClauseKind(), OldClause->getBeginLoc());
13321 ParsedClause.setEndLoc(OldClause->getEndLoc());
13323 if (
const auto *WithParms = dyn_cast<OpenACCClauseWithParams>(OldClause))
13324 ParsedClause.setLParenLoc(WithParms->getLParenLoc());
13326 OpenACCClauseTransform<Derived> Transform{*
this, ExistingClauses,
13328 Transform.Visit(OldClause);
13330 return Transform.CreatedClause();
13333template <
typename Derived>
13335TreeTransform<Derived>::TransformOpenACCClauseList(
13338 for (
const auto *Clause : OldClauses) {
13339 if (
OpenACCClause *TransformedClause = getDerived().TransformOpenACCClause(
13340 TransformedClauses, DirKind, Clause))
13341 TransformedClauses.push_back(TransformedClause);
13343 return TransformedClauses;
13346template <
typename Derived>
13349 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13352 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
13355 if (getSema().OpenACC().ActOnStartStmtDirective(
13356 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
13361 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
13362 C->clauses(), TransformedClauses);
13363 StmtResult StrBlock = getDerived().TransformStmt(
C->getStructuredBlock());
13364 StrBlock = getSema().OpenACC().ActOnAssociatedStmt(
13365 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses, StrBlock);
13367 return getDerived().RebuildOpenACCComputeConstruct(
13368 C->getDirectiveKind(),
C->getBeginLoc(),
C->getDirectiveLoc(),
13369 C->getEndLoc(), TransformedClauses, StrBlock);
13372template <
typename Derived>
13376 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13379 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
13382 if (getSema().OpenACC().ActOnStartStmtDirective(
13383 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
13388 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
13389 C->clauses(), TransformedClauses);
13391 Loop = getSema().OpenACC().ActOnAssociatedStmt(
13392 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses,
Loop);
13394 return getDerived().RebuildOpenACCLoopConstruct(
13395 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
13396 TransformedClauses,
Loop);
13399template <
typename Derived>
13401 OpenACCCombinedConstruct *
C) {
13402 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13405 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
13408 if (getSema().OpenACC().ActOnStartStmtDirective(
13409 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
13414 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
13415 C->clauses(), TransformedClauses);
13417 Loop = getSema().OpenACC().ActOnAssociatedStmt(
13418 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses,
Loop);
13420 return getDerived().RebuildOpenACCCombinedConstruct(
13421 C->getDirectiveKind(),
C->getBeginLoc(),
C->getDirectiveLoc(),
13422 C->getEndLoc(), TransformedClauses,
Loop);
13425template <
typename Derived>
13428 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13431 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
13433 if (getSema().OpenACC().ActOnStartStmtDirective(
13434 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
13438 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
13439 C->clauses(), TransformedClauses);
13440 StmtResult StrBlock = getDerived().TransformStmt(
C->getStructuredBlock());
13441 StrBlock = getSema().OpenACC().ActOnAssociatedStmt(
13442 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses, StrBlock);
13444 return getDerived().RebuildOpenACCDataConstruct(
13445 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
13446 TransformedClauses, StrBlock);
13449template <
typename Derived>
13451 OpenACCEnterDataConstruct *
C) {
13452 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13455 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
13457 if (getSema().OpenACC().ActOnStartStmtDirective(
13458 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
13461 return getDerived().RebuildOpenACCEnterDataConstruct(
13462 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
13463 TransformedClauses);
13466template <
typename Derived>
13468 OpenACCExitDataConstruct *
C) {
13469 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13472 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
13474 if (getSema().OpenACC().ActOnStartStmtDirective(
13475 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
13478 return getDerived().RebuildOpenACCExitDataConstruct(
13479 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
13480 TransformedClauses);
13483template <
typename Derived>
13485 OpenACCHostDataConstruct *
C) {
13486 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13489 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
13491 if (getSema().OpenACC().ActOnStartStmtDirective(
13492 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
13496 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
13497 C->clauses(), TransformedClauses);
13498 StmtResult StrBlock = getDerived().TransformStmt(
C->getStructuredBlock());
13499 StrBlock = getSema().OpenACC().ActOnAssociatedStmt(
13500 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses, StrBlock);
13502 return getDerived().RebuildOpenACCHostDataConstruct(
13503 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
13504 TransformedClauses, StrBlock);
13507template <
typename Derived>
13510 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13513 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
13515 if (getSema().OpenACC().ActOnStartStmtDirective(
13516 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
13519 return getDerived().RebuildOpenACCInitConstruct(
13520 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
13521 TransformedClauses);
13524template <
typename Derived>
13526 OpenACCShutdownConstruct *
C) {
13527 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13530 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
13532 if (getSema().OpenACC().ActOnStartStmtDirective(
13533 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
13536 return getDerived().RebuildOpenACCShutdownConstruct(
13537 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
13538 TransformedClauses);
13540template <
typename Derived>
13543 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13546 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
13548 if (getSema().OpenACC().ActOnStartStmtDirective(
13549 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
13552 return getDerived().RebuildOpenACCSetConstruct(
13553 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
13554 TransformedClauses);
13557template <
typename Derived>
13559 OpenACCUpdateConstruct *
C) {
13560 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13563 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
13565 if (getSema().OpenACC().ActOnStartStmtDirective(
13566 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
13569 return getDerived().RebuildOpenACCUpdateConstruct(
13570 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
13571 TransformedClauses);
13574template <
typename Derived>
13577 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13580 if (
C->hasDevNumExpr()) {
13581 DevNumExpr = getDerived().TransformExpr(
C->getDevNumExpr());
13583 if (DevNumExpr.isUsable())
13584 DevNumExpr = getSema().OpenACC().ActOnIntExpr(
13586 C->getBeginLoc(), DevNumExpr.get());
13591 for (
Expr *QE :
C->getQueueIdExprs()) {
13592 assert(QE &&
"Null queue id expr?");
13593 ExprResult NewEQ = getDerived().TransformExpr(QE);
13595 if (!NewEQ.isUsable())
13599 C->getBeginLoc(), NewEQ.get());
13600 if (NewEQ.isUsable())
13601 QueueIdExprs.push_back(NewEQ.get());
13605 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
13608 if (getSema().OpenACC().ActOnStartStmtDirective(
13609 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
13612 return getDerived().RebuildOpenACCWaitConstruct(
13613 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getLParenLoc(),
13614 DevNumExpr.isUsable() ? DevNumExpr.get() :
nullptr,
C->getQueuesLoc(),
13615 QueueIdExprs,
C->getRParenLoc(),
C->getEndLoc(), TransformedClauses);
13617template <
typename Derived>
13619 OpenACCCacheConstruct *
C) {
13620 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13623 for (
Expr *Var :
C->getVarList()) {
13624 assert(Var &&
"Null var listexpr?");
13626 ExprResult NewVar = getDerived().TransformExpr(Var);
13628 if (!NewVar.isUsable())
13631 NewVar = getSema().OpenACC().ActOnVar(
13633 if (!NewVar.isUsable())
13636 TransformedVarList.push_back(NewVar.get());
13639 if (getSema().OpenACC().ActOnStartStmtDirective(
C->getDirectiveKind(),
13640 C->getBeginLoc(), {}))
13643 return getDerived().RebuildOpenACCCacheConstruct(
13644 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getLParenLoc(),
13645 C->getReadOnlyLoc(), TransformedVarList,
C->getRParenLoc(),
13649template <
typename Derived>
13651 OpenACCAtomicConstruct *
C) {
13652 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13655 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
13658 if (getSema().OpenACC().ActOnStartStmtDirective(
C->getDirectiveKind(),
13659 C->getBeginLoc(), {}))
13664 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(), {}, {});
13666 StmtResult AssocStmt = getDerived().TransformStmt(
C->getAssociatedStmt());
13671 AssocStmt = getSema().OpenACC().ActOnAssociatedStmt(
13672 C->getBeginLoc(),
C->getDirectiveKind(),
C->getAtomicKind(), {},
13675 return getDerived().RebuildOpenACCAtomicConstruct(
13676 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getAtomicKind(),
13677 C->getEndLoc(), TransformedClauses, AssocStmt);
13680template <
typename Derived>
13683 if (getDerived().AlwaysRebuild())
13692template<
typename Derived>
13695 return TransformExpr(E->getSubExpr());
13698template <
typename Derived>
13701 if (!E->isTypeDependent())
13704 TypeSourceInfo *NewT = getDerived().TransformType(E->getTypeSourceInfo());
13709 if (!getDerived().AlwaysRebuild() && E->getTypeSourceInfo() == NewT)
13712 return getDerived().RebuildSYCLUniqueStableNameExpr(
13713 E->getLocation(), E->getLParenLocation(), E->getRParenLocation(), NewT);
13716template <
typename Derived>
13721 const auto *SKEPAttr = FD->template getAttr<SYCLKernelEntryPointAttr>();
13722 if (!SKEPAttr || SKEPAttr->isInvalidAttr())
13735 assert(!SKEPAttr->getKernelName()->isDependentType() &&
13736 "SYCL kernel name type should not be dependent here");
13738 SKEPAttr->getKernelName());
13740 assert(!InfoType.isNull());
13742 ExprResult IdExpr = getDerived().TransformExpr(S->getKernelLaunchIdExpr());
13743 if (IdExpr.isInvalid())
13746 StmtResult Body = getDerived().TransformStmt(S->getOriginalStmt());
13747 if (Body.isInvalid())
13753 if (SR.isInvalid())
13759template <
typename Derived>
13763 switch (E->getKind()) {
13772 llvm_unreachable(
"A null reflection should not reach here");
13775 assert(
false &&
"unknown or unimplemented reflection entities");
13779template<
typename Derived>
13782 if (!E->isTypeDependent())
13786 E->getIdentKind());
13789template<
typename Derived>
13793 if (E->getQualifierLoc()) {
13795 = getDerived().TransformNestedNameSpecifierLoc(E->getQualifierLoc());
13801 = cast_or_null<ValueDecl>(getDerived().TransformDecl(E->getLocation(),
13803 if (!ND || ND->isInvalidDecl())
13807 if (E->getFoundDecl() != E->getDecl()) {
13808 Found = cast_or_null<NamedDecl>(
13809 getDerived().TransformDecl(E->getLocation(), E->getFoundDecl()));
13815 if (NameInfo.getName()) {
13816 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
13817 if (!NameInfo.getName())
13821 if (!getDerived().AlwaysRebuild() &&
13822 !E->isCapturedByCopyInLambdaWithExplicitObjectParameter() &&
13823 QualifierLoc == E->getQualifierLoc() && ND == E->getDecl() &&
13824 Found == E->getFoundDecl() &&
13825 NameInfo.getName() == E->getDecl()->getDeclName() &&
13826 !E->hasExplicitTemplateArgs()) {
13836 if (E->hasExplicitTemplateArgs()) {
13837 TemplateArgs = &TransArgs;
13838 TransArgs.setLAngleLoc(E->getLAngleLoc());
13839 TransArgs.setRAngleLoc(E->getRAngleLoc());
13840 if (getDerived().TransformTemplateArguments(E->getTemplateArgs(),
13841 E->getNumTemplateArgs(),
13846 return getDerived().RebuildDeclRefExpr(QualifierLoc, ND, NameInfo,
13847 Found, TemplateArgs);
13850template<
typename Derived>
13856template <
typename Derived>
13862template<
typename Derived>
13868template<
typename Derived>
13874template<
typename Derived>
13880template<
typename Derived>
13886template<
typename Derived>
13889 return getDerived().TransformCallExpr(E);
13892template<
typename Derived>
13897 if (E->isExprPredicate())
13898 ControllingExpr = getDerived().TransformExpr(E->getControllingExpr());
13900 ControllingType = getDerived().TransformType(E->getControllingType());
13902 if (!ControllingExpr.isUsable() && !ControllingType)
13913 AssocTypes.push_back(AssocType);
13915 AssocTypes.push_back(
nullptr);
13919 getDerived().TransformExpr(Assoc.getAssociationExpr());
13920 if (AssocExpr.isInvalid())
13922 AssocExprs.push_back(AssocExpr.get());
13925 if (!ControllingType)
13926 return getDerived().RebuildGenericSelectionExpr(E->getGenericLoc(),
13927 E->getDefaultLoc(),
13929 ControllingExpr.get(),
13932 return getDerived().RebuildGenericSelectionExpr(
13933 E->getGenericLoc(), E->getDefaultLoc(), E->getRParenLoc(),
13934 ControllingType, AssocTypes, AssocExprs);
13937template<
typename Derived>
13940 ExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
13941 if (SubExpr.isInvalid())
13944 if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getSubExpr())
13947 return getDerived().RebuildParenExpr(SubExpr.get(), E->getLParen(),
13954template<
typename Derived>
13958 return getDerived().TransformDependentScopeDeclRefExpr(
13959 DRE,
true,
nullptr);
13961 return getDerived().TransformUnresolvedLookupExpr(
13967template<
typename Derived>
13972 SubExpr = TransformAddressOfOperand(E->
getSubExpr());
13978 if (!getDerived().AlwaysRebuild() && SubExpr.
get() == E->
getSubExpr())
13986template<
typename Derived>
13988TreeTransform<Derived>::TransformOffsetOfExpr(OffsetOfExpr *E) {
13990 TypeSourceInfo *Type = getDerived().TransformType(E->getTypeSourceInfo());
14000 bool ExprChanged =
false;
14002 for (
unsigned I = 0, N = E->getNumComponents(); I != N; ++I) {
14003 const OffsetOfNode &ON = E->getComponent(I);
14004 switch (ON.getKind()) {
14006 Expr *FromIndex = E->getIndexExpr(ON.getArrayExprIndex());
14007 ExprResult Index = getDerived().TransformExpr(FromIndex);
14008 if (Index.isInvalid())
14011 ExprChanged = ExprChanged || Index.get() != FromIndex;
14014 AD.setRBracketLoc(ON.getEndLoc());
14015 Desig.AddDesignator(AD);
14027 Desig.AddDesignator(
14039 if (!getDerived().AlwaysRebuild() &&
14040 Type == E->getTypeSourceInfo() &&
14045 return getDerived().RebuildOffsetOfExpr(E->getOperatorLoc(),
Type, Desig,
14046 E->getRParenLoc());
14049template<
typename Derived>
14052 assert((!E->getSourceExpr() || getDerived().AlreadyTransformed(E->getType())) &&
14053 "opaque value expression requires transformation");
14057template <
typename Derived>
14061 for (
Expr *
C : E->subExpressions()) {
14063 if (NewC.isInvalid())
14069 if (!getDerived().AlwaysRebuild() && !Changed)
14071 return getDerived().RebuildRecoveryExpr(E->getBeginLoc(), E->getEndLoc(),
14075template<
typename Derived>
14085 ExprResult result = getDerived().TransformExpr(newSyntacticForm);
14086 if (result.isInvalid())
return ExprError();
14091 if (result.get()->hasPlaceholderType(BuiltinType::PseudoObject))
14097template<
typename Derived>
14108 if (E->isArgumentType()) {
14115 if (!getDerived().AlwaysRebuild() && OldT == NewT)
14118 return getDerived().RebuildUnaryExprOrTypeTrait(NewT, E->getOperatorLoc(),
14120 E->getSourceRange());
14127 auto *PE = dyn_cast<ParenExpr>(E->getArgumentExpr());
14129 PE ? dyn_cast<DependentScopeDeclRefExpr>(PE->getSubExpr()) :
nullptr)
14130 SubExpr = getDerived().TransformParenDependentScopeDeclRefExpr(
14131 PE, DRE,
false, &RecoveryTSI);
14133 SubExpr = getDerived().TransformExpr(E->getArgumentExpr());
14136 return getDerived().RebuildUnaryExprOrTypeTrait(
14137 RecoveryTSI, E->getOperatorLoc(), E->getKind(), E->getSourceRange());
14138 }
else if (SubExpr.isInvalid())
14141 if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getArgumentExpr())
14144 return getDerived().RebuildUnaryExprOrTypeTrait(SubExpr.get(),
14145 E->getOperatorLoc(),
14147 E->getSourceRange());
14150template<
typename Derived>
14153 ExprResult LHS = getDerived().TransformExpr(E->getLHS());
14154 if (LHS.isInvalid())
14157 ExprResult RHS = getDerived().TransformExpr(E->getRHS());
14158 if (RHS.isInvalid())
14162 if (!getDerived().AlwaysRebuild() &&
14163 LHS.get() == E->getLHS() &&
14164 RHS.get() == E->getRHS())
14167 return getDerived().RebuildArraySubscriptExpr(
14169 E->getLHS()->getBeginLoc(), RHS.get(), E->getRBracketLoc());
14172template <
typename Derived>
14176 if (
Base.isInvalid())
14179 ExprResult RowIdx = getDerived().TransformExpr(E->getRowIdx());
14180 if (RowIdx.isInvalid())
14183 if (!getDerived().AlwaysRebuild() &&
Base.get() == E->getBase() &&
14184 RowIdx.get() == E->getRowIdx())
14187 return getDerived().RebuildMatrixSingleSubscriptExpr(
Base.get(), RowIdx.get(),
14188 E->getRBracketLoc());
14191template <
typename Derived>
14195 if (
Base.isInvalid())
14198 ExprResult RowIdx = getDerived().TransformExpr(E->getRowIdx());
14199 if (RowIdx.isInvalid())
14202 ExprResult ColumnIdx = getDerived().TransformExpr(E->getColumnIdx());
14203 if (ColumnIdx.isInvalid())
14206 if (!getDerived().AlwaysRebuild() &&
Base.get() == E->getBase() &&
14207 RowIdx.get() == E->getRowIdx() && ColumnIdx.get() == E->getColumnIdx())
14210 return getDerived().RebuildMatrixSubscriptExpr(
14211 Base.get(), RowIdx.get(), ColumnIdx.get(), E->getRBracketLoc());
14214template <
typename Derived>
14218 if (
Base.isInvalid())
14222 if (E->getLowerBound()) {
14223 LowerBound = getDerived().TransformExpr(E->getLowerBound());
14224 if (LowerBound.isInvalid())
14229 if (E->getLength()) {
14230 Length = getDerived().TransformExpr(E->getLength());
14231 if (Length.isInvalid())
14236 if (E->isOMPArraySection()) {
14237 if (
Expr *Str = E->getStride()) {
14238 Stride = getDerived().TransformExpr(Str);
14239 if (Stride.isInvalid())
14244 if (!getDerived().AlwaysRebuild() &&
Base.get() == E->getBase() &&
14245 LowerBound.get() == E->getLowerBound() &&
14246 Length.get() == E->getLength() &&
14247 (E->isOpenACCArraySection() || Stride.get() == E->getStride()))
14250 return getDerived().RebuildArraySectionExpr(
14251 E->isOMPArraySection(),
Base.get(), E->getBase()->getEndLoc(),
14252 LowerBound.get(), E->getColonLocFirst(),
14253 E->isOMPArraySection() ? E->getColonLocSecond() :
SourceLocation{},
14254 Length.get(), Stride.get(), E->getRBracketLoc());
14257template <
typename Derived>
14261 if (
Base.isInvalid())
14265 bool ErrorFound =
false;
14266 for (
Expr *
Dim : E->getDimensions()) {
14268 if (DimRes.isInvalid()) {
14272 Dims.push_back(DimRes.get());
14277 return getDerived().RebuildOMPArrayShapingExpr(
Base.get(), E->getLParenLoc(),
14278 E->getRParenLoc(), Dims,
14279 E->getBracketsRanges());
14282template <
typename Derived>
14285 unsigned NumIterators = E->numOfIterators();
14288 bool ErrorFound =
false;
14289 bool NeedToRebuild = getDerived().AlwaysRebuild();
14290 for (
unsigned I = 0; I < NumIterators; ++I) {
14292 Data[I].DeclIdent = D->getIdentifier();
14293 Data[I].DeclIdentLoc = D->getLocation();
14294 if (D->getLocation() == D->getBeginLoc()) {
14296 "Implicit type must be int.");
14298 TypeSourceInfo *TSI = getDerived().TransformType(D->getTypeSourceInfo());
14299 QualType DeclTy = getDerived().TransformType(D->getType());
14306 ErrorFound = ErrorFound ||
14307 !(!D->getTypeSourceInfo() || (
Data[I].
Type.getAsOpaquePtr() &&
14308 !
Data[I].Type.get().isNull())) ||
14309 Begin.isInvalid() || End.isInvalid() || Step.isInvalid();
14312 Data[I].Range.Begin = Begin.get();
14313 Data[I].Range.End = End.get();
14314 Data[I].Range.Step = Step.get();
14315 Data[I].AssignLoc = E->getAssignLoc(I);
14316 Data[I].ColonLoc = E->getColonLoc(I);
14317 Data[I].SecColonLoc = E->getSecondColonLoc(I);
14320 (D->getTypeSourceInfo() &&
Data[I].
Type.get().getTypePtrOrNull() !=
14321 D->getType().getTypePtrOrNull()) ||
14327 if (!NeedToRebuild)
14330 ExprResult Res = getDerived().RebuildOMPIteratorExpr(
14331 E->getIteratorKwLoc(), E->getLParenLoc(), E->getRParenLoc(),
Data);
14332 if (!Res.isUsable())
14335 for (
unsigned I = 0; I < NumIterators; ++I)
14336 getDerived().transformedLocalDecl(E->getIteratorDecl(I),
14337 IE->getIteratorDecl(I));
14341template<
typename Derived>
14350 bool ArgChanged =
false;
14352 if (getDerived().TransformExprs(E->getArgs(), E->getNumArgs(),
true, Args,
14356 if (!getDerived().AlwaysRebuild() &&
14357 Callee.get() == E->getCallee() &&
14363 = ((
Expr *)
Callee.get())->getSourceRange().getBegin();
14366 if (E->hasStoredFPFeatures()) {
14368 getSema().CurFPFeatures =
14370 getSema().FpPragmaStack.CurrentValue = NewOverrides;
14373 return getDerived().RebuildCallExpr(
Callee.get(), FakeLParenLoc,
14375 E->getRParenLoc());
14378template<
typename Derived>
14382 if (
Base.isInvalid())
14386 if (E->hasQualifier()) {
14388 = getDerived().TransformNestedNameSpecifierLoc(E->getQualifierLoc());
14396 = cast_or_null<ValueDecl>(getDerived().TransformDecl(E->getMemberLoc(),
14397 E->getMemberDecl()));
14401 NamedDecl *FoundDecl = E->getFoundDecl();
14402 if (FoundDecl == E->getMemberDecl()) {
14405 FoundDecl = cast_or_null<NamedDecl>(
14406 getDerived().TransformDecl(E->getMemberLoc(), FoundDecl));
14411 if (!getDerived().AlwaysRebuild() &&
14412 Base.get() == E->getBase() &&
14413 QualifierLoc == E->getQualifierLoc() &&
14414 Member == E->getMemberDecl() &&
14415 FoundDecl == E->getFoundDecl() &&
14416 !E->hasExplicitTemplateArgs()) {
14421 getSema().OpenMP().isOpenMPRebuildMemberExpr(
14431 if (E->hasExplicitTemplateArgs()) {
14432 TransArgs.setLAngleLoc(E->getLAngleLoc());
14433 TransArgs.setRAngleLoc(E->getRAngleLoc());
14434 if (getDerived().TransformTemplateArguments(E->getTemplateArgs(),
14435 E->getNumTemplateArgs(),
14448 NamedDecl *FirstQualifierInScope =
nullptr;
14450 if (MemberNameInfo.getName()) {
14451 MemberNameInfo = getDerived().TransformDeclarationNameInfo(MemberNameInfo);
14452 if (!MemberNameInfo.getName())
14456 return getDerived().RebuildMemberExpr(
Base.get(), FakeOperatorLoc,
14463 (E->hasExplicitTemplateArgs()
14464 ? &TransArgs :
nullptr),
14465 FirstQualifierInScope);
14468template<
typename Derived>
14471 ExprResult LHS = getDerived().TransformExpr(E->getLHS());
14472 if (LHS.isInvalid())
14476 getDerived().TransformInitializer(E->getRHS(),
false);
14477 if (RHS.isInvalid())
14480 if (!getDerived().AlwaysRebuild() &&
14481 LHS.get() == E->getLHS() &&
14482 RHS.get() == E->getRHS())
14485 if (E->isCompoundAssignmentOp())
14487 return getDerived().RebuildBinaryOperator(
14488 E->getOperatorLoc(), E->getOpcode(), LHS.get(), RHS.get());
14491 getSema().CurFPFeatures =
14492 NewOverrides.applyOverrides(getSema().getLangOpts());
14493 getSema().FpPragmaStack.CurrentValue = NewOverrides;
14494 return getDerived().RebuildBinaryOperator(E->getOperatorLoc(), E->getOpcode(),
14495 LHS.get(), RHS.get());
14498template <
typename Derived>
14503 ExprResult LHS = getDerived().TransformExpr(
const_cast<Expr*
>(Decomp.LHS));
14504 if (LHS.isInvalid())
14507 ExprResult RHS = getDerived().TransformExpr(
const_cast<Expr*
>(Decomp.RHS));
14508 if (RHS.isInvalid())
14514 bool ChangedAnyLookups =
false;
14515 Expr *PossibleBinOps[] = {E->getSemanticForm(),
14516 const_cast<Expr *
>(Decomp.InnerBinOp)};
14517 for (
Expr *PossibleBinOp : PossibleBinOps) {
14518 auto *Op = dyn_cast<CXXOperatorCallExpr>(PossibleBinOp->IgnoreImplicit());
14521 auto *
Callee = dyn_cast<DeclRefExpr>(Op->getCallee()->IgnoreImplicit());
14527 NamedDecl *
Found = cast_or_null<NamedDecl>(getDerived().TransformDecl(
14528 E->getOperatorLoc(),
Callee->getFoundDecl()));
14532 ChangedAnyLookups =
true;
14533 UnqualLookups.addDecl(
Found);
14536 if (!getDerived().AlwaysRebuild() && !ChangedAnyLookups &&
14537 LHS.get() == Decomp.LHS && RHS.get() == Decomp.RHS) {
14543 const Expr *StopAt[] = {Decomp.LHS, Decomp.RHS};
14548 return getDerived().RebuildCXXRewrittenBinaryOperator(
14549 E->getOperatorLoc(), Decomp.Opcode, UnqualLookups, LHS.get(), RHS.get());
14552template<
typename Derived>
14558 getSema().CurFPFeatures =
14559 NewOverrides.applyOverrides(getSema().getLangOpts());
14560 getSema().FpPragmaStack.CurrentValue = NewOverrides;
14561 return getDerived().TransformBinaryOperator(E);
14564template<
typename Derived>
14570 ExprResult commonExpr = getDerived().TransformExpr(e->getCommon());
14571 if (commonExpr.isInvalid())
14574 ExprResult rhs = getDerived().TransformExpr(e->getFalseExpr());
14575 if (rhs.isInvalid())
14578 if (!getDerived().AlwaysRebuild() &&
14579 commonExpr.get() == e->getCommon() &&
14580 rhs.get() == e->getFalseExpr())
14583 return getDerived().RebuildConditionalOperator(commonExpr.get(),
14584 e->getQuestionLoc(),
14590template<
typename Derived>
14593 ExprResult Cond = getDerived().TransformExpr(E->getCond());
14594 if (Cond.isInvalid())
14597 ExprResult LHS = getDerived().TransformExpr(E->getLHS());
14598 if (LHS.isInvalid())
14601 ExprResult RHS = getDerived().TransformExpr(E->getRHS());
14602 if (RHS.isInvalid())
14605 if (!getDerived().AlwaysRebuild() &&
14606 Cond.get() == E->getCond() &&
14607 LHS.get() == E->getLHS() &&
14608 RHS.get() == E->getRHS())
14611 return getDerived().RebuildConditionalOperator(Cond.get(),
14612 E->getQuestionLoc(),
14618template<
typename Derived>
14623 return getDerived().
TransformExpr(E->getSubExprAsWritten());
14626template<
typename Derived>
14634 = getDerived().TransformExpr(E->getSubExprAsWritten());
14635 if (SubExpr.isInvalid())
14638 if (!getDerived().AlwaysRebuild() &&
14639 Type == E->getTypeInfoAsWritten() &&
14640 SubExpr.get() == E->getSubExpr())
14643 return getDerived().RebuildCStyleCastExpr(E->getLParenLoc(),
14649template<
typename Derived>
14657 ExprResult Init = getDerived().TransformExpr(E->getInitializer());
14658 if (
Init.isInvalid())
14661 if (!getDerived().AlwaysRebuild() &&
14663 Init.get() == E->getInitializer())
14670 return getDerived().RebuildCompoundLiteralExpr(
14671 E->getLParenLoc(), NewT,
14672 E->getInitializer()->getEndLoc(),
Init.get());
14675template<
typename Derived>
14679 if (
Base.isInvalid())
14682 if (!getDerived().AlwaysRebuild() &&
14683 Base.get() == E->getBase())
14689 return getDerived().RebuildExtVectorOrMatrixElementExpr(
14690 Base.get(), FakeOperatorLoc, E->isArrow(), E->getAccessorLoc(),
14694template <
typename Derived>
14698 if (
Base.isInvalid())
14701 if (!getDerived().AlwaysRebuild() &&
Base.get() == E->getBase())
14707 return getDerived().RebuildExtVectorOrMatrixElementExpr(
14708 Base.get(), FakeOperatorLoc,
false, E->getAccessorLoc(),
14712template<
typename Derived>
14718 bool InitChanged =
false;
14724 if (getDerived().TransformExprs(E->getInits(), E->getNumInits(),
false,
14725 Inits, &InitChanged))
14728 if (!getDerived().AlwaysRebuild() && !InitChanged) {
14735 return getDerived().RebuildInitList(E->getLBraceLoc(),
Inits,
14736 E->getRBraceLoc(), E->isExplicit());
14739template<
typename Derived>
14746 if (
Init.isInvalid())
14751 bool ExprChanged =
false;
14753 if (D.isFieldDesignator()) {
14754 if (D.getFieldDecl()) {
14756 getDerived().TransformDecl(D.getFieldLoc(), D.getFieldDecl()));
14757 if (Field != D.getFieldDecl())
14760 ExprChanged =
true;
14761 if (
Field->isAnonymousStructOrUnion())
14767 ExprChanged =
true;
14770 D.getFieldName(), D.getDotLoc(), D.getFieldLoc()));
14774 if (D.isArrayDesignator()) {
14775 ExprResult Index = getDerived().TransformExpr(E->getArrayIndex(D));
14776 if (Index.isInvalid())
14779 Desig.AddDesignator(
14782 ExprChanged = ExprChanged || Index.get() != E->getArrayIndex(D);
14783 ArrayExprs.push_back(Index.get());
14787 assert(D.isArrayRangeDesignator() &&
"New kind of designator?");
14789 = getDerived().TransformExpr(E->getArrayRangeStart(D));
14790 if (Start.isInvalid())
14793 ExprResult End = getDerived().TransformExpr(E->getArrayRangeEnd(D));
14794 if (End.isInvalid())
14798 Start.get(), End.get(), D.getLBracketLoc(), D.getEllipsisLoc()));
14800 ExprChanged = ExprChanged || Start.get() != E->getArrayRangeStart(D) ||
14801 End.get() != E->getArrayRangeEnd(D);
14803 ArrayExprs.push_back(Start.get());
14804 ArrayExprs.push_back(End.get());
14807 if (!getDerived().AlwaysRebuild() &&
14808 Init.get() == E->getInit() &&
14812 return getDerived().RebuildDesignatedInitExpr(Desig, ArrayExprs,
14813 E->getEqualOrColonLoc(),
14814 E->usesGNUSyntax(),
Init.get());
14819template<
typename Derived>
14823 llvm_unreachable(
"Unexpected DesignatedInitUpdateExpr in syntactic form of "
14828template<
typename Derived>
14832 llvm_unreachable(
"Unexpected NoInitExpr in syntactic form of initializer");
14836template<
typename Derived>
14839 llvm_unreachable(
"Unexpected ArrayInitLoopExpr outside of initializer");
14843template<
typename Derived>
14846 llvm_unreachable(
"Unexpected ArrayInitIndexExpr outside of initializer");
14850template<
typename Derived>
14858 QualType T = getDerived().TransformType(E->getType());
14862 if (!getDerived().AlwaysRebuild() &&
14866 return getDerived().RebuildImplicitValueInitExpr(T);
14869template<
typename Derived>
14872 TypeSourceInfo *TInfo = getDerived().TransformType(E->getWrittenTypeInfo());
14876 ExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
14877 if (SubExpr.isInvalid())
14880 if (!getDerived().AlwaysRebuild() &&
14881 TInfo == E->getWrittenTypeInfo() &&
14882 SubExpr.get() == E->getSubExpr())
14885 return getDerived().RebuildVAArgExpr(E->getBuiltinLoc(), SubExpr.get(),
14886 TInfo, E->getRParenLoc());
14889template<
typename Derived>
14892 bool ArgumentChanged =
false;
14894 if (TransformExprs(E->getExprs(), E->getNumExprs(),
true,
Inits,
14898 return getDerived().RebuildParenListExpr(E->getLParenLoc(),
14900 E->getRParenLoc());
14908template<
typename Derived>
14911 Decl *LD = getDerived().TransformDecl(E->getLabel()->getLocation(),
14916 return getDerived().RebuildAddrLabelExpr(E->getAmpAmpLoc(), E->getLabelLoc(),
14920template<
typename Derived>
14925 = getDerived().TransformCompoundStmt(E->getSubStmt(),
true);
14926 if (SubStmt.isInvalid()) {
14931 unsigned OldDepth = E->getTemplateDepth();
14932 unsigned NewDepth = getDerived().TransformTemplateDepth(OldDepth);
14934 if (!getDerived().AlwaysRebuild() && OldDepth == NewDepth &&
14935 SubStmt.get() == E->getSubStmt()) {
14941 return getDerived().RebuildStmtExpr(E->getLParenLoc(), SubStmt.get(),
14942 E->getRParenLoc(), NewDepth,
14943 !E->getType()->isVoidType());
14946template<
typename Derived>
14949 ExprResult Cond = getDerived().TransformExpr(E->getCond());
14950 if (Cond.isInvalid())
14953 ExprResult LHS = getDerived().TransformExpr(E->getLHS());
14954 if (LHS.isInvalid())
14957 ExprResult RHS = getDerived().TransformExpr(E->getRHS());
14958 if (RHS.isInvalid())
14961 if (!getDerived().AlwaysRebuild() &&
14962 Cond.get() == E->getCond() &&
14963 LHS.get() == E->getLHS() &&
14964 RHS.get() == E->getRHS())
14967 return getDerived().RebuildChooseExpr(E->getBuiltinLoc(),
14968 Cond.get(), LHS.get(), RHS.get(),
14969 E->getRParenLoc());
14972template<
typename Derived>
14978template<
typename Derived>
14981 switch (E->getOperator()) {
14985 case OO_Array_Delete:
14986 llvm_unreachable(
"new and delete operators cannot use CXXOperatorCallExpr");
14991 assert(E->getNumArgs() >= 1 &&
"Object call is missing arguments");
15004 if (FakeLParenLoc.isInvalid() && EndLoc.isValid())
15005 FakeLParenLoc = EndLoc;
15009 if (getDerived().TransformExprs(E->getArgs() + 1, E->getNumArgs() - 1,
true,
15013 if (E->getOperator() == OO_Subscript)
15014 return getDerived().RebuildCxxSubscriptExpr(
Object.get(), FakeLParenLoc,
15015 Args, E->getEndLoc());
15017 return getDerived().RebuildCallExpr(
Object.get(), FakeLParenLoc, Args,
15021#define OVERLOADED_OPERATOR(Name, Spelling, Token, Unary, Binary, MemberOnly) \
15025#define OVERLOADED_OPERATOR_MULTI(Name,Spelling,Unary,Binary,MemberOnly)
15026#include "clang/Basic/OperatorKinds.def"
15028 case OO_Conditional:
15029 llvm_unreachable(
"conditional operator is not actually overloadable");
15033 llvm_unreachable(
"not an overloaded operator?");
15037 if (E->getNumArgs() == 1 && E->getOperator() == OO_Amp)
15038 First = getDerived().TransformAddressOfOperand(E->getArg(0));
15040 First = getDerived().TransformExpr(E->getArg(0));
15041 if (
First.isInvalid())
15045 if (E->getNumArgs() == 2) {
15047 getDerived().TransformInitializer(E->getArg(1),
false);
15048 if (Second.isInvalid())
15054 getSema().CurFPFeatures =
15055 NewOverrides.applyOverrides(getSema().getLangOpts());
15056 getSema().FpPragmaStack.CurrentValue = NewOverrides;
15062 if (getDerived().TransformOverloadExprDecls(ULE, ULE->requiresADL(), R))
15065 return getDerived().RebuildCXXOperatorCallExpr(
15066 E->getOperator(), E->getOperatorLoc(),
Callee->getBeginLoc(),
15067 ULE->requiresADL(),
R.asUnresolvedSet(),
First.get(), Second.get());
15072 Callee = ICE->getSubExprAsWritten();
15074 ValueDecl *VD = cast_or_null<ValueDecl>(
15075 getDerived().TransformDecl(DR->getLocation(), DR));
15080 Functions.addDecl(VD);
15082 return getDerived().RebuildCXXOperatorCallExpr(
15083 E->getOperator(), E->getOperatorLoc(),
Callee->getBeginLoc(),
15084 false, Functions,
First.get(), Second.get());
15087template<
typename Derived>
15090 return getDerived().TransformCallExpr(E);
15093template <
typename Derived>
15096 getSema().CurContext != E->getParentContext();
15098 if (!getDerived().AlwaysRebuild() && !NeedRebuildFunc)
15101 return getDerived().RebuildSourceLocExpr(E->getIdentKind(), E->getType(),
15102 E->getBeginLoc(), E->getEndLoc(),
15103 getSema().CurContext);
15106template <
typename Derived>
15111template<
typename Derived>
15120 ExprResult EC = getDerived().TransformCallExpr(E->getConfig());
15121 if (EC.isInvalid())
15125 bool ArgChanged =
false;
15127 if (getDerived().TransformExprs(E->getArgs(), E->getNumArgs(),
true, Args,
15131 if (!getDerived().AlwaysRebuild() &&
15132 Callee.get() == E->getCallee() &&
15138 = ((
Expr *)
Callee.get())->getSourceRange().getBegin();
15139 return getDerived().RebuildCallExpr(
Callee.get(), FakeLParenLoc,
15141 E->getRParenLoc(), EC.get());
15144template<
typename Derived>
15160 return getDerived().RebuildCXXNamedCastExpr(
15167template<
typename Derived>
15176 if (Sub.isInvalid())
15179 return getDerived().RebuildBuiltinBitCastExpr(BCE->
getBeginLoc(), TSI,
15183template<
typename Derived>
15185TreeTransform<Derived>::TransformCXXStaticCastExpr(CXXStaticCastExpr *E) {
15186 return getDerived().TransformCXXNamedCastExpr(E);
15189template<
typename Derived>
15195template<
typename Derived>
15202template<
typename Derived>
15208template<
typename Derived>
15214template<
typename Derived>
15219 getDerived().TransformTypeWithDeducedTST(E->getTypeInfoAsWritten());
15224 = getDerived().TransformExpr(E->getSubExprAsWritten());
15225 if (SubExpr.isInvalid())
15228 if (!getDerived().AlwaysRebuild() &&
15229 Type == E->getTypeInfoAsWritten() &&
15230 SubExpr.get() == E->getSubExpr())
15233 return getDerived().RebuildCXXFunctionalCastExpr(
Type,
15237 E->isListInitialization());
15240template<
typename Derived>
15243 if (E->isTypeOperand()) {
15245 = getDerived().TransformType(E->getTypeOperandSourceInfo());
15249 if (!getDerived().AlwaysRebuild() &&
15250 TInfo == E->getTypeOperandSourceInfo())
15253 return getDerived().RebuildCXXTypeidExpr(E->getType(), E->getBeginLoc(),
15254 TInfo, E->getEndLoc());
15260 Expr *Op = E->getExprOperand();
15262 if (E->isGLValue()) {
15264 if (
auto *RD = OpType->getAsCXXRecordDecl()) {
15266 diag::err_incomplete_typeid))
15269 if (RD->isPolymorphic())
15277 ExprResult SubExpr = getDerived().TransformExpr(Op);
15278 if (SubExpr.isInvalid())
15281 if (!getDerived().AlwaysRebuild() &&
15282 SubExpr.get() == E->getExprOperand())
15285 return getDerived().RebuildCXXTypeidExpr(E->getType(), E->getBeginLoc(),
15286 SubExpr.get(), E->getEndLoc());
15289template<
typename Derived>
15292 if (E->isTypeOperand()) {
15294 = getDerived().TransformType(E->getTypeOperandSourceInfo());
15298 if (!getDerived().AlwaysRebuild() &&
15299 TInfo == E->getTypeOperandSourceInfo())
15302 return getDerived().RebuildCXXUuidofExpr(E->getType(), E->getBeginLoc(),
15303 TInfo, E->getEndLoc());
15309 ExprResult SubExpr = getDerived().TransformExpr(E->getExprOperand());
15310 if (SubExpr.isInvalid())
15313 if (!getDerived().AlwaysRebuild() &&
15314 SubExpr.get() == E->getExprOperand())
15317 return getDerived().RebuildCXXUuidofExpr(E->getType(), E->getBeginLoc(),
15318 SubExpr.get(), E->getEndLoc());
15321template<
typename Derived>
15327template<
typename Derived>
15334template<
typename Derived>
15350 auto &S = getSema();
15351 if (E->isCapturedByCopyInLambdaWithExplicitObjectParameter())
15352 return S.getCurrentThisType();
15353 if (S.getCurLambda())
15354 return getDerived().TransformType(E->getType());
15355 return S.getCurrentThisType();
15358 if (!getDerived().AlwaysRebuild() && T == E->getType() &&
15359 !E->isCapturedByCopyInLambdaWithExplicitObjectParameter()) {
15362 getSema().MarkThisReferenced(E);
15366 return getDerived().RebuildCXXThisExpr(E->getBeginLoc(), T, E->isImplicit());
15369template<
typename Derived>
15372 ExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
15373 if (SubExpr.isInvalid())
15376 getSema().DiagnoseExceptionUse(E->getThrowLoc(),
false);
15378 if (!getDerived().AlwaysRebuild() &&
15379 SubExpr.get() == E->getSubExpr())
15382 return getDerived().RebuildCXXThrowExpr(E->getThrowLoc(), SubExpr.get(),
15383 E->isThrownVariableInScope());
15386template<
typename Derived>
15390 getDerived().TransformDecl(E->getBeginLoc(), E->getParam()));
15395 if (E->hasRewrittenInit()) {
15396 InitRes = getDerived().TransformExpr(E->getRewrittenExpr());
15397 if (InitRes.isInvalid())
15401 if (!getDerived().AlwaysRebuild() && Param == E->getParam() &&
15402 E->getUsedContext() == SemaRef.
CurContext &&
15403 InitRes.get() == E->getRewrittenExpr())
15406 return getDerived().RebuildCXXDefaultArgExpr(E->getUsedLocation(), Param,
15410template<
typename Derived>
15414 getDerived().TransformDecl(E->getBeginLoc(), E->getField()));
15419 if (E->hasRewrittenInit()) {
15423 InitRes = getDerived().TransformExpr(E->getRewrittenExpr());
15424 if (InitRes.isInvalid())
15428 if (!getDerived().AlwaysRebuild() && Field == E->getField() &&
15429 E->getUsedContext() == SemaRef.
CurContext &&
15430 InitRes.get() == E->getExpr())
15433 return getDerived().RebuildCXXDefaultInitExpr(E->getExprLoc(), Field,
15437template<
typename Derived>
15441 TypeSourceInfo *T = getDerived().TransformType(E->getTypeSourceInfo());
15445 if (!getDerived().AlwaysRebuild() &&
15446 T == E->getTypeSourceInfo())
15449 return getDerived().RebuildCXXScalarValueInitExpr(T,
15450 T->getTypeLoc().getEndLoc(),
15451 E->getRParenLoc());
15454template<
typename Derived>
15459 getDerived().TransformTypeWithDeducedTST(E->getAllocatedTypeSourceInfo());
15460 if (!AllocTypeInfo)
15464 std::optional<Expr *> ArraySize;
15465 if (E->isArray()) {
15467 if (std::optional<Expr *> OldArraySize = E->getArraySize()) {
15468 NewArraySize = getDerived().TransformExpr(*OldArraySize);
15469 if (NewArraySize.isInvalid())
15472 ArraySize = NewArraySize.get();
15476 bool ArgumentChanged =
false;
15478 if (getDerived().TransformExprs(E->getPlacementArgs(),
15479 E->getNumPlacementArgs(),
true,
15480 PlacementArgs, &ArgumentChanged))
15484 Expr *OldInit = E->getInitializer();
15487 NewInit = getDerived().TransformInitializer(OldInit,
true);
15488 if (NewInit.isInvalid())
15493 if (E->getOperatorNew()) {
15494 OperatorNew = cast_or_null<FunctionDecl>(
15495 getDerived().TransformDecl(E->getBeginLoc(), E->getOperatorNew()));
15501 if (E->getOperatorDelete()) {
15502 OperatorDelete = cast_or_null<FunctionDecl>(
15503 getDerived().TransformDecl(E->getBeginLoc(), E->getOperatorDelete()));
15504 if (!OperatorDelete)
15508 if (!getDerived().AlwaysRebuild() &&
15509 AllocTypeInfo == E->getAllocatedTypeSourceInfo() &&
15510 ArraySize == E->getArraySize() &&
15511 NewInit.get() == OldInit &&
15512 OperatorNew == E->getOperatorNew() &&
15513 OperatorDelete == E->getOperatorDelete() &&
15514 !ArgumentChanged) {
15519 if (OperatorDelete)
15522 if (E->isArray() && !E->getAllocatedType()->isDependentType()) {
15534 QualType AllocType = AllocTypeInfo->getType();
15545 = dyn_cast<ConstantArrayType>(ArrayT)) {
15549 AllocType = ConsArrayT->getElementType();
15551 = dyn_cast<DependentSizedArrayType>(ArrayT)) {
15552 if (DepArrayT->getSizeExpr()) {
15553 ArraySize = DepArrayT->getSizeExpr();
15554 AllocType = DepArrayT->getElementType();
15559 return getDerived().RebuildCXXNewExpr(
15560 E->getBeginLoc(), E->isGlobalNew(),
15561 E->getBeginLoc(), PlacementArgs,
15562 E->getBeginLoc(), E->getTypeIdParens(), AllocType,
15563 AllocTypeInfo, ArraySize, E->getDirectInitRange(), NewInit.get());
15566template<
typename Derived>
15575 if (E->getOperatorDelete()) {
15576 OperatorDelete = cast_or_null<FunctionDecl>(
15577 getDerived().TransformDecl(E->getBeginLoc(), E->getOperatorDelete()));
15578 if (!OperatorDelete)
15582 if (!getDerived().AlwaysRebuild() &&
15583 Operand.get() == E->getArgument() &&
15584 OperatorDelete == E->getOperatorDelete()) {
15587 if (OperatorDelete)
15590 if (!E->getArgument()->isTypeDependent()) {
15592 E->getDestroyedType());
15601 return getDerived().RebuildCXXDeleteExpr(
15602 E->getBeginLoc(), E->isGlobalDelete(), E->isArrayForm(),
Operand.get());
15605template<
typename Derived>
15610 if (
Base.isInvalid())
15614 bool MayBePseudoDestructor =
false;
15616 E->getOperatorLoc(),
15617 E->isArrow()? tok::arrow : tok::period,
15619 MayBePseudoDestructor);
15620 if (
Base.isInvalid())
15623 QualType ObjectType = ObjectTypePtr.get();
15625 if (QualifierLoc) {
15627 = getDerived().TransformNestedNameSpecifierLoc(QualifierLoc, ObjectType);
15632 SS.
Adopt(QualifierLoc);
15635 if (E->getDestroyedTypeInfo()) {
15636 TypeSourceInfo *DestroyedTypeInfo = getDerived().TransformTypeInObjectScope(
15637 E->getDestroyedTypeInfo(), ObjectType,
15639 if (!DestroyedTypeInfo)
15642 }
else if (!ObjectType.isNull() && ObjectType->isDependentType()) {
15646 E->getDestroyedTypeLoc());
15650 *E->getDestroyedTypeIdentifier(), E->getDestroyedTypeLoc(),
15651 nullptr, SS, ObjectTypePtr,
false);
15657 E->getDestroyedTypeLoc());
15661 if (E->getScopeTypeInfo()) {
15662 ScopeTypeInfo = getDerived().TransformTypeInObjectScope(
15663 E->getScopeTypeInfo(), ObjectType,
nullptr);
15664 if (!ScopeTypeInfo)
15668 return getDerived().RebuildCXXPseudoDestructorExpr(
Base.get(),
15669 E->getOperatorLoc(),
15673 E->getColonColonLoc(),
15678template <
typename Derived>
15683 bool AllEmptyPacks =
true;
15684 for (
auto *OldD : Old->
decls()) {
15700 if (
auto *UPD = dyn_cast<UsingPackDecl>(InstD))
15701 Decls = UPD->expansions();
15704 for (
auto *D : Decls) {
15705 if (
auto *UD = dyn_cast<UsingDecl>(D)) {
15706 for (
auto *SD : UD->shadows())
15713 AllEmptyPacks &= Decls.empty();
15722 if (AllEmptyPacks && !RequiresADL) {
15733 NamedDecl *FoundDecl = R.getRepresentativeDecl()->getUnderlyingDecl();
15734 getSema().FilterAcceptableTemplateNames(R,
15740 getSema().Diag(R.getNameLoc(),
15741 diag::err_template_kw_refers_to_non_template)
15745 diag::note_template_kw_refers_to_non_template)
15746 << R.getLookupName();
15754template <
typename Derived>
15760template <
typename Derived>
15763 bool IsAddressOfOperand) {
15768 if (TransformOverloadExprDecls(Old, Old->
requiresADL(), R))
15775 = getDerived().TransformNestedNameSpecifierLoc(Old->
getQualifierLoc());
15779 SS.
Adopt(QualifierLoc);
15783 CXXRecordDecl *NamingClass
15784 = cast_or_null<CXXRecordDecl>(getDerived().TransformDecl(
15787 if (!NamingClass) {
15792 R.setNamingClass(NamingClass);
15813 SS, TemplateKWLoc, R,
15820 return getDerived().RebuildDeclarationNameExpr(SS, R, Old->
requiresADL());
15823 return getDerived().RebuildTemplateIdExpr(SS, TemplateKWLoc, R,
15827template<
typename Derived>
15830 bool ArgChanged =
false;
15832 for (
unsigned I = 0, N = E->getNumArgs(); I != N; ++I) {
15834 TypeLoc FromTL = From->getTypeLoc();
15837 TLB.
reserve(FromTL.getFullDataSize());
15838 QualType To = getDerived().TransformType(TLB, FromTL);
15842 if (To == From->getType())
15843 Args.push_back(From);
15845 Args.push_back(TLB.getTypeSourceInfo(SemaRef.
Context, To));
15855 TypeLoc PatternTL = ExpansionTL.getPatternLoc();
15861 bool Expand =
true;
15862 bool RetainExpansion =
false;
15864 ExpansionTL.getTypePtr()->getNumExpansions();
15866 if (getDerived().TryExpandParameterPacks(
15867 ExpansionTL.getEllipsisLoc(), PatternTL.getSourceRange(),
15868 Unexpanded,
true, Expand,
15869 RetainExpansion, NumExpansions))
15879 TLB.
reserve(From->getTypeLoc().getFullDataSize());
15881 QualType To = getDerived().TransformType(TLB, PatternTL);
15885 To = getDerived().RebuildPackExpansionType(To,
15886 PatternTL.getSourceRange(),
15887 ExpansionTL.getEllipsisLoc(),
15895 Args.push_back(TLB.getTypeSourceInfo(SemaRef.
Context, To));
15901 for (
unsigned I = 0; I != *NumExpansions; ++I) {
15904 TLB.
reserve(PatternTL.getFullDataSize());
15905 QualType To = getDerived().TransformType(TLB, PatternTL);
15909 if (To->containsUnexpandedParameterPack()) {
15910 To = getDerived().RebuildPackExpansionType(To,
15911 PatternTL.getSourceRange(),
15912 ExpansionTL.getEllipsisLoc(),
15922 Args.push_back(TLB.getTypeSourceInfo(SemaRef.
Context, To));
15925 if (!RetainExpansion)
15930 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
15933 TLB.
reserve(From->getTypeLoc().getFullDataSize());
15935 QualType To = getDerived().TransformType(TLB, PatternTL);
15939 To = getDerived().RebuildPackExpansionType(To,
15940 PatternTL.getSourceRange(),
15941 ExpansionTL.getEllipsisLoc(),
15949 Args.push_back(TLB.getTypeSourceInfo(SemaRef.
Context, To));
15952 if (!getDerived().AlwaysRebuild() && !ArgChanged)
15955 return getDerived().RebuildTypeTrait(E->getTrait(), E->getBeginLoc(), Args,
15959template<
typename Derived>
15965 if (getDerived().TransformTemplateArguments(Old->getTemplateArgs(),
15966 Old->NumTemplateArgs, TransArgs))
15969 return getDerived().RebuildConceptSpecializationExpr(
15970 E->getNestedNameSpecifierLoc(), E->getTemplateKWLoc(),
15971 E->getConceptNameInfo(), E->getFoundDecl(), E->getConceptDecl(),
15975template<
typename Derived>
15989 getSema().Context, getSema().CurContext,
15990 E->getBody()->getBeginLoc());
15994 ExprResult TypeParamResult = getDerived().TransformRequiresTypeParams(
15995 E->getRequiresKWLoc(), E->getRBraceLoc(), E, Body,
15996 E->getLocalParameters(), TransParamTypes, TransParams, ExtParamInfos);
16000 Param->setDeclContext(Body);
16006 if (!TypeParamResult.isUnset())
16007 return TypeParamResult;
16010 if (getDerived().TransformRequiresExprRequirements(E->getRequirements(),
16015 if (
auto *ER = dyn_cast<concepts::ExprRequirement>(Req)) {
16016 if (ER->getReturnTypeRequirement().isTypeConstraint()) {
16017 ER->getReturnTypeRequirement()
16018 .getTypeConstraintTemplateParameterList()->getParam(0)
16019 ->setDeclContext(Body);
16024 return getDerived().RebuildRequiresExpr(
16025 E->getRequiresKWLoc(), Body, E->getLParenLoc(), TransParams,
16026 E->getRParenLoc(), TransReqs, E->getRBraceLoc());
16029template<
typename Derived>
16035 if (
auto *TypeReq = dyn_cast<concepts::TypeRequirement>(Req))
16036 TransReq =
getDerived().TransformTypeRequirement(TypeReq);
16037 else if (
auto *ExprReq = dyn_cast<concepts::ExprRequirement>(Req))
16038 TransReq =
getDerived().TransformExprRequirement(ExprReq);
16040 TransReq =
getDerived().TransformNestedRequirement(
16044 Transformed.push_back(TransReq);
16049template<
typename Derived>
16062 return getDerived().RebuildTypeRequirement(TransType);
16065template<
typename Derived>
16068 llvm::PointerUnion<Expr *, concepts::Requirement::SubstitutionDiagnostic *> TransExpr;
16074 TransExprRes =
SemaRef.CheckPlaceholderExpr(TransExprRes.
get());
16077 TransExpr = TransExprRes.
get();
16080 std::optional<concepts::ExprRequirement::ReturnTypeRequirement> TransRetReq;
16082 if (RetReq.isEmpty())
16083 TransRetReq.emplace();
16084 else if (RetReq.isSubstitutionFailure())
16085 TransRetReq.emplace(RetReq.getSubstitutionDiagnostic());
16086 else if (RetReq.isTypeConstraint()) {
16088 RetReq.getTypeConstraintTemplateParameterList();
16090 getDerived().TransformTemplateParameterList(OrigTPL);
16093 TransRetReq.emplace(TPL);
16095 assert(TransRetReq &&
"All code paths leading here must set TransRetReq");
16096 if (
Expr *E = dyn_cast<Expr *>(TransExpr))
16099 std::move(*TransRetReq));
16105template<
typename Derived>
16111 return getDerived().RebuildNestedRequirement(
16119 return getDerived().RebuildNestedRequirement(TransConstraint.
get());
16122template<
typename Derived>
16129 if (!getDerived().AlwaysRebuild() &&
16146template<
typename Derived>
16153 SubExpr = getDerived().TransformExpr(E->getQueriedExpression());
16154 if (SubExpr.isInvalid())
16157 if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getQueriedExpression())
16161 return getDerived().RebuildExpressionTrait(E->getTrait(), E->getBeginLoc(),
16162 SubExpr.get(), E->getEndLoc());
16165template <
typename Derived>
16170 DRE, AddrTaken, RecoveryTSI);
16183template <
typename Derived>
16190template <
typename Derived>
16206 getDerived().TransformDeclarationNameInfo(E->
getNameInfo());
16211 if (!getDerived().AlwaysRebuild() && QualifierLoc == E->
getQualifierLoc() &&
16217 return getDerived().RebuildDependentScopeDeclRefExpr(
16218 QualifierLoc, TemplateKWLoc, NameInfo,
nullptr,
16219 IsAddressOfOperand, RecoveryTSI);
16223 if (getDerived().TransformTemplateArguments(
16227 return getDerived().RebuildDependentScopeDeclRefExpr(
16228 QualifierLoc, TemplateKWLoc, NameInfo, &TransArgs, IsAddressOfOperand,
16232template<
typename Derived>
16238 if (getDerived().AllowSkippingCXXConstructExpr() &&
16239 ((E->getNumArgs() == 1 ||
16240 (E->getNumArgs() > 1 && getDerived().DropCallArgument(E->getArg(1)))) &&
16241 (!getDerived().DropCallArgument(E->getArg(0))) &&
16242 !E->isListInitialization()))
16248 QualType T = getDerived().TransformType(E->getType());
16253 getDerived().TransformDecl(E->getBeginLoc(), E->getConstructor()));
16257 bool ArgumentChanged =
false;
16262 E->isListInitialization());
16263 if (getDerived().TransformExprs(E->getArgs(), E->getNumArgs(),
true, Args,
16268 if (!getDerived().AlwaysRebuild() &&
16269 T == E->getType() &&
16271 !ArgumentChanged) {
16278 return getDerived().RebuildCXXConstructExpr(
16279 T, E->getBeginLoc(),
Constructor, E->isElidable(), Args,
16280 E->hadMultipleCandidates(), E->isListInitialization(),
16281 E->isStdInitListInitialization(), E->requiresZeroInitialization(),
16282 E->getConstructionKind(), E->getParenOrBraceRange());
16285template<
typename Derived>
16288 QualType T = getDerived().TransformType(E->getType());
16293 getDerived().TransformDecl(E->getBeginLoc(), E->getConstructor()));
16297 if (!getDerived().AlwaysRebuild() &&
16298 T == E->getType() &&
16306 return getDerived().RebuildCXXInheritedCtorInitExpr(
16308 E->constructsVBase(), E->inheritedFromVBase());
16315template<
typename Derived>
16318 if (
auto *Dtor = E->getTemporary()->getDestructor())
16321 return getDerived().TransformExpr(E->getSubExpr());
16329template<
typename Derived>
16335template<
typename Derived>
16340 getDerived().TransformTypeWithDeducedTST(E->getTypeSourceInfo());
16345 getDerived().TransformDecl(E->getBeginLoc(), E->getConstructor()));
16349 bool ArgumentChanged =
false;
16351 Args.reserve(E->getNumArgs());
16355 E->isListInitialization());
16356 if (TransformExprs(E->getArgs(), E->getNumArgs(),
true, Args,
16360 if (E->isListInitialization() && !E->isStdInitListInitialization()) {
16361 ExprResult Res = RebuildInitList(E->getBeginLoc(), Args, E->getEndLoc(),
16363 if (Res.isInvalid())
16365 Args = {Res.get()};
16369 if (!getDerived().AlwaysRebuild() &&
16370 T == E->getTypeSourceInfo() &&
16372 !ArgumentChanged) {
16379 return getDerived().RebuildCXXTemporaryObjectExpr(
16380 T, LParenLoc, Args, E->getEndLoc(), E->isListInitialization());
16383template<
typename Derived>
16388 typedef std::pair<ExprResult, QualType> InitCaptureInfoTy;
16389 struct TransformedInitCapture {
16391 SourceLocation EllipsisLoc;
16393 SmallVector<InitCaptureInfoTy, 4> Expansions;
16396 InitCaptures.resize(E->explicit_capture_end() - E->explicit_capture_begin());
16398 CEnd = E->capture_end();
16400 if (!E->isInitCapture(
C))
16403 TransformedInitCapture &
Result = InitCaptures[
C - E->capture_begin()];
16408 ExprResult NewExprInitResult = getDerived().TransformInitializer(
16411 if (NewExprInitResult.isInvalid()) {
16415 Expr *NewExprInit = NewExprInitResult.get();
16418 getSema().buildLambdaInitCaptureInitialization(
16419 C->getLocation(),
C->getCaptureKind() ==
LCK_ByRef,
16420 EllipsisLoc, NumExpansions, OldVD->getIdentifier(),
16424 Result.Expansions.push_back(
16425 InitCaptureInfoTy(NewExprInit, NewInitCaptureType));
16429 if (OldVD->isParameterPack()) {
16438 bool Expand =
true;
16439 bool RetainExpansion =
false;
16441 ExpansionTL.getTypePtr()->getNumExpansions();
16443 if (getDerived().TryExpandParameterPacks(
16444 ExpansionTL.getEllipsisLoc(), OldVD->getInit()->getSourceRange(),
16445 Unexpanded,
true, Expand,
16446 RetainExpansion, NumExpansions))
16448 assert(!RetainExpansion &&
"Should not need to retain expansion after a "
16449 "capture since it cannot be extended");
16451 for (
unsigned I = 0; I != *NumExpansions; ++I) {
16456 SubstInitCapture(ExpansionTL.getEllipsisLoc(), NumExpansions);
16457 Result.EllipsisLoc = ExpansionTL.getEllipsisLoc();
16496 if ((getSema().isUnevaluatedContext() ||
16497 getSema().isConstantEvaluatedContext()) &&
16498 !(dyn_cast_or_null<CXXRecordDecl>(DC->getParent()) &&
16500 (DC->isFileContext() || !DC->getParent()->isDependentContext()))
16505 E->getIntroducerRange(),
nullptr, DependencyKind,
16506 E->getCaptureDefault());
16507 getDerived().transformedLocalDecl(OldClass, {
Class});
16510 getSema().CreateLambdaCallOperator(E->getIntroducerRange(),
Class);
16513 getSema().buildLambdaScope(LSI, NewCallOperator, E->getIntroducerRange(),
16514 E->getCaptureDefault(), E->getCaptureDefaultLoc(),
16515 E->hasExplicitParameters(), E->isMutable());
16525 CEnd = E->capture_end();
16529 if (
C->isImplicit())
16533 if (
C->capturesThis()) {
16541 dyn_cast_if_present<CXXRecordDecl>(
16542 getSema().getFunctionLevelDeclContext()),
16544 getSema().CheckCXXThisCapture(
C->getLocation(),
C->isExplicit(),
16551 if (
C->capturesVLAType())
16555 if (E->isInitCapture(
C)) {
16556 TransformedInitCapture &NewC = InitCaptures[
C - E->capture_begin()];
16561 for (InitCaptureInfoTy &Info : NewC.Expansions) {
16563 QualType InitQualType = Info.second;
16564 if (
Init.isInvalid() || InitQualType.isNull()) {
16568 VarDecl *NewVD = getSema().createLambdaInitCaptureVarDecl(
16569 OldVD->getLocation(), InitQualType, NewC.EllipsisLoc,
16570 OldVD->getIdentifier(), OldVD->getInitStyle(),
Init.get(),
16571 getSema().CurContext);
16576 NewVDs.push_back(NewVD);
16577 getSema().addInitCapture(LSI, NewVD,
C->getCaptureKind() ==
LCK_ByRef);
16582 if (NewC.EllipsisLoc.isInvalid())
16583 LSI->ContainsUnexpandedParameterPack |=
16584 Init.get()->containsUnexpandedParameterPack();
16590 getDerived().transformedLocalDecl(OldVD, NewVDs);
16594 assert(
C->capturesVariable() &&
"unexpected kind of lambda capture");
16602 if (
C->isPackExpansion()) {
16604 bool ShouldExpand =
false;
16605 bool RetainExpansion =
false;
16607 if (getDerived().TryExpandParameterPacks(
16608 C->getEllipsisLoc(),
C->getLocation(), Unexpanded,
16609 true, ShouldExpand,
16610 RetainExpansion, NumExpansions)) {
16615 if (ShouldExpand) {
16620 for (
unsigned I = 0; I != *NumExpansions; ++I) {
16622 ValueDecl *CapturedVar = cast_if_present<ValueDecl>(
16623 getDerived().TransformDecl(
C->getLocation(), Pack));
16624 if (!CapturedVar) {
16630 getSema().tryCaptureVariable(CapturedVar,
C->getLocation(), Kind);
16638 EllipsisLoc =
C->getEllipsisLoc();
16642 auto *CapturedVar = cast_or_null<ValueDecl>(
16643 getDerived().TransformDecl(
C->getLocation(),
C->getCapturedVar()));
16644 if (!CapturedVar || CapturedVar->isInvalidDecl()) {
16651 if (
auto *VD = dyn_cast<VarDecl>(CapturedVar); VD && !
C->isPackExpansion())
16652 LSI->ContainsUnexpandedParameterPack |= VD->isParameterPack();
16655 getSema().tryCaptureVariable(CapturedVar,
C->getLocation(), Kind,
16658 getSema().finishLambdaExplicitCaptures(LSI);
16662 auto TPL = getDerived().TransformTemplateParameterList(
16663 E->getTemplateParameterList());
16664 LSI->GLTemplateParameterList = TPL;
16666 getSema().AddTemplateParametersToLambdaCallOperator(NewCallOperator,
Class,
16668 LSI->ContainsUnexpandedParameterPack |=
16669 TPL->containsUnexpandedParameterPack();
16674 E->getCallOperator()->getTypeSourceInfo()->getTypeLoc();
16676 getDerived().TransformType(NewCallOpTLBuilder, OldCallOpTypeLoc);
16677 if (NewCallOpType.isNull())
16679 LSI->ContainsUnexpandedParameterPack |=
16680 NewCallOpType->containsUnexpandedParameterPack();
16682 NewCallOpTLBuilder.getTypeSourceInfo(getSema().Context, NewCallOpType);
16687 assert(FPTL &&
"Not a FunctionProtoType?");
16691 ExprResult E = getDerived().TransformLambdaConstraint(
16692 const_cast<Expr *
>(TRC.ConstraintExpr));
16695 TRC.ConstraintExpr = E.get();
16698 LSI->BeforeCompoundStatement =
false;
16699 getSema().CompleteLambdaCallOperator(
16700 NewCallOperator, E->getCallOperator()->getLocation(),
16701 E->getCallOperator()->getInnerLocStart(), TRC, NewCallOpTSI,
16702 E->getCallOperator()->getConstexprKind(),
16703 E->getCallOperator()->getStorageClass(), FPTL.getParams(),
16704 E->hasExplicitResultType());
16706 getDerived().transformAttrs(E->getCallOperator(), NewCallOperator);
16707 getDerived().transformedLocalDecl(E->getCallOperator(), {NewCallOperator});
16713 std::optional<CXXRecordDecl::LambdaNumbering> Numbering;
16714 if (getDerived().ReplacingOriginal()) {
16715 Numbering = OldClass->getLambdaNumbering();
16718 getSema().handleLambdaNumbering(
Class, NewCallOperator, Numbering);
16723 getSema().PushExpressionEvaluationContextForFunction(
16725 E->getCallOperator());
16732 C.PointOfInstantiation = E->getBody()->getBeginLoc();
16733 getSema().pushCodeSynthesisContext(
C);
16737 : getDerived().TransformLambdaBody(E, E->getBody());
16739 getSema().popCodeSynthesisContext();
16743 FuncScopeCleanup.disable();
16745 if (Body.isInvalid()) {
16746 SavedContext.pop();
16747 getSema().ActOnLambdaError(E->getBeginLoc(),
nullptr,
16752 getSema().ActOnFinishFunctionBody(NewCallOperator, Body.get(),
16755 SavedContext.pop();
16790 DependencyKind = getDerived().ComputeLambdaDependency(LSI);
16791 Class->setLambdaDependencyKind(DependencyKind);
16793 return getDerived().RebuildLambdaExpr(E->getBeginLoc(),
16794 Body.get()->getEndLoc(), LSI);
16797template<
typename Derived>
16803template<
typename Derived>
16812 if (!
C->isImplicit())
16816 if (
C->capturesThis()) {
16817 getSema().CheckCXXThisCapture(
C->getLocation(),
C->isExplicit(),
16824 if (
C->capturesVLAType())
16827 assert(
C->capturesVariable() &&
"unexpected kind of lambda capture");
16831 VarDecl *CapturedVar = cast_or_null<VarDecl>(
16837 getSema().tryCaptureVariable(CapturedVar,
C->getLocation());
16843template<
typename Derived>
16852 bool ArgumentChanged =
false;
16864 if (!getDerived().AlwaysRebuild() &&
16870 return getDerived().RebuildCXXUnresolvedConstructExpr(
16874template <
typename Derived>
16878 TemplateName Name = getDerived().TransformConceptTemplateName(
16879 E->getTemplateName(), E->getNameLoc());
16884 if (getDerived().TransformTemplateArguments(
16885 E->template_arguments().data(), E->getNumTemplateArgs(), TransArgs))
16898 return getDerived().RebuildTemplateIdExpr(
16900 false, &TransArgs);
16903template<
typename Derived>
16912 if (!E->isImplicitAccess()) {
16913 OldBase = E->getBase();
16914 Base = getDerived().TransformExpr(OldBase);
16915 if (
Base.isInvalid())
16920 bool MayBePseudoDestructor =
false;
16922 E->getOperatorLoc(),
16923 E->isArrow()? tok::arrow : tok::period,
16925 MayBePseudoDestructor);
16926 if (
Base.isInvalid())
16929 ObjectType = ObjectTy.get();
16930 BaseType = ((
Expr*)
Base.get())->getType();
16933 BaseType = getDerived().TransformType(E->getBaseType());
16940 = getDerived().TransformFirstQualifierInScope(
16941 E->getFirstQualifierFoundInScope(),
16942 E->getQualifierLoc().getBeginLoc());
16945 if (E->getQualifier()) {
16947 = getDerived().TransformNestedNameSpecifierLoc(E->getQualifierLoc(),
16949 FirstQualifierInScope);
16961 = getDerived().TransformDeclarationNameInfo(E->getMemberNameInfo());
16962 if (!NameInfo.getName())
16965 if (!E->hasExplicitTemplateArgs()) {
16968 if (!getDerived().AlwaysRebuild() &&
16969 Base.get() == OldBase &&
16970 BaseType == E->getBaseType() &&
16971 QualifierLoc == E->getQualifierLoc() &&
16972 NameInfo.getName() == E->getMember() &&
16973 FirstQualifierInScope == E->getFirstQualifierFoundInScope())
16976 return getDerived().RebuildCXXDependentScopeMemberExpr(
Base.get(),
16979 E->getOperatorLoc(),
16982 FirstQualifierInScope,
16988 if (getDerived().TransformTemplateArguments(E->getTemplateArgs(),
16989 E->getNumTemplateArgs(),
16993 return getDerived().RebuildCXXDependentScopeMemberExpr(
Base.get(),
16996 E->getOperatorLoc(),
16999 FirstQualifierInScope,
17004template <
typename Derived>
17010 if (!Old->isImplicitAccess()) {
17011 Base = getDerived().TransformExpr(Old->getBase());
17012 if (
Base.isInvalid())
17015 getSema().PerformMemberExprBaseConversion(
Base.get(), Old->isArrow());
17016 if (
Base.isInvalid())
17018 BaseType =
Base.get()->getType();
17020 BaseType = getDerived().TransformType(Old->getBaseType());
17024 if (Old->getQualifierLoc()) {
17026 getDerived().TransformNestedNameSpecifierLoc(Old->getQualifierLoc());
17036 if (TransformOverloadExprDecls(Old,
false, R))
17040 if (Old->getNamingClass()) {
17042 getDerived().TransformDecl(Old->getMemberLoc(), Old->getNamingClass()));
17046 R.setNamingClass(NamingClass);
17050 if (Old->hasExplicitTemplateArgs()) {
17051 TransArgs.setLAngleLoc(Old->getLAngleLoc());
17052 TransArgs.setRAngleLoc(Old->getRAngleLoc());
17053 if (getDerived().TransformTemplateArguments(
17054 Old->getTemplateArgs(), Old->getNumTemplateArgs(), TransArgs))
17062 NamedDecl *FirstQualifierInScope =
nullptr;
17064 return getDerived().RebuildUnresolvedMemberExpr(
17065 Base.get(), BaseType, Old->getOperatorLoc(), Old->isArrow(), QualifierLoc,
17066 TemplateKWLoc, FirstQualifierInScope, R,
17067 (Old->hasExplicitTemplateArgs() ? &TransArgs :
nullptr));
17070template<
typename Derived>
17075 ExprResult SubExpr = getDerived().TransformExpr(E->getOperand());
17076 if (SubExpr.isInvalid())
17079 if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getOperand())
17082 return getDerived().RebuildCXXNoexceptExpr(E->getSourceRange(),SubExpr.get());
17085template<
typename Derived>
17088 ExprResult Pattern = getDerived().TransformExpr(E->getPattern());
17089 if (Pattern.isInvalid())
17092 if (!getDerived().AlwaysRebuild() && Pattern.get() == E->getPattern())
17095 return getDerived().RebuildPackExpansion(Pattern.get(), E->getEllipsisLoc(),
17096 E->getNumExpansions());
17099template <
typename Derived>
17104 if (!Arg.isPackExpansion()) {
17116 getSema().getTemplateArgumentPackExpansionPattern(ArgLoc, Ellipsis,
17117 OrigNumExpansions);
17129 if (!NumExpansions) {
17141template<
typename Derived>
17160 bool ShouldExpand =
false;
17161 bool RetainExpansion =
false;
17163 if (getDerived().TryExpandParameterPacks(
17165 true, ShouldExpand,
17166 RetainExpansion, NumExpansions))
17171 if (ShouldExpand) {
17173 if (
auto *TTPD = dyn_cast<TemplateTypeParmDecl>(Pack)) {
17174 ArgStorage = getSema().Context.getPackExpansionType(
17175 getSema().Context.getTypeDeclType(TTPD), std::nullopt);
17176 }
else if (
auto *TTPD = dyn_cast<TemplateTemplateParmDecl>(Pack)) {
17180 ExprResult DRE = getSema().BuildDeclRefExpr(
17181 VD, VD->getType().getNonLValueExprType(getSema().Context),
17184 if (DRE.isInvalid())
17187 new (getSema().Context)
17191 PackArgs = ArgStorage;
17196 if (!PackArgs.size()) {
17197 auto *Pack = cast_or_null<NamedDecl>(
17201 return getDerived().RebuildSizeOfPackExpr(
17208 getDerived().ComputeSizeOfPackExprWithoutSubstitution(PackArgs);
17220 TemporaryBase Rebase(*
this, E->
getPackLoc(), getBaseEntity());
17223 if (TransformTemplateArguments(PackLocIterator(*
this, PackArgs.begin()),
17224 PackLocIterator(*
this, PackArgs.end()),
17225 TransformedPackArgs,
true))
17232 bool PartialSubstitution =
false;
17233 for (
auto &Loc : TransformedPackArgs.arguments()) {
17234 Args.push_back(Loc.getArgument());
17235 if (Loc.getArgument().isPackExpansion())
17236 PartialSubstitution =
true;
17239 if (PartialSubstitution)
17240 return getDerived().RebuildSizeOfPackExpr(
17242 std::nullopt, Args);
17244 return getDerived().RebuildSizeOfPackExpr(
17246 static_cast<unsigned>(Args.size()),
17250template <
typename Derived>
17253 if (!E->isValueDependent())
17261 IndexExpr = getDerived().TransformExpr(E->getIndexExpr());
17262 if (IndexExpr.isInvalid())
17267 bool FullySubstituted =
true;
17268 if (!E->expandsToEmptyPack() && E->getExpressions().empty()) {
17269 Expr *Pattern = E->getPackIdExpression();
17271 getSema().collectUnexpandedParameterPacks(E->getPackIdExpression(),
17273 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
17277 bool ShouldExpand =
true;
17278 bool RetainExpansion =
false;
17280 NumExpansions = std::nullopt;
17281 if (getDerived().TryExpandParameterPacks(
17282 E->getEllipsisLoc(), Pattern->getSourceRange(), Unexpanded,
17283 true, ShouldExpand,
17284 RetainExpansion, NumExpansions))
17286 if (!ShouldExpand) {
17288 ExprResult Pack = getDerived().TransformExpr(Pattern);
17289 if (Pack.isInvalid())
17291 return getDerived().RebuildPackIndexingExpr(
17292 E->getEllipsisLoc(), E->getRSquareLoc(), Pack.get(), IndexExpr.get(),
17295 for (
unsigned I = 0; I != *NumExpansions; ++I) {
17298 if (
Out.isInvalid())
17300 if (
Out.get()->containsUnexpandedParameterPack()) {
17301 Out = getDerived().RebuildPackExpansion(
Out.get(), E->getEllipsisLoc(),
17302 OrigNumExpansions);
17303 if (
Out.isInvalid())
17305 FullySubstituted =
false;
17307 ExpandedExprs.push_back(
Out.get());
17311 if (RetainExpansion) {
17312 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
17315 if (
Out.isInvalid())
17318 Out = getDerived().RebuildPackExpansion(
Out.get(), E->getEllipsisLoc(),
17319 OrigNumExpansions);
17320 if (
Out.isInvalid())
17322 FullySubstituted =
false;
17323 ExpandedExprs.push_back(
Out.get());
17325 }
else if (!E->expandsToEmptyPack()) {
17326 if (getDerived().TransformExprs(E->getExpressions().data(),
17327 E->getExpressions().size(),
false,
17332 return getDerived().RebuildPackIndexingExpr(
17333 E->getEllipsisLoc(), E->getRSquareLoc(), E->getPackIdExpression(),
17334 IndexExpr.get(), ExpandedExprs, FullySubstituted);
17337template <
typename Derived>
17340 if (!getSema().ArgPackSubstIndex)
17346 return getDerived().RebuildSubstNonTypeTemplateParmExpr(
17347 E->getAssociatedDecl(), E->getParameterPack()->getPosition(),
17348 E->getParameterPack()->getType(), E->getParameterPackLocation(), Arg,
17352template <
typename Derived>
17369 ExprResult Replacement = getDerived().TransformExpr(OrigReplacement);
17370 if (Replacement.isInvalid())
17373 Decl *AssociatedDecl =
17374 getDerived().TransformDecl(E->getNameLoc(), E->getAssociatedDecl());
17375 if (!AssociatedDecl)
17378 QualType ParamType = TransformType(E->getParameterType());
17379 if (ParamType.isNull())
17382 if (Replacement.get() == OrigReplacement &&
17383 AssociatedDecl == E->getAssociatedDecl() &&
17384 ParamType == E->getParameterType())
17387 if (Replacement.get() != OrigReplacement ||
17388 ParamType != E->getParameterType()) {
17397 Param, ParamType, Replacement.get(), SugaredConverted,
17398 CanonicalConverted,
17400 if (Replacement.isInvalid())
17404 Replacement = E->getReplacement();
17407 return getDerived().RebuildSubstNonTypeTemplateParmExpr(
17408 AssociatedDecl, E->getIndex(), ParamType, E->getNameLoc(),
17410 E->getPackIndex(), E->getFinal());
17413template<
typename Derived>
17420template<
typename Derived>
17427template<
typename Derived>
17431 if (
Expr *OldCallee = E->getCallee()) {
17432 ExprResult CalleeResult = getDerived().TransformExpr(OldCallee);
17433 if (CalleeResult.isInvalid())
17438 Expr *Pattern = E->getPattern();
17441 getSema().collectUnexpandedParameterPacks(Pattern, Unexpanded);
17442 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
17446 bool Expand =
true;
17447 bool RetainExpansion =
false;
17449 NumExpansions = OrigNumExpansions;
17450 if (getDerived().TryExpandParameterPacks(
17451 E->getEllipsisLoc(), Pattern->getSourceRange(), Unexpanded,
17452 true, Expand, RetainExpansion,
17462 E->getLHS() ? getDerived().TransformExpr(E->getLHS()) :
ExprResult();
17463 if (LHS.isInvalid())
17467 E->getRHS() ? getDerived().TransformExpr(E->getRHS()) :
ExprResult();
17468 if (RHS.isInvalid())
17471 if (!getDerived().AlwaysRebuild() &&
17472 LHS.get() == E->getLHS() && RHS.get() == E->getRHS())
17475 return getDerived().RebuildCXXFoldExpr(
17476 Callee, E->getBeginLoc(), LHS.get(), E->getOperator(),
17477 E->getEllipsisLoc(), RHS.get(), E->getEndLoc(), NumExpansions);
17483 if (NumExpansions && SemaRef.
getLangOpts().BracketDepth < *NumExpansions) {
17484 SemaRef.
Diag(E->getEllipsisLoc(),
17485 clang::diag::err_fold_expression_limit_exceeded)
17486 << *NumExpansions << SemaRef.
getLangOpts().BracketDepth
17487 << E->getSourceRange();
17488 SemaRef.
Diag(E->getEllipsisLoc(), diag::note_bracket_depth);
17497 bool LeftFold = E->isLeftFold();
17501 if (!LeftFold && RetainExpansion) {
17502 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
17505 if (
Out.isInvalid())
17508 Result = getDerived().RebuildCXXFoldExpr(
17509 Callee, E->getBeginLoc(),
Out.get(), E->getOperator(),
17510 E->getEllipsisLoc(),
Result.get(), E->getEndLoc(), OrigNumExpansions);
17515 bool WarnedOnComparison =
false;
17516 for (
unsigned I = 0; I != *NumExpansions; ++I) {
17518 getSema(), LeftFold ? I : *NumExpansions - I - 1);
17520 if (
Out.isInvalid())
17523 if (
Out.get()->containsUnexpandedParameterPack()) {
17525 Result = getDerived().RebuildCXXFoldExpr(
17526 Callee, E->getBeginLoc(), LeftFold ?
Result.get() :
Out.get(),
17527 E->getOperator(), E->getEllipsisLoc(),
17528 LeftFold ?
Out.get() :
Result.get(), E->getEndLoc(),
17529 OrigNumExpansions);
17530 }
else if (
Result.isUsable()) {
17537 Result = getDerived().RebuildCXXOperatorCallExpr(
17539 E->getEllipsisLoc(),
Callee->getBeginLoc(),
Callee->requiresADL(),
17540 Functions, LHS, RHS);
17542 Result = getDerived().RebuildBinaryOperator(E->getEllipsisLoc(),
17543 E->getOperator(), LHS, RHS,
17545 if (!WarnedOnComparison &&
Result.isUsable()) {
17546 if (
auto *BO = dyn_cast<BinaryOperator>(
Result.get());
17547 BO && BO->isComparisonOp()) {
17548 WarnedOnComparison =
true;
17549 SemaRef.
Diag(BO->getBeginLoc(),
17550 diag::warn_comparison_in_fold_expression)
17551 << BO->getOpcodeStr();
17564 if (LeftFold && RetainExpansion) {
17565 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
17568 if (
Out.isInvalid())
17571 Result = getDerived().RebuildCXXFoldExpr(
17572 Callee, E->getBeginLoc(),
Result.get(), E->getOperator(),
17573 E->getEllipsisLoc(),
Out.get(), E->getEndLoc(), OrigNumExpansions);
17579 PE->setIsProducedByFoldExpansion();
17584 return getDerived().RebuildEmptyCXXFoldExpr(E->getEllipsisLoc(),
17589template <
typename Derived>
17595 QualType T = getDerived().TransformType(E->getType());
17597 bool ArgChanged =
false;
17599 if (getDerived().TransformExprs(InitExprs.data(), InitExprs.size(),
true,
17600 TransformedInits, &ArgChanged))
17603 if (!getDerived().AlwaysRebuild() && !ArgChanged && T == E->getType())
17606 return getDerived().RebuildCXXParenListInitExpr(
17607 TransformedInits, T, E->getUserSpecifiedInitExprs().size(),
17608 E->getInitLoc(), E->getBeginLoc(), E->getEndLoc());
17611template<
typename Derived>
17618template<
typename Derived>
17624template<
typename Derived>
17630template<
typename Derived>
17633 ExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
17634 if (SubExpr.isInvalid())
17637 if (!getDerived().AlwaysRebuild() &&
17638 SubExpr.get() == E->getSubExpr())
17641 return getDerived().RebuildObjCBoxedExpr(E->getSourceRange(), SubExpr.get());
17644template<
typename Derived>
17649 bool ArgChanged =
false;
17650 if (getDerived().TransformExprs(E->getElements(), E->getNumElements(),
17651 false, Elements, &ArgChanged))
17654 if (!getDerived().AlwaysRebuild() && !ArgChanged)
17657 return getDerived().RebuildObjCArrayLiteral(E->getSourceRange(),
17662template<
typename Derived>
17668 bool ArgChanged =
false;
17669 for (
unsigned I = 0, N = E->getNumElements(); I != N; ++I) {
17672 if (OrigElement.isPackExpansion()) {
17675 getSema().collectUnexpandedParameterPacks(OrigElement.Key, Unexpanded);
17676 getSema().collectUnexpandedParameterPacks(OrigElement.Value, Unexpanded);
17677 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
17681 bool Expand =
true;
17682 bool RetainExpansion =
false;
17685 SourceRange PatternRange(OrigElement.Key->getBeginLoc(),
17686 OrigElement.Value->getEndLoc());
17687 if (getDerived().TryExpandParameterPacks(
17688 OrigElement.EllipsisLoc, PatternRange, Unexpanded,
17689 true, Expand, RetainExpansion,
17698 ExprResult Key = getDerived().TransformExpr(OrigElement.Key);
17699 if (Key.isInvalid())
17702 if (Key.get() != OrigElement.Key)
17706 if (
Value.isInvalid())
17713 Key.get(),
Value.get(), OrigElement.EllipsisLoc, NumExpansions
17715 Elements.push_back(Expansion);
17725 for (
unsigned I = 0; I != *NumExpansions; ++I) {
17727 ExprResult Key = getDerived().TransformExpr(OrigElement.Key);
17728 if (Key.isInvalid())
17732 if (
Value.isInvalid())
17742 if (Key.get()->containsUnexpandedParameterPack() ||
17743 Value.get()->containsUnexpandedParameterPack())
17744 Element.EllipsisLoc = OrigElement.EllipsisLoc;
17746 Elements.push_back(Element);
17756 ExprResult Key = getDerived().TransformExpr(OrigElement.Key);
17757 if (Key.isInvalid())
17760 if (Key.get() != OrigElement.Key)
17765 = getDerived().TransformExpr(OrigElement.Value);
17766 if (
Value.isInvalid())
17774 Elements.push_back(Element);
17777 if (!getDerived().AlwaysRebuild() && !ArgChanged)
17780 return getDerived().RebuildObjCDictionaryLiteral(E->getSourceRange(),
17784template<
typename Derived>
17788 = getDerived().TransformType(E->getEncodedTypeSourceInfo());
17789 if (!EncodedTypeInfo)
17792 if (!getDerived().AlwaysRebuild() &&
17793 EncodedTypeInfo == E->getEncodedTypeSourceInfo())
17796 return getDerived().RebuildObjCEncodeExpr(E->getAtLoc(),
17798 E->getRParenLoc());
17801template<
typename Derived>
17811template<
typename Derived>
17815 = getDerived().TransformType(E->getTypeInfoAsWritten());
17823 if (!getDerived().AlwaysRebuild() &&
17824 TSInfo == E->getTypeInfoAsWritten() &&
17825 Result.get() == E->getSubExpr())
17829 E->getLParenLoc(), E->getBridgeKind(), E->getBridgeKeywordLoc(), TSInfo,
17833template <
typename Derived>
17839template<
typename Derived>
17843 bool ArgChanged =
false;
17845 Args.reserve(E->getNumArgs());
17846 if (getDerived().TransformExprs(E->getArgs(), E->getNumArgs(),
false, Args,
17853 = getDerived().TransformType(E->getClassReceiverTypeInfo());
17854 if (!ReceiverTypeInfo)
17858 if (!getDerived().AlwaysRebuild() &&
17859 ReceiverTypeInfo == E->getClassReceiverTypeInfo() && !ArgChanged)
17864 E->getSelectorLocs(SelLocs);
17865 return getDerived().RebuildObjCMessageExpr(ReceiverTypeInfo,
17868 E->getMethodDecl(),
17875 if (!E->getMethodDecl())
17880 E->getSelectorLocs(SelLocs);
17881 return getDerived().RebuildObjCMessageExpr(E->getSuperLoc(),
17884 E->getReceiverType(),
17885 E->getMethodDecl(),
17893 "Only class and instance messages may be instantiated");
17895 = getDerived().TransformExpr(E->getInstanceReceiver());
17896 if (Receiver.isInvalid())
17900 if (!getDerived().AlwaysRebuild() &&
17901 Receiver.get() == E->getInstanceReceiver() && !ArgChanged)
17906 E->getSelectorLocs(SelLocs);
17907 return getDerived().RebuildObjCMessageExpr(Receiver.get(),
17910 E->getMethodDecl(),
17916template<
typename Derived>
17922template<
typename Derived>
17928template<
typename Derived>
17933 if (
Base.isInvalid())
17939 if (!getDerived().AlwaysRebuild() &&
17940 Base.get() == E->getBase())
17943 return getDerived().RebuildObjCIvarRefExpr(
Base.get(), E->getDecl(),
17945 E->isArrow(), E->isFreeIvar());
17948template<
typename Derived>
17953 if (!E->isObjectReceiver())
17958 if (
Base.isInvalid())
17964 if (!getDerived().AlwaysRebuild() &&
17965 Base.get() == E->getBase())
17968 if (E->isExplicitProperty())
17969 return getDerived().RebuildObjCPropertyRefExpr(
Base.get(),
17970 E->getExplicitProperty(),
17973 return getDerived().RebuildObjCPropertyRefExpr(
Base.get(),
17975 E->getImplicitPropertyGetter(),
17976 E->getImplicitPropertySetter(),
17980template<
typename Derived>
17985 if (
Base.isInvalid())
17989 ExprResult Key = getDerived().TransformExpr(E->getKeyExpr());
17990 if (Key.isInvalid())
17994 if (!getDerived().AlwaysRebuild() &&
17995 Key.get() == E->getKeyExpr() &&
Base.get() == E->getBaseExpr())
17998 return getDerived().RebuildObjCSubscriptRefExpr(E->getRBracket(),
17999 Base.get(), Key.get(),
18000 E->getAtIndexMethodDecl(),
18001 E->setAtIndexMethodDecl());
18004template<
typename Derived>
18009 if (
Base.isInvalid())
18013 if (!getDerived().AlwaysRebuild() &&
18014 Base.get() == E->getBase())
18017 return getDerived().RebuildObjCIsaExpr(
Base.get(), E->getIsaMemberLoc(),
18022template<
typename Derived>
18025 bool ArgumentChanged =
false;
18027 SubExprs.reserve(E->getNumSubExprs());
18028 if (getDerived().TransformExprs(E->getSubExprs(), E->getNumSubExprs(),
false,
18029 SubExprs, &ArgumentChanged))
18032 if (!getDerived().AlwaysRebuild() &&
18036 return getDerived().RebuildShuffleVectorExpr(E->getBuiltinLoc(),
18038 E->getRParenLoc());
18041template<
typename Derived>
18044 ExprResult SrcExpr = getDerived().TransformExpr(E->getSrcExpr());
18045 if (SrcExpr.isInvalid())
18052 if (!getDerived().AlwaysRebuild() &&
18053 Type == E->getTypeSourceInfo() &&
18054 SrcExpr.get() == E->getSrcExpr())
18057 return getDerived().RebuildConvertVectorExpr(E->getBuiltinLoc(),
18058 SrcExpr.get(),
Type,
18059 E->getRParenLoc());
18062template<
typename Derived>
18065 BlockDecl *oldBlock = E->getBlockDecl();
18071 blockScope->TheDecl->setBlockMissingReturnType(
18072 oldBlock->blockMissingReturnType());
18081 if (getDerived().TransformFunctionTypeParams(
18082 E->getCaretLocation(), oldBlock->parameters(),
nullptr,
18083 exprFunctionType->getExtParameterInfosOrNull(), paramTypes, ¶ms,
18085 getSema().ActOnBlockError(E->getCaretLocation(),
nullptr);
18090 getDerived().TransformType(exprFunctionType->getReturnType());
18092 auto epi = exprFunctionType->getExtProtoInfo();
18093 epi.ExtParameterInfos = extParamInfos.getPointerOrNull(paramTypes.size());
18096 getDerived().RebuildFunctionProtoType(exprResultType, paramTypes, epi);
18100 if (!params.empty())
18101 blockScope->TheDecl->setParams(params);
18103 if (!oldBlock->blockMissingReturnType()) {
18104 blockScope->HasImplicitReturnType =
false;
18105 blockScope->ReturnType = exprResultType;
18109 StmtResult body = getDerived().TransformStmt(E->getBody());
18110 if (body.isInvalid()) {
18111 getSema().ActOnBlockError(E->getCaretLocation(),
nullptr);
18119 for (
const auto &I : oldBlock->captures()) {
18120 VarDecl *oldCapture = I.getVariable();
18123 if (oldCapture->isParameterPack())
18127 cast<VarDecl>(getDerived().TransformDecl(E->getCaretLocation(),
18129 assert(blockScope->CaptureMap.count(newCapture));
18138template<
typename Derived>
18141 ExprResult SrcExpr = getDerived().TransformExpr(E->getSrcExpr());
18142 if (SrcExpr.isInvalid())
18145 QualType Type = getDerived().TransformType(E->getType());
18148 E->getRParenLoc());
18151template<
typename Derived>
18154 bool ArgumentChanged =
false;
18156 SubExprs.reserve(E->getNumSubExprs());
18157 if (getDerived().TransformExprs(E->getSubExprs(), E->getNumSubExprs(),
false,
18158 SubExprs, &ArgumentChanged))
18161 if (!getDerived().AlwaysRebuild() &&
18165 return getDerived().RebuildAtomicExpr(E->getBuiltinLoc(), SubExprs,
18166 E->getOp(), E->getRParenLoc());
18173template<
typename Derived>
18176 return SemaRef.BuildPointerType(PointeeType,
Star,
18180template<
typename Derived>
18183 return SemaRef.BuildBlockPointerType(PointeeType,
Star,
18187template<
typename Derived>
18190 bool WrittenAsLValue,
18192 return SemaRef.BuildReferenceType(ReferentType, WrittenAsLValue,
18196template <
typename Derived>
18200 return SemaRef.BuildMemberPointerType(PointeeType, SS, Cls, Sigil,
18204template<
typename Derived>
18211 return SemaRef.ObjC().BuildObjCTypeParamType(
18212 Decl, ProtocolLAngleLoc, Protocols, ProtocolLocs, ProtocolRAngleLoc,
18216template<
typename Derived>
18227 return SemaRef.ObjC().BuildObjCObjectType(
18228 BaseType, Loc, TypeArgsLAngleLoc, TypeArgs, TypeArgsRAngleLoc,
18229 ProtocolLAngleLoc, Protocols, ProtocolLocs, ProtocolRAngleLoc,
18234template<
typename Derived>
18238 return SemaRef.Context.getObjCObjectPointerType(PointeeType);
18241template <
typename Derived>
18244 Expr *SizeExpr,
unsigned IndexTypeQuals,
SourceRange BracketsRange) {
18245 if (SizeExpr || !Size)
18246 return SemaRef.BuildArrayType(ElementType, SizeMod, SizeExpr,
18247 IndexTypeQuals, BracketsRange,
18251 SemaRef.Context.UnsignedCharTy,
SemaRef.Context.UnsignedShortTy,
18253 SemaRef.Context.UnsignedLongLongTy,
SemaRef.Context.UnsignedInt128Ty
18256 for (
const auto &T : Types)
18257 if (Size->getBitWidth() ==
SemaRef.Context.getIntWidth(T)) {
18267 return SemaRef.BuildArrayType(ElementType, SizeMod, ArraySize,
18268 IndexTypeQuals, BracketsRange,
18272template <
typename Derived>
18275 Expr *SizeExpr,
unsigned IndexTypeQuals,
SourceRange BracketsRange) {
18276 return getDerived().RebuildArrayType(ElementType, SizeMod, &Size, SizeExpr,
18277 IndexTypeQuals, BracketsRange);
18280template <
typename Derived>
18284 return getDerived().RebuildArrayType(ElementType, SizeMod,
nullptr,
nullptr,
18285 IndexTypeQuals, BracketsRange);
18288template <
typename Derived>
18291 unsigned IndexTypeQuals,
SourceRange BracketsRange) {
18292 return getDerived().RebuildArrayType(ElementType, SizeMod,
nullptr,
18294 IndexTypeQuals, BracketsRange);
18297template <
typename Derived>
18300 unsigned IndexTypeQuals,
SourceRange BracketsRange) {
18301 return getDerived().RebuildArrayType(ElementType, SizeMod,
nullptr,
18303 IndexTypeQuals, BracketsRange);
18306template <
typename Derived>
18309 return SemaRef.BuildAddressSpaceAttr(PointeeType, AddrSpaceExpr,
18313template <
typename Derived>
18315 unsigned NumElements,
18318 return SemaRef.Context.getVectorType(ElementType, NumElements, VecKind);
18321template <
typename Derived>
18325 return SemaRef.BuildVectorType(ElementType, SizeExpr, AttributeLoc);
18328template<
typename Derived>
18330 unsigned NumElements,
18332 llvm::APInt numElements(
SemaRef.Context.getIntWidth(
SemaRef.Context.IntTy),
18333 NumElements,
true);
18337 return SemaRef.BuildExtVectorType(ElementType, VectorSize, AttributeLoc);
18340template<
typename Derived>
18345 return SemaRef.BuildExtVectorType(ElementType, SizeExpr, AttributeLoc);
18348template <
typename Derived>
18350 QualType ElementType,
unsigned NumRows,
unsigned NumColumns,
18356 Ctx, llvm::APInt(SizeWidth, NumRows), SizeTy, AttributeLoc);
18358 Ctx, llvm::APInt(SizeWidth, NumColumns), SizeTy, AttributeLoc);
18359 return SemaRef.BuildMatrixType(ElementType, RowExpr, ColumnExpr,
18363template <
typename Derived>
18365 QualType ElementType,
unsigned Scope,
unsigned NumRows,
unsigned NumColumns,
18367 return SemaRef.Context.getCooperativeMatrixType(ElementType,
Scope, NumRows,
18371template <
typename Derived>
18375 return SemaRef.BuildMatrixType(ElementType, RowExpr, ColumnExpr,
18379template <
typename Derived>
18383 return SemaRef.BuildFunctionType(T, ParamTypes,
18389template<
typename Derived>
18391 return SemaRef.Context.getFunctionNoProtoType(T);
18394template <
typename Derived>
18398 assert(D &&
"no decl found");
18402 if (
auto *UPD = dyn_cast<UsingPackDecl>(D)) {
18406 if (UPD->expansions().empty()) {
18407 getSema().Diag(NameLoc, diag::err_using_pack_expansion_empty)
18408 << UPD->isCXXClassMember() << UPD;
18417 for (
auto *E : UPD->expansions()) {
18424 else if (T.isNull())
18427 assert(
getSema().Context.hasSameType(ThisT, T) &&
18428 "mismatched resolved types in using pack expansion");
18430 return T.
isNull() ? FallbackT : T;
18432 if (
auto *Using = dyn_cast<UsingDecl>(D)) {
18433 assert(Using->hasTypename() &&
18434 "UnresolvedUsingTypenameDecl transformed to non-typename using");
18437 assert(++Using->shadow_begin() == Using->shadow_end());
18442 return SemaRef.Context.getUsingType(
Keyword, Qualifier, Shadow);
18445 "UnresolvedUsingTypenameDecl transformed to non-using decl");
18446 return SemaRef.Context.getUnresolvedUsingType(
18450template <
typename Derived>
18453 return SemaRef.BuildTypeofExprType(E, Kind);
18456template<
typename Derived>
18459 return SemaRef.Context.getTypeOfType(Underlying, Kind);
18462template <
typename Derived>
18464 return SemaRef.BuildDecltypeType(E);
18467template <
typename Derived>
18471 return SemaRef.BuildPackIndexingType(Pattern, IndexExpr, Loc,
18472 FullySubstituted, Expansions);
18475template<
typename Derived>
18477 UnaryTransformType::UTTKind UKind,
18479 return SemaRef.BuildUnaryTransformType(BaseType, UKind, Loc);
18482template <
typename Derived>
18486 return SemaRef.CheckTemplateIdType(
18491template<
typename Derived>
18494 return SemaRef.BuildAtomicType(ValueType, KWLoc);
18497template<
typename Derived>
18501 return isReadPipe ?
SemaRef.BuildReadPipeType(ValueType, KWLoc)
18502 :
SemaRef.BuildWritePipeType(ValueType, KWLoc);
18505template <
typename Derived>
18509 llvm::APInt NumBitsAP(
SemaRef.Context.getIntWidth(
SemaRef.Context.IntTy),
18513 return SemaRef.BuildBitIntType(IsUnsigned, Bits, Loc);
18516template <
typename Derived>
18519 return SemaRef.BuildBitIntType(IsUnsigned, NumBitsExpr, Loc);
18522template <
typename Derived>
18530template <
typename Derived>
18537 getSema().ActOnTemplateName(
nullptr, SS, TemplateKWLoc,
18540 AllowInjectedClassName);
18544template<
typename Derived>
18551 bool AllowInjectedClassName) {
18554 SourceLocation SymbolLocations[3] = { NameLoc, NameLoc, NameLoc };
18559 false,
Template, AllowInjectedClassName);
18563template <
typename Derived>
18568 bool isPostIncDec = Second && (Op == OO_PlusPlus || Op == OO_MinusMinus);
18573 return SemaRef.PseudoObject().checkAssignment(
nullptr, OpLoc,
18574 Opc,
First, Second);
18589 if (Op == OO_Subscript) {
18590 if (!
First->getType()->isOverloadableType() &&
18592 return getSema().CreateBuiltinArraySubscriptExpr(
First, CalleeLoc, Second,
18594 }
else if (Op == OO_Arrow) {
18597 if (
First->getType()->isDependentType())
18600 return SemaRef.BuildOverloadedArrowExpr(
nullptr,
First, OpLoc);
18601 }
else if (Second ==
nullptr || isPostIncDec) {
18602 if (!
First->getType()->isOverloadableType() ||
18603 (Op == OO_Amp &&
getSema().isQualifiedMemberAccess(
First))) {
18610 return getSema().CreateBuiltinUnaryOp(OpLoc, Opc,
First);
18614 !
First->getType()->isOverloadableType() &&
18620 =
SemaRef.CreateBuiltinBinOp(OpLoc, Opc,
First, Second);
18629 if (!Second || isPostIncDec) {
18632 return SemaRef.CreateOverloadedUnaryOp(OpLoc, Opc, Functions,
First,
18639 First, Second, RequiresADL);
18646template<
typename Derived>
18656 QualType CanonicalBaseType =
Base->getType().getCanonicalType();
18657 if (
Base->isTypeDependent() || Destroyed.getIdentifier() ||
18662 ->getAsCanonical<RecordType>())) {
18664 return SemaRef.BuildPseudoDestructorExpr(
18665 Base, OperatorLoc, isArrow ? tok::arrow : tok::period, SS, ScopeType,
18666 CCLoc, TildeLoc, Destroyed);
18678 if (!
isa<TagType>(ScopeType->getType().getCanonicalType())) {
18679 getSema().Diag(ScopeType->getTypeLoc().getBeginLoc(),
18680 diag::err_expected_class_or_namespace)
18681 << ScopeType->getType() <<
getSema().getLangOpts().CPlusPlus;
18685 SS.
Make(
SemaRef.Context, ScopeType->getTypeLoc(), CCLoc);
18689 return getSema().BuildMemberReferenceExpr(
18690 Base,
Base->getType(), OperatorLoc, isArrow, SS, TemplateKWLoc,
18696template<
typename Derived>
18704 for (
unsigned I = 0; I < NumParams; ++I) {
18705 if (I != ContextParamPos) {
18711 Params.push_back(std::make_pair(StringRef(), QualType()));
18714 getSema().ActOnCapturedRegionStart(Loc,
nullptr,
18722 if (Body.isInvalid()) {
18723 getSema().ActOnCapturedRegionError();
18727 return getSema().ActOnCapturedRegionEnd(Body.get());
18730template <
typename Derived>
18736 llvm_unreachable(
"SYCL kernel call statement cannot appear in dependent "
18740template <
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...
void setAttrNameLoc(SourceLocation loc)
Represents an opaque OpenCL cooperative matrix type.
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.
const Type * getTypePtr() const
Retrieves a pointer to the underlying (unqualified) type.
Qualifiers getLocalQualifiers() const
Retrieve the set of qualifiers local to this particular QualType instance, not including any qualifie...
Represents a template name as written in source code.
Wrapper of type source information for a type with non-trivial direct qualifiers.
The collection of all-type qualifiers we support.
void removeObjCLifetime()
static Qualifiers fromCVRMask(unsigned CVR)
PointerAuthQualifier getPointerAuth() const
bool hasObjCLifetime() const
LangAS getAddressSpace() const
Frontend produces RecoveryExprs on semantic errors that prevent creating other well-formed expression...
Base for LValueReferenceType and RValueReferenceType.
QualType getPointeeTypeAsWritten() const
Represents the body of a requires-expression.
static RequiresExprBodyDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc)
C++2a [expr.prim.req]: A requires-expression provides a concise way to express requirements on templa...
static RequiresExpr * Create(ASTContext &C, SourceLocation RequiresKWLoc, RequiresExprBodyDecl *Body, SourceLocation LParenLoc, ArrayRef< ParmVarDecl * > LocalParameters, SourceLocation RParenLoc, ArrayRef< concepts::Requirement * > Requirements, SourceLocation RBraceLoc)
ReturnStmt - This represents a return, optionally of an expression: return; return 4;.
static SEHFinallyStmt * Create(const ASTContext &C, SourceLocation FinallyLoc, Stmt *Block)
Represents a __leave statement.
SYCLKernelCallStmt represents the transformation that is applied to the body of a function declared w...
Scope - A scope is a transient data structure that is used while parsing the program.
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)
ExprResult BuildUniqueStableNameExpr(SourceLocation OpLoc, SourceLocation LParen, SourceLocation RParen, TypeSourceInfo *TSI)
QualType GetSYCLKernelInfoClassSpecializationType(QualType KNT)
GetSYCLKernelInfoClassSpecializationType returns a type for the class template returned by GetSYCLKer...
StmtResult BuildSYCLKernelCallStmt(FunctionDecl *FD, CompoundStmt *Body, const SYCLKernelCallStmtASTFragments &ASTFragments)
BuildSYCLKernelCallStmt constructs a SYCLKernelCallStmt or an UnresolvedSYCLKernelCallStmt depending ...
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={})
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,...
ExprResult BuildStmtExpr(SourceLocation LPLoc, Stmt *SubStmt, SourceLocation RPLoc, unsigned TemplateDepth, bool HasResult=true)
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...
ExprResult ActOnGCCAsmStmtString(Expr *Stm, bool ForAsmLabel, bool IsConstexpr=false)
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.
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.
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.
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
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.
SYCLKernelCallStmtASTFragments holds portions of the AST used to resolve SYCL runtime library functio...
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