13#ifndef LLVM_CLANG_LIB_SEMA_TREETRANSFORM_H
14#define LLVM_CLANG_LIB_SEMA_TREETRANSFORM_H
50#include "llvm/ADT/ArrayRef.h"
51#include "llvm/Support/ErrorHandling.h"
55using namespace llvm::omp;
122template<
typename Derived>
127 class ForgetPartiallySubstitutedPackRAII {
135 ForgetPartiallySubstitutedPackRAII(Derived &
Self)
136 :
Self(
Self), ResetPackSubstIndex(
Self.getSema(), std::nullopt) {
137 Old =
Self.ForgetPartiallySubstitutedPack();
140 ~ForgetPartiallySubstitutedPackRAII() {
141 Self.RememberPartiallySubstitutedPack(Old);
143 ForgetPartiallySubstitutedPackRAII(
144 const ForgetPartiallySubstitutedPackRAII &) =
delete;
145 ForgetPartiallySubstitutedPackRAII &
146 operator=(
const ForgetPartiallySubstitutedPackRAII &) =
delete;
162 Derived &
getDerived() {
return static_cast<Derived&
>(*this); }
166 return static_cast<const Derived&
>(*this);
234 if (Location.isValid())
235 Self.getDerived().setBase(Location, Entity);
239 Self.getDerived().setBase(OldLocation, OldEntity);
314 bool FailOnPackProducingTemplates,
315 bool &ShouldExpand,
bool &RetainExpansion,
317 ShouldExpand =
false;
345 struct ForgetSubstitutionRAII {
351 Old =
Self.ForgetSubstitution();
354 ~ForgetSubstitutionRAII() {
Self.RememberSubstitution(std::move(Old)); }
454 const X##Attr *Transform##X##Attr(const X##Attr *R) { return R; }
455#include "clang/Basic/AttrList.inc"
465 const X##Attr *TransformStmt##X##Attr(const Stmt *, const Stmt *, \
466 const X##Attr *A) { \
467 return getDerived().Transform##X##Attr(A); \
469#include "clang/Basic/AttrList.inc"
515 bool *ArgChanged =
nullptr);
524 llvm::DenseMap<Decl *, Decl *>::iterator Known
527 return Known->second;
555 assert(
New.size() == 1 &&
556 "must override transformedLocalDecl if performing pack expansion");
594 NamedDecl *FirstQualifierInScope =
nullptr);
639 NamedDecl *FirstQualifierInScope =
nullptr,
640 bool AllowInjectedClassName =
false);
655 bool Uneval =
false);
682 bool Uneval =
false) {
701 template<
typename InputIterator>
705 bool Uneval =
false);
707 template <
typename InputIterator>
711 bool Uneval =
false);
732 return SemaRef.Context.getTrivialTypeSourceInfo(
T,
736#define ABSTRACT_TYPELOC(CLASS, PARENT)
737#define TYPELOC(CLASS, PARENT) \
738 QualType Transform##CLASS##Type(TypeLocBuilder &TLB, CLASS##TypeLoc T);
739#include "clang/AST/TypeLocNodes.def"
743 bool SuppressObjCLifetime);
747 bool SuppressObjCLifetime);
749 template<
typename Fn>
767 bool AllowInjectedClassName);
795 return getDerived().TransformFunctionTypeParams(
796 Loc, Params, ParamTypes, ParamInfos, PTypes, PVars, PInfos,
nullptr);
814 KWLoc, Params,
nullptr,
815 nullptr, PTypes, &TransParams, PInfos))
829 bool ExpectParameterPack);
858 bool IsAddressOfOperand,
866 bool IsAddressOfOperand);
874#define STMT(Node, Parent) \
875 LLVM_ATTRIBUTE_NOINLINE \
876 StmtResult Transform##Node(Node *S);
877#define VALUESTMT(Node, Parent) \
878 LLVM_ATTRIBUTE_NOINLINE \
879 StmtResult Transform##Node(Node *S, StmtDiscardKind SDK);
880#define EXPR(Node, Parent) \
881 LLVM_ATTRIBUTE_NOINLINE \
882 ExprResult Transform##Node(Node *E);
883#define ABSTRACT_STMT(Stmt)
884#include "clang/AST/StmtNodes.inc"
886#define GEN_CLANG_CLAUSE_CLASS
887#define CLAUSE_CLASS(Enum, Str, Class) \
888 LLVM_ATTRIBUTE_NOINLINE \
889 OMPClause *Transform##Class(Class *S);
890#include "llvm/Frontend/OpenMP/OMP.inc"
968 const llvm::APInt *Size,
Expr *SizeExpr,
969 unsigned IndexTypeQuals,
SourceRange BracketsRange);
978 const llvm::APInt &Size,
Expr *SizeExpr,
979 unsigned IndexTypeQuals,
989 unsigned IndexTypeQuals,
999 unsigned IndexTypeQuals,
1010 unsigned IndexTypeQuals,
1048 unsigned NumColumns,
1066 Expr *AddrSpaceExpr,
1090 return SemaRef.Context.getUsingType(
Keyword, Qualifier, D, UnderlyingType);
1103 return SemaRef.Context.getMacroQualifiedType(
T, MacroII);
1113 return SemaRef.Context.getCanonicalTagType(Tag);
1130 UnaryTransformType::UTTKind UKind,
1142 bool FullySubstituted,
1152 return SemaRef.Context.getAutoType(
1153 DK, DeducedAsType,
Keyword, TypeConstraintConcept, TypeConstraintArgs);
1161 return SemaRef.Context.getDeducedTemplateSpecializationType(
1180 return SemaRef.BuildParenType(InnerType);
1193 bool DeducedTSTContext) {
1195 SS.
Adopt(QualifierLoc);
1199 if (!
SemaRef.computeDeclContext(SS))
1207 return SemaRef.CheckTypenameType(
Keyword, KeywordLoc, QualifierLoc,
1208 *Id, IdLoc, DeducedTSTContext);
1221 if (
SemaRef.RequireCompleteDeclContext(SS, DC))
1226 switch (
Result.getResultKind()) {
1237 llvm_unreachable(
"Tag lookup cannot find non-tags");
1249 switch (
Result.getResultKind()) {
1255 SemaRef.Diag(IdLoc, diag::err_tag_reference_non_tag)
1256 << SomeDecl << NTK << Kind;
1261 SemaRef.Diag(IdLoc, diag::err_not_tag_in_scope)
1267 if (!
SemaRef.isAcceptableTagRedeclaration(Tag, Kind,
false,
1269 SemaRef.Diag(KeywordLoc, diag::err_use_with_wrong_tag) << Id;
1270 SemaRef.Diag(Tag->getLocation(), diag::note_previous_use);
1326 bool AllowInjectedClassName);
1339 bool AllowInjectedClassName);
1345 bool AllowInjectedClassName);
1355 Decl *AssociatedDecl,
unsigned Index,
1358 ArgPack, AssociatedDecl, Index, Final);
1367 bool FullySubstituted,
1370 Pattern, IndexExpr, FullySubstituted, Expansions);
1424 return SemaRef.ActOnLabelStmt(IdentLoc, L, ColonLoc, SubStmt);
1434 if (
SemaRef.CheckRebuiltStmtAttributes(Attrs))
1436 return SemaRef.BuildAttributedStmt(AttrLoc, Attrs, SubStmt);
1448 Then, ElseLoc, Else);
1502 Inc, RParenLoc, Body);
1547 bool IsVolatile,
unsigned NumOutputs,
1554 NumInputs, Names, Constraints, Exprs,
1555 AsmString, Clobbers, NumLabels, RParenLoc);
1564 StringRef AsmString,
1565 unsigned NumOutputs,
unsigned NumInputs,
1571 NumOutputs, NumInputs,
1572 Constraints, Clobbers, Exprs, EndLoc);
1601 CoawaitLoc, Operand, OpCoawaitLookup);
1605 Suspend.
get(),
true);
1706 Kind, DirName, CancelRegion, Clauses, AStmt, StartLoc, EndLoc);
1718 Kind, DirName, Clauses, AStmt, StartLoc, EndLoc);
1732 NameModifier,
Condition, StartLoc, LParenLoc, NameModifierLoc, ColonLoc,
1759 VarList, PrescriptivenessModifier, PrescriptivenessModifierLoc,
1760 DimsModifier, DimsModifierExpr, DimsModifierLoc, StartLoc, LParenLoc,
1798 std::optional<unsigned> FillIdx,
1800 unsigned FillCount = FillIdx ? 1 : 0;
1802 Counts, StartLoc, LParenLoc, EndLoc, FillIdx, FillLoc, FillCount);
1841 First, Count, StartLoc, LParenLoc, FirstLoc, CountLoc, EndLoc);
1877 Kind, KindKwLoc, VCKind, VCLoc, StartLoc, LParenLoc, EndLoc);
1890 Kind, KindKwLoc, StartLoc, LParenLoc, EndLoc);
1897 ImpexTypeArg, StartLoc, LParenLoc, EndLoc);
1910 M1, M2, Kind, ChunkSize, StartLoc, LParenLoc, M1Loc, M2Loc, KindLoc,
1972 VarList, LPKind, LPKindLoc, ColonLoc, StartLoc, LParenLoc, EndLoc);
2000 VarList, {Modifier, OriginalSharingModifier}, StartLoc, LParenLoc,
2001 ModifierLoc, ColonLoc, EndLoc, ReductionIdScopeSpec, ReductionId,
2002 UnresolvedReductions);
2016 VarList, StartLoc, LParenLoc, ColonLoc, EndLoc, ReductionIdScopeSpec,
2017 ReductionId, UnresolvedReductions);
2032 VarList, StartLoc, LParenLoc, ColonLoc, EndLoc, ReductionIdScopeSpec,
2033 ReductionId, UnresolvedReductions);
2046 VarList, Step, StartLoc, LParenLoc, Modifier, ModifierLoc, ColonLoc,
2047 StepModifierLoc, EndLoc);
2060 VarList, Alignment, StartLoc, LParenLoc, ColonLoc, EndLoc);
2120 Data, DepModifier, VarList, StartLoc, LParenLoc, EndLoc);
2133 Modifier,
Device, StartLoc, LParenLoc, ModifierLoc, EndLoc);
2148 IteratorModifier, MapTypeModifiers, MapTypeModifiersLoc,
2149 MapperIdScopeSpec, MapperId, MapType, IsMapTypeImplicit, MapLoc,
2150 ColonLoc, VarList, Locs,
2151 false, UnresolvedMappers);
2168 Allocate, Alignment, FirstModifier, FirstModifierLoc, SecondModifier,
2169 SecondModifierLoc, VarList, StartLoc, LParenLoc, ColonLoc, EndLoc);
2183 VarList, Modifier, ModifierExpr, ModifierLoc, ModifierExtra,
2184 ModifierExtraExpr, ModifierExtraLoc, StartLoc, LParenLoc, EndLoc);
2196 VarList, Modifier, ModifierExpr, ModifierLoc, StartLoc, LParenLoc,
2221 Modifier,
Device, StartLoc, LParenLoc, ModifierLoc, EndLoc);
2234 Modifier, NumTasks, StartLoc, LParenLoc, ModifierLoc, EndLoc);
2269 Kind, ChunkSize, StartLoc, LParenLoc, KindLoc, CommaLoc, EndLoc);
2284 MotionModifiers, MotionModifiersLoc, IteratorModifier,
2285 MapperIdScopeSpec, MapperId, ColonLoc, VarList, Locs,
2301 MotionModifiers, MotionModifiersLoc, IteratorModifier,
2302 MapperIdScopeSpec, MapperId, ColonLoc, VarList, Locs,
2315 VarList, Locs, FallbackModifier, FallbackModifierLoc);
2357 M, Kind, StartLoc, LParenLoc, MLoc, KindLoc, EndLoc);
2404 StartLoc, LParenLoc, EndLoc,
Data);
2417 StartLoc, LParenLoc, ColonLoc, EndLoc, Modifier, Locators);
2429 Modifier, Kind, StartLoc, LParenLoc, ModifierKwLoc, KindKwLoc, EndLoc);
2442 InteropVar, InteropInfo, StartLoc, LParenLoc, VarLoc, EndLoc);
2453 LParenLoc, VarLoc, EndLoc);
2465 InteropVar, StartLoc, LParenLoc, VarLoc, EndLoc);
2536 M1, M2, Size, StartLoc, LParenLoc, M1Loc, M2Loc, EndLoc);
2617 DepType, DepLoc, ColonLoc, VarList, StartLoc, LParenLoc, EndLoc);
2665 ForLoc, Element, Collection, RParenLoc);
2683 StartLoc, IdLoc, Id);
2720 if (
DeclStmt *RangeStmt = dyn_cast<DeclStmt>(Range)) {
2721 if (RangeStmt->isSingleDecl()) {
2722 if (
VarDecl *RangeVar = dyn_cast<VarDecl>(RangeStmt->getSingleDecl())) {
2723 if (RangeVar->isInvalidDecl())
2726 Expr *RangeExpr = RangeVar->getInit();
2733 diag::err_objc_for_range_init_stmt)
2734 <<
Init->getSourceRange();
2737 ForLoc, LoopVar, RangeExpr, RParenLoc);
2744 ForLoc, CoawaitLoc,
Init, ColonLoc, Range, Begin, End, Cond, Inc,
2758 QualifierLoc, NameInfo, Nested);
2820 SS.
Adopt(QualifierLoc);
2874 UnaryExprOrTypeTrait ExprKind,
2885 UnaryExprOrTypeTrait ExprKind,
2940 if (IsOMPArraySection)
2942 Base, LBracketLoc, LowerBound, ColonLocFirst, ColonLocSecond, Length,
2943 Stride, RBracketLoc);
2945 assert(Stride ==
nullptr && !ColonLocSecond.
isValid() &&
2946 "Stride/second colon not allowed for OpenACC");
2949 Base, LBracketLoc, LowerBound, ColonLocFirst, Length, RBracketLoc);
2961 Base, LParenLoc, RParenLoc, Dims, BracketsRanges);
2973 nullptr, IteratorKwLoc, LLoc, RLoc,
Data);
2983 Expr *ExecConfig =
nullptr) {
2985 nullptr, Callee, LParenLoc, Args, RParenLoc, ExecConfig);
2992 nullptr, Callee, LParenLoc, Args, RParenLoc);
3010 if (!
Member->getDeclName()) {
3014 assert(
Member->getType()->isRecordType() &&
3015 "unnamed member not of record type?");
3028 if (!isArrow &&
Base->isPRValue()) {
3043 SS.
Adopt(QualifierLoc);
3046 if (
Base->containsErrors())
3051 if (isArrow && !BaseType->isPointerType())
3057 R.addDecl(FoundDecl);
3060 if (
getSema().isUnevaluatedContext() &&
Base->isImplicitCXXThis() &&
3065 ->getAsCXXRecordDecl()) {
3069 if (!ThisClass->Equals(
Class) && !ThisClass->isDerivedFrom(
Class))
3077 FirstQualifierInScope,
3078 R, ExplicitTemplateArgs,
3088 bool ForFoldExpression =
false) {
3166 return SemaRef.BuildInitList(LBraceLoc,
Inits, RBraceLoc, IsExplicit);
3179 =
SemaRef.ActOnDesignatedInitializer(Desig, EqualOrColonLoc, GNUSyntax,
3219 unsigned NumUserSpecifiedExprs,
3224 InitLoc, LParenLoc, RParenLoc);
3254 return SemaRef.ActOnChooseExpr(BuiltinLoc,
3266 Expr *ControllingExpr,
3271 ControllingExpr, Types, Exprs);
3286 ControllingType, Types, Exprs);
3319 case Stmt::CXXStaticCastExprClass:
3320 return getDerived().RebuildCXXStaticCastExpr(OpLoc, LAngleLoc, TInfo,
3321 RAngleLoc, LParenLoc,
3322 SubExpr, RParenLoc);
3324 case Stmt::CXXDynamicCastExprClass:
3325 return getDerived().RebuildCXXDynamicCastExpr(OpLoc, LAngleLoc, TInfo,
3326 RAngleLoc, LParenLoc,
3327 SubExpr, RParenLoc);
3329 case Stmt::CXXReinterpretCastExprClass:
3330 return getDerived().RebuildCXXReinterpretCastExpr(OpLoc, LAngleLoc, TInfo,
3331 RAngleLoc, LParenLoc,
3335 case Stmt::CXXConstCastExprClass:
3336 return getDerived().RebuildCXXConstCastExpr(OpLoc, LAngleLoc, TInfo,
3337 RAngleLoc, LParenLoc,
3338 SubExpr, RParenLoc);
3340 case Stmt::CXXAddrspaceCastExprClass:
3341 return getDerived().RebuildCXXAddrspaceCastExpr(
3342 OpLoc, LAngleLoc, TInfo, RAngleLoc, LParenLoc, SubExpr, RParenLoc);
3345 llvm_unreachable(
"Invalid C++ named cast");
3423 OpLoc, tok::kw_addrspace_cast, TInfo, SubExpr,
3435 bool ListInitialization) {
3439 if (
auto *PLE = dyn_cast<ParenListExpr>(Sub))
3441 TInfo, LParenLoc,
MultiExprArg(PLE->getExprs(), PLE->getNumExprs()),
3442 RParenLoc, ListInitialization);
3444 if (
auto *PLE = dyn_cast<CXXParenListInitExpr>(Sub))
3446 TInfo, LParenLoc, PLE->getUserSpecifiedInitExprs(), RParenLoc,
3447 ListInitialization);
3451 ListInitialization);
3515 if (
getSema().CheckCXXThisType(ThisLoc, ThisType))
3525 bool IsThrownVariableInScope) {
3535 Expr *RewrittenExpr) {
3537 RewrittenExpr,
getSema().CurContext);
3546 Expr *RewrittenInit) {
3548 getSema().CurContext, RewrittenInit);
3572 std::optional<Expr *> ArraySize,
3591 bool IsGlobalDelete,
3642 bool IsAddressOfOperand,
3645 SS.
Adopt(QualifierLoc);
3647 if (TemplateArgs || TemplateKWLoc.
isValid())
3649 SS, TemplateKWLoc, NameInfo, TemplateArgs, IsAddressOfOperand);
3652 SS, NameInfo, IsAddressOfOperand, RecoveryTSI);
3674 bool IsElidable,
MultiExprArg Args,
bool HadMultipleCandidates,
3675 bool ListInitialization,
bool StdInitListInitialization,
3682 FoundCtor =
Constructor->getInheritedConstructor().getConstructor();
3685 if (
getSema().CompleteConstructorCall(FoundCtor,
T, Args, Loc,
3692 HadMultipleCandidates,
3694 StdInitListInitialization,
3695 RequiresZeroInit, ConstructKind,
3703 bool ConstructsVBase,
3704 bool InheritedFromVBase) {
3706 Loc,
T,
Constructor, ConstructsVBase, InheritedFromVBase);
3717 bool ListInitialization) {
3719 TSInfo, LParenOrBraceLoc, Args, RParenOrBraceLoc, ListInitialization);
3730 bool ListInitialization) {
3732 RParenLoc, ListInitialization);
3749 SS.
Adopt(QualifierLoc);
3751 return SemaRef.BuildMemberReferenceExpr(BaseE, BaseType,
3752 OperatorLoc, IsArrow,
3754 FirstQualifierInScope,
3756 TemplateArgs,
nullptr);
3772 SS.
Adopt(QualifierLoc);
3774 return SemaRef.BuildMemberReferenceExpr(BaseE, BaseType,
3775 OperatorLoc, IsArrow,
3777 FirstQualifierInScope,
3778 R, TemplateArgs,
nullptr);
3786 return SemaRef.BuildCXXNoexceptExpr(Range.getBegin(), Arg, Range.getEnd());
3799 RParenLoc, Length, PartialArgs);
3804 Expr *PackIdExpression,
Expr *IndexExpr,
3806 bool FullySubstituted =
false) {
3808 IndexExpr, RSquareLoc, ExpandedExprs,
3834 NamedConcept, TALI);
3852 LocalParameters, RParenLoc, Requirements,
3859 return SemaRef.BuildTypeRequirement(SubstDiag);
3863 return SemaRef.BuildTypeRequirement(
T);
3871 return SemaRef.BuildExprRequirement(SubstDiag, IsSimple, NoexceptLoc,
3878 return SemaRef.BuildExprRequirement(E, IsSimple, NoexceptLoc,
3885 return SemaRef.BuildNestedRequirement(InvalidConstraintEntity,
3890 return SemaRef.BuildNestedRequirement(Constraint);
3906 Expr **Elements,
unsigned NumElements) {
3916 RB,
Base, Key, getterMethod, setterMethod);
3935 return SemaRef.ObjC().BuildObjCEncodeExpression(AtLoc, EncodeTypeInfo,
3947 return SemaRef.ObjC().BuildClassMessage(
3948 ReceiverTypeInfo, ReceiverTypeInfo->
getType(),
3961 return SemaRef.ObjC().BuildInstanceMessage(Receiver, Receiver->
getType(),
3964 SelectorLocs, RBracLoc, Args);
3976 return Method->isInstanceMethod()
3977 ?
SemaRef.ObjC().BuildInstanceMessage(
3978 nullptr, SuperType, SuperLoc, Sel,
Method, LBracLoc,
3979 SelectorLocs, RBracLoc, Args)
3980 :
SemaRef.ObjC().BuildClassMessage(
nullptr, SuperType, SuperLoc,
3982 SelectorLocs, RBracLoc, Args);
3991 bool IsArrow,
bool IsFreeIvar) {
4000 if (IsFreeIvar &&
Result.isUsable())
4037 PropertyLoc,
Base));
4066 =
SemaRef.Context.Idents.get(
"__builtin_shufflevector");
4069 assert(!Lookup.
empty() &&
"No __builtin_shufflevector?");
4077 Callee =
SemaRef.ImpCastExprToType(Callee, CalleePtrTy,
4078 CK_BuiltinFnToFnPtr).get();
4094 return SemaRef.ConvertVectorExpr(SrcExpr, DstTInfo, BuiltinLoc, RParenLoc);
4109 EllipsisLoc, NumExpansions);
4133 llvm_unreachable(
"Pack expansion pattern has no parameter packs");
4169 EllipsisLoc, RHS, RParenLoc,
4178 Init->containsUnexpandedParameterPack();
4179 else if (PVD->hasUninstantiatedDefaultArg())
4181 PVD->getUninstantiatedDefaultArg()
4182 ->containsUnexpandedParameterPack();
4336 Exprs.push_back(DevNumExpr);
4337 llvm::append_range(Exprs, QueueIdExprs);
4374 AssociatedDecl, Index, ParamType, Loc, Arg,
PackIndex, Final);
4398 ObjectType, FirstQualifierInScope);
4404 QualType TransformDependentNameType(TypeLocBuilder &TLB,
4405 DependentNameTypeLoc TL,
4406 bool DeducibleTSTContext,
4407 QualType ObjectType = QualType(),
4408 NamedDecl *UnqualLookup =
nullptr);
4411 TransformOpenACCClauseList(OpenACCDirectiveKind DirKind,
4416 OpenACCDirectiveKind DirKind,
4417 const OpenACCClause *OldClause);
4420template <
typename Derived>
4430#define STMT(Node, Parent) \
4431 case Stmt::Node##Class: return getDerived().Transform##Node(cast<Node>(S));
4432#define VALUESTMT(Node, Parent) \
4433 case Stmt::Node##Class: \
4434 return getDerived().Transform##Node(cast<Node>(S), SDK);
4435#define ABSTRACT_STMT(Node)
4436#define EXPR(Node, Parent)
4437#include "clang/AST/StmtNodes.inc"
4440#define STMT(Node, Parent)
4441#define ABSTRACT_STMT(Stmt)
4442#define EXPR(Node, Parent) case Stmt::Node##Class:
4443#include "clang/AST/StmtNodes.inc"
4448 E =
getSema().ActOnStmtExprResult(E);
4456template<
typename Derived>
4464#define GEN_CLANG_CLAUSE_CLASS
4465#define CLAUSE_CLASS(Enum, Str, Class) \
4467 return getDerived().Transform##Class(cast<Class>(S));
4468#include "llvm/Frontend/OpenMP/OMP.inc"
4475template<
typename Derived>
4482#define STMT(Node, Parent) case Stmt::Node##Class: break;
4483#define ABSTRACT_STMT(Stmt)
4484#define EXPR(Node, Parent) \
4485 case Stmt::Node##Class: return getDerived().Transform##Node(cast<Node>(E));
4486#include "clang/AST/StmtNodes.inc"
4492template<
typename Derived>
4500 if (
auto *FE = dyn_cast<FullExpr>(
Init))
4501 Init = FE->getSubExpr();
4503 if (
auto *AIL = dyn_cast<ArrayInitLoopExpr>(
Init)) {
4509 Init = MTE->getSubExpr();
4512 Init = Binder->getSubExpr();
4515 Init = ICE->getSubExprAsWritten();
4518 dyn_cast<CXXStdInitializerListExpr>(
Init))
4555 getSema().currentEvaluationContext().InLifetimeExtendingContext =
4556 getSema().parentEvaluationContext().InLifetimeExtendingContext;
4557 getSema().currentEvaluationContext().RebuildDefaultArgOrDefaultInit =
4558 getSema().parentEvaluationContext().RebuildDefaultArgOrDefaultInit;
4560 bool ArgChanged =
false;
4562 true, NewArgs, &ArgChanged))
4573 if (
Parens.isInvalid()) {
4576 assert(NewArgs.empty() &&
4577 "no parens or braces but have direct init with arguments?");
4584template<
typename Derived>
4590 for (
unsigned I = 0; I != NumInputs; ++I) {
4600 Expr *Pattern = Expansion->getPattern();
4603 getSema().collectUnexpandedParameterPacks(Pattern, Unexpanded);
4604 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
4609 bool RetainExpansion =
false;
4610 UnsignedOrNone OrigNumExpansions = Expansion->getNumExpansions();
4614 Unexpanded,
true, Expand,
4615 RetainExpansion, NumExpansions))
4628 Expansion->getEllipsisLoc(),
4630 if (Out.isInvalid())
4635 Outputs.push_back(Out.get());
4641 if (ArgChanged) *ArgChanged =
true;
4645 for (
unsigned I = 0; I != *NumExpansions; ++I) {
4648 if (Out.isInvalid())
4651 if (Out.get()->containsUnexpandedParameterPack()) {
4653 Out.get(), Expansion->getEllipsisLoc(), OrigNumExpansions);
4654 if (Out.isInvalid())
4658 Outputs.push_back(Out.get());
4663 if (RetainExpansion) {
4664 ForgetPartiallySubstitutedPackRAII Forget(
getDerived());
4667 if (Out.isInvalid())
4671 Out.get(), Expansion->getEllipsisLoc(), OrigNumExpansions);
4672 if (Out.isInvalid())
4675 Outputs.push_back(Out.get());
4682 IsCall ?
getDerived().TransformInitializer(Inputs[I],
false)
4687 if (
Result.get() != Inputs[I] && ArgChanged)
4690 Outputs.push_back(
Result.get());
4696template <
typename Derived>
4707 VarDecl *ConditionVar = cast_or_null<VarDecl>(
4713 return getSema().ActOnConditionVariable(ConditionVar, Loc, Kind);
4722 return getSema().ActOnCondition(
nullptr, Loc, CondExpr.
get(), Kind,
4729template <
typename Derived>
4737 Qualifier = Qualifier.getAsNamespaceAndPrefix().Prefix)
4749 llvm_unreachable(
"unexpected null nested name specifier");
4780 QualifierLoc =
getDerived().TransformNestedNameSpecifierLoc(
4781 QualifierLoc, ObjectType, FirstQualifierInScope);
4785 FirstQualifierInScope =
nullptr;
4787 SS.
Adopt(QualifierLoc);
4791 if (
SemaRef.BuildCXXNestedNameSpecifier(
nullptr, IdInfo,
4793 FirstQualifierInScope,
false))
4801 T = TransformTypeInObjectScope(TLB, TL, ObjectType,
4802 FirstQualifierInScope);
4808 if (
T->isDependentType() ||
T->isRecordType() ||
4809 (
SemaRef.getLangOpts().CPlusPlus11 &&
T->isEnumeralType())) {
4810 if (
T->isEnumeralType())
4812 diag::warn_cxx98_compat_enum_nested_name_spec);
4819 if (!TTL || !TTL.
getDecl()->isInvalidDecl()) {
4843template<
typename Derived>
4863 TemplateDecl *NewTemplate = cast_or_null<TemplateDecl>(
4870 SemaRef.Context.DeclarationNames.getCXXDeductionGuideName(NewTemplate));
4880 NewTInfo =
getDerived().TransformType(OldTInfo);
4883 NewCanTy =
SemaRef.Context.getCanonicalType(NewTInfo->
getType());
4891 NewCanTy =
SemaRef.Context.getCanonicalType(NewT);
4904 llvm_unreachable(
"Unknown name kind.");
4907template <
typename Derived>
4911 QualType ObjectType,
bool AllowInjectedClassName) {
4913 return getDerived().RebuildTemplateName(SS, TemplateKWLoc, *II, NameLoc,
4914 ObjectType, AllowInjectedClassName);
4916 NameLoc, ObjectType,
4917 AllowInjectedClassName);
4920template <
typename Derived>
4924 NamedDecl *FirstQualifierInScope,
bool AllowInjectedClassName) {
4926 TemplateName UnderlyingName = QTN->getUnderlyingTemplate();
4929 QualifierLoc =
getDerived().TransformNestedNameSpecifierLoc(
4930 QualifierLoc, ObjectType, FirstQualifierInScope);
4937 UnderlyingQualifier, TemplateKWLoc, UnderlyingName, NameLoc, ObjectType,
4938 FirstQualifierInScope, AllowInjectedClassName);
4939 if (NewUnderlyingName.
isNull())
4941 assert(!UnderlyingQualifier &&
"unexpected qualifier");
4945 NewUnderlyingName == UnderlyingName)
4948 SS.
Adopt(QualifierLoc);
4949 return getDerived().RebuildTemplateName(SS, QTN->hasTemplateKeyword(),
4955 QualifierLoc =
getDerived().TransformNestedNameSpecifierLoc(
4956 QualifierLoc, ObjectType, FirstQualifierInScope);
4970 SS.
Adopt(QualifierLoc);
4971 return getDerived().RebuildTemplateName(SS, TemplateKWLoc, DTN->getName(),
4972 NameLoc, ObjectType,
4973 AllowInjectedClassName);
4978 assert(!QualifierLoc &&
"Unexpected qualified SubstTemplateTemplateParm");
4985 ReplacementQualifierLoc = Builder.getWithLocInContext(
SemaRef.Context);
4989 ReplacementQualifierLoc, TemplateKWLoc, ReplacementName, NameLoc,
4990 ObjectType, FirstQualifierInScope, AllowInjectedClassName);
4993 Decl *AssociatedDecl =
4994 getDerived().TransformDecl(NameLoc, S->getAssociatedDecl());
4996 AssociatedDecl == S->getAssociatedDecl())
4998 return SemaRef.Context.getSubstTemplateTemplateParm(
4999 NewName, AssociatedDecl, S->getIndex(), S->getPackIndex(),
5004 assert(!QualifierLoc &&
"Unexpected qualified pack-index-template-name");
5010 IndexExpr =
getDerived().TransformExpr(PI->getIndexExpr());
5018 NoQualifier, TemplateKWLoc, N, NameLoc, ObjectType,
5019 FirstQualifierInScope, AllowInjectedClassName);
5026 bool NotYetExpanded = Names.empty();
5027 bool FullySubstituted =
true;
5029 if (Names.empty() && !PI->expandsToEmptyPack())
5033 if (!N.containsUnexpandedParameterPack()) {
5035 if (Transformed.
isNull())
5037 SubstitutedNames.push_back(Transformed);
5042 getSema().collectUnexpandedParameterPacks(N, Unexpanded);
5043 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
5045 bool ShouldExpand =
true;
5046 bool RetainExpansion =
false;
5051 RetainExpansion, NumExpansions))
5054 if (!ShouldExpand) {
5059 if (NotYetExpanded) {
5060 FullySubstituted =
false;
5061 return getDerived().RebuildPackIndexingTemplateName(
5062 Pack, IndexExpr.
get(), FullySubstituted);
5064 SubstitutedNames.push_back(Pack);
5068 for (
unsigned I = 0; I != *NumExpansions; ++I) {
5073 SubstitutedNames.push_back(Out);
5074 FullySubstituted &= !Out.containsUnexpandedParameterPack();
5079 if (RetainExpansion) {
5080 FullySubstituted =
false;
5081 ForgetPartiallySubstitutedPackRAII Forget(
getDerived());
5085 SubstitutedNames.push_back(Out);
5094 return getDerived().RebuildPackIndexingTemplateName(
5095 NewPattern, IndexExpr.
get(), FullySubstituted, SubstitutedNames);
5099 "DeducedTemplateName should not escape partial ordering");
5103 assert(!QualifierLoc &&
"Unexpected qualifier");
5110 assert(!QualifierLoc &&
5111 "Unexpected qualified SubstTemplateTemplateParmPack");
5113 SubstPack->getArgumentPack(), SubstPack->getAssociatedDecl(),
5114 SubstPack->getIndex(), SubstPack->getFinal());
5118 llvm_unreachable(
"overloaded function decl survived to here");
5121template <
typename Derived>
5130template <
typename Derived>
5135 QualifierLoc, TemplateKeywordLoc, Name, NameLoc);
5141template<
typename Derived>
5145 Output =
getSema().getTrivialTemplateArgumentLoc(
5149template <
typename Derived>
5157 llvm_unreachable(
"Unexpected TemplateArgument");
5180 if (NewT ==
T && D == NewD)
5197 llvm_unreachable(
"unexpected template argument kind");
5229 llvm_unreachable(
"Caller should expand pack expansions");
5245 E =
SemaRef.ActOnConstantExpression(E);
5260template<
typename Derived,
typename InputIterator>
5268 typedef typename std::iterator_traits<InputIterator>::difference_type
5283 : Self(Self), Iter(Iter) { }
5298 Self.InventTemplateArgumentLoc(*Iter,
Result);
5306 return X.Iter == Y.Iter;
5311 return X.Iter != Y.Iter;
5315template<
typename Derived>
5316template<
typename InputIterator>
5336 PackLocIterator(*
this, In.getArgument().pack_begin()),
5337 PackLocIterator(*
this, In.getArgument().pack_end()), *PackOutput,
5344 if (In.getArgument().isPackExpansion()) {
5356 std::optional<ForgetSubstitutionRAII> ForgetSubst;
5366 if (Out.getArgument().containsUnexpandedParameterPack()) {
5369 if (Out.getArgument().isNull())
5379 ForgetPartiallySubstitutedPackRAII Forget(
getDerived());
5387 if (Out.getArgument().isNull())
5406template <
typename Derived>
5407template <
typename InputIterator>
5416 return !Arg.isDependent() && Arg.isConceptOrConceptTemplateParameter();
5428 PackLocIterator(*
this, In.getArgument().pack_begin()),
5429 PackLocIterator(*
this, In.getArgument().pack_end()), Outputs,
5435 if (!isNonDependentConceptArgument(In.getArgument())) {
5450template <
typename Derived>
5461 Pattern =
getSema().getTemplateArgumentPackExpansionPattern(
5464 getSema().collectUnexpandedParameterPacks(Pattern, Unexpanded);
5465 if (IsLateExpansionAttempt) {
5472 if (!SawPackTypes) {
5477 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
5485 Info.
Ellipsis, Pattern.getSourceRange(), Unexpanded,
5491 if (ComputeInfo(In,
false, Info, Pattern))
5503 std::optional<Sema::ArgPackSubstIndexRAII> SubstIndex(
5504 std::in_place,
getSema(), std::nullopt);
5510 if (Out.getArgument().isNull())
5547 ForgetSubstitutionRAII ForgetSubst(
getDerived());
5548 if (ComputeInfo(Out,
true, Info, OutPattern))
5561template<
typename Derived>
5579template <
typename Derived>
5599template<
typename Derived>
5602 switch (
T.getTypeLocClass()) {
5603#define ABSTRACT_TYPELOC(CLASS, PARENT)
5604#define TYPELOC(CLASS, PARENT) \
5605 case TypeLoc::CLASS: \
5606 return getDerived().Transform##CLASS##Type(TLB, \
5607 T.castAs<CLASS##TypeLoc>());
5608#include "clang/AST/TypeLocNodes.def"
5611 llvm_unreachable(
"unhandled type loc!");
5614template<
typename Derived>
5627template <
typename Derived>
5665template<
typename Derived>
5670 TypeLoc UnqualTL =
T.getUnqualifiedLoc();
5671 auto SuppressObjCLifetime =
5672 T.getType().getLocalQualifiers().hasObjCLifetime();
5674 Result = getDerived().TransformTemplateTypeParmType(TLB, TTP,
5675 SuppressObjCLifetime);
5676 }
else if (
auto STTP = UnqualTL.
getAs<SubstTemplateTypeParmPackTypeLoc>()) {
5677 Result = getDerived().TransformSubstTemplateTypeParmPackType(
5678 TLB, STTP, SuppressObjCLifetime);
5680 Result = getDerived().TransformType(TLB, UnqualTL);
5699template <
typename Derived>
5709 SemaRef.Diag(Loc, diag::err_address_space_mismatch_templ_inst)
5716 if (
T.getPointerAuth().isPresent()) {
5717 SemaRef.Diag(Loc, diag::err_ptrauth_qualifier_redundant) << TL.
getType();
5720 if (!
T->isDependentType()) {
5721 if (!
T->isSignableType(
SemaRef.getASTContext())) {
5722 SemaRef.Diag(Loc, diag::err_ptrauth_qualifier_invalid_target) <<
T;
5730 if (
T->isFunctionType()) {
5731 T =
SemaRef.getASTContext().getAddrSpaceQualType(
T,
5741 if (
T->isReferenceType()) {
5751 if (!
T->isObjCLifetimeType() && !
T->isDependentType())
5753 else if (
T.getObjCLifetime()) {
5757 const AutoType *AutoTy;
5758 if ((AutoTy = dyn_cast<AutoType>(
T)) && AutoTy->isDeduced()) {
5764 SemaRef.Context.getQualifiedType(
Deduced.getUnqualifiedType(), Qs);
5766 AutoTy->getKeyword(),
5767 AutoTy->getTypeConstraintConcept(),
5768 AutoTy->getTypeConstraintArguments());
5773 SemaRef.Diag(Loc, diag::err_attr_objc_ownership_redundant) <<
T;
5779 return SemaRef.BuildQualifiedType(
T, Loc, Quals);
5782template <
typename Derived>
5783QualType TreeTransform<Derived>::TransformTypeInObjectScope(
5786 assert(!getDerived().AlreadyTransformed(TL.
getType()));
5789 case TypeLoc::TemplateSpecialization:
5790 return getDerived().TransformTemplateSpecializationType(
5792 FirstQualifierInScope,
true);
5793 case TypeLoc::DependentName:
5794 return getDerived().TransformDependentNameType(
5796 ObjectType, FirstQualifierInScope);
5800 return getDerived().TransformType(TLB, TL);
5804template <
class TyLoc>
static inline
5806 TyLoc NewT = TLB.
push<TyLoc>(
T.getType());
5807 NewT.setNameLoc(
T.getNameLoc());
5811template<
typename Derived>
5812QualType TreeTransform<Derived>::TransformBuiltinType(TypeLocBuilder &TLB,
5814 BuiltinTypeLoc NewT = TLB.push<BuiltinTypeLoc>(T.getType());
5815 NewT.setBuiltinLoc(T.getBuiltinLoc());
5816 if (T.needsExtraLocalData())
5817 NewT.getWrittenBuiltinSpecs() = T.getWrittenBuiltinSpecs();
5821template<
typename Derived>
5828template <
typename Derived>
5832 return getDerived().
TransformType(TLB, TL.getOriginalLoc());
5835template<
typename Derived>
5838 QualType OriginalType = getDerived().TransformType(TLB, TL.getOriginalLoc());
5839 if (OriginalType.isNull())
5843 if (getDerived().AlwaysRebuild() ||
5844 OriginalType != TL.getOriginalLoc().getType())
5851template <
typename Derived>
5855 QualType OriginalType = getDerived().TransformType(TLB, TL.getElementLoc());
5856 if (OriginalType.isNull())
5860 if (getDerived().AlwaysRebuild() ||
5861 OriginalType != TL.getElementLoc().getType())
5868template<
typename Derived>
5872 = getDerived().TransformType(TLB, TL.getPointeeLoc());
5873 if (PointeeType.isNull())
5877 if (PointeeType->getAs<ObjCObjectType>()) {
5889 if (getDerived().AlwaysRebuild() ||
5890 PointeeType != TL.getPointeeLoc().getType()) {
5891 Result = getDerived().RebuildPointerType(PointeeType, TL.getSigilLoc());
5898 TLB.TypeWasModifiedSafely(
Result->getPointeeType());
5905template<
typename Derived>
5910 = getDerived().TransformType(TLB, TL.getPointeeLoc());
5911 if (PointeeType.isNull())
5915 if (getDerived().AlwaysRebuild() ||
5916 PointeeType != TL.getPointeeLoc().getType()) {
5917 Result = getDerived().RebuildBlockPointerType(PointeeType,
5932template<
typename Derived>
5940 if (PointeeType.
isNull())
5945 PointeeType !=
T->getPointeeTypeAsWritten()) {
5947 T->isSpelledAsLValue(),
5969template<
typename Derived>
5973 return TransformReferenceType(TLB, TL);
5976template<
typename Derived>
5978TreeTransform<Derived>::TransformRValueReferenceType(TypeLocBuilder &TLB,
5979 RValueReferenceTypeLoc TL) {
5980 return TransformReferenceType(TLB, TL);
5983template<
typename Derived>
5987 QualType PointeeType = getDerived().TransformType(TLB, TL.getPointeeLoc());
5988 if (PointeeType.isNull())
5995 getDerived().TransformNestedNameSpecifierLoc(OldQualifierLoc);
5996 if (!NewQualifierLoc)
5999 CXXRecordDecl *OldCls =
T->getMostRecentCXXRecordDecl(), *NewCls =
nullptr;
6001 NewCls = cast_or_null<CXXRecordDecl>(
6002 getDerived().TransformDecl(TL.getStarLoc(), OldCls));
6008 if (getDerived().AlwaysRebuild() || PointeeType !=
T->getPointeeType() ||
6009 NewQualifierLoc.getNestedNameSpecifier() !=
6010 OldQualifierLoc.getNestedNameSpecifier() ||
6013 SS.
Adopt(NewQualifierLoc);
6014 Result = getDerived().RebuildMemberPointerType(PointeeType, SS, NewCls,
6023 if (MPT && PointeeType != MPT->getPointeeType()) {
6030 NewTL.setQualifierLoc(NewQualifierLoc);
6035template<
typename Derived>
6040 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
6041 if (ElementType.isNull())
6045 Expr *OldSize = TL.getSizeExpr();
6047 OldSize =
const_cast<Expr*
>(
T->getSizeExpr());
6048 Expr *NewSize =
nullptr;
6052 NewSize = getDerived().TransformExpr(OldSize).template getAs<Expr>();
6057 if (getDerived().AlwaysRebuild() ||
6058 ElementType !=
T->getElementType() ||
6059 (
T->getSizeExpr() && NewSize != OldSize)) {
6060 Result = getDerived().RebuildConstantArrayType(ElementType,
6061 T->getSizeModifier(),
6062 T->getSize(), NewSize,
6063 T->getIndexTypeCVRQualifiers(),
6064 TL.getBracketsRange());
6075 NewTL.setRBracketLoc(TL.getRBracketLoc());
6076 NewTL.setSizeExpr(NewSize);
6081template<
typename Derived>
6086 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
6087 if (ElementType.isNull())
6091 if (getDerived().AlwaysRebuild() ||
6092 ElementType !=
T->getElementType()) {
6093 Result = getDerived().RebuildIncompleteArrayType(ElementType,
6094 T->getSizeModifier(),
6095 T->getIndexTypeCVRQualifiers(),
6096 TL.getBracketsRange());
6103 NewTL.setRBracketLoc(TL.getRBracketLoc());
6104 NewTL.setSizeExpr(
nullptr);
6109template<
typename Derived>
6114 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
6115 if (ElementType.isNull())
6122 SizeResult = getDerived().TransformExpr(
T->getSizeExpr());
6124 if (SizeResult.isInvalid())
6128 if (SizeResult.isInvalid())
6134 if (getDerived().AlwaysRebuild() ||
6135 ElementType !=
T->getElementType() ||
6136 Size !=
T->getSizeExpr()) {
6137 Result = getDerived().RebuildVariableArrayType(ElementType,
6138 T->getSizeModifier(),
6140 T->getIndexTypeCVRQualifiers(),
6141 TL.getBracketsRange());
6150 NewTL.setRBracketLoc(TL.getRBracketLoc());
6151 NewTL.setSizeExpr(Size);
6156template<
typename Derived>
6161 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
6162 if (ElementType.isNull())
6170 SemaRef.
ExprEvalContexts.back().InConditionallyConstantEvaluateContext =
true;
6173 Expr *origSize = TL.getSizeExpr();
6174 if (!origSize) origSize =
T->getSizeExpr();
6177 = getDerived().TransformExpr(origSize);
6179 if (sizeResult.isInvalid())
6182 Expr *size = sizeResult.get();
6185 if (getDerived().AlwaysRebuild() ||
6186 ElementType !=
T->getElementType() ||
6188 Result = getDerived().RebuildDependentSizedArrayType(ElementType,
6189 T->getSizeModifier(),
6191 T->getIndexTypeCVRQualifiers(),
6192 TL.getBracketsRange());
6201 NewTL.setRBracketLoc(TL.getRBracketLoc());
6202 NewTL.setSizeExpr(size);
6207template <
typename Derived>
6211 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
6212 if (ElementType.isNull())
6220 if (
Size.isInvalid())
6224 if (getDerived().AlwaysRebuild() || ElementType !=
T->getElementType() ||
6225 Size.get() !=
T->getSizeExpr()) {
6226 Result = getDerived().RebuildDependentVectorType(
6227 ElementType,
Size.get(),
T->getAttributeLoc(),
T->getVectorKind());
6245template<
typename Derived>
6252 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
6253 if (ElementType.isNull())
6262 if (
Size.isInvalid())
6266 if (getDerived().AlwaysRebuild() ||
6267 ElementType !=
T->getElementType() ||
6268 Size.get() !=
T->getSizeExpr()) {
6269 Result = getDerived().RebuildDependentSizedExtVectorType(ElementType,
6271 T->getAttributeLoc());
6289template <
typename Derived>
6294 QualType ElementType = getDerived().TransformType(
T->getElementType());
6295 if (ElementType.isNull())
6299 if (getDerived().AlwaysRebuild() || ElementType !=
T->getElementType()) {
6300 Result = getDerived().RebuildConstantMatrixType(
6301 ElementType,
T->getNumRows(),
T->getNumColumns(), TL.getAttrNameLoc());
6308 NewTL.setAttrOperandParensRange(TL.getAttrOperandParensRange());
6309 NewTL.setAttrRowOperand(TL.getAttrRowOperand());
6310 NewTL.setAttrColumnOperand(TL.getAttrColumnOperand());
6315template <
typename Derived>
6320 QualType ElementType = getDerived().TransformType(
T->getElementType());
6321 if (ElementType.isNull()) {
6329 Expr *origRows = TL.getAttrRowOperand();
6331 origRows =
T->getRowExpr();
6332 Expr *origColumns = TL.getAttrColumnOperand();
6334 origColumns =
T->getColumnExpr();
6336 ExprResult rowResult = getDerived().TransformExpr(origRows);
6338 if (rowResult.isInvalid())
6341 ExprResult columnResult = getDerived().TransformExpr(origColumns);
6343 if (columnResult.isInvalid())
6346 Expr *rows = rowResult.get();
6347 Expr *columns = columnResult.get();
6350 if (getDerived().AlwaysRebuild() || ElementType !=
T->getElementType() ||
6351 rows != origRows || columns != origColumns) {
6352 Result = getDerived().RebuildDependentSizedMatrixType(
6353 ElementType, rows, columns,
T->getAttributeLoc());
6363 NewTL.setAttrOperandParensRange(TL.getAttrOperandParensRange());
6364 NewTL.setAttrRowOperand(rows);
6365 NewTL.setAttrColumnOperand(columns);
6369template <
typename Derived>
6375 getDerived().TransformType(TLB, TL.getPointeeTypeLoc());
6384 ExprResult AddrSpace = getDerived().TransformExpr(
T->getAddrSpaceExpr());
6386 if (AddrSpace.isInvalid())
6390 if (getDerived().AlwaysRebuild() ||
pointeeType !=
T->getPointeeType() ||
6391 AddrSpace.get() !=
T->getAddrSpaceExpr()) {
6392 Result = getDerived().RebuildDependentAddressSpaceType(
6404 NewTL.setAttrExprOperand(TL.getAttrExprOperand());
6405 NewTL.setAttrNameLoc(TL.getAttrNameLoc());
6408 TLB.TypeWasModifiedSafely(
Result);
6414template <
typename Derived>
6418 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
6419 if (ElementType.isNull())
6423 if (getDerived().AlwaysRebuild() ||
6424 ElementType !=
T->getElementType()) {
6425 Result = getDerived().RebuildVectorType(ElementType,
T->getNumElements(),
6426 T->getVectorKind());
6437template<
typename Derived>
6441 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
6442 if (ElementType.isNull())
6446 if (getDerived().AlwaysRebuild() ||
6447 ElementType !=
T->getElementType()) {
6448 Result = getDerived().RebuildExtVectorType(ElementType,
6449 T->getNumElements(),
6461template <
typename Derived>
6464 bool ExpectParameterPack) {
6499 if (NewTSI == OldTSI && indexAdjustment == 0)
6509 getDerived().transformedLocalDecl(OldParm, {newParm});
6513template <
typename Derived>
6521 unsigned *LastParamTransformed) {
6522 int indexAdjustment = 0;
6524 unsigned NumParams = Params.size();
6525 for (
unsigned i = 0; i != NumParams; ++i) {
6526 if (LastParamTransformed)
6527 *LastParamTransformed = i;
6529 assert(OldParm->getFunctionScopeIndex() == i);
6533 if (OldParm->isParameterPack()) {
6538 TypeLoc TL = OldParm->getTypeSourceInfo()->getTypeLoc();
6541 SemaRef.collectUnexpandedParameterPacks(Pattern, Unexpanded);
6544 bool ShouldExpand =
false;
6545 bool RetainExpansion =
false;
6547 if (Unexpanded.size() > 0) {
6548 OrigNumExpansions = ExpansionTL.
getTypePtr()->getNumExpansions();
6549 NumExpansions = OrigNumExpansions;
6553 ShouldExpand, RetainExpansion, NumExpansions)) {
6558 const AutoType *AT =
6559 Pattern.getType().getTypePtr()->getContainedAutoType();
6560 assert((AT && (!AT->isDeduced() || AT->getDeducedType().isNull())) &&
6561 "Could not find parameter packs or undeduced auto type!");
6568 getDerived().ExpandingFunctionParameterPack(OldParm);
6569 for (
unsigned I = 0; I != *NumExpansions; ++I) {
6572 =
getDerived().TransformFunctionTypeParam(OldParm,
6580 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6581 OutParamTypes.push_back(NewParm->
getType());
6583 PVars->push_back(NewParm);
6588 if (RetainExpansion) {
6589 ForgetPartiallySubstitutedPackRAII Forget(
getDerived());
6591 =
getDerived().TransformFunctionTypeParam(OldParm,
6599 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6600 OutParamTypes.push_back(NewParm->
getType());
6602 PVars->push_back(NewParm);
6618 NewParm =
getDerived().TransformFunctionTypeParam(OldParm,
6623 "Parameter pack no longer a parameter pack after "
6626 NewParm =
getDerived().TransformFunctionTypeParam(
6627 OldParm, indexAdjustment, std::nullopt,
6635 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6636 OutParamTypes.push_back(NewParm->
getType());
6638 PVars->push_back(NewParm);
6646 bool IsPackExpansion =
false;
6649 if (
const PackExpansionType *Expansion
6650 = dyn_cast<PackExpansionType>(OldType)) {
6652 QualType Pattern = Expansion->getPattern();
6654 getSema().collectUnexpandedParameterPacks(Pattern, Unexpanded);
6657 bool ShouldExpand =
false;
6658 bool RetainExpansion =
false;
6662 RetainExpansion, NumExpansions)) {
6669 for (
unsigned I = 0; I != *NumExpansions; ++I) {
6676 NewType =
getSema().getASTContext().getPackExpansionType(
6677 NewType, std::nullopt);
6684 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6685 OutParamTypes.push_back(NewType);
6687 PVars->push_back(
nullptr);
6696 if (RetainExpansion) {
6697 ForgetPartiallySubstitutedPackRAII Forget(
getDerived());
6703 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6704 OutParamTypes.push_back(NewType);
6706 PVars->push_back(
nullptr);
6711 OldType = Expansion->getPattern();
6712 IsPackExpansion =
true;
6714 NewType =
getDerived().TransformType(OldType);
6716 NewType =
getDerived().TransformType(OldType);
6722 if (IsPackExpansion)
6723 NewType =
getSema().Context.getPackExpansionType(NewType,
6727 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6728 OutParamTypes.push_back(NewType);
6730 PVars->push_back(
nullptr);
6735 for (
unsigned i = 0, e = PVars->size(); i != e; ++i)
6737 assert(parm->getFunctionScopeIndex() == i);
6744template<
typename Derived>
6749 return getDerived().TransformFunctionProtoType(
6753 ExceptionStorage, Changed);
6757template<
typename Derived>
template<
typename Fn>
6776 if (
T->hasTrailingReturn()) {
6780 T->getExtParameterInfosOrNull(),
6781 ParamTypes, &ParamDecls, ExtParamInfos))
6791 auto *RD = dyn_cast<CXXRecordDecl>(
SemaRef.getCurLexicalContext());
6793 SemaRef, !ThisContext && RD ? RD : ThisContext, ThisTypeQuals);
6808 T->getExtParameterInfosOrNull(),
6809 ParamTypes, &ParamDecls, ExtParamInfos))
6815 bool EPIChanged =
false;
6820 if (
auto NewExtParamInfos =
6836 std::optional<FunctionEffectSet> NewFX;
6848 std::optional<FunctionEffectMode> Mode =
6868 "FunctionEffectMode::None shouldn't be possible here");
6871 if (!
SemaRef.diagnoseConflictingFunctionEffect(*NewFX, NewEC,
6874 NewFX->insert(NewEC, Errs);
6875 assert(Errs.empty());
6885 Result =
getDerived().RebuildFunctionProtoType(ResultType, ParamTypes, EPI);
6896 for (
unsigned i = 0, e = NewTL.
getNumParams(); i != e; ++i)
6902template<
typename Derived>
6925 getSema().ActOnNoexceptSpec(NoexceptExpr.
get(), EST);
6940 if (
const PackExpansionType *PackExpansion =
6941 T->getAs<PackExpansionType>()) {
6946 SemaRef.collectUnexpandedParameterPacks(PackExpansion->getPattern(),
6948 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
6953 bool Expand =
false;
6954 bool RetainExpansion =
false;
6955 UnsignedOrNone NumExpansions = PackExpansion->getNumExpansions();
6960 true, Expand, RetainExpansion,
6973 U =
SemaRef.Context.getPackExpansionType(
U, NumExpansions);
6974 Exceptions.push_back(
U);
6980 for (
unsigned ArgIdx = 0; ArgIdx != *NumExpansions; ++ArgIdx) {
6984 if (
U.isNull() ||
SemaRef.CheckSpecifiedExceptionType(
U, Loc))
6987 Exceptions.push_back(
U);
6991 if (
U.isNull() ||
SemaRef.CheckSpecifiedExceptionType(
U, Loc))
6996 Exceptions.push_back(
U);
7006template<
typename Derived>
7016 if (getDerived().AlwaysRebuild() || ResultType !=
T->getReturnType())
7017 Result = getDerived().RebuildFunctionNoProtoType(ResultType);
7028template <
typename Derived>
7029QualType TreeTransform<Derived>::TransformUnresolvedUsingType(
7030 TypeLocBuilder &TLB, UnresolvedUsingTypeLoc TL) {
7032 const UnresolvedUsingType *T = TL.getTypePtr();
7033 bool Changed =
false;
7035 NestedNameSpecifierLoc QualifierLoc = TL.getQualifierLoc();
7036 if (NestedNameSpecifierLoc OldQualifierLoc = QualifierLoc) {
7037 QualifierLoc = getDerived().TransformNestedNameSpecifierLoc(QualifierLoc);
7040 Changed |= QualifierLoc != OldQualifierLoc;
7043 auto *D = getDerived().TransformDecl(TL.getNameLoc(),
T->getDecl());
7049 if (getDerived().AlwaysRebuild() || Changed) {
7050 Result = getDerived().RebuildUnresolvedUsingType(
7051 T->getKeyword(), QualifierLoc.getNestedNameSpecifier(), TL.getNameLoc(),
7059 QualifierLoc, TL.getNameLoc());
7062 QualifierLoc, TL.getNameLoc());
7066template <
typename Derived>
7074 QualifierLoc = getDerived().TransformNestedNameSpecifierLoc(QualifierLoc);
7077 Changed |= QualifierLoc != OldQualifierLoc;
7080 auto *D = cast_or_null<UsingShadowDecl>(
7081 getDerived().TransformDecl(TL.getNameLoc(),
T->getDecl()));
7086 QualType UnderlyingType = getDerived().TransformType(
T->desugar());
7087 if (UnderlyingType.isNull())
7089 Changed |= UnderlyingType !=
T->desugar();
7092 if (getDerived().AlwaysRebuild() || Changed) {
7093 Result = getDerived().RebuildUsingType(
7094 T->getKeyword(), QualifierLoc.getNestedNameSpecifier(), D,
7104template<
typename Derived>
7112 QualifierLoc = getDerived().TransformNestedNameSpecifierLoc(QualifierLoc);
7115 Changed |= QualifierLoc != OldQualifierLoc;
7118 auto *
Typedef = cast_or_null<TypedefNameDecl>(
7119 getDerived().TransformDecl(TL.getNameLoc(),
T->getDecl()));
7127 if (getDerived().AlwaysRebuild() || Changed) {
7128 Result = getDerived().RebuildTypedefType(
7129 T->getKeyword(), QualifierLoc.getNestedNameSpecifier(),
Typedef);
7135 QualifierLoc, TL.getNameLoc());
7139template<
typename Derived>
7147 ExprResult E = getDerived().TransformExpr(TL.getUnderlyingExpr());
7157 if (getDerived().AlwaysRebuild() || E.get() != TL.getUnderlyingExpr()) {
7159 getDerived().RebuildTypeOfExprType(E.get(), TL.getTypeofLoc(), Kind);
7166 NewTL.setLParenLoc(TL.getLParenLoc());
7167 NewTL.setRParenLoc(TL.getRParenLoc());
7172template<
typename Derived>
7176 TypeSourceInfo* New_Under_TI = getDerived().TransformType(Old_Under_TI);
7182 if (getDerived().AlwaysRebuild() || New_Under_TI != Old_Under_TI) {
7183 Result = getDerived().RebuildTypeOfType(New_Under_TI->getType(), Kind);
7190 NewTL.setLParenLoc(TL.getLParenLoc());
7191 NewTL.setRParenLoc(TL.getRParenLoc());
7192 NewTL.setUnmodifiedTInfo(New_Under_TI);
7197template<
typename Derived>
7200 const DecltypeType *
T = TL.getTypePtr();
7207 ExprResult E = getDerived().TransformExpr(
T->getUnderlyingExpr());
7211 E = getSema().ActOnDecltypeExpression(E.get());
7216 if (getDerived().AlwaysRebuild() ||
7217 E.get() !=
T->getUnderlyingExpr()) {
7218 Result = getDerived().RebuildDecltypeType(E.get(), TL.getDecltypeLoc());
7226 NewTL.setRParenLoc(TL.getRParenLoc());
7230template <
typename Derived>
7240 IndexExpr = getDerived().TransformExpr(TL.getIndexExpr());
7241 if (IndexExpr.isInvalid())
7244 QualType Pattern = TL.getPattern();
7246 const PackIndexingType *PIT = TL.getTypePtr();
7250 bool NotYetExpanded = Types.empty();
7251 bool FullySubstituted =
true;
7253 if (Types.empty() && !PIT->expandsToEmptyPack())
7257 if (!
T->containsUnexpandedParameterPack()) {
7258 QualType Transformed = getDerived().TransformType(
T);
7259 if (Transformed.isNull())
7261 SubtitutedTypes.push_back(Transformed);
7266 getSema().collectUnexpandedParameterPacks(
T, Unexpanded);
7267 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
7270 bool ShouldExpand =
true;
7271 bool RetainExpansion =
false;
7273 if (getDerived().TryExpandParameterPacks(
7276 RetainExpansion, NumExpansions))
7278 if (!ShouldExpand) {
7284 QualType Pack = getDerived().TransformType(TLB, TI->getTypeLoc());
7287 if (NotYetExpanded) {
7288 FullySubstituted =
false;
7289 QualType Out = getDerived().RebuildPackIndexingType(
7299 SubtitutedTypes.push_back(Pack);
7302 for (
unsigned I = 0; I != *NumExpansions; ++I) {
7307 SubtitutedTypes.push_back(Out);
7308 FullySubstituted &= !
Out->containsUnexpandedParameterPack();
7312 if (RetainExpansion) {
7313 FullySubstituted =
false;
7314 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
7318 SubtitutedTypes.push_back(Out);
7326 QualType Result = getDerived().TransformType(TLB, TL.getPatternLoc());
7328 QualType Out = getDerived().RebuildPackIndexingType(
7330 FullySubstituted, SubtitutedTypes);
7339template<
typename Derived>
7345 if (
Result->isDependentType()) {
7346 const UnaryTransformType *
T = TL.getTypePtr();
7348 NewBaseTSI = getDerived().TransformType(TL.getUnderlyingTInfo());
7351 QualType NewBase = NewBaseTSI->getType();
7353 Result = getDerived().RebuildUnaryTransformType(NewBase,
7362 NewTL.setParensRange(TL.getParensRange());
7363 NewTL.setUnderlyingTInfo(NewBaseTSI);
7367template<
typename Derived>
7370 const DeducedTemplateSpecializationType *
T = TL.getTypePtr();
7375 TL.getTemplateNameLoc());
7379 QualType OldDeduced =
T->getDeducedType();
7381 if (!OldDeduced.isNull()) {
7382 NewDeduced = getDerived().TransformType(OldDeduced);
7383 if (NewDeduced.isNull())
7387 QualType Result = getDerived().RebuildDeducedTemplateSpecializationType(
7395 NewTL.setTemplateNameLoc(TL.getTemplateNameLoc());
7396 NewTL.setQualifierLoc(QualifierLoc);
7400template <
typename Derived>
7407 QualifierLoc =
getDerived().TransformNestedNameSpecifierLoc(QualifierLoc);
7412 auto *TD = cast_or_null<TagDecl>(
7419 TD !=
T->getDecl()) {
7420 if (
T->isCanonicalUnqualified())
7437template <
typename Derived>
7443template <
typename Derived>
7444QualType TreeTransform<Derived>::TransformRecordType(TypeLocBuilder &TLB,
7446 return getDerived().TransformTagType(TLB, TL);
7449template<
typename Derived>
7456template<
typename Derived>
7460 return getDerived().TransformTemplateTypeParmType(
7465template <
typename Derived>
7471template<
typename Derived>
7472QualType TreeTransform<Derived>::TransformSubstTemplateTypeParmType(
7473 TypeLocBuilder &TLB,
7474 SubstTemplateTypeParmTypeLoc TL) {
7475 const SubstTemplateTypeParmType *T = TL.getTypePtr();
7478 getDerived().TransformDecl(TL.getNameLoc(), T->getAssociatedDecl());
7483 TemporaryBase Rebase(*
this, TL.getNameLoc(), DeclarationName());
7484 QualType Replacement = getDerived().TransformType(T->getReplacementType());
7485 if (Replacement.isNull())
7489 Replacement, NewReplaced, T->getIndex(), T->getPackIndex(),
7493 SubstTemplateTypeParmTypeLoc NewTL
7494 = TLB.push<SubstTemplateTypeParmTypeLoc>(
Result);
7495 NewTL.setNameLoc(TL.getNameLoc());
7499template <
typename Derived>
7505template<
typename Derived>
7509 return getDerived().TransformSubstTemplateTypeParmPackType(
7513template <
typename Derived>
7519template<
typename Derived>
7520QualType TreeTransform<Derived>::TransformAtomicType(TypeLocBuilder &TLB,
7522 QualType ValueType = getDerived().TransformType(TLB, TL.getValueLoc());
7523 if (ValueType.isNull())
7526 QualType
Result = TL.getType();
7527 if (getDerived().AlwaysRebuild() ||
7528 ValueType != TL.getValueLoc().getType()) {
7529 Result = getDerived().RebuildAtomicType(ValueType, TL.getKWLoc());
7536 NewTL.setLParenLoc(TL.getLParenLoc());
7537 NewTL.setRParenLoc(TL.getRParenLoc());
7542template <
typename Derived>
7545 QualType ValueType = getDerived().TransformType(TLB, TL.getValueLoc());
7546 if (ValueType.isNull())
7550 if (getDerived().AlwaysRebuild() || ValueType != TL.getValueLoc().getType()) {
7553 Result = getDerived().RebuildPipeType(ValueType, TL.getKWLoc(), isReadPipe);
7564template <
typename Derived>
7570 if (getDerived().AlwaysRebuild()) {
7571 Result = getDerived().RebuildBitIntType(EIT->isUnsigned(),
7572 EIT->getNumBits(), TL.getNameLoc());
7582template <
typename Derived>
7589 ExprResult BitsExpr = getDerived().TransformExpr(EIT->getNumBitsExpr());
7592 if (BitsExpr.isInvalid())
7597 if (getDerived().AlwaysRebuild() || BitsExpr.get() != EIT->getNumBitsExpr()) {
7598 Result = getDerived().RebuildDependentBitIntType(
7599 EIT->isUnsigned(), BitsExpr.get(), TL.getNameLoc());
7615template <
typename Derived>
7618 llvm_unreachable(
"This type does not need to be transformed.");
7626 template<
typename ArgLocContainer>
7628 ArgLocContainer *Container;
7653 : Container(&Container), Index(Index) { }
7667 return Container->getArgLoc(Index);
7671 return pointer(Container->getArgLoc(Index));
7676 return X.Container == Y.Container &&
X.Index == Y.Index;
7685template<
typename Derived>
7686QualType TreeTransform<Derived>::TransformAutoType(TypeLocBuilder &TLB,
7688 const AutoType *T = TL.getTypePtr();
7689 QualType OldDeduced = T->getDeducedType();
7690 QualType NewDeduced;
7691 if (!OldDeduced.isNull()) {
7692 NewDeduced = getDerived().TransformType(OldDeduced);
7693 if (NewDeduced.isNull())
7700 if (
T->isConstrained()) {
7701 assert(TL.getConceptReference());
7702 NewCD = getDerived().TransformConceptTemplateName(
7703 T->getTypeConstraintConcept(), TL.getConceptNameLoc());
7707 NewTemplateArgs.setLAngleLoc(TL.getLAngleLoc());
7708 NewTemplateArgs.setRAngleLoc(TL.getRAngleLoc());
7710 if (getDerived().TransformTemplateArguments(
7711 ArgIterator(TL, 0), ArgIterator(TL, TL.getNumArgs()),
7715 if (TL.getNestedNameSpecifierLoc()) {
7717 = getDerived().TransformNestedNameSpecifierLoc(
7718 TL.getNestedNameSpecifierLoc());
7719 if (!NewNestedNameSpec)
7725 if (getDerived().AlwaysRebuild() || NewDeduced != OldDeduced ||
7726 T->isDependentType() ||
T->isConstrained()) {
7729 NewArgList.reserve(NewTemplateArgs.size());
7730 for (
const auto &ArgLoc : NewTemplateArgs.arguments())
7731 NewArgList.push_back(ArgLoc.getArgument());
7732 Result = getDerived().RebuildAutoType(
7734 NewDeduced,
T->getKeyword(), NewCD, NewArgList);
7741 NewTL.setRParenLoc(TL.getRParenLoc());
7742 NewTL.setConceptReference(
nullptr);
7744 if (
T->isConstrained()) {
7748 TL.getConceptNameLoc())
7753 SemaRef.
Context, NewNestedNameSpec, TL.getTemplateKWLoc(), DNI,
7754 TL.getFoundDecl(), TL.getTypePtr()->getTypeConstraintConcept(),
7756 NewTL.setConceptReference(CR);
7762template <
typename Derived>
7765 return getDerived().TransformTemplateSpecializationType(
7770template <
typename Derived>
7773 NamedDecl *FirstQualifierInScope,
bool AllowInjectedClassName) {
7774 const TemplateSpecializationType *
T = TL.
getTypePtr();
7780 AllowInjectedClassName);
7789 if (getDerived().TransformTemplateArguments(ArgIterator(TL, 0),
7798 QualType Result = getDerived().RebuildTemplateSpecializationType(
7811template <
typename Derived>
7815 QualType modifiedType = getDerived().TransformType(TLB, TL.getModifiedLoc());
7816 if (modifiedType.isNull())
7823 oldType->getAttrKind(), modifiedType,
7824 TL.getAttr() ? TL.getAttr()->getLocation()
7825 : TL.getModifiedLoc().getBeginLoc()))
7829 const Attr *oldAttr = TL.getAttr();
7830 const Attr *newAttr = oldAttr ? getDerived().TransformAttr(oldAttr) :
nullptr;
7831 if (oldAttr && !newAttr)
7837 if (getDerived().AlwaysRebuild() ||
7838 modifiedType != oldType->getModifiedType()) {
7851 QualType equivalentType = modifiedType;
7852 if (TL.getModifiedLoc().getType() != TL.getEquivalentTypeLoc().getType()) {
7854 AuxiliaryTLB.
reserve(TL.getFullDataSize());
7856 getDerived().TransformType(AuxiliaryTLB, TL.getEquivalentTypeLoc());
7857 if (equivalentType.isNull())
7862 if (oldType->getAttrKind() == attr::HLSLRowMajor)
7865 else if (oldType->getAttrKind() == attr::HLSLColumnMajor)
7872 if (
auto nullability = oldType->getImmediateNullability()) {
7873 if (!modifiedType->canHaveNullability()) {
7874 SemaRef.
Diag((TL.getAttr() ? TL.getAttr()->getLocation()
7875 : TL.getModifiedLoc().getBeginLoc()),
7876 diag::err_nullability_nonpointer)
7893template <
typename Derived>
7897 QualType InnerTy = getDerived().TransformType(TLB, TL.getInnerLoc());
7898 if (InnerTy.isNull())
7901 Expr *OldCount = TL.getCountExpr();
7902 Expr *NewCount =
nullptr;
7904 ExprResult CountResult = getDerived().TransformExpr(OldCount);
7905 if (CountResult.isInvalid())
7907 NewCount = CountResult.get();
7911 if (getDerived().AlwaysRebuild() || InnerTy != OldTy->desugar() ||
7912 OldCount != NewCount) {
7915 InnerTy, NewCount, OldTy->isCountInBytes(), OldTy->isOrNull());
7922template <
typename Derived>
7927 QualType InnerTy = getDerived().TransformType(TLB, TL.getInnerLoc());
7928 if (InnerTy.isNull())
7932 if (getDerived().AlwaysRebuild() || InnerTy != OldTy->getWrappedType()) {
7934 InnerTy, OldTy->getLateParsedAttribute());
7942template <
typename Derived>
7946 llvm_unreachable(
"Unexpected TreeTransform for BTFTagAttributedType");
7949template <
typename Derived>
7952 const OverflowBehaviorType *OldTy = TL.getTypePtr();
7953 QualType InnerTy = getDerived().TransformType(TLB, TL.getWrappedLoc());
7954 if (InnerTy.isNull())
7958 if (getDerived().AlwaysRebuild() || InnerTy != OldTy->getUnderlyingType()) {
7970template <
typename Derived>
7974 const HLSLAttributedResourceType *oldType = TL.getTypePtr();
7976 QualType WrappedTy = getDerived().TransformType(TLB, TL.getWrappedLoc());
7977 if (WrappedTy.isNull())
7981 QualType OldContainedTy = oldType->getContainedType();
7983 if (!OldContainedTy.isNull()) {
7984 TypeSourceInfo *oldContainedTSI = TL.getContainedTypeSourceInfo();
7985 if (!oldContainedTSI)
7986 oldContainedTSI = getSema().getASTContext().getTrivialTypeSourceInfo(
7988 ContainedTSI = getDerived().TransformType(oldContainedTSI);
7991 ContainedTy = ContainedTSI->getType();
7994 HLSLAttributedResourceType::Attributes Attrs = oldType->getAttrs();
7995 if (Attrs.SampleCountExpr) {
7997 getDerived().TransformExpr(Attrs.SampleCountExpr);
7998 if (SampleCountResult.isInvalid())
8000 Attrs.SampleCountExpr = SampleCountResult.get();
8004 if (getDerived().AlwaysRebuild() || WrappedTy != oldType->getWrappedType() ||
8005 ContainedTy != oldType->getContainedType() ||
8006 Attrs.SampleCountExpr != oldType->getSampleCountExpr()) {
8008 ContainedTy, Attrs);
8014 NewTL.setContainedTypeSourceInfo(ContainedTSI);
8018template <
typename Derived>
8022 return TL.getType();
8025template<
typename Derived>
8029 QualType Inner = getDerived().TransformType(TLB, TL.getInnerLoc());
8034 if (getDerived().AlwaysRebuild() ||
8035 Inner != TL.getInnerLoc().getType()) {
8036 Result = getDerived().RebuildParenType(Inner);
8043 NewTL.setRParenLoc(TL.getRParenLoc());
8047template <
typename Derived>
8051 QualType Inner = getDerived().TransformType(TLB, TL.getInnerLoc());
8056 if (getDerived().AlwaysRebuild() || Inner != TL.getInnerLoc().getType()) {
8058 getDerived().RebuildMacroQualifiedType(Inner, TL.getMacroIdentifier());
8068template<
typename Derived>
8069QualType TreeTransform<Derived>::TransformDependentNameType(
8071 return TransformDependentNameType(TLB, TL,
false);
8074template <
typename Derived>
8075QualType TreeTransform<Derived>::TransformDependentNameType(
8078 const DependentNameType *
T = TL.getTypePtr();
8082 QualifierLoc = getDerived().TransformNestedNameSpecifierLoc(
8083 QualifierLoc, ObjectType, UnqualLookup);
8087 assert((ObjectType.isNull() && !UnqualLookup) &&
8088 "must be transformed by TransformNestedNameSpecifierLoc");
8092 = getDerived().RebuildDependentNameType(
T->getKeyword(),
8093 TL.getElaboratedKeywordLoc(),
8104 NewTL.setQualifierLoc(QualifierLoc);
8105 NewTL.setNameLoc(TL.getNameLoc());
8109 NewTL.setTemplateNameLoc(TL.getNameLoc());
8110 NewTL.setQualifierLoc(QualifierLoc);
8113 QualifierLoc, TL.getNameLoc());
8116 NewTL.
set(TL.getElaboratedKeywordLoc(), QualifierLoc, TL.getNameLoc());
8120 NewTL.setQualifierLoc(QualifierLoc);
8121 NewTL.setNameLoc(TL.getNameLoc());
8126template<
typename Derived>
8130 = getDerived().TransformType(TLB, TL.getPatternLoc());
8131 if (Pattern.isNull())
8135 if (getDerived().AlwaysRebuild() ||
8136 Pattern != TL.getPatternLoc().getType()) {
8137 Result = getDerived().RebuildPackExpansionType(Pattern,
8138 TL.getPatternLoc().getSourceRange(),
8139 TL.getEllipsisLoc(),
8140 TL.getTypePtr()->getNumExpansions());
8150template<
typename Derived>
8155 TLB.pushFullCopy(TL);
8156 return TL.getType();
8159template<
typename Derived>
8163 const ObjCTypeParamType *
T = TL.getTypePtr();
8165 getDerived().TransformDecl(
T->getDecl()->getLocation(),
T->getDecl()));
8170 if (getDerived().AlwaysRebuild() ||
8171 OTP !=
T->getDecl()) {
8172 Result = getDerived().RebuildObjCTypeParamType(
8173 OTP, TL.getProtocolLAngleLoc(),
8174 llvm::ArrayRef(TL.getTypePtr()->qual_begin(), TL.getNumProtocols()),
8175 TL.getProtocolLocs(), TL.getProtocolRAngleLoc());
8181 if (TL.getNumProtocols()) {
8182 NewTL.setProtocolLAngleLoc(TL.getProtocolLAngleLoc());
8183 for (
unsigned i = 0, n = TL.getNumProtocols(); i != n; ++i)
8184 NewTL.setProtocolLoc(i, TL.getProtocolLoc(i));
8185 NewTL.setProtocolRAngleLoc(TL.getProtocolRAngleLoc());
8190template<
typename Derived>
8195 QualType BaseType = getDerived().TransformType(TLB, TL.getBaseLoc());
8196 if (BaseType.isNull())
8199 bool AnyChanged = BaseType != TL.getBaseLoc().getType();
8203 for (
unsigned i = 0, n = TL.getNumTypeArgs(); i != n; ++i) {
8205 TypeLoc TypeArgLoc = TypeArgInfo->getTypeLoc();
8206 QualType TypeArg = TypeArgInfo->getType();
8211 const auto *PackExpansion = PackExpansionLoc.getType()
8212 ->castAs<PackExpansionType>();
8216 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
8220 TypeLoc PatternLoc = PackExpansionLoc.getPatternLoc();
8221 bool Expand =
false;
8222 bool RetainExpansion =
false;
8223 UnsignedOrNone NumExpansions = PackExpansion->getNumExpansions();
8224 if (getDerived().TryExpandParameterPacks(
8225 PackExpansionLoc.getEllipsisLoc(), PatternLoc.getSourceRange(),
8226 Unexpanded,
true, Expand,
8227 RetainExpansion, NumExpansions))
8237 TypeArgBuilder.
reserve(PatternLoc.getFullDataSize());
8238 QualType NewPatternType = getDerived().TransformType(TypeArgBuilder,
8240 if (NewPatternType.isNull())
8244 NewPatternType, NumExpansions);
8246 NewExpansionLoc.
setEllipsisLoc(PackExpansionLoc.getEllipsisLoc());
8247 NewTypeArgInfos.push_back(
8248 TypeArgBuilder.getTypeSourceInfo(SemaRef.
Context, NewExpansionType));
8254 for (
unsigned ArgIdx = 0; ArgIdx != *NumExpansions; ++ArgIdx) {
8258 TypeArgBuilder.
reserve(PatternLoc.getFullDataSize());
8260 QualType NewTypeArg = getDerived().TransformType(TypeArgBuilder,
8262 if (NewTypeArg.isNull())
8265 NewTypeArgInfos.push_back(
8266 TypeArgBuilder.getTypeSourceInfo(SemaRef.
Context, NewTypeArg));
8273 TypeArgBuilder.
reserve(TypeArgLoc.getFullDataSize());
8275 getDerived().TransformType(TypeArgBuilder, TypeArgLoc);
8276 if (NewTypeArg.isNull())
8280 if (NewTypeArg == TypeArg) {
8281 NewTypeArgInfos.push_back(TypeArgInfo);
8285 NewTypeArgInfos.push_back(
8286 TypeArgBuilder.getTypeSourceInfo(SemaRef.
Context, NewTypeArg));
8291 if (getDerived().AlwaysRebuild() || AnyChanged) {
8293 Result = getDerived().RebuildObjCObjectType(
8294 BaseType, TL.getBeginLoc(), TL.getTypeArgsLAngleLoc(), NewTypeArgInfos,
8295 TL.getTypeArgsRAngleLoc(), TL.getProtocolLAngleLoc(),
8296 llvm::ArrayRef(TL.getTypePtr()->qual_begin(), TL.getNumProtocols()),
8297 TL.getProtocolLocs(), TL.getProtocolRAngleLoc());
8305 NewT.setTypeArgsLAngleLoc(TL.getTypeArgsLAngleLoc());
8306 for (
unsigned i = 0, n = TL.getNumTypeArgs(); i != n; ++i)
8307 NewT.setTypeArgTInfo(i, NewTypeArgInfos[i]);
8308 NewT.setTypeArgsRAngleLoc(TL.getTypeArgsRAngleLoc());
8309 NewT.setProtocolLAngleLoc(TL.getProtocolLAngleLoc());
8310 for (
unsigned i = 0, n = TL.getNumProtocols(); i != n; ++i)
8311 NewT.setProtocolLoc(i, TL.getProtocolLoc(i));
8312 NewT.setProtocolRAngleLoc(TL.getProtocolRAngleLoc());
8316template<
typename Derived>
8320 QualType PointeeType = getDerived().TransformType(TLB, TL.getPointeeLoc());
8321 if (PointeeType.isNull())
8325 if (getDerived().AlwaysRebuild() ||
8326 PointeeType != TL.getPointeeLoc().getType()) {
8327 Result = getDerived().RebuildObjCObjectPointerType(PointeeType,
8341template<
typename Derived>
8347template<
typename Derived>
8350 return getDerived().TransformCompoundStmt(S,
false);
8353template<
typename Derived>
8360 getSema().resetFPOptions(
8363 bool SubStmtInvalid =
false;
8364 bool SubStmtChanged =
false;
8366 for (
auto *B : S->
body()) {
8368 B, IsStmtExpr && B == S->
body_back() ? StmtDiscardKind::StmtExprResult
8369 : StmtDiscardKind::Discarded);
8371 if (
Result.isInvalid()) {
8378 SubStmtInvalid =
true;
8382 SubStmtChanged = SubStmtChanged ||
Result.get() != B;
8383 Statements.push_back(
Result.getAs<Stmt>());
8389 if (!getDerived().AlwaysRebuild() &&
8393 return getDerived().RebuildCompoundStmt(S->
getLBracLoc(),
8399template<
typename Derived>
8408 LHS = getDerived().TransformExpr(S->getLHS());
8410 if (LHS.isInvalid())
8414 RHS = getDerived().TransformExpr(S->getRHS());
8416 if (RHS.isInvalid())
8423 StmtResult Case = getDerived().RebuildCaseStmt(S->getCaseLoc(),
8425 S->getEllipsisLoc(),
8428 if (Case.isInvalid())
8433 getDerived().TransformStmt(S->getSubStmt());
8434 if (SubStmt.isInvalid())
8438 return getDerived().RebuildCaseStmtBody(Case.get(), SubStmt.get());
8441template <
typename Derived>
8445 getDerived().TransformStmt(S->getSubStmt());
8446 if (SubStmt.isInvalid())
8450 return getDerived().RebuildDefaultStmt(S->getDefaultLoc(), S->getColonLoc(),
8454template<
typename Derived>
8457 StmtResult SubStmt = getDerived().TransformStmt(S->getSubStmt(), SDK);
8458 if (SubStmt.isInvalid())
8461 Decl *LD = getDerived().TransformDecl(S->getDecl()->getLocation(),
8469 if (LD == S->getDecl())
8470 S->getDecl()->setStmt(
nullptr);
8473 return getDerived().RebuildLabelStmt(S->getIdentLoc(),
8478template <
typename Derived>
8483 switch (R->getKind()) {
8487 return getDerived().Transform##X##Attr(cast<X##Attr>(R));
8488#include "clang/Basic/AttrList.inc"
8493template <
typename Derived>
8500 switch (R->getKind()) {
8504 return getDerived().TransformStmt##X##Attr(OrigS, InstS, cast<X##Attr>(R));
8505#include "clang/Basic/AttrList.inc"
8510template <
typename Derived>
8513 StmtDiscardKind SDK) {
8518 bool AttrsChanged =
false;
8522 for (
const auto *I : S->
getAttrs()) {
8524 getDerived().TransformStmtAttr(S->
getSubStmt(), SubStmt.
get(), I);
8525 AttrsChanged |= (I != R);
8538 return getDerived().RebuildAttributedStmt(S->
getAttrLoc(), Attrs,
8542template<
typename Derived>
8547 if (
Init.isInvalid())
8551 if (!S->isConsteval()) {
8553 Cond = getDerived().TransformCondition(
8554 S->getIfLoc(), S->getConditionVariable(), S->getCond(),
8557 if (Cond.isInvalid())
8562 std::optional<bool> ConstexprConditionValue;
8563 if (S->isConstexpr())
8568 if (!ConstexprConditionValue || *ConstexprConditionValue) {
8572 S->isNonNegatedConsteval());
8574 Then = getDerived().TransformStmt(S->getThen());
8575 if (Then.isInvalid())
8581 Then =
new (getSema().Context)
8582 CompoundStmt(S->getThen()->getBeginLoc(), S->getThen()->getEndLoc());
8587 if (!ConstexprConditionValue || !*ConstexprConditionValue) {
8591 S->isNegatedConsteval());
8593 Else = getDerived().TransformStmt(S->getElse());
8594 if (Else.isInvalid())
8596 }
else if (S->getElse() && ConstexprConditionValue &&
8597 *ConstexprConditionValue) {
8601 Else =
new (getSema().Context)
8602 CompoundStmt(S->getElse()->getBeginLoc(), S->getElse()->getEndLoc());
8605 if (!getDerived().AlwaysRebuild() &&
8606 Init.get() == S->getInit() &&
8607 Cond.get() == std::make_pair(S->getConditionVariable(), S->getCond()) &&
8608 Then.get() == S->getThen() &&
8609 Else.get() == S->getElse())
8612 return getDerived().RebuildIfStmt(
8613 S->getIfLoc(), S->getStatementKind(), S->getLParenLoc(), Cond,
8614 S->getRParenLoc(),
Init.get(), Then.get(), S->getElseLoc(), Else.get());
8617template<
typename Derived>
8622 if (
Init.isInvalid())
8627 S->getSwitchLoc(), S->getConditionVariable(), S->getCond(),
8629 if (Cond.isInvalid())
8634 getDerived().RebuildSwitchStmtStart(S->getSwitchLoc(), S->getLParenLoc(),
8635 Init.get(), Cond, S->getRParenLoc());
8640 StmtResult Body = getDerived().TransformStmt(S->getBody());
8643 return getDerived().RebuildSwitchStmtBody(S->getSwitchLoc(),
Switch.get(),
8647template<
typename Derived>
8652 S->getWhileLoc(), S->getConditionVariable(), S->getCond(),
8654 if (Cond.isInvalid())
8663 StmtResult Body = getDerived().TransformStmt(S->getBody());
8664 if (Body.isInvalid())
8667 if (!getDerived().AlwaysRebuild() &&
8668 Cond.get() == std::make_pair(S->getConditionVariable(), S->getCond()) &&
8669 Body.get() == S->getBody())
8672 return getDerived().RebuildWhileStmt(S->getWhileLoc(), S->getLParenLoc(),
8673 Cond, S->getRParenLoc(), Body.get());
8676template<
typename Derived>
8685 StmtResult Body = getDerived().TransformStmt(S->getBody());
8686 if (Body.isInvalid())
8690 ExprResult Cond = getDerived().TransformExpr(S->getCond());
8691 if (Cond.isInvalid())
8694 if (!getDerived().AlwaysRebuild() &&
8695 Cond.get() == S->getCond() &&
8696 Body.get() == S->getBody())
8699 return getDerived().RebuildDoStmt(S->getDoLoc(), Body.get(), S->getWhileLoc(),
8700 S->getWhileLoc(), Cond.get(),
8704template<
typename Derived>
8707 if (getSema().getLangOpts().getOpenMPVersion())
8708 getSema().OpenMP().startOpenMPLoop();
8712 if (
Init.isInvalid())
8717 if (getSema().getLangOpts().getOpenMPVersion() &&
Init.isUsable())
8718 getSema().OpenMP().ActOnOpenMPLoopInitialization(S->getForLoc(),
8723 S->getForLoc(), S->getConditionVariable(), S->getCond(),
8725 if (Cond.isInvalid())
8730 if (
Inc.isInvalid())
8734 if (S->getInc() && !FullInc.get())
8741 S->getBeginLoc(), S->getInit(),
Init.get(), S->getCond(),
8742 Cond.get().second, S->getInc(),
Inc.get());
8745 StmtResult Body = getDerived().TransformStmt(S->getBody());
8746 if (Body.isInvalid())
8751 if (!getDerived().AlwaysRebuild() &&
8752 Init.get() == S->getInit() &&
8753 Cond.get() == std::make_pair(S->getConditionVariable(), S->getCond()) &&
8754 Inc.get() == S->getInc() &&
8755 Body.get() == S->getBody())
8758 return getDerived().RebuildForStmt(S->getForLoc(), S->getLParenLoc(),
8759 Init.get(), Cond, FullInc,
8760 S->getRParenLoc(), Body.get());
8763template<
typename Derived>
8766 Decl *LD = getDerived().TransformDecl(S->getLabel()->getLocation(),
8772 return getDerived().RebuildGotoStmt(S->getGotoLoc(), S->getLabelLoc(),
8776template<
typename Derived>
8784 if (!getDerived().AlwaysRebuild() &&
8785 Target.get() == S->getTarget())
8788 return getDerived().RebuildIndirectGotoStmt(S->getGotoLoc(), S->getStarLoc(),
8792template<
typename Derived>
8795 if (!S->hasLabelTarget())
8798 Decl *LD = getDerived().TransformDecl(S->getLabelDecl()->getLocation(),
8807template<
typename Derived>
8810 if (!S->hasLabelTarget())
8813 Decl *LD = getDerived().TransformDecl(S->getLabelDecl()->getLocation(),
8822template <
typename Derived>
8830template<
typename Derived>
8840 return getDerived().RebuildReturnStmt(S->getReturnLoc(),
Result.get());
8843template<
typename Derived>
8846 bool DeclChanged =
false;
8849 for (
auto *D : S->decls()) {
8850 Decl *Transformed = getDerived().TransformDefinition(D->getLocation(), D);
8854 if (Transformed != D)
8858 if (
auto *TD = dyn_cast<TypeDecl>(Transformed)) {
8859 if (
auto *TN = dyn_cast<TypedefNameDecl>(TD)) {
8860 LSI->ContainsUnexpandedParameterPack |=
8861 TN->getUnderlyingType()->containsUnexpandedParameterPack();
8863 LSI->ContainsUnexpandedParameterPack |=
8866 .getTypeDeclType(TD)
8867 ->containsUnexpandedParameterPack();
8870 if (
auto *VD = dyn_cast<VarDecl>(Transformed))
8871 LSI->ContainsUnexpandedParameterPack |=
8872 VD->getType()->containsUnexpandedParameterPack();
8875 Decls.push_back(Transformed);
8878 if (!getDerived().AlwaysRebuild() && !DeclChanged)
8881 return getDerived().RebuildDeclStmt(Decls, S->getBeginLoc(), S->getEndLoc());
8884template<
typename Derived>
8894 bool ExprsChanged =
false;
8896 auto RebuildString = [&](
Expr *E) {
8901 ExprsChanged =
true;
8908 for (
unsigned I = 0, E = S->getNumOutputs(); I != E; ++I) {
8909 Names.push_back(S->getOutputIdentifier(I));
8915 Constraints.push_back(
Result.get());
8918 Expr *OutputExpr = S->getOutputExpr(I);
8919 Result = getDerived().TransformExpr(OutputExpr);
8923 ExprsChanged |=
Result.get() != OutputExpr;
8925 Exprs.push_back(
Result.get());
8929 for (
unsigned I = 0, E = S->getNumInputs(); I != E; ++I) {
8930 Names.push_back(S->getInputIdentifier(I));
8936 Constraints.push_back(
Result.get());
8939 Expr *InputExpr = S->getInputExpr(I);
8940 Result = getDerived().TransformExpr(InputExpr);
8944 ExprsChanged |=
Result.get() != InputExpr;
8946 Exprs.push_back(
Result.get());
8950 for (
unsigned I = 0, E = S->getNumLabels(); I != E; ++I) {
8951 Names.push_back(S->getLabelIdentifier(I));
8956 ExprsChanged |=
Result.get() != S->getLabelExpr(I);
8957 Exprs.push_back(
Result.get());
8961 for (
unsigned I = 0, E = S->getNumClobbers(); I != E; ++I) {
8965 Clobbers.push_back(
Result.get());
8968 ExprResult AsmString = RebuildString(S->getAsmStringExpr());
8969 if (AsmString.isInvalid())
8972 if (!getDerived().AlwaysRebuild() && !ExprsChanged)
8975 return getDerived().RebuildGCCAsmStmt(S->getAsmLoc(), S->isSimple(),
8976 S->isVolatile(), S->getNumOutputs(),
8977 S->getNumInputs(), Names.data(),
8978 Constraints, Exprs, AsmString.get(),
8979 Clobbers, S->getNumLabels(),
8983template<
typename Derived>
8988 bool HadError =
false, HadChange =
false;
8992 TransformedExprs.reserve(SrcExprs.size());
8993 for (
unsigned i = 0, e = SrcExprs.size(); i != e; ++i) {
8995 if (!
Result.isUsable()) {
8998 HadChange |= (
Result.get() != SrcExprs[i]);
8999 TransformedExprs.push_back(
Result.get());
9004 if (!HadChange && !getDerived().AlwaysRebuild())
9007 return getDerived().RebuildMSAsmStmt(S->getAsmLoc(), S->getLBraceLoc(),
9008 AsmToks, S->getAsmString(),
9009 S->getNumOutputs(), S->getNumInputs(),
9010 S->getAllConstraints(), S->getClobbers(),
9011 TransformedExprs, S->getEndLoc());
9015template<
typename Derived>
9020 assert(FD && ScopeInfo && !ScopeInfo->CoroutinePromise &&
9021 ScopeInfo->NeedsCoroutineSuspends &&
9022 ScopeInfo->CoroutineSuspends.first ==
nullptr &&
9023 ScopeInfo->CoroutineSuspends.second ==
nullptr &&
9024 "expected clean scope info");
9028 ScopeInfo->setNeedsCoroutineSuspends(
false);
9041 getDerived().transformedLocalDecl(S->getPromiseDecl(), {Promise});
9042 ScopeInfo->CoroutinePromise = Promise;
9047 StmtResult InitSuspend = getDerived().TransformStmt(S->getInitSuspendStmt());
9048 if (InitSuspend.isInvalid())
9051 getDerived().TransformStmt(S->getFinalSuspendStmt());
9052 if (FinalSuspend.isInvalid() ||
9055 ScopeInfo->setCoroutineSuspends(InitSuspend.get(), FinalSuspend.get());
9058 StmtResult BodyRes = getDerived().TransformStmt(S->getBody());
9059 if (BodyRes.isInvalid())
9063 if (Builder.isInvalid())
9066 Expr *ReturnObject = S->getReturnValueInit();
9067 assert(ReturnObject &&
"the return object is expected to be valid");
9068 ExprResult Res = getDerived().TransformInitializer(ReturnObject,
9070 if (Res.isInvalid())
9072 Builder.ReturnValue = Res.get();
9077 if (S->hasDependentPromiseType()) {
9080 if (!Promise->getType()->isDependentType()) {
9081 assert(!S->getFallthroughHandler() && !S->getExceptionHandler() &&
9082 !S->getReturnStmtOnAllocFailure() && !S->getDeallocate() &&
9083 "these nodes should not have been built yet");
9084 if (!Builder.buildDependentStatements())
9088 if (
auto *OnFallthrough = S->getFallthroughHandler()) {
9089 StmtResult Res = getDerived().TransformStmt(OnFallthrough);
9090 if (Res.isInvalid())
9092 Builder.OnFallthrough = Res.get();
9095 if (
auto *OnException = S->getExceptionHandler()) {
9096 StmtResult Res = getDerived().TransformStmt(OnException);
9097 if (Res.isInvalid())
9099 Builder.OnException = Res.get();
9102 if (
auto *OnAllocFailure = S->getReturnStmtOnAllocFailure()) {
9103 StmtResult Res = getDerived().TransformStmt(OnAllocFailure);
9104 if (Res.isInvalid())
9106 Builder.ReturnStmtOnAllocFailure = Res.get();
9110 assert(S->getAllocate() && S->getDeallocate() &&
9111 "allocation and deallocation calls must already be built");
9112 ExprResult AllocRes = getDerived().TransformExpr(S->getAllocate());
9113 if (AllocRes.isInvalid())
9115 Builder.Allocate = AllocRes.get();
9117 ExprResult DeallocRes = getDerived().TransformExpr(S->getDeallocate());
9118 if (DeallocRes.isInvalid())
9120 Builder.Deallocate = DeallocRes.get();
9122 if (
auto *ResultDecl = S->getResultDecl()) {
9123 StmtResult Res = getDerived().TransformStmt(ResultDecl);
9124 if (Res.isInvalid())
9126 Builder.ResultDecl = Res.get();
9131 if (Res.isInvalid())
9133 Builder.ReturnStmt = Res.get();
9137 return getDerived().RebuildCoroutineBodyStmt(Builder);
9140template<
typename Derived>
9150 return getDerived().RebuildCoreturnStmt(S->getKeywordLoc(),
Result.get(),
9154template <
typename Derived>
9167 ExprResult Lookup = getSema().BuildOperatorCoawaitLookupExpr(
9168 getSema().getCurScope(), E->getKeywordLoc());
9172 return getDerived().RebuildCoawaitExpr(
9173 E->getKeywordLoc(),
Operand.get(),
9177template <
typename Derived>
9180 ExprResult OperandResult = getDerived().TransformInitializer(E->getOperand(),
9182 if (OperandResult.isInvalid())
9186 E->getOperatorCoawaitLookup());
9193 return getDerived().RebuildDependentCoawaitExpr(
9194 E->getKeywordLoc(), OperandResult.get(),
9198template<
typename Derived>
9208 return getDerived().RebuildCoyieldExpr(E->getKeywordLoc(),
Result.get());
9213template<
typename Derived>
9217 StmtResult TryBody = getDerived().TransformStmt(S->getTryBody());
9218 if (TryBody.isInvalid())
9222 bool AnyCatchChanged =
false;
9224 for (
unsigned I = 0, N = S->getNumCatchStmts(); I != N; ++I) {
9225 StmtResult Catch = getDerived().TransformStmt(S->getCatchStmt(I));
9226 if (Catch.isInvalid())
9228 if (Catch.get() != S->getCatchStmt(I))
9229 AnyCatchChanged =
true;
9230 CatchStmts.push_back(Catch.get());
9235 if (S->getFinallyStmt()) {
9236 Finally = getDerived().TransformStmt(S->getFinallyStmt());
9237 if (Finally.isInvalid())
9242 if (!getDerived().AlwaysRebuild() &&
9243 TryBody.get() == S->getTryBody() &&
9245 Finally.get() == S->getFinallyStmt())
9249 return getDerived().RebuildObjCAtTryStmt(S->getAtTryLoc(), TryBody.get(),
9250 CatchStmts, Finally.get());
9253template<
typename Derived>
9258 if (
VarDecl *FromVar = S->getCatchParamDecl()) {
9260 if (FromVar->getTypeSourceInfo()) {
9261 TSInfo = getDerived().TransformType(FromVar->getTypeSourceInfo());
9268 T = TSInfo->getType();
9270 T = getDerived().TransformType(FromVar->getType());
9275 Var = getDerived().RebuildObjCExceptionDecl(FromVar, TSInfo,
T);
9280 StmtResult Body = getDerived().TransformStmt(S->getCatchBody());
9281 if (Body.isInvalid())
9284 return getDerived().RebuildObjCAtCatchStmt(S->getAtCatchLoc(),
9289template<
typename Derived>
9293 StmtResult Body = getDerived().TransformStmt(S->getFinallyBody());
9294 if (Body.isInvalid())
9298 if (!getDerived().AlwaysRebuild() &&
9299 Body.get() == S->getFinallyBody())
9303 return getDerived().RebuildObjCAtFinallyStmt(S->getAtFinallyLoc(),
9307template<
typename Derived>
9311 if (S->getThrowExpr()) {
9312 Operand = getDerived().TransformExpr(S->getThrowExpr());
9317 if (!getDerived().AlwaysRebuild() &&
9318 Operand.get() == S->getThrowExpr())
9321 return getDerived().RebuildObjCAtThrowStmt(S->getThrowLoc(),
Operand.get());
9324template<
typename Derived>
9333 getDerived().RebuildObjCAtSynchronizedOperand(S->getAtSynchronizedLoc(),
9339 StmtResult Body = getDerived().TransformStmt(S->getSynchBody());
9340 if (Body.isInvalid())
9344 if (!getDerived().AlwaysRebuild() &&
9345 Object.get() == S->getSynchExpr() &&
9346 Body.get() == S->getSynchBody())
9350 return getDerived().RebuildObjCAtSynchronizedStmt(S->getAtSynchronizedLoc(),
9351 Object.get(), Body.get());
9354template<
typename Derived>
9359 StmtResult Body = getDerived().TransformStmt(S->getSubStmt());
9360 if (Body.isInvalid())
9364 if (!getDerived().AlwaysRebuild() &&
9365 Body.get() == S->getSubStmt())
9369 return getDerived().RebuildObjCAutoreleasePoolStmt(
9370 S->getAtLoc(), Body.get());
9373template<
typename Derived>
9378 StmtResult Element = getDerived().TransformStmt(
9379 S->getElement(), StmtDiscardKind::NotDiscarded);
9380 if (Element.isInvalid())
9384 ExprResult Collection = getDerived().TransformExpr(S->getCollection());
9385 if (Collection.isInvalid())
9389 StmtResult Body = getDerived().TransformStmt(S->getBody());
9390 if (Body.isInvalid())
9394 if (!getDerived().AlwaysRebuild() &&
9395 Element.get() == S->getElement() &&
9396 Collection.get() == S->getCollection() &&
9397 Body.get() == S->getBody())
9401 return getDerived().RebuildObjCForCollectionStmt(S->getForLoc(),
9408template <
typename Derived>
9412 if (
VarDecl *ExceptionDecl = S->getExceptionDecl()) {
9414 getDerived().TransformType(ExceptionDecl->getTypeSourceInfo());
9418 Var = getDerived().RebuildExceptionDecl(
9419 ExceptionDecl,
T, ExceptionDecl->getInnerLocStart(),
9420 ExceptionDecl->getLocation(), ExceptionDecl->getIdentifier());
9421 if (!Var || Var->isInvalidDecl())
9426 StmtResult Handler = getDerived().TransformStmt(S->getHandlerBlock());
9427 if (Handler.isInvalid())
9430 if (!getDerived().AlwaysRebuild() && !Var &&
9431 Handler.get() == S->getHandlerBlock())
9434 return getDerived().RebuildCXXCatchStmt(S->getCatchLoc(), Var, Handler.get());
9437template <
typename Derived>
9440 StmtResult TryBlock = getDerived().TransformCompoundStmt(S->getTryBlock());
9441 if (TryBlock.isInvalid())
9445 bool HandlerChanged =
false;
9447 for (
unsigned I = 0, N = S->getNumHandlers(); I != N; ++I) {
9448 StmtResult Handler = getDerived().TransformCXXCatchStmt(S->getHandler(I));
9449 if (Handler.isInvalid())
9452 HandlerChanged = HandlerChanged || Handler.get() != S->getHandler(I);
9453 Handlers.push_back(Handler.getAs<
Stmt>());
9456 getSema().DiagnoseExceptionUse(S->getTryLoc(),
true);
9458 if (!getDerived().AlwaysRebuild() && TryBlock.get() == S->getTryBlock() &&
9462 return getDerived().RebuildCXXTryStmt(S->getTryLoc(), TryBlock.get(),
9466template<
typename Derived>
9477 auto &LastRecord = getSema().currentEvaluationContext();
9478 LastRecord.InLifetimeExtendingContext =
true;
9479 LastRecord.RebuildDefaultArgOrDefaultInit =
true;
9482 S->getInit() ? getDerived().TransformStmt(S->getInit()) :
StmtResult();
9483 if (
Init.isInvalid())
9487 if (
Range.isInvalid())
9492 getSema().ExprEvalContexts.back().ForRangeLifetimeExtendTemps.empty());
9493 auto ForRangeLifetimeExtendTemps =
9494 getSema().ExprEvalContexts.back().ForRangeLifetimeExtendTemps;
9496 StmtResult Begin = getDerived().TransformStmt(S->getBeginStmt());
9497 if (Begin.isInvalid())
9499 StmtResult End = getDerived().TransformStmt(S->getEndStmt());
9500 if (End.isInvalid())
9503 ExprResult Cond = getDerived().TransformExpr(S->getCond());
9504 if (Cond.isInvalid())
9508 if (Cond.isInvalid())
9514 if (
Inc.isInvalid())
9519 StmtResult LoopVar = getDerived().TransformStmt(S->getLoopVarStmt());
9520 if (LoopVar.isInvalid())
9524 if (getDerived().AlwaysRebuild() ||
9525 Init.get() != S->getInit() ||
9526 Range.get() != S->getRangeStmt() ||
9527 Begin.get() != S->getBeginStmt() ||
9528 End.get() != S->getEndStmt() ||
9529 Cond.get() != S->getCond() ||
9530 Inc.get() != S->getInc() ||
9531 LoopVar.get() != S->getLoopVarStmt()) {
9532 NewStmt = getDerived().RebuildCXXForRangeStmt(
9533 S->getForLoc(), S->getCoawaitLoc(),
Init.get(), S->getColonLoc(),
9534 Range.get(), Begin.get(), End.get(), Cond.get(),
Inc.get(),
9535 LoopVar.get(), S->getRParenLoc(), ForRangeLifetimeExtendTemps);
9536 if (NewStmt.isInvalid() && LoopVar.get() != S->getLoopVarStmt()) {
9538 getSema().ActOnInitializerError(
9549 StmtResult Body = getDerived().TransformStmt(S->getBody());
9550 if (Body.isInvalid())
9557 if (Body.get() != S->getBody() && NewStmt.get() == S) {
9558 NewStmt = getDerived().RebuildCXXForRangeStmt(
9559 S->getForLoc(), S->getCoawaitLoc(),
Init.get(), S->getColonLoc(),
9560 Range.get(), Begin.get(), End.get(), Cond.get(),
Inc.get(),
9561 LoopVar.get(), S->getRParenLoc(), ForRangeLifetimeExtendTemps);
9562 if (NewStmt.isInvalid())
9566 if (NewStmt.get() == S)
9569 return FinishCXXForRangeStmt(NewStmt.get(), Body.get());
9572template <
typename Derived>
9578 getDerived().TransformDecl(S->getDecl()->getLocation(), S->getDecl());
9579 if (!ESD || ESD->isInvalidDecl())
9586 auto TransformStmtInParentContext = [&](
Stmt *SubStmt) ->
StmtResult {
9589 return getDerived().TransformStmt(SubStmt);
9608 if (S->isDependent() || S->isIterating()) {
9614 if (S->isDependent()) {
9620 ExpansionInitializer =
9621 getDerived().TransformExpr(S->getExpansionInitializer());
9622 if (ExpansionInitializer.isInvalid())
9624 }
else if (S->isIterating()) {
9625 Range = TransformStmtInParentContext(S->getRangeVarStmt());
9626 if (
Range.isInvalid())
9630 ExpansionInitializer =
9633 LifetimeExtendTemps =
9638 if (S->isEnumerating()) {
9640 getDerived().TransformStmt(S->getExpansionVarStmt());
9641 if (ExpansionVar.isInvalid())
9646 S->getLParenLoc(), S->getColonLoc(), S->getRParenLoc());
9647 }
else if (S->isIterating()) {
9648 StmtResult Begin = TransformStmtInParentContext(S->getBeginVarStmt());
9649 StmtResult Iter = TransformStmtInParentContext(S->getIterVarStmt());
9650 if (Begin.isInvalid() || Iter.isInvalid())
9657 getDerived().TransformStmt(S->getExpansionVarStmt());
9658 if (ExpansionVar.isInvalid())
9664 Iter.getAs<
DeclStmt>(), S->getLParenLoc(), S->getColonLoc(),
9668 NewPattern->getRangeVar(), LifetimeExtendTemps);
9669 }
else if (S->isDependent()) {
9671 getDerived().TransformStmt(S->getExpansionVarStmt());
9672 if (ExpansionVar.isInvalid())
9677 ExpansionInitializer.get(), S->getLParenLoc(), S->getColonLoc(),
9678 S->getRParenLoc(), LifetimeExtendTemps);
9680 if (Res.isInvalid())
9690 llvm_unreachable(
"destructuring pattern should never be instantiated");
9693 StmtResult Body = getDerived().TransformStmt(S->getBody());
9694 if (Body.isInvalid())
9700template <
typename Derived>
9703 bool SubStmtChanged =
false;
9706 for (
Stmt *OldDS : OldStmts) {
9707 StmtResult NewDS = getDerived().TransformStmt(OldDS);
9708 if (NewDS.isInvalid())
9711 SubStmtChanged |= NewDS.get() != OldDS;
9712 NewStmts.push_back(NewDS.get());
9719 getDerived().TransformDecl(S->getParent()->getLocation(), S->getParent());
9720 if (!ESD || ESD->isInvalidDecl())
9734 if (TransformStmts(PreambleStmts, S->getPreambleStmts()))
9737 if (S->shouldApplyLifetimeExtensionToPreamble()) {
9745 if (TransformStmts(Instantiations, S->getInstantiations()))
9748 if (!getDerived().AlwaysRebuild() && !SubStmtChanged)
9752 SemaRef.
Context, NewESD, Instantiations, PreambleStmts,
9753 S->shouldApplyLifetimeExtensionToPreamble());
9756template <
typename Derived>
9760 ExprResult Idx = getDerived().TransformExpr(E->getIndexExpr());
9761 if (
Range.isInvalid() || Idx.isInvalid())
9764 if (!getDerived().AlwaysRebuild() &&
Range.get() == E->getRangeExpr() &&
9765 Idx.get() == E->getIndexExpr())
9772template<
typename Derived>
9778 if (S->getQualifierLoc()) {
9780 = getDerived().TransformNestedNameSpecifierLoc(S->getQualifierLoc());
9787 if (NameInfo.getName()) {
9788 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
9789 if (!NameInfo.getName())
9794 if (!getDerived().AlwaysRebuild() &&
9795 QualifierLoc == S->getQualifierLoc() &&
9796 NameInfo.getName() == S->getNameInfo().getName())
9801 SS.
Adopt(QualifierLoc);
9803 switch (getSema().CheckMicrosoftIfExistsSymbol(
nullptr, SS, NameInfo)) {
9805 if (S->isIfExists())
9808 return new (getSema().Context)
NullStmt(S->getKeywordLoc());
9811 if (S->isIfNotExists())
9814 return new (getSema().Context)
NullStmt(S->getKeywordLoc());
9825 StmtResult SubStmt = getDerived().TransformCompoundStmt(S->getSubStmt());
9826 if (SubStmt.isInvalid())
9834 return getDerived().RebuildMSDependentExistsStmt(S->getKeywordLoc(),
9841template<
typename Derived>
9845 if (E->getQualifierLoc()) {
9847 = getDerived().TransformNestedNameSpecifierLoc(E->getQualifierLoc());
9853 getDerived().TransformDecl(E->getMemberLoc(), E->getPropertyDecl()));
9858 if (
Base.isInvalid())
9864 QualifierLoc, E->getMemberLoc());
9867template <
typename Derived>
9871 if (BaseRes.isInvalid())
9873 auto IdxRes = getDerived().TransformExpr(E->getIdx());
9874 if (IdxRes.isInvalid())
9877 if (!getDerived().AlwaysRebuild() &&
9878 BaseRes.get() == E->getBase() &&
9879 IdxRes.get() == E->getIdx())
9882 return getDerived().RebuildArraySubscriptExpr(
9883 BaseRes.get(),
SourceLocation(), IdxRes.get(), E->getRBracketLoc());
9886template <
typename Derived>
9888 StmtResult TryBlock = getDerived().TransformCompoundStmt(S->getTryBlock());
9889 if (TryBlock.isInvalid())
9892 StmtResult Handler = getDerived().TransformSEHHandler(S->getHandler());
9893 if (Handler.isInvalid())
9896 if (!getDerived().AlwaysRebuild() && TryBlock.get() == S->getTryBlock() &&
9897 Handler.get() == S->getHandler())
9900 return getDerived().RebuildSEHTryStmt(S->getIsCXXTry(), S->getTryLoc(),
9901 TryBlock.get(), Handler.get());
9904template <
typename Derived>
9907 if (
Block.isInvalid())
9910 return getDerived().RebuildSEHFinallyStmt(S->getFinallyLoc(),
Block.get());
9913template <
typename Derived>
9915 ExprResult FilterExpr = getDerived().TransformExpr(S->getFilterExpr());
9916 if (FilterExpr.isInvalid())
9920 if (
Block.isInvalid())
9923 return getDerived().RebuildSEHExceptStmt(S->getExceptLoc(), FilterExpr.get(),
9927template <
typename Derived>
9935template<
typename Derived>
9945template <
typename Derived>
9947TreeTransform<Derived>::TransformOMPCanonicalLoop(OMPCanonicalLoop *L) {
9951 return getDerived().TransformStmt(L->getLoopStmt());
9954template <
typename Derived>
9961 TClauses.reserve(Clauses.size());
9965 getDerived().getSema().OpenMP().StartOpenMPClause((*I)->getClauseKind());
9967 getDerived().getSema().OpenMP().EndOpenMPClause();
9969 TClauses.push_back(Clause);
9971 TClauses.push_back(
nullptr);
9975 if (D->hasAssociatedStmt() && D->getAssociatedStmt()) {
9976 getDerived().getSema().OpenMP().ActOnOpenMPRegionStart(
9977 D->getDirectiveKind(),
9983 if (D->getDirectiveKind() == OMPD_atomic ||
9984 D->getDirectiveKind() == OMPD_critical ||
9985 D->getDirectiveKind() == OMPD_section ||
9986 D->getDirectiveKind() == OMPD_master)
9987 CS = D->getAssociatedStmt();
9989 CS = D->getRawStmt();
9992 getSema().getLangOpts().OpenMPIRBuilder)
9996 getDerived().getSema().OpenMP().ActOnOpenMPRegionEnd(Body, TClauses);
10001 if (TClauses.size() != Clauses.size()) {
10007 if (D->getDirectiveKind() == OMPD_critical) {
10009 DirName =
getDerived().TransformDeclarationNameInfo(DirName);
10012 if (D->getDirectiveKind() == OMPD_cancellation_point) {
10014 }
else if (D->getDirectiveKind() == OMPD_cancel) {
10018 return getDerived().RebuildOMPExecutableDirective(
10019 D->getDirectiveKind(), DirName, CancelRegion, TClauses,
10020 AssociatedStmt.
get(), D->getBeginLoc(), D->getEndLoc());
10028template <
typename Derived>
10035 TClauses.reserve(Clauses.size());
10038 getDerived().getSema().OpenMP().StartOpenMPClause(
C->getClauseKind());
10040 getDerived().getSema().OpenMP().EndOpenMPClause();
10042 TClauses.push_back(Clause);
10044 TClauses.push_back(
nullptr);
10048 if (D->hasAssociatedStmt() && D->getAssociatedStmt()) {
10049 getDerived().getSema().OpenMP().ActOnOpenMPRegionStart(
10050 D->getDirectiveKind(),
10055 assert(D->getDirectiveKind() == OMPD_assume &&
10056 "Unexpected informational directive");
10057 Stmt *CS = D->getAssociatedStmt();
10061 getDerived().getSema().OpenMP().ActOnOpenMPRegionEnd(Body, TClauses);
10065 if (TClauses.size() != Clauses.size())
10070 return getDerived().RebuildOMPInformationalDirective(
10071 D->getDirectiveKind(), DirName, TClauses, AssociatedStmt.
get(),
10072 D->getBeginLoc(), D->getEndLoc());
10075template <
typename Derived>
10079 llvm::omp::Version OMPVersion =
10081 SemaRef.
Diag(D->getBeginLoc(), diag::err_omp_instantiation_not_supported)
10082 << getOpenMPDirectiveName(D->getDirectiveKind(), OMPVersion);
10086template <
typename Derived>
10088TreeTransform<Derived>::TransformOMPParallelDirective(OMPParallelDirective *D) {
10089 DeclarationNameInfo DirName;
10090 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10091 OMPD_parallel, DirName,
nullptr, D->getBeginLoc());
10092 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10093 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10097template <
typename Derived>
10101 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10102 OMPD_simd, DirName,
nullptr, D->getBeginLoc());
10103 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10104 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10108template <
typename Derived>
10112 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10113 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
10114 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10115 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10119template <
typename Derived>
10123 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10124 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
10125 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10126 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10130template <
typename Derived>
10134 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10135 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
10136 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10137 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10141template <
typename Derived>
10145 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10146 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
10147 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10148 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10152template <
typename Derived>
10154 OMPInterchangeDirective *D) {
10156 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10157 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
10158 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10159 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10163template <
typename Derived>
10167 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10168 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
10169 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10170 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10174template <
typename Derived>
10178 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10179 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
10180 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10181 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10185template <
typename Derived>
10189 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10190 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
10191 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10192 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10196template <
typename Derived>
10200 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10201 OMPD_for, DirName,
nullptr, D->getBeginLoc());
10202 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10203 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10207template <
typename Derived>
10211 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10212 OMPD_for_simd, DirName,
nullptr, D->getBeginLoc());
10213 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10214 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10218template <
typename Derived>
10222 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10223 OMPD_sections, DirName,
nullptr, D->getBeginLoc());
10224 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10225 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10229template <
typename Derived>
10233 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10234 OMPD_section, DirName,
nullptr, D->getBeginLoc());
10235 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10236 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10240template <
typename Derived>
10244 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10245 OMPD_scope, DirName,
nullptr, D->getBeginLoc());
10246 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10247 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10251template <
typename Derived>
10255 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10256 OMPD_single, DirName,
nullptr, D->getBeginLoc());
10257 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10258 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10262template <
typename Derived>
10266 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10267 OMPD_master, DirName,
nullptr, D->getBeginLoc());
10268 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10269 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10273template <
typename Derived>
10278 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10279 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10283template <
typename Derived>
10285 OMPParallelForDirective *D) {
10287 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10288 OMPD_parallel_for, DirName,
nullptr, D->getBeginLoc());
10289 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10290 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10294template <
typename Derived>
10296 OMPParallelForSimdDirective *D) {
10298 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10299 OMPD_parallel_for_simd, DirName,
nullptr, D->getBeginLoc());
10300 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10301 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10305template <
typename Derived>
10307 OMPParallelMasterDirective *D) {
10309 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10310 OMPD_parallel_master, DirName,
nullptr, D->getBeginLoc());
10311 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10312 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10316template <
typename Derived>
10318 OMPParallelMaskedDirective *D) {
10320 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10321 OMPD_parallel_masked, DirName,
nullptr, D->getBeginLoc());
10322 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10323 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10327template <
typename Derived>
10329 OMPParallelSectionsDirective *D) {
10331 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10332 OMPD_parallel_sections, DirName,
nullptr, D->getBeginLoc());
10333 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10334 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10338template <
typename Derived>
10342 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10343 OMPD_task, DirName,
nullptr, D->getBeginLoc());
10344 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10345 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10349template <
typename Derived>
10351 OMPTaskyieldDirective *D) {
10353 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10354 OMPD_taskyield, DirName,
nullptr, D->getBeginLoc());
10355 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10356 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10360template <
typename Derived>
10364 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10365 OMPD_barrier, DirName,
nullptr, D->getBeginLoc());
10366 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10367 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10371template <
typename Derived>
10375 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10376 OMPD_taskwait, DirName,
nullptr, D->getBeginLoc());
10377 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10378 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10382template <
typename Derived>
10386 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10387 OMPD_assume, DirName,
nullptr, D->getBeginLoc());
10388 StmtResult Res = getDerived().TransformOMPInformationalDirective(D);
10389 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10393template <
typename Derived>
10397 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10398 OMPD_error, DirName,
nullptr, D->getBeginLoc());
10399 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10400 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10404template <
typename Derived>
10406 OMPTaskgroupDirective *D) {
10408 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10409 OMPD_taskgroup, DirName,
nullptr, D->getBeginLoc());
10410 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10411 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10415template <
typename Derived>
10419 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10420 OMPD_flush, DirName,
nullptr, D->getBeginLoc());
10421 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10422 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10426template <
typename Derived>
10430 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10431 OMPD_depobj, DirName,
nullptr, D->getBeginLoc());
10432 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10433 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10437template <
typename Derived>
10441 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10442 OMPD_scan, DirName,
nullptr, D->getBeginLoc());
10443 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10444 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10448template <
typename Derived>
10450 OMPOrderedStandaloneDirective *D) {
10452 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10453 OMPD_ordered_standalone, DirName,
nullptr, D->getBeginLoc());
10454 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10455 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10459template <
typename Derived>
10461 OMPOrderedBlockAssocDirective *D) {
10463 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10464 OMPD_ordered_blockassoc, DirName,
nullptr, D->getBeginLoc());
10465 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10466 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10470template <
typename Derived>
10474 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10475 OMPD_atomic, DirName,
nullptr, D->getBeginLoc());
10476 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10477 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10481template <
typename Derived>
10485 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10486 OMPD_target, DirName,
nullptr, D->getBeginLoc());
10487 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10488 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10492template <
typename Derived>
10494 OMPTargetDataDirective *D) {
10496 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10497 OMPD_target_data, DirName,
nullptr, D->getBeginLoc());
10498 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10499 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10503template <
typename Derived>
10505 OMPTargetEnterDataDirective *D) {
10507 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10508 OMPD_target_enter_data, DirName,
nullptr, D->getBeginLoc());
10509 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10510 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10514template <
typename Derived>
10516 OMPTargetExitDataDirective *D) {
10518 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10519 OMPD_target_exit_data, DirName,
nullptr, D->getBeginLoc());
10520 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10521 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10525template <
typename Derived>
10527 OMPTargetParallelDirective *D) {
10529 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10530 OMPD_target_parallel, DirName,
nullptr, D->getBeginLoc());
10531 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10532 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10536template <
typename Derived>
10538 OMPTargetParallelForDirective *D) {
10540 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10541 OMPD_target_parallel_for, DirName,
nullptr, D->getBeginLoc());
10542 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10543 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10547template <
typename Derived>
10549 OMPTargetUpdateDirective *D) {
10551 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10552 OMPD_target_update, DirName,
nullptr, D->getBeginLoc());
10553 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10554 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10558template <
typename Derived>
10562 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10563 OMPD_teams, DirName,
nullptr, D->getBeginLoc());
10564 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10565 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10569template <
typename Derived>
10571 OMPCancellationPointDirective *D) {
10573 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10574 OMPD_cancellation_point, DirName,
nullptr, D->getBeginLoc());
10575 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10576 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10580template <
typename Derived>
10584 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10585 OMPD_cancel, DirName,
nullptr, D->getBeginLoc());
10586 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10587 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10591template <
typename Derived>
10595 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10596 OMPD_taskloop, DirName,
nullptr, D->getBeginLoc());
10597 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10598 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10602template <
typename Derived>
10604 OMPTaskLoopSimdDirective *D) {
10606 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10607 OMPD_taskloop_simd, DirName,
nullptr, D->getBeginLoc());
10608 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10609 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10613template <
typename Derived>
10615 OMPMasterTaskLoopDirective *D) {
10617 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10618 OMPD_master_taskloop, DirName,
nullptr, D->getBeginLoc());
10619 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10620 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10624template <
typename Derived>
10626 OMPMaskedTaskLoopDirective *D) {
10628 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10629 OMPD_masked_taskloop, DirName,
nullptr, D->getBeginLoc());
10630 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10631 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10635template <
typename Derived>
10637 OMPMasterTaskLoopSimdDirective *D) {
10639 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10640 OMPD_master_taskloop_simd, DirName,
nullptr, D->getBeginLoc());
10641 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10642 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10646template <
typename Derived>
10648 OMPMaskedTaskLoopSimdDirective *D) {
10650 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10651 OMPD_masked_taskloop_simd, DirName,
nullptr, D->getBeginLoc());
10652 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10653 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10657template <
typename Derived>
10659 OMPParallelMasterTaskLoopDirective *D) {
10661 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10662 OMPD_parallel_master_taskloop, DirName,
nullptr, D->getBeginLoc());
10663 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10664 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10668template <
typename Derived>
10670 OMPParallelMaskedTaskLoopDirective *D) {
10672 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10673 OMPD_parallel_masked_taskloop, DirName,
nullptr, D->getBeginLoc());
10674 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10675 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10679template <
typename Derived>
10682 OMPParallelMasterTaskLoopSimdDirective *D) {
10684 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10685 OMPD_parallel_master_taskloop_simd, DirName,
nullptr, D->getBeginLoc());
10686 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10687 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10691template <
typename Derived>
10694 OMPParallelMaskedTaskLoopSimdDirective *D) {
10696 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10697 OMPD_parallel_masked_taskloop_simd, DirName,
nullptr, D->getBeginLoc());
10698 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10699 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10703template <
typename Derived>
10705 OMPDistributeDirective *D) {
10707 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10708 OMPD_distribute, DirName,
nullptr, D->getBeginLoc());
10709 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10710 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10714template <
typename Derived>
10716 OMPDistributeParallelForDirective *D) {
10718 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10719 OMPD_distribute_parallel_for, DirName,
nullptr, D->getBeginLoc());
10720 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10721 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10725template <
typename Derived>
10728 OMPDistributeParallelForSimdDirective *D) {
10730 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10731 OMPD_distribute_parallel_for_simd, DirName,
nullptr, D->getBeginLoc());
10732 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10733 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10737template <
typename Derived>
10739 OMPDistributeSimdDirective *D) {
10741 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10742 OMPD_distribute_simd, DirName,
nullptr, D->getBeginLoc());
10743 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10744 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10748template <
typename Derived>
10750 OMPTargetParallelForSimdDirective *D) {
10752 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10753 OMPD_target_parallel_for_simd, DirName,
nullptr, D->getBeginLoc());
10754 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10755 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10759template <
typename Derived>
10761 OMPTargetSimdDirective *D) {
10763 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10764 OMPD_target_simd, DirName,
nullptr, D->getBeginLoc());
10765 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10766 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10770template <
typename Derived>
10772 OMPTeamsDistributeDirective *D) {
10774 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10775 OMPD_teams_distribute, DirName,
nullptr, D->getBeginLoc());
10776 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10777 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10781template <
typename Derived>
10783 OMPTeamsDistributeSimdDirective *D) {
10785 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10786 OMPD_teams_distribute_simd, DirName,
nullptr, D->getBeginLoc());
10787 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10788 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10792template <
typename Derived>
10794 OMPTeamsDistributeParallelForSimdDirective *D) {
10796 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10797 OMPD_teams_distribute_parallel_for_simd, DirName,
nullptr,
10799 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10800 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10804template <
typename Derived>
10806 OMPTeamsDistributeParallelForDirective *D) {
10808 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10809 OMPD_teams_distribute_parallel_for, DirName,
nullptr, D->getBeginLoc());
10810 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10811 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10815template <
typename Derived>
10817 OMPTargetTeamsDirective *D) {
10819 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10820 OMPD_target_teams, DirName,
nullptr, D->getBeginLoc());
10821 auto Res = getDerived().TransformOMPExecutableDirective(D);
10822 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10826template <
typename Derived>
10828 OMPTargetTeamsDistributeDirective *D) {
10830 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10831 OMPD_target_teams_distribute, DirName,
nullptr, D->getBeginLoc());
10832 auto Res = getDerived().TransformOMPExecutableDirective(D);
10833 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10837template <
typename Derived>
10840 OMPTargetTeamsDistributeParallelForDirective *D) {
10842 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10843 OMPD_target_teams_distribute_parallel_for, DirName,
nullptr,
10845 auto Res = getDerived().TransformOMPExecutableDirective(D);
10846 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10850template <
typename Derived>
10853 OMPTargetTeamsDistributeParallelForSimdDirective *D) {
10855 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10856 OMPD_target_teams_distribute_parallel_for_simd, DirName,
nullptr,
10858 auto Res = getDerived().TransformOMPExecutableDirective(D);
10859 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10863template <
typename Derived>
10866 OMPTargetTeamsDistributeSimdDirective *D) {
10868 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10869 OMPD_target_teams_distribute_simd, DirName,
nullptr, D->getBeginLoc());
10870 auto Res = getDerived().TransformOMPExecutableDirective(D);
10871 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10875template <
typename Derived>
10879 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10880 OMPD_interop, DirName,
nullptr, D->getBeginLoc());
10881 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10882 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10886template <
typename Derived>
10890 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10891 OMPD_dispatch, DirName,
nullptr, D->getBeginLoc());
10892 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10893 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10897template <
typename Derived>
10901 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10902 OMPD_masked, DirName,
nullptr, D->getBeginLoc());
10903 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10904 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10908template <
typename Derived>
10910 OMPGenericLoopDirective *D) {
10912 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10913 OMPD_loop, DirName,
nullptr, D->getBeginLoc());
10914 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10915 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10919template <
typename Derived>
10921 OMPTeamsGenericLoopDirective *D) {
10923 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10924 OMPD_teams_loop, DirName,
nullptr, D->getBeginLoc());
10925 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10926 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10930template <
typename Derived>
10932 OMPTargetTeamsGenericLoopDirective *D) {
10934 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10935 OMPD_target_teams_loop, DirName,
nullptr, D->getBeginLoc());
10936 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10937 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10941template <
typename Derived>
10943 OMPParallelGenericLoopDirective *D) {
10945 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10946 OMPD_parallel_loop, DirName,
nullptr, D->getBeginLoc());
10947 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10948 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10952template <
typename Derived>
10955 OMPTargetParallelGenericLoopDirective *D) {
10957 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10958 OMPD_target_parallel_loop, DirName,
nullptr, D->getBeginLoc());
10959 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10960 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10967template <
typename Derived>
10969 ExprResult Cond = getDerived().TransformExpr(
C->getCondition());
10970 if (Cond.isInvalid())
10972 return getDerived().RebuildOMPIfClause(
10973 C->getNameModifier(), Cond.get(),
C->getBeginLoc(),
C->getLParenLoc(),
10974 C->getNameModifierLoc(),
C->getColonLoc(),
C->getEndLoc());
10977template <
typename Derived>
10979 ExprResult Cond = getDerived().TransformExpr(
C->getCondition());
10980 if (Cond.isInvalid())
10982 return getDerived().RebuildOMPFinalClause(Cond.get(),
C->getBeginLoc(),
10983 C->getLParenLoc(),
C->getEndLoc());
10986template <
typename Derived>
10990 Vars.reserve(
C->varlist_size());
10991 for (
auto *
VE :
C->varlist()) {
10993 if (EVar.isInvalid())
10995 Vars.push_back(EVar.get());
10997 Expr *DimsModifierExpr =
C->getDimsModifierExpr();
10998 if (DimsModifierExpr) {
11000 if (EVar.isInvalid())
11002 DimsModifierExpr = EVar.get();
11004 return getDerived().RebuildOMPNumThreadsClause(
11005 Vars,
C->getPrescriptivenessModifier(),
11006 C->getPrescriptivenessModifierLoc(),
C->getDimsModifier(),
11007 DimsModifierExpr,
C->getDimsModifierLoc(),
C->getBeginLoc(),
11008 C->getLParenLoc(),
C->getEndLoc());
11011template <
typename Derived>
11014 ExprResult E = getDerived().TransformExpr(
C->getSafelen());
11017 return getDerived().RebuildOMPSafelenClause(
11018 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11021template <
typename Derived>
11024 ExprResult E = getDerived().TransformExpr(
C->getAllocator());
11027 return getDerived().RebuildOMPAllocatorClause(
11028 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11031template <
typename Derived>
11034 ExprResult E = getDerived().TransformExpr(
C->getSimdlen());
11037 return getDerived().RebuildOMPSimdlenClause(
11038 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11041template <
typename Derived>
11044 TransformedSizes.reserve(
C->getNumSizes());
11046 for (
Expr *E :
C->getSizesRefs()) {
11048 TransformedSizes.push_back(
nullptr);
11057 TransformedSizes.push_back(
T.get());
11060 if (!Changed && !getDerived().AlwaysRebuild())
11062 return RebuildOMPSizesClause(TransformedSizes,
C->getBeginLoc(),
11063 C->getLParenLoc(),
C->getEndLoc());
11066template <
typename Derived>
11070 TransformedCounts.reserve(
C->getNumCounts());
11071 for (
Expr *E :
C->getCountsRefs()) {
11073 TransformedCounts.push_back(
nullptr);
11080 TransformedCounts.push_back(
T.get());
11083 return RebuildOMPCountsClause(TransformedCounts,
C->getBeginLoc(),
11084 C->getLParenLoc(),
C->getEndLoc(),
11085 C->getOmpFillIndex(),
C->getOmpFillLoc());
11088template <
typename Derived>
11092 TransformedArgs.reserve(
C->getNumLoops());
11094 for (
Expr *E :
C->getArgsRefs()) {
11096 TransformedArgs.push_back(
nullptr);
11105 TransformedArgs.push_back(
T.get());
11108 if (!Changed && !getDerived().AlwaysRebuild())
11110 return RebuildOMPPermutationClause(TransformedArgs,
C->getBeginLoc(),
11111 C->getLParenLoc(),
C->getEndLoc());
11114template <
typename Derived>
11116 if (!getDerived().AlwaysRebuild())
11118 return RebuildOMPFullClause(
C->getBeginLoc(),
C->getEndLoc());
11121template <
typename Derived>
11124 ExprResult T = getDerived().TransformExpr(
C->getFactor());
11127 Expr *Factor =
T.get();
11128 bool Changed = Factor !=
C->getFactor();
11130 if (!Changed && !getDerived().AlwaysRebuild())
11132 return RebuildOMPPartialClause(Factor,
C->getBeginLoc(),
C->getLParenLoc(),
11136template <
typename Derived>
11138 ExprResult T = getDerived().TransformExpr(
C->getDepth());
11141 Expr *Depth =
T.get();
11142 bool Changed = Depth !=
C->getDepth();
11144 if (!Changed && !getDerived().AlwaysRebuild())
11146 return RebuildOMPDepthClause(Depth,
C->getBeginLoc(),
C->getLParenLoc(),
11150template <
typename Derived>
11153 ExprResult F = getDerived().TransformExpr(
C->getFirst());
11157 ExprResult Cn = getDerived().TransformExpr(
C->getCount());
11158 if (Cn.isInvalid())
11162 Expr *Count = Cn.get();
11164 bool Changed = (
First !=
C->getFirst()) || (Count !=
C->getCount());
11167 if (!Changed && !getDerived().AlwaysRebuild())
11170 return RebuildOMPLoopRangeClause(
First, Count,
C->getBeginLoc(),
11171 C->getLParenLoc(),
C->getFirstLoc(),
11172 C->getCountLoc(),
C->getEndLoc());
11175template <
typename Derived>
11178 ExprResult E = getDerived().TransformExpr(
C->getNumForLoops());
11181 return getDerived().RebuildOMPCollapseClause(
11182 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11185template <
typename Derived>
11189 C->getDefaultKind(),
C->getDefaultKindKwLoc(),
C->getDefaultVC(),
11190 C->getDefaultVCLoc(),
C->getBeginLoc(),
C->getLParenLoc(),
11194template <
typename Derived>
11201template <
typename Derived>
11204 Expr *Impex =
C->getImpexType();
11205 ExprResult TransformedImpex = getDerived().TransformExpr(Impex);
11207 if (TransformedImpex.isInvalid())
11210 return getDerived().RebuildOMPTransparentClause(
11211 TransformedImpex.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11215template <
typename Derived>
11219 C->getProcBindKind(),
C->getProcBindKindKwLoc(),
C->getBeginLoc(),
11220 C->getLParenLoc(),
C->getEndLoc());
11223template <
typename Derived>
11226 ExprResult E = getDerived().TransformExpr(
C->getChunkSize());
11229 return getDerived().RebuildOMPScheduleClause(
11230 C->getFirstScheduleModifier(),
C->getSecondScheduleModifier(),
11231 C->getScheduleKind(), E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11232 C->getFirstScheduleModifierLoc(),
C->getSecondScheduleModifierLoc(),
11233 C->getScheduleKindLoc(),
C->getCommaLoc(),
C->getEndLoc());
11236template <
typename Derived>
11240 if (
auto *
Num =
C->getNumForLoops()) {
11241 E = getDerived().TransformExpr(
Num);
11245 return getDerived().RebuildOMPOrderedClause(
C->getBeginLoc(),
C->getEndLoc(),
11246 C->getLParenLoc(), E.get());
11249template <
typename Derived>
11253 if (
Expr *Evt =
C->getEventHandler()) {
11254 E = getDerived().TransformExpr(Evt);
11258 return getDerived().RebuildOMPDetachClause(E.get(),
C->getBeginLoc(),
11259 C->getLParenLoc(),
C->getEndLoc());
11262template <
typename Derived>
11267 Cond = getDerived().TransformExpr(
Condition);
11268 if (Cond.isInvalid())
11271 return getDerived().RebuildOMPNowaitClause(Cond.get(),
C->getBeginLoc(),
11272 C->getLParenLoc(),
C->getEndLoc());
11275template <
typename Derived>
11282template <
typename Derived>
11289template <
typename Derived>
11295template <
typename Derived>
11301template <
typename Derived>
11308template <
typename Derived>
11310 OMPUpdateDependObjectsClause *
C) {
11315template <
typename Derived>
11322template <
typename Derived>
11329template <
typename Derived>
11335template <
typename Derived>
11341template <
typename Derived>
11343 ExprResult E = getDerived().TransformExpr(
C->getExpr());
11346 return getDerived().RebuildOMPHoldsClause(E.get(),
C->getBeginLoc(),
11347 C->getLParenLoc(),
C->getEndLoc());
11350template <
typename Derived>
11356template <
typename Derived>
11361template <
typename Derived>
11363 OMPNoOpenMPRoutinesClause *
C) {
11366template <
typename Derived>
11368 OMPNoOpenMPConstructsClause *
C) {
11371template <
typename Derived>
11373 OMPNoParallelismClause *
C) {
11377template <
typename Derived>
11384template <
typename Derived>
11391template <
typename Derived>
11398template <
typename Derived>
11405template <
typename Derived>
11412template <
typename Derived>
11418template <
typename Derived>
11425template <
typename Derived>
11431template <
typename Derived>
11438template <
typename Derived>
11440 ExprResult IVR = getDerived().TransformExpr(
C->getInteropVar());
11441 if (IVR.isInvalid())
11445 for (OMPInitClause::PrefView P :
C->prefs()) {
11446 Expr *NewFr =
nullptr;
11448 ExprResult ER = getDerived().TransformExpr(P.Fr);
11449 if (ER.isInvalid())
11454 NewAttrs.reserve(P.Attrs.size());
11455 for (
Expr *A : P.Attrs) {
11456 ExprResult ER = getDerived().TransformExpr(A);
11457 if (ER.isInvalid())
11459 NewAttrs.push_back(ER.get());
11461 InteropInfo.Prefs.emplace_back(NewFr, std::move(NewAttrs));
11463 InteropInfo.HasPreferAttrs =
C->hasPreferAttrs();
11464 return getDerived().RebuildOMPInitClause(IVR.get(), InteropInfo,
11465 C->getBeginLoc(),
C->getLParenLoc(),
11466 C->getVarLoc(),
C->getEndLoc());
11469template <
typename Derived>
11471 ExprResult ER = getDerived().TransformExpr(
C->getInteropVar());
11472 if (ER.isInvalid())
11474 return getDerived().RebuildOMPUseClause(ER.get(),
C->getBeginLoc(),
11475 C->getLParenLoc(),
C->getVarLoc(),
11479template <
typename Derived>
11483 if (
Expr *IV =
C->getInteropVar()) {
11484 ER = getDerived().TransformExpr(IV);
11485 if (ER.isInvalid())
11488 return getDerived().RebuildOMPDestroyClause(ER.get(),
C->getBeginLoc(),
11489 C->getLParenLoc(),
C->getVarLoc(),
11493template <
typename Derived>
11496 ExprResult Cond = getDerived().TransformExpr(
C->getCondition());
11497 if (Cond.isInvalid())
11499 return getDerived().RebuildOMPNovariantsClause(
11500 Cond.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11503template <
typename Derived>
11506 ExprResult Cond = getDerived().TransformExpr(
C->getCondition());
11507 if (Cond.isInvalid())
11509 return getDerived().RebuildOMPNocontextClause(
11510 Cond.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11513template <
typename Derived>
11516 ExprResult ThreadID = getDerived().TransformExpr(
C->getThreadID());
11517 if (ThreadID.isInvalid())
11519 return getDerived().RebuildOMPFilterClause(ThreadID.get(),
C->getBeginLoc(),
11520 C->getLParenLoc(),
C->getEndLoc());
11523template <
typename Derived>
11525 ExprResult E = getDerived().TransformExpr(
C->getAlignment());
11528 return getDerived().RebuildOMPAlignClause(E.get(),
C->getBeginLoc(),
11529 C->getLParenLoc(),
C->getEndLoc());
11532template <
typename Derived>
11534 OMPUnifiedAddressClause *
C) {
11535 llvm_unreachable(
"unified_address clause cannot appear in dependent context");
11538template <
typename Derived>
11540 OMPUnifiedSharedMemoryClause *
C) {
11542 "unified_shared_memory clause cannot appear in dependent context");
11545template <
typename Derived>
11547 OMPReverseOffloadClause *
C) {
11548 llvm_unreachable(
"reverse_offload clause cannot appear in dependent context");
11551template <
typename Derived>
11553 OMPDynamicAllocatorsClause *
C) {
11555 "dynamic_allocators clause cannot appear in dependent context");
11558template <
typename Derived>
11560 OMPAtomicDefaultMemOrderClause *
C) {
11562 "atomic_default_mem_order clause cannot appear in dependent context");
11565template <
typename Derived>
11568 llvm_unreachable(
"self_maps clause cannot appear in dependent context");
11571template <
typename Derived>
11574 C->getBeginLoc(),
C->getLParenLoc(),
11578template <
typename Derived>
11582 C->getSeverityKind(),
C->getSeverityKindKwLoc(),
C->getBeginLoc(),
11583 C->getLParenLoc(),
C->getEndLoc());
11586template <
typename Derived>
11589 ExprResult E = getDerived().TransformExpr(
C->getMessageString());
11592 return getDerived().RebuildOMPMessageClause(
11593 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11596template <
typename Derived>
11600 Vars.reserve(
C->varlist_size());
11601 for (
auto *
VE :
C->varlist()) {
11603 if (EVar.isInvalid())
11605 Vars.push_back(EVar.get());
11607 return getDerived().RebuildOMPPrivateClause(
11608 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11611template <
typename Derived>
11613 OMPFirstprivateClause *
C) {
11615 Vars.reserve(
C->varlist_size());
11616 for (
auto *
VE :
C->varlist()) {
11618 if (EVar.isInvalid())
11620 Vars.push_back(EVar.get());
11622 return getDerived().RebuildOMPFirstprivateClause(
11623 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11626template <
typename Derived>
11630 Vars.reserve(
C->varlist_size());
11631 for (
auto *
VE :
C->varlist()) {
11633 if (EVar.isInvalid())
11635 Vars.push_back(EVar.get());
11637 return getDerived().RebuildOMPLastprivateClause(
11638 Vars,
C->getKind(),
C->getKindLoc(),
C->getColonLoc(),
C->getBeginLoc(),
11639 C->getLParenLoc(),
C->getEndLoc());
11642template <
typename Derived>
11646 Vars.reserve(
C->varlist_size());
11647 for (
auto *
VE :
C->varlist()) {
11649 if (EVar.isInvalid())
11651 Vars.push_back(EVar.get());
11653 return getDerived().RebuildOMPSharedClause(Vars,
C->getBeginLoc(),
11654 C->getLParenLoc(),
C->getEndLoc());
11657template <
typename Derived>
11661 Vars.reserve(
C->varlist_size());
11662 for (
auto *
VE :
C->varlist()) {
11664 if (EVar.isInvalid())
11666 Vars.push_back(EVar.get());
11669 ReductionIdScopeSpec.
Adopt(
C->getQualifierLoc());
11672 if (NameInfo.getName()) {
11673 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
11674 if (!NameInfo.getName())
11680 for (
auto *E :
C->reduction_ops()) {
11685 for (
auto *D : ULE->decls()) {
11688 Decls.addDecl(InstD, InstD->getAccess());
11692 ReductionIdScopeSpec.getWithLocInContext(SemaRef.
Context), NameInfo,
11693 true, Decls.begin(), Decls.end(),
11696 UnresolvedReductions.push_back(
nullptr);
11698 return getDerived().RebuildOMPReductionClause(
11699 Vars,
C->getModifier(),
C->getOriginalSharingModifier(),
C->getBeginLoc(),
11700 C->getLParenLoc(),
C->getModifierLoc(),
C->getColonLoc(),
C->getEndLoc(),
11701 ReductionIdScopeSpec, NameInfo, UnresolvedReductions);
11704template <
typename Derived>
11706 OMPTaskReductionClause *
C) {
11708 Vars.reserve(
C->varlist_size());
11709 for (
auto *
VE :
C->varlist()) {
11711 if (EVar.isInvalid())
11713 Vars.push_back(EVar.get());
11716 ReductionIdScopeSpec.
Adopt(
C->getQualifierLoc());
11719 if (NameInfo.getName()) {
11720 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
11721 if (!NameInfo.getName())
11727 for (
auto *E :
C->reduction_ops()) {
11732 for (
auto *D : ULE->decls()) {
11735 Decls.addDecl(InstD, InstD->getAccess());
11739 ReductionIdScopeSpec.getWithLocInContext(SemaRef.
Context), NameInfo,
11740 true, Decls.begin(), Decls.end(),
11743 UnresolvedReductions.push_back(
nullptr);
11745 return getDerived().RebuildOMPTaskReductionClause(
11746 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getColonLoc(),
11747 C->getEndLoc(), ReductionIdScopeSpec, NameInfo, UnresolvedReductions);
11750template <
typename Derived>
11754 Vars.reserve(
C->varlist_size());
11755 for (
auto *
VE :
C->varlist()) {
11757 if (EVar.isInvalid())
11759 Vars.push_back(EVar.get());
11762 ReductionIdScopeSpec.
Adopt(
C->getQualifierLoc());
11765 if (NameInfo.getName()) {
11766 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
11767 if (!NameInfo.getName())
11773 for (
auto *E :
C->reduction_ops()) {
11778 for (
auto *D : ULE->decls()) {
11781 Decls.addDecl(InstD, InstD->getAccess());
11785 ReductionIdScopeSpec.getWithLocInContext(SemaRef.
Context), NameInfo,
11786 true, Decls.begin(), Decls.end(),
11789 UnresolvedReductions.push_back(
nullptr);
11791 return getDerived().RebuildOMPInReductionClause(
11792 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getColonLoc(),
11793 C->getEndLoc(), ReductionIdScopeSpec, NameInfo, UnresolvedReductions);
11796template <
typename Derived>
11800 Vars.reserve(
C->varlist_size());
11801 for (
auto *
VE :
C->varlist()) {
11803 if (EVar.isInvalid())
11805 Vars.push_back(EVar.get());
11807 ExprResult Step = getDerived().TransformExpr(
C->getStep());
11808 if (Step.isInvalid())
11810 return getDerived().RebuildOMPLinearClause(
11811 Vars, Step.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getModifier(),
11812 C->getModifierLoc(),
C->getColonLoc(),
C->getStepModifierLoc(),
11816template <
typename Derived>
11820 Vars.reserve(
C->varlist_size());
11821 for (
auto *
VE :
C->varlist()) {
11823 if (EVar.isInvalid())
11825 Vars.push_back(EVar.get());
11827 ExprResult Alignment = getDerived().TransformExpr(
C->getAlignment());
11828 if (Alignment.isInvalid())
11830 return getDerived().RebuildOMPAlignedClause(
11831 Vars, Alignment.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11832 C->getColonLoc(),
C->getEndLoc());
11835template <
typename Derived>
11839 Vars.reserve(
C->varlist_size());
11840 for (
auto *
VE :
C->varlist()) {
11842 if (EVar.isInvalid())
11844 Vars.push_back(EVar.get());
11846 return getDerived().RebuildOMPCopyinClause(Vars,
C->getBeginLoc(),
11847 C->getLParenLoc(),
C->getEndLoc());
11850template <
typename Derived>
11854 Vars.reserve(
C->varlist_size());
11855 for (
auto *
VE :
C->varlist()) {
11857 if (EVar.isInvalid())
11859 Vars.push_back(EVar.get());
11861 return getDerived().RebuildOMPCopyprivateClause(
11862 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11865template <
typename Derived>
11868 Vars.reserve(
C->varlist_size());
11869 for (
auto *
VE :
C->varlist()) {
11871 if (EVar.isInvalid())
11873 Vars.push_back(EVar.get());
11875 return getDerived().RebuildOMPFlushClause(Vars,
C->getBeginLoc(),
11876 C->getLParenLoc(),
C->getEndLoc());
11879template <
typename Derived>
11882 ExprResult E = getDerived().TransformExpr(
C->getDepobj());
11885 return getDerived().RebuildOMPDepobjClause(E.get(),
C->getBeginLoc(),
11886 C->getLParenLoc(),
C->getEndLoc());
11889template <
typename Derived>
11893 Expr *DepModifier =
C->getModifier();
11895 ExprResult DepModRes = getDerived().TransformExpr(DepModifier);
11896 if (DepModRes.isInvalid())
11898 DepModifier = DepModRes.get();
11900 Vars.reserve(
C->varlist_size());
11901 for (
auto *
VE :
C->varlist()) {
11903 if (EVar.isInvalid())
11905 Vars.push_back(EVar.get());
11907 return getDerived().RebuildOMPDependClause(
11908 {
C->getDependencyKind(),
C->getDependencyLoc(),
C->getColonLoc(),
11909 C->getOmpAllMemoryLoc()},
11910 DepModifier, Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11913template <
typename Derived>
11916 ExprResult E = getDerived().TransformExpr(
C->getDevice());
11919 return getDerived().RebuildOMPDeviceClause(
11920 C->getModifier(), E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11921 C->getModifierLoc(),
C->getEndLoc());
11924template <
typename Derived,
class T>
11931 Vars.reserve(
C->varlist_size());
11932 for (
auto *
VE :
C->varlist()) {
11936 Vars.push_back(EVar.
get());
11940 if (
C->getMapperQualifierLoc()) {
11941 QualifierLoc = TT.
getDerived().TransformNestedNameSpecifierLoc(
11942 C->getMapperQualifierLoc());
11946 MapperIdScopeSpec.
Adopt(QualifierLoc);
11947 MapperIdInfo =
C->getMapperIdInfo();
11948 if (MapperIdInfo.
getName()) {
11949 MapperIdInfo = TT.
getDerived().TransformDeclarationNameInfo(MapperIdInfo);
11955 for (
auto *E :
C->mapperlists()) {
11960 for (
auto *D : ULE->decls()) {
11963 Decls.addDecl(InstD, InstD->
getAccess());
11968 MapperIdInfo,
true, Decls.begin(), Decls.end(),
11971 UnresolvedMappers.push_back(
nullptr);
11977template <
typename Derived>
11979 OMPVarListLocTy Locs(
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11981 Expr *IteratorModifier =
C->getIteratorModifier();
11982 if (IteratorModifier) {
11983 ExprResult MapModRes = getDerived().TransformExpr(IteratorModifier);
11984 if (MapModRes.isInvalid())
11986 IteratorModifier = MapModRes.
get();
11992 *
this,
C, Vars, MapperIdScopeSpec, MapperIdInfo, UnresolvedMappers))
11994 return getDerived().RebuildOMPMapClause(
11995 IteratorModifier,
C->getMapTypeModifiers(),
C->getMapTypeModifiersLoc(),
11996 MapperIdScopeSpec, MapperIdInfo,
C->getMapType(),
C->isImplicitMapType(),
11997 C->getMapLoc(),
C->getColonLoc(), Vars, Locs, UnresolvedMappers);
12000template <
typename Derived>
12003 Expr *Allocator =
C->getAllocator();
12005 ExprResult AllocatorRes = getDerived().TransformExpr(Allocator);
12006 if (AllocatorRes.isInvalid())
12008 Allocator = AllocatorRes.get();
12010 Expr *Alignment =
C->getAlignment();
12012 ExprResult AlignmentRes = getDerived().TransformExpr(Alignment);
12013 if (AlignmentRes.isInvalid())
12015 Alignment = AlignmentRes.get();
12018 Vars.reserve(
C->varlist_size());
12019 for (
auto *
VE :
C->varlist()) {
12021 if (EVar.isInvalid())
12023 Vars.push_back(EVar.get());
12025 return getDerived().RebuildOMPAllocateClause(
12026 Allocator, Alignment,
C->getFirstAllocateModifier(),
12027 C->getFirstAllocateModifierLoc(),
C->getSecondAllocateModifier(),
12028 C->getSecondAllocateModifierLoc(), Vars,
C->getBeginLoc(),
12029 C->getLParenLoc(),
C->getColonLoc(),
C->getEndLoc());
12032template <
typename Derived>
12036 Vars.reserve(
C->varlist_size());
12037 for (
auto *
VE :
C->varlist()) {
12039 if (EVar.isInvalid())
12041 Vars.push_back(EVar.get());
12043 Expr *ModifierExpr =
C->getModifierExpr();
12044 if (ModifierExpr) {
12046 if (EVar.isInvalid())
12048 ModifierExpr = EVar.get();
12050 return getDerived().RebuildOMPNumTeamsClause(
12051 Vars,
C->getModifier(), ModifierExpr,
C->getModifierLoc(),
12053 C->getLParenLoc(),
C->getEndLoc());
12056template <
typename Derived>
12060 Vars.reserve(
C->varlist_size());
12061 for (
auto *
VE :
C->varlist()) {
12063 if (EVar.isInvalid())
12065 Vars.push_back(EVar.get());
12067 Expr *ModifierExpr =
C->getModifierExpr();
12068 if (ModifierExpr) {
12070 if (EVar.isInvalid())
12072 ModifierExpr = EVar.get();
12074 return getDerived().RebuildOMPThreadLimitClause(
12075 Vars,
C->getModifier(), ModifierExpr,
C->getModifierLoc(),
12076 C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
12079template <
typename Derived>
12082 ExprResult E = getDerived().TransformExpr(
C->getPriority());
12085 return getDerived().RebuildOMPPriorityClause(
12086 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
12089template <
typename Derived>
12092 ExprResult E = getDerived().TransformExpr(
C->getGrainsize());
12095 return getDerived().RebuildOMPGrainsizeClause(
12096 C->getModifier(), E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
12097 C->getModifierLoc(),
C->getEndLoc());
12100template <
typename Derived>
12103 ExprResult E = getDerived().TransformExpr(
C->getNumTasks());
12106 return getDerived().RebuildOMPNumTasksClause(
12107 C->getModifier(), E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
12108 C->getModifierLoc(),
C->getEndLoc());
12111template <
typename Derived>
12113 ExprResult E = getDerived().TransformExpr(
C->getHint());
12116 return getDerived().RebuildOMPHintClause(E.get(),
C->getBeginLoc(),
12117 C->getLParenLoc(),
C->getEndLoc());
12120template <
typename Derived>
12122 OMPDistScheduleClause *
C) {
12123 ExprResult E = getDerived().TransformExpr(
C->getChunkSize());
12126 return getDerived().RebuildOMPDistScheduleClause(
12127 C->getDistScheduleKind(), E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
12128 C->getDistScheduleKindLoc(),
C->getCommaLoc(),
C->getEndLoc());
12131template <
typename Derived>
12137 C->getDefaultmapKind(),
12140 C->getDefaultmapModifierLoc(),
12141 C->getDefaultmapKindLoc(),
12145template <
typename Derived>
12149 Expr *IteratorModifier =
C->getIteratorModifier();
12150 if (IteratorModifier) {
12151 ExprResult MapModRes = getDerived().TransformExpr(IteratorModifier);
12152 if (MapModRes.isInvalid())
12154 IteratorModifier = MapModRes.get();
12160 *
this,
C, Vars, MapperIdScopeSpec, MapperIdInfo, UnresolvedMappers))
12162 return getDerived().RebuildOMPToClause(
12163 C->getMotionModifiers(),
C->getMotionModifiersLoc(), IteratorModifier,
12164 MapperIdScopeSpec, MapperIdInfo,
C->getColonLoc(), Vars, Locs,
12165 UnresolvedMappers);
12168template <
typename Derived>
12172 Expr *IteratorModifier =
C->getIteratorModifier();
12173 if (IteratorModifier) {
12174 ExprResult MapModRes = getDerived().TransformExpr(IteratorModifier);
12175 if (MapModRes.isInvalid())
12177 IteratorModifier = MapModRes.get();
12183 *
this,
C, Vars, MapperIdScopeSpec, MapperIdInfo, UnresolvedMappers))
12185 return getDerived().RebuildOMPFromClause(
12186 C->getMotionModifiers(),
C->getMotionModifiersLoc(), IteratorModifier,
12187 MapperIdScopeSpec, MapperIdInfo,
C->getColonLoc(), Vars, Locs,
12188 UnresolvedMappers);
12191template <
typename Derived>
12193 OMPUseDevicePtrClause *
C) {
12195 Vars.reserve(
C->varlist_size());
12196 for (
auto *
VE :
C->varlist()) {
12198 if (EVar.isInvalid())
12200 Vars.push_back(EVar.get());
12203 return getDerived().RebuildOMPUseDevicePtrClause(
12204 Vars, Locs,
C->getFallbackModifier(),
C->getFallbackModifierLoc());
12207template <
typename Derived>
12209 OMPUseDeviceAddrClause *
C) {
12211 Vars.reserve(
C->varlist_size());
12212 for (
auto *
VE :
C->varlist()) {
12214 if (EVar.isInvalid())
12216 Vars.push_back(EVar.get());
12219 return getDerived().RebuildOMPUseDeviceAddrClause(Vars, Locs);
12222template <
typename Derived>
12226 Vars.reserve(
C->varlist_size());
12227 for (
auto *
VE :
C->varlist()) {
12229 if (EVar.isInvalid())
12231 Vars.push_back(EVar.get());
12234 return getDerived().RebuildOMPIsDevicePtrClause(Vars, Locs);
12237template <
typename Derived>
12239 OMPHasDeviceAddrClause *
C) {
12241 Vars.reserve(
C->varlist_size());
12242 for (
auto *
VE :
C->varlist()) {
12244 if (EVar.isInvalid())
12246 Vars.push_back(EVar.get());
12249 return getDerived().RebuildOMPHasDeviceAddrClause(Vars, Locs);
12252template <
typename Derived>
12256 Vars.reserve(
C->varlist_size());
12257 for (
auto *
VE :
C->varlist()) {
12259 if (EVar.isInvalid())
12261 Vars.push_back(EVar.get());
12263 return getDerived().RebuildOMPNontemporalClause(
12264 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
12267template <
typename Derived>
12271 Vars.reserve(
C->varlist_size());
12272 for (
auto *
VE :
C->varlist()) {
12274 if (EVar.isInvalid())
12276 Vars.push_back(EVar.get());
12278 return getDerived().RebuildOMPInclusiveClause(
12279 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
12282template <
typename Derived>
12286 Vars.reserve(
C->varlist_size());
12287 for (
auto *
VE :
C->varlist()) {
12289 if (EVar.isInvalid())
12291 Vars.push_back(EVar.get());
12293 return getDerived().RebuildOMPExclusiveClause(
12294 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
12297template <
typename Derived>
12299 OMPUsesAllocatorsClause *
C) {
12301 Data.reserve(
C->getNumberOfAllocators());
12302 for (
unsigned I = 0, E =
C->getNumberOfAllocators(); I < E; ++I) {
12303 OMPUsesAllocatorsClause::Data D =
C->getAllocatorData(I);
12305 if (Allocator.isInvalid())
12309 AllocatorTraits = getDerived().TransformExpr(AT);
12310 if (AllocatorTraits.isInvalid())
12314 NewD.Allocator = Allocator.get();
12315 NewD.AllocatorTraits = AllocatorTraits.get();
12319 return getDerived().RebuildOMPUsesAllocatorsClause(
12320 Data,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
12323template <
typename Derived>
12327 Locators.reserve(
C->varlist_size());
12329 if (
Expr *Modifier =
C->getModifier()) {
12330 ModifierRes = getDerived().TransformExpr(Modifier);
12331 if (ModifierRes.isInvalid())
12334 for (
Expr *E :
C->varlist()) {
12335 ExprResult Locator = getDerived().TransformExpr(E);
12336 if (Locator.isInvalid())
12338 Locators.push_back(Locator.get());
12340 return getDerived().RebuildOMPAffinityClause(
12341 C->getBeginLoc(),
C->getLParenLoc(),
C->getColonLoc(),
C->getEndLoc(),
12342 ModifierRes.get(), Locators);
12345template <
typename Derived>
12348 C->getKind(),
C->getKindKwLoc(),
C->getBeginLoc(),
C->getLParenLoc(),
12349 C->getEndLoc(),
C->getModifier(),
C->getModifierKwLoc());
12352template <
typename Derived>
12355 C->getBindKind(),
C->getBindKindLoc(),
C->getBeginLoc(),
12356 C->getLParenLoc(),
C->getEndLoc());
12359template <
typename Derived>
12361 OMPXDynCGroupMemClause *
C) {
12363 if (
Size.isInvalid())
12365 return getDerived().RebuildOMPXDynCGroupMemClause(
12366 Size.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
12369template <
typename Derived>
12371 OMPDynGroupprivateClause *
C) {
12373 if (
Size.isInvalid())
12375 return getDerived().RebuildOMPDynGroupprivateClause(
12376 C->getDynGroupprivateModifier(),
C->getDynGroupprivateFallbackModifier(),
12377 Size.get(),
C->getBeginLoc(),
C->getLParenLoc(),
12378 C->getDynGroupprivateModifierLoc(),
12379 C->getDynGroupprivateFallbackModifierLoc(),
C->getEndLoc());
12382template <
typename Derived>
12386 Vars.reserve(
C->varlist_size());
12387 for (
auto *
VE :
C->varlist()) {
12389 if (EVar.isInvalid())
12391 Vars.push_back(EVar.get());
12393 return getDerived().RebuildOMPDoacrossClause(
12394 C->getDependenceType(),
C->getDependenceLoc(),
C->getColonLoc(), Vars,
12395 C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
12398template <
typename Derived>
12402 for (
auto *A :
C->getAttrs())
12403 NewAttrs.push_back(getDerived().TransformAttr(A));
12404 return getDerived().RebuildOMPXAttributeClause(
12405 NewAttrs,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
12408template <
typename Derived>
12417template <
typename Derived>
12418class OpenACCClauseTransform final
12420 TreeTransform<Derived> &Self;
12421 ArrayRef<const OpenACCClause *> ExistingClauses;
12422 SemaOpenACC::OpenACCParsedClause &ParsedClause;
12423 OpenACCClause *NewClause =
nullptr;
12426 ExprResult Res = Self.TransformExpr(VarRef);
12428 if (!Res.isUsable())
12431 Res = Self.getSema().OpenACC().ActOnVar(ParsedClause.getDirectiveKind(),
12432 ParsedClause.getClauseKind(),
12438 llvm::SmallVector<Expr *> VisitVarList(ArrayRef<Expr *> VarList) {
12439 llvm::SmallVector<Expr *> InstantiatedVarList;
12440 for (Expr *CurVar : VarList) {
12443 if (VarRef.isUsable())
12444 InstantiatedVarList.push_back(VarRef.get());
12447 return InstantiatedVarList;
12451 OpenACCClauseTransform(TreeTransform<Derived> &Self,
12452 ArrayRef<const OpenACCClause *> ExistingClauses,
12453 SemaOpenACC::OpenACCParsedClause &PC)
12454 : Self(Self), ExistingClauses(ExistingClauses), ParsedClause(PC) {}
12456 OpenACCClause *CreatedClause()
const {
return NewClause; }
12458#define VISIT_CLAUSE(CLAUSE_NAME) \
12459 void Visit##CLAUSE_NAME##Clause(const OpenACC##CLAUSE_NAME##Clause &Clause);
12460#include "clang/Basic/OpenACCClauses.def"
12463template <
typename Derived>
12464void OpenACCClauseTransform<Derived>::VisitDefaultClause(
12466 ParsedClause.setDefaultDetails(
C.getDefaultClauseKind());
12469 Self.getSema().getASTContext(), ParsedClause.getDefaultClauseKind(),
12470 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12471 ParsedClause.getEndLoc());
12474template <
typename Derived>
12475void OpenACCClauseTransform<Derived>::VisitIfClause(
const OpenACCIfClause &
C) {
12476 Expr *Cond =
const_cast<Expr *
>(
C.getConditionExpr());
12477 assert(Cond &&
"If constructed with invalid Condition");
12481 if (Res.isInvalid() || !Res.get().second)
12484 ParsedClause.setConditionDetails(Res.get().second);
12487 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12488 ParsedClause.getLParenLoc(), ParsedClause.getConditionExpr(),
12489 ParsedClause.getEndLoc());
12492template <
typename Derived>
12493void OpenACCClauseTransform<Derived>::VisitSelfClause(
12499 for (
Expr *CurVar :
C.getVarList()) {
12502 if (!Res.isUsable())
12505 Res =
Self.getSema().OpenACC().ActOnVar(ParsedClause.getDirectiveKind(),
12506 ParsedClause.getClauseKind(),
12509 if (Res.isUsable())
12510 InstantiatedVarList.push_back(Res.get());
12513 ParsedClause.setVarListDetails(InstantiatedVarList,
12517 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12518 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12519 ParsedClause.getEndLoc());
12522 if (
C.hasConditionExpr()) {
12523 Expr *Cond =
const_cast<Expr *
>(
C.getConditionExpr());
12525 Self.TransformCondition(Cond->getExprLoc(),
nullptr, Cond,
12528 if (Res.isInvalid() || !Res.get().second)
12531 ParsedClause.setConditionDetails(Res.get().second);
12535 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12536 ParsedClause.getLParenLoc(), ParsedClause.getConditionExpr(),
12537 ParsedClause.getEndLoc());
12541template <
typename Derived>
12542void OpenACCClauseTransform<Derived>::VisitNumGangsClause(
12546 for (
Expr *CurIntExpr :
C.getIntExprs()) {
12549 if (!Res.isUsable())
12554 C.getBeginLoc(), Res.get());
12555 if (!Res.isUsable())
12558 InstantiatedIntExprs.push_back(Res.get());
12561 ParsedClause.setIntExprDetails(InstantiatedIntExprs);
12563 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12564 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs(),
12565 ParsedClause.getEndLoc());
12568template <
typename Derived>
12569void OpenACCClauseTransform<Derived>::VisitPrivateClause(
12574 for (
const auto [RefExpr, InitRecipe] :
12575 llvm::zip(
C.getVarList(),
C.getInitRecipes())) {
12578 if (VarRef.isUsable()) {
12579 InstantiatedVarList.push_back(VarRef.get());
12583 if (InitRecipe.isSet())
12584 InitRecipes.push_back(InitRecipe);
12586 InitRecipes.push_back(
12587 Self.getSema().OpenACC().CreatePrivateInitRecipe(VarRef.get()));
12590 ParsedClause.setVarListDetails(InstantiatedVarList,
12594 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12595 ParsedClause.getLParenLoc(), ParsedClause.getVarList(), InitRecipes,
12596 ParsedClause.getEndLoc());
12599template <
typename Derived>
12600void OpenACCClauseTransform<Derived>::VisitHostClause(
12602 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12606 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12607 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12608 ParsedClause.getEndLoc());
12611template <
typename Derived>
12612void OpenACCClauseTransform<Derived>::VisitDeviceClause(
12614 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12618 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12619 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12620 ParsedClause.getEndLoc());
12623template <
typename Derived>
12624void OpenACCClauseTransform<Derived>::VisitFirstPrivateClause(
12629 for (
const auto [RefExpr, InitRecipe] :
12630 llvm::zip(
C.getVarList(),
C.getInitRecipes())) {
12633 if (VarRef.isUsable()) {
12634 InstantiatedVarList.push_back(VarRef.get());
12638 if (InitRecipe.isSet())
12639 InitRecipes.push_back(InitRecipe);
12641 InitRecipes.push_back(
12642 Self.getSema().OpenACC().CreateFirstPrivateInitRecipe(
12646 ParsedClause.setVarListDetails(InstantiatedVarList,
12650 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12651 ParsedClause.getLParenLoc(), ParsedClause.getVarList(), InitRecipes,
12652 ParsedClause.getEndLoc());
12655template <
typename Derived>
12656void OpenACCClauseTransform<Derived>::VisitNoCreateClause(
12658 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12662 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12663 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12664 ParsedClause.getEndLoc());
12667template <
typename Derived>
12668void OpenACCClauseTransform<Derived>::VisitPresentClause(
12670 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12674 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12675 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12676 ParsedClause.getEndLoc());
12679template <
typename Derived>
12680void OpenACCClauseTransform<Derived>::VisitCopyClause(
12682 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12683 C.getModifierList());
12686 Self.getSema().getASTContext(), ParsedClause.getClauseKind(),
12687 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12688 ParsedClause.getModifierList(), ParsedClause.getVarList(),
12689 ParsedClause.getEndLoc());
12692template <
typename Derived>
12693void OpenACCClauseTransform<Derived>::VisitLinkClause(
12695 llvm_unreachable(
"link clause not valid unless a decl transform");
12698template <
typename Derived>
12699void OpenACCClauseTransform<Derived>::VisitDeviceResidentClause(
12701 llvm_unreachable(
"device_resident clause not valid unless a decl transform");
12703template <
typename Derived>
12704void OpenACCClauseTransform<Derived>::VisitNoHostClause(
12706 llvm_unreachable(
"nohost clause not valid unless a decl transform");
12708template <
typename Derived>
12709void OpenACCClauseTransform<Derived>::VisitBindClause(
12711 llvm_unreachable(
"bind clause not valid unless a decl transform");
12714template <
typename Derived>
12715void OpenACCClauseTransform<Derived>::VisitCopyInClause(
12717 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12718 C.getModifierList());
12721 Self.getSema().getASTContext(), ParsedClause.getClauseKind(),
12722 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12723 ParsedClause.getModifierList(), ParsedClause.getVarList(),
12724 ParsedClause.getEndLoc());
12727template <
typename Derived>
12728void OpenACCClauseTransform<Derived>::VisitCopyOutClause(
12730 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12731 C.getModifierList());
12734 Self.getSema().getASTContext(), ParsedClause.getClauseKind(),
12735 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12736 ParsedClause.getModifierList(), ParsedClause.getVarList(),
12737 ParsedClause.getEndLoc());
12740template <
typename Derived>
12741void OpenACCClauseTransform<Derived>::VisitCreateClause(
12743 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12744 C.getModifierList());
12747 Self.getSema().getASTContext(), ParsedClause.getClauseKind(),
12748 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12749 ParsedClause.getModifierList(), ParsedClause.getVarList(),
12750 ParsedClause.getEndLoc());
12752template <
typename Derived>
12753void OpenACCClauseTransform<Derived>::VisitAttachClause(
12758 llvm::erase_if(VarList, [&](
Expr *E) {
12759 return Self.getSema().OpenACC().CheckVarIsPointerType(
12765 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12766 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12767 ParsedClause.getEndLoc());
12770template <
typename Derived>
12771void OpenACCClauseTransform<Derived>::VisitDetachClause(
12776 llvm::erase_if(VarList, [&](
Expr *E) {
12777 return Self.getSema().OpenACC().CheckVarIsPointerType(
12783 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12784 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12785 ParsedClause.getEndLoc());
12788template <
typename Derived>
12789void OpenACCClauseTransform<Derived>::VisitDeleteClause(
12791 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12794 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12795 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12796 ParsedClause.getEndLoc());
12799template <
typename Derived>
12800void OpenACCClauseTransform<Derived>::VisitUseDeviceClause(
12802 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12805 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12806 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12807 ParsedClause.getEndLoc());
12810template <
typename Derived>
12811void OpenACCClauseTransform<Derived>::VisitDevicePtrClause(
12816 llvm::erase_if(VarList, [&](
Expr *E) {
12817 return Self.getSema().OpenACC().CheckVarIsPointerType(
12823 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12824 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12825 ParsedClause.getEndLoc());
12828template <
typename Derived>
12829void OpenACCClauseTransform<Derived>::VisitNumWorkersClause(
12831 Expr *IntExpr =
const_cast<Expr *
>(
C.getIntExpr());
12832 assert(IntExpr &&
"num_workers clause constructed with invalid int expr");
12835 if (!Res.isUsable())
12840 C.getBeginLoc(), Res.get());
12841 if (!Res.isUsable())
12844 ParsedClause.setIntExprDetails(Res.get());
12846 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12847 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs()[0],
12848 ParsedClause.getEndLoc());
12851template <
typename Derived>
12852void OpenACCClauseTransform<Derived>::VisitDeviceNumClause (
12854 Expr *IntExpr =
const_cast<Expr *
>(
C.getIntExpr());
12855 assert(IntExpr &&
"device_num clause constructed with invalid int expr");
12858 if (!Res.isUsable())
12863 C.getBeginLoc(), Res.get());
12864 if (!Res.isUsable())
12867 ParsedClause.setIntExprDetails(Res.get());
12869 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12870 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs()[0],
12871 ParsedClause.getEndLoc());
12874template <
typename Derived>
12875void OpenACCClauseTransform<Derived>::VisitDefaultAsyncClause(
12877 Expr *IntExpr =
const_cast<Expr *
>(
C.getIntExpr());
12878 assert(IntExpr &&
"default_async clause constructed with invalid int expr");
12881 if (!Res.isUsable())
12886 C.getBeginLoc(), Res.get());
12887 if (!Res.isUsable())
12890 ParsedClause.setIntExprDetails(Res.get());
12892 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12893 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs()[0],
12894 ParsedClause.getEndLoc());
12897template <
typename Derived>
12898void OpenACCClauseTransform<Derived>::VisitVectorLengthClause(
12900 Expr *IntExpr =
const_cast<Expr *
>(
C.getIntExpr());
12901 assert(IntExpr &&
"vector_length clause constructed with invalid int expr");
12904 if (!Res.isUsable())
12909 C.getBeginLoc(), Res.get());
12910 if (!Res.isUsable())
12913 ParsedClause.setIntExprDetails(Res.get());
12915 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12916 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs()[0],
12917 ParsedClause.getEndLoc());
12920template <
typename Derived>
12921void OpenACCClauseTransform<Derived>::VisitAsyncClause(
12923 if (
C.hasIntExpr()) {
12925 if (!Res.isUsable())
12930 C.getBeginLoc(), Res.get());
12931 if (!Res.isUsable())
12933 ParsedClause.setIntExprDetails(Res.get());
12937 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12938 ParsedClause.getLParenLoc(),
12939 ParsedClause.getNumIntExprs() != 0 ? ParsedClause.getIntExprs()[0]
12941 ParsedClause.getEndLoc());
12944template <
typename Derived>
12945void OpenACCClauseTransform<Derived>::VisitWorkerClause(
12947 if (
C.hasIntExpr()) {
12952 if (!Res.isUsable())
12957 C.getBeginLoc(), Res.get());
12958 if (!Res.isUsable())
12960 ParsedClause.setIntExprDetails(Res.get());
12964 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12965 ParsedClause.getLParenLoc(),
12966 ParsedClause.getNumIntExprs() != 0 ? ParsedClause.getIntExprs()[0]
12968 ParsedClause.getEndLoc());
12971template <
typename Derived>
12972void OpenACCClauseTransform<Derived>::VisitVectorClause(
12974 if (
C.hasIntExpr()) {
12979 if (!Res.isUsable())
12984 C.getBeginLoc(), Res.get());
12985 if (!Res.isUsable())
12987 ParsedClause.setIntExprDetails(Res.get());
12991 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12992 ParsedClause.getLParenLoc(),
12993 ParsedClause.getNumIntExprs() != 0 ? ParsedClause.getIntExprs()[0]
12995 ParsedClause.getEndLoc());
12998template <
typename Derived>
12999void OpenACCClauseTransform<Derived>::VisitWaitClause(
13001 if (
C.hasExprs()) {
13002 Expr *DevNumExpr =
nullptr;
13006 if (
C.getDevNumExpr()) {
13008 if (!Res.isUsable())
13012 C.getBeginLoc(), Res.get());
13013 if (!Res.isUsable())
13016 DevNumExpr = Res.get();
13020 for (
Expr *CurQueueIdExpr :
C.getQueueIdExprs()) {
13022 if (!Res.isUsable())
13026 C.getBeginLoc(), Res.get());
13027 if (!Res.isUsable())
13030 InstantiatedQueueIdExprs.push_back(Res.get());
13033 ParsedClause.setWaitDetails(DevNumExpr,
C.getQueuesLoc(),
13034 std::move(InstantiatedQueueIdExprs));
13038 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
13039 ParsedClause.getLParenLoc(), ParsedClause.getDevNumExpr(),
13040 ParsedClause.getQueuesLoc(), ParsedClause.getQueueIdExprs(),
13041 ParsedClause.getEndLoc());
13044template <
typename Derived>
13045void OpenACCClauseTransform<Derived>::VisitDeviceTypeClause(
13049 Self.getSema().getASTContext(),
C.getClauseKind(),
13050 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
13051 C.getArchitectures(), ParsedClause.getEndLoc());
13054template <
typename Derived>
13055void OpenACCClauseTransform<Derived>::VisitAutoClause(
13059 ParsedClause.getBeginLoc(),
13060 ParsedClause.getEndLoc());
13063template <
typename Derived>
13064void OpenACCClauseTransform<Derived>::VisitIndependentClause(
13067 ParsedClause.getBeginLoc(),
13068 ParsedClause.getEndLoc());
13071template <
typename Derived>
13072void OpenACCClauseTransform<Derived>::VisitSeqClause(
13075 ParsedClause.getBeginLoc(),
13076 ParsedClause.getEndLoc());
13078template <
typename Derived>
13079void OpenACCClauseTransform<Derived>::VisitFinalizeClause(
13082 ParsedClause.getBeginLoc(),
13083 ParsedClause.getEndLoc());
13086template <
typename Derived>
13087void OpenACCClauseTransform<Derived>::VisitIfPresentClause(
13090 ParsedClause.getBeginLoc(),
13091 ParsedClause.getEndLoc());
13094template <
typename Derived>
13095void OpenACCClauseTransform<Derived>::VisitReductionClause(
13101 for (
const auto [Var, OrigRecipe] :
13102 llvm::zip(TransformedVars,
C.getRecipes())) {
13104 ParsedClause.getDirectiveKind(),
C.getReductionOp(), Var);
13105 if (Res.isUsable()) {
13106 ValidVars.push_back(Res.get());
13108 if (OrigRecipe.isSet())
13109 Recipes.emplace_back(OrigRecipe.AllocaDecl, OrigRecipe.CombinerRecipes);
13111 Recipes.push_back(
Self.getSema().OpenACC().CreateReductionInitRecipe(
13112 C.getReductionOp(), Res.get()));
13116 NewClause =
Self.getSema().OpenACC().CheckReductionClause(
13117 ExistingClauses, ParsedClause.getDirectiveKind(),
13118 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
13119 C.getReductionOp(), ValidVars, Recipes, ParsedClause.getEndLoc());
13122template <
typename Derived>
13123void OpenACCClauseTransform<Derived>::VisitCollapseClause(
13125 Expr *LoopCount =
const_cast<Expr *
>(
C.getLoopCount());
13126 assert(LoopCount &&
"collapse clause constructed with invalid loop count");
13130 if (!NewLoopCount.isUsable())
13133 NewLoopCount =
Self.getSema().OpenACC().ActOnIntExpr(
13135 NewLoopCount.get()->getBeginLoc(), NewLoopCount.get());
13139 if (!NewLoopCount.isUsable())
13143 Self.getSema().OpenACC().CheckCollapseLoopCount(NewLoopCount.get());
13147 if (!NewLoopCount.isUsable())
13150 ParsedClause.setCollapseDetails(
C.hasForce(), NewLoopCount.get());
13152 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
13153 ParsedClause.getLParenLoc(), ParsedClause.isForce(),
13154 ParsedClause.getLoopCount(), ParsedClause.getEndLoc());
13157template <
typename Derived>
13158void OpenACCClauseTransform<Derived>::VisitTileClause(
13163 for (
Expr *E :
C.getSizeExprs()) {
13166 if (!NewSizeExpr.isUsable())
13169 NewSizeExpr =
Self.getSema().OpenACC().ActOnIntExpr(
13171 NewSizeExpr.get()->getBeginLoc(), NewSizeExpr.get());
13175 if (!NewSizeExpr.isUsable())
13178 NewSizeExpr =
Self.getSema().OpenACC().CheckTileSizeExpr(NewSizeExpr.get());
13180 if (!NewSizeExpr.isUsable())
13182 TransformedExprs.push_back(NewSizeExpr.get());
13185 ParsedClause.setIntExprDetails(TransformedExprs);
13187 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
13188 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs(),
13189 ParsedClause.getEndLoc());
13191template <
typename Derived>
13192void OpenACCClauseTransform<Derived>::VisitGangClause(
13197 for (
unsigned I = 0; I <
C.getNumExprs(); ++I) {
13199 if (!ER.isUsable())
13202 ER =
Self.getSema().OpenACC().CheckGangExpr(ExistingClauses,
13203 ParsedClause.getDirectiveKind(),
13204 C.getExpr(I).first, ER.get());
13205 if (!ER.isUsable())
13207 TransformedGangKinds.push_back(
C.getExpr(I).first);
13208 TransformedIntExprs.push_back(ER.get());
13211 NewClause =
Self.getSema().OpenACC().CheckGangClause(
13212 ParsedClause.getDirectiveKind(), ExistingClauses,
13213 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
13214 TransformedGangKinds, TransformedIntExprs, ParsedClause.getEndLoc());
13217template <
typename Derived>
13218OpenACCClause *TreeTransform<Derived>::TransformOpenACCClause(
13223 DirKind, OldClause->getClauseKind(), OldClause->getBeginLoc());
13224 ParsedClause.setEndLoc(OldClause->getEndLoc());
13226 if (
const auto *WithParms = dyn_cast<OpenACCClauseWithParams>(OldClause))
13227 ParsedClause.setLParenLoc(WithParms->getLParenLoc());
13229 OpenACCClauseTransform<Derived> Transform{*
this, ExistingClauses,
13231 Transform.Visit(OldClause);
13233 return Transform.CreatedClause();
13236template <
typename Derived>
13238TreeTransform<Derived>::TransformOpenACCClauseList(
13241 for (
const auto *Clause : OldClauses) {
13242 if (
OpenACCClause *TransformedClause = getDerived().TransformOpenACCClause(
13243 TransformedClauses, DirKind, Clause))
13244 TransformedClauses.push_back(TransformedClause);
13246 return TransformedClauses;
13249template <
typename Derived>
13252 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13255 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
13258 if (getSema().OpenACC().ActOnStartStmtDirective(
13259 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
13264 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
13265 C->clauses(), TransformedClauses);
13266 StmtResult StrBlock = getDerived().TransformStmt(
C->getStructuredBlock());
13267 StrBlock = getSema().OpenACC().ActOnAssociatedStmt(
13268 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses, StrBlock);
13270 return getDerived().RebuildOpenACCComputeConstruct(
13271 C->getDirectiveKind(),
C->getBeginLoc(),
C->getDirectiveLoc(),
13272 C->getEndLoc(), TransformedClauses, StrBlock);
13275template <
typename Derived>
13279 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13282 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
13285 if (getSema().OpenACC().ActOnStartStmtDirective(
13286 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
13291 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
13292 C->clauses(), TransformedClauses);
13294 Loop = getSema().OpenACC().ActOnAssociatedStmt(
13295 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses,
Loop);
13297 return getDerived().RebuildOpenACCLoopConstruct(
13298 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
13299 TransformedClauses,
Loop);
13302template <
typename Derived>
13304 OpenACCCombinedConstruct *
C) {
13305 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13308 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
13311 if (getSema().OpenACC().ActOnStartStmtDirective(
13312 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
13317 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
13318 C->clauses(), TransformedClauses);
13320 Loop = getSema().OpenACC().ActOnAssociatedStmt(
13321 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses,
Loop);
13323 return getDerived().RebuildOpenACCCombinedConstruct(
13324 C->getDirectiveKind(),
C->getBeginLoc(),
C->getDirectiveLoc(),
13325 C->getEndLoc(), TransformedClauses,
Loop);
13328template <
typename Derived>
13331 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13334 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
13336 if (getSema().OpenACC().ActOnStartStmtDirective(
13337 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
13341 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
13342 C->clauses(), TransformedClauses);
13343 StmtResult StrBlock = getDerived().TransformStmt(
C->getStructuredBlock());
13344 StrBlock = getSema().OpenACC().ActOnAssociatedStmt(
13345 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses, StrBlock);
13347 return getDerived().RebuildOpenACCDataConstruct(
13348 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
13349 TransformedClauses, StrBlock);
13352template <
typename Derived>
13354 OpenACCEnterDataConstruct *
C) {
13355 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13358 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
13360 if (getSema().OpenACC().ActOnStartStmtDirective(
13361 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
13364 return getDerived().RebuildOpenACCEnterDataConstruct(
13365 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
13366 TransformedClauses);
13369template <
typename Derived>
13371 OpenACCExitDataConstruct *
C) {
13372 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13375 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
13377 if (getSema().OpenACC().ActOnStartStmtDirective(
13378 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
13381 return getDerived().RebuildOpenACCExitDataConstruct(
13382 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
13383 TransformedClauses);
13386template <
typename Derived>
13388 OpenACCHostDataConstruct *
C) {
13389 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13392 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
13394 if (getSema().OpenACC().ActOnStartStmtDirective(
13395 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
13399 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
13400 C->clauses(), TransformedClauses);
13401 StmtResult StrBlock = getDerived().TransformStmt(
C->getStructuredBlock());
13402 StrBlock = getSema().OpenACC().ActOnAssociatedStmt(
13403 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses, StrBlock);
13405 return getDerived().RebuildOpenACCHostDataConstruct(
13406 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
13407 TransformedClauses, StrBlock);
13410template <
typename Derived>
13413 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13416 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
13418 if (getSema().OpenACC().ActOnStartStmtDirective(
13419 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
13422 return getDerived().RebuildOpenACCInitConstruct(
13423 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
13424 TransformedClauses);
13427template <
typename Derived>
13429 OpenACCShutdownConstruct *
C) {
13430 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13433 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
13435 if (getSema().OpenACC().ActOnStartStmtDirective(
13436 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
13439 return getDerived().RebuildOpenACCShutdownConstruct(
13440 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
13441 TransformedClauses);
13443template <
typename Derived>
13446 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13449 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
13451 if (getSema().OpenACC().ActOnStartStmtDirective(
13452 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
13455 return getDerived().RebuildOpenACCSetConstruct(
13456 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
13457 TransformedClauses);
13460template <
typename Derived>
13462 OpenACCUpdateConstruct *
C) {
13463 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13466 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
13468 if (getSema().OpenACC().ActOnStartStmtDirective(
13469 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
13472 return getDerived().RebuildOpenACCUpdateConstruct(
13473 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
13474 TransformedClauses);
13477template <
typename Derived>
13480 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13483 if (
C->hasDevNumExpr()) {
13484 DevNumExpr = getDerived().TransformExpr(
C->getDevNumExpr());
13486 if (DevNumExpr.isUsable())
13487 DevNumExpr = getSema().OpenACC().ActOnIntExpr(
13489 C->getBeginLoc(), DevNumExpr.get());
13494 for (
Expr *QE :
C->getQueueIdExprs()) {
13495 assert(QE &&
"Null queue id expr?");
13496 ExprResult NewEQ = getDerived().TransformExpr(QE);
13498 if (!NewEQ.isUsable())
13502 C->getBeginLoc(), NewEQ.get());
13503 if (NewEQ.isUsable())
13504 QueueIdExprs.push_back(NewEQ.get());
13508 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
13511 if (getSema().OpenACC().ActOnStartStmtDirective(
13512 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
13515 return getDerived().RebuildOpenACCWaitConstruct(
13516 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getLParenLoc(),
13517 DevNumExpr.isUsable() ? DevNumExpr.get() :
nullptr,
C->getQueuesLoc(),
13518 QueueIdExprs,
C->getRParenLoc(),
C->getEndLoc(), TransformedClauses);
13520template <
typename Derived>
13522 OpenACCCacheConstruct *
C) {
13523 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13526 for (
Expr *Var :
C->getVarList()) {
13527 assert(Var &&
"Null var listexpr?");
13529 ExprResult NewVar = getDerived().TransformExpr(Var);
13531 if (!NewVar.isUsable())
13534 NewVar = getSema().OpenACC().ActOnVar(
13536 if (!NewVar.isUsable())
13539 TransformedVarList.push_back(NewVar.get());
13542 if (getSema().OpenACC().ActOnStartStmtDirective(
C->getDirectiveKind(),
13543 C->getBeginLoc(), {}))
13546 return getDerived().RebuildOpenACCCacheConstruct(
13547 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getLParenLoc(),
13548 C->getReadOnlyLoc(), TransformedVarList,
C->getRParenLoc(),
13552template <
typename Derived>
13554 OpenACCAtomicConstruct *
C) {
13555 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13558 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
13561 if (getSema().OpenACC().ActOnStartStmtDirective(
C->getDirectiveKind(),
13562 C->getBeginLoc(), {}))
13567 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(), {}, {});
13569 StmtResult AssocStmt = getDerived().TransformStmt(
C->getAssociatedStmt());
13570 AssocStmt = getSema().OpenACC().ActOnAssociatedStmt(
13571 C->getBeginLoc(),
C->getDirectiveKind(),
C->getAtomicKind(), {},
13574 return getDerived().RebuildOpenACCAtomicConstruct(
13575 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getAtomicKind(),
13576 C->getEndLoc(), TransformedClauses, AssocStmt);
13579template <
typename Derived>
13582 if (getDerived().AlwaysRebuild())
13591template<
typename Derived>
13594 return TransformExpr(E->getSubExpr());
13597template <
typename Derived>
13600 if (!E->isTypeDependent())
13603 TypeSourceInfo *NewT = getDerived().TransformType(E->getTypeSourceInfo());
13608 if (!getDerived().AlwaysRebuild() && E->getTypeSourceInfo() == NewT)
13611 return getDerived().RebuildSYCLUniqueStableNameExpr(
13612 E->getLocation(), E->getLParenLocation(), E->getRParenLocation(), NewT);
13615template <
typename Derived>
13619 const auto *SKEPAttr = FD->template getAttr<SYCLKernelEntryPointAttr>();
13620 if (!SKEPAttr || SKEPAttr->isInvalidAttr())
13623 ExprResult IdExpr = getDerived().TransformExpr(S->getKernelLaunchIdExpr());
13624 if (IdExpr.isInvalid())
13627 StmtResult Body = getDerived().TransformStmt(S->getOriginalStmt());
13628 if (Body.isInvalid())
13634 if (SR.isInvalid())
13640template <
typename Derived>
13644 switch (E->getKind()) {
13653 llvm_unreachable(
"A null reflection should not reach here");
13656 assert(
false &&
"unknown or unimplemented reflection entities");
13660template<
typename Derived>
13663 if (!E->isTypeDependent())
13667 E->getIdentKind());
13670template<
typename Derived>
13674 if (E->getQualifierLoc()) {
13676 = getDerived().TransformNestedNameSpecifierLoc(E->getQualifierLoc());
13682 = cast_or_null<ValueDecl>(getDerived().TransformDecl(E->getLocation(),
13684 if (!ND || ND->isInvalidDecl())
13688 if (E->getFoundDecl() != E->getDecl()) {
13689 Found = cast_or_null<NamedDecl>(
13690 getDerived().TransformDecl(E->getLocation(), E->getFoundDecl()));
13696 if (NameInfo.getName()) {
13697 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
13698 if (!NameInfo.getName())
13702 if (!getDerived().AlwaysRebuild() &&
13703 !E->isCapturedByCopyInLambdaWithExplicitObjectParameter() &&
13704 QualifierLoc == E->getQualifierLoc() && ND == E->getDecl() &&
13705 Found == E->getFoundDecl() &&
13706 NameInfo.getName() == E->getDecl()->getDeclName() &&
13707 !E->hasExplicitTemplateArgs()) {
13717 if (E->hasExplicitTemplateArgs()) {
13718 TemplateArgs = &TransArgs;
13719 TransArgs.setLAngleLoc(E->getLAngleLoc());
13720 TransArgs.setRAngleLoc(E->getRAngleLoc());
13721 if (getDerived().TransformTemplateArguments(E->getTemplateArgs(),
13722 E->getNumTemplateArgs(),
13727 return getDerived().RebuildDeclRefExpr(QualifierLoc, ND, NameInfo,
13728 Found, TemplateArgs);
13731template<
typename Derived>
13737template <
typename Derived>
13743template<
typename Derived>
13749template<
typename Derived>
13755template<
typename Derived>
13761template<
typename Derived>
13767template<
typename Derived>
13770 return getDerived().TransformCallExpr(E);
13773template<
typename Derived>
13778 if (E->isExprPredicate())
13779 ControllingExpr = getDerived().TransformExpr(E->getControllingExpr());
13781 ControllingType = getDerived().TransformType(E->getControllingType());
13783 if (ControllingExpr.isInvalid() && !ControllingType)
13794 AssocTypes.push_back(AssocType);
13796 AssocTypes.push_back(
nullptr);
13800 getDerived().TransformExpr(Assoc.getAssociationExpr());
13801 if (AssocExpr.isInvalid())
13803 AssocExprs.push_back(AssocExpr.get());
13806 if (!ControllingType)
13807 return getDerived().RebuildGenericSelectionExpr(E->getGenericLoc(),
13808 E->getDefaultLoc(),
13810 ControllingExpr.get(),
13813 return getDerived().RebuildGenericSelectionExpr(
13814 E->getGenericLoc(), E->getDefaultLoc(), E->getRParenLoc(),
13815 ControllingType, AssocTypes, AssocExprs);
13818template<
typename Derived>
13821 ExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
13822 if (SubExpr.isInvalid())
13825 if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getSubExpr())
13828 return getDerived().RebuildParenExpr(SubExpr.get(), E->getLParen(),
13835template<
typename Derived>
13839 return getDerived().TransformDependentScopeDeclRefExpr(
13840 DRE,
true,
nullptr);
13842 return getDerived().TransformUnresolvedLookupExpr(
13848template<
typename Derived>
13853 SubExpr = TransformAddressOfOperand(E->
getSubExpr());
13859 if (!getDerived().AlwaysRebuild() && SubExpr.
get() == E->
getSubExpr())
13867template<
typename Derived>
13869TreeTransform<Derived>::TransformOffsetOfExpr(OffsetOfExpr *E) {
13871 TypeSourceInfo *Type = getDerived().TransformType(E->getTypeSourceInfo());
13881 bool ExprChanged =
false;
13883 for (
unsigned I = 0, N = E->getNumComponents(); I != N; ++I) {
13884 const OffsetOfNode &ON = E->getComponent(I);
13885 switch (ON.getKind()) {
13887 Expr *FromIndex = E->getIndexExpr(ON.getArrayExprIndex());
13888 ExprResult Index = getDerived().TransformExpr(FromIndex);
13889 if (Index.isInvalid())
13892 ExprChanged = ExprChanged || Index.get() != FromIndex;
13895 AD.setRBracketLoc(ON.getEndLoc());
13896 Desig.AddDesignator(AD);
13908 Desig.AddDesignator(
13920 if (!getDerived().AlwaysRebuild() &&
13921 Type == E->getTypeSourceInfo() &&
13926 return getDerived().RebuildOffsetOfExpr(E->getOperatorLoc(),
Type, Desig,
13927 E->getRParenLoc());
13930template<
typename Derived>
13933 assert((!E->getSourceExpr() || getDerived().AlreadyTransformed(E->getType())) &&
13934 "opaque value expression requires transformation");
13938template <
typename Derived>
13942 for (
Expr *
C : E->subExpressions()) {
13944 if (NewC.isInvalid())
13950 if (!getDerived().AlwaysRebuild() && !Changed)
13952 return getDerived().RebuildRecoveryExpr(E->getBeginLoc(), E->getEndLoc(),
13956template<
typename Derived>
13966 ExprResult result = getDerived().TransformExpr(newSyntacticForm);
13967 if (result.isInvalid())
return ExprError();
13972 if (result.get()->hasPlaceholderType(BuiltinType::PseudoObject))
13978template<
typename Derived>
13982 if (E->isArgumentType()) {
13989 if (!getDerived().AlwaysRebuild() && OldT == NewT)
13992 return getDerived().RebuildUnaryExprOrTypeTrait(NewT, E->getOperatorLoc(),
13994 E->getSourceRange());
14008 auto *PE = dyn_cast<ParenExpr>(E->getArgumentExpr());
14010 PE ? dyn_cast<DependentScopeDeclRefExpr>(PE->getSubExpr()) :
nullptr)
14011 SubExpr = getDerived().TransformParenDependentScopeDeclRefExpr(
14012 PE, DRE,
false, &RecoveryTSI);
14014 SubExpr = getDerived().TransformExpr(E->getArgumentExpr());
14017 return getDerived().RebuildUnaryExprOrTypeTrait(
14018 RecoveryTSI, E->getOperatorLoc(), E->getKind(), E->getSourceRange());
14019 }
else if (SubExpr.isInvalid())
14022 if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getArgumentExpr())
14025 return getDerived().RebuildUnaryExprOrTypeTrait(SubExpr.get(),
14026 E->getOperatorLoc(),
14028 E->getSourceRange());
14031template<
typename Derived>
14034 ExprResult LHS = getDerived().TransformExpr(E->getLHS());
14035 if (LHS.isInvalid())
14038 ExprResult RHS = getDerived().TransformExpr(E->getRHS());
14039 if (RHS.isInvalid())
14043 if (!getDerived().AlwaysRebuild() &&
14044 LHS.get() == E->getLHS() &&
14045 RHS.get() == E->getRHS())
14048 return getDerived().RebuildArraySubscriptExpr(
14050 E->getLHS()->getBeginLoc(), RHS.get(), E->getRBracketLoc());
14053template <
typename Derived>
14057 if (
Base.isInvalid())
14060 ExprResult RowIdx = getDerived().TransformExpr(E->getRowIdx());
14061 if (RowIdx.isInvalid())
14064 if (!getDerived().AlwaysRebuild() &&
Base.get() == E->getBase() &&
14065 RowIdx.get() == E->getRowIdx())
14068 return getDerived().RebuildMatrixSingleSubscriptExpr(
Base.get(), RowIdx.get(),
14069 E->getRBracketLoc());
14072template <
typename Derived>
14076 if (
Base.isInvalid())
14079 ExprResult RowIdx = getDerived().TransformExpr(E->getRowIdx());
14080 if (RowIdx.isInvalid())
14083 ExprResult ColumnIdx = getDerived().TransformExpr(E->getColumnIdx());
14084 if (ColumnIdx.isInvalid())
14087 if (!getDerived().AlwaysRebuild() &&
Base.get() == E->getBase() &&
14088 RowIdx.get() == E->getRowIdx() && ColumnIdx.get() == E->getColumnIdx())
14091 return getDerived().RebuildMatrixSubscriptExpr(
14092 Base.get(), RowIdx.get(), ColumnIdx.get(), E->getRBracketLoc());
14095template <
typename Derived>
14099 if (
Base.isInvalid())
14103 if (E->getLowerBound()) {
14104 LowerBound = getDerived().TransformExpr(E->getLowerBound());
14105 if (LowerBound.isInvalid())
14110 if (E->getLength()) {
14111 Length = getDerived().TransformExpr(E->getLength());
14112 if (Length.isInvalid())
14117 if (E->isOMPArraySection()) {
14118 if (
Expr *Str = E->getStride()) {
14119 Stride = getDerived().TransformExpr(Str);
14120 if (Stride.isInvalid())
14125 if (!getDerived().AlwaysRebuild() &&
Base.get() == E->getBase() &&
14126 LowerBound.get() == E->getLowerBound() &&
14127 Length.get() == E->getLength() &&
14128 (E->isOpenACCArraySection() || Stride.get() == E->getStride()))
14131 return getDerived().RebuildArraySectionExpr(
14132 E->isOMPArraySection(),
Base.get(), E->getBase()->getEndLoc(),
14133 LowerBound.get(), E->getColonLocFirst(),
14134 E->isOMPArraySection() ? E->getColonLocSecond() :
SourceLocation{},
14135 Length.get(), Stride.get(), E->getRBracketLoc());
14138template <
typename Derived>
14142 if (
Base.isInvalid())
14146 bool ErrorFound =
false;
14147 for (
Expr *
Dim : E->getDimensions()) {
14149 if (DimRes.isInvalid()) {
14153 Dims.push_back(DimRes.get());
14158 return getDerived().RebuildOMPArrayShapingExpr(
Base.get(), E->getLParenLoc(),
14159 E->getRParenLoc(), Dims,
14160 E->getBracketsRanges());
14163template <
typename Derived>
14166 unsigned NumIterators = E->numOfIterators();
14169 bool ErrorFound =
false;
14170 bool NeedToRebuild = getDerived().AlwaysRebuild();
14171 for (
unsigned I = 0; I < NumIterators; ++I) {
14173 Data[I].DeclIdent = D->getIdentifier();
14174 Data[I].DeclIdentLoc = D->getLocation();
14175 if (D->getLocation() == D->getBeginLoc()) {
14177 "Implicit type must be int.");
14179 TypeSourceInfo *TSI = getDerived().TransformType(D->getTypeSourceInfo());
14180 QualType DeclTy = getDerived().TransformType(D->getType());
14187 ErrorFound = ErrorFound ||
14188 !(!D->getTypeSourceInfo() || (
Data[I].
Type.getAsOpaquePtr() &&
14189 !
Data[I].Type.get().isNull())) ||
14190 Begin.isInvalid() || End.isInvalid() || Step.isInvalid();
14193 Data[I].Range.Begin = Begin.get();
14194 Data[I].Range.End = End.get();
14195 Data[I].Range.Step = Step.get();
14196 Data[I].AssignLoc = E->getAssignLoc(I);
14197 Data[I].ColonLoc = E->getColonLoc(I);
14198 Data[I].SecColonLoc = E->getSecondColonLoc(I);
14201 (D->getTypeSourceInfo() &&
Data[I].
Type.get().getTypePtrOrNull() !=
14202 D->getType().getTypePtrOrNull()) ||
14208 if (!NeedToRebuild)
14211 ExprResult Res = getDerived().RebuildOMPIteratorExpr(
14212 E->getIteratorKwLoc(), E->getLParenLoc(), E->getRParenLoc(),
Data);
14213 if (!Res.isUsable())
14216 for (
unsigned I = 0; I < NumIterators; ++I)
14217 getDerived().transformedLocalDecl(E->getIteratorDecl(I),
14218 IE->getIteratorDecl(I));
14222template<
typename Derived>
14231 bool ArgChanged =
false;
14233 if (getDerived().TransformExprs(E->getArgs(), E->getNumArgs(),
true, Args,
14237 if (!getDerived().AlwaysRebuild() &&
14238 Callee.get() == E->getCallee() &&
14244 = ((
Expr *)
Callee.get())->getSourceRange().getBegin();
14247 if (E->hasStoredFPFeatures()) {
14249 getSema().CurFPFeatures =
14251 getSema().FpPragmaStack.CurrentValue = NewOverrides;
14254 return getDerived().RebuildCallExpr(
Callee.get(), FakeLParenLoc,
14256 E->getRParenLoc());
14259template<
typename Derived>
14263 if (
Base.isInvalid())
14267 if (E->hasQualifier()) {
14269 = getDerived().TransformNestedNameSpecifierLoc(E->getQualifierLoc());
14277 = cast_or_null<ValueDecl>(getDerived().TransformDecl(E->getMemberLoc(),
14278 E->getMemberDecl()));
14282 NamedDecl *FoundDecl = E->getFoundDecl();
14283 if (FoundDecl == E->getMemberDecl()) {
14286 FoundDecl = cast_or_null<NamedDecl>(
14287 getDerived().TransformDecl(E->getMemberLoc(), FoundDecl));
14292 if (!getDerived().AlwaysRebuild() &&
14293 Base.get() == E->getBase() &&
14294 QualifierLoc == E->getQualifierLoc() &&
14295 Member == E->getMemberDecl() &&
14296 FoundDecl == E->getFoundDecl() &&
14297 !E->hasExplicitTemplateArgs()) {
14302 getSema().OpenMP().isOpenMPRebuildMemberExpr(
14312 if (E->hasExplicitTemplateArgs()) {
14313 TransArgs.setLAngleLoc(E->getLAngleLoc());
14314 TransArgs.setRAngleLoc(E->getRAngleLoc());
14315 if (getDerived().TransformTemplateArguments(E->getTemplateArgs(),
14316 E->getNumTemplateArgs(),
14329 NamedDecl *FirstQualifierInScope =
nullptr;
14331 if (MemberNameInfo.getName()) {
14332 MemberNameInfo = getDerived().TransformDeclarationNameInfo(MemberNameInfo);
14333 if (!MemberNameInfo.getName())
14337 return getDerived().RebuildMemberExpr(
Base.get(), FakeOperatorLoc,
14344 (E->hasExplicitTemplateArgs()
14345 ? &TransArgs :
nullptr),
14346 FirstQualifierInScope);
14349template<
typename Derived>
14352 ExprResult LHS = getDerived().TransformExpr(E->getLHS());
14353 if (LHS.isInvalid())
14357 getDerived().TransformInitializer(E->getRHS(),
false);
14358 if (RHS.isInvalid())
14361 if (!getDerived().AlwaysRebuild() &&
14362 LHS.get() == E->getLHS() &&
14363 RHS.get() == E->getRHS())
14366 if (E->isCompoundAssignmentOp())
14368 return getDerived().RebuildBinaryOperator(
14369 E->getOperatorLoc(), E->getOpcode(), LHS.get(), RHS.get());
14372 getSema().CurFPFeatures =
14373 NewOverrides.applyOverrides(getSema().getLangOpts());
14374 getSema().FpPragmaStack.CurrentValue = NewOverrides;
14375 return getDerived().RebuildBinaryOperator(E->getOperatorLoc(), E->getOpcode(),
14376 LHS.get(), RHS.get());
14379template <
typename Derived>
14384 ExprResult LHS = getDerived().TransformExpr(
const_cast<Expr*
>(Decomp.LHS));
14385 if (LHS.isInvalid())
14388 ExprResult RHS = getDerived().TransformExpr(
const_cast<Expr*
>(Decomp.RHS));
14389 if (RHS.isInvalid())
14395 bool ChangedAnyLookups =
false;
14396 Expr *PossibleBinOps[] = {E->getSemanticForm(),
14397 const_cast<Expr *
>(Decomp.InnerBinOp)};
14398 for (
Expr *PossibleBinOp : PossibleBinOps) {
14399 auto *Op = dyn_cast<CXXOperatorCallExpr>(PossibleBinOp->IgnoreImplicit());
14402 auto *
Callee = dyn_cast<DeclRefExpr>(Op->getCallee()->IgnoreImplicit());
14408 NamedDecl *
Found = cast_or_null<NamedDecl>(getDerived().TransformDecl(
14409 E->getOperatorLoc(),
Callee->getFoundDecl()));
14413 ChangedAnyLookups =
true;
14414 UnqualLookups.addDecl(
Found);
14417 if (!getDerived().AlwaysRebuild() && !ChangedAnyLookups &&
14418 LHS.get() == Decomp.LHS && RHS.get() == Decomp.RHS) {
14424 const Expr *StopAt[] = {Decomp.LHS, Decomp.RHS};
14429 return getDerived().RebuildCXXRewrittenBinaryOperator(
14430 E->getOperatorLoc(), Decomp.Opcode, UnqualLookups, LHS.get(), RHS.get());
14433template<
typename Derived>
14439 getSema().CurFPFeatures =
14440 NewOverrides.applyOverrides(getSema().getLangOpts());
14441 getSema().FpPragmaStack.CurrentValue = NewOverrides;
14442 return getDerived().TransformBinaryOperator(E);
14445template<
typename Derived>
14451 ExprResult commonExpr = getDerived().TransformExpr(e->getCommon());
14452 if (commonExpr.isInvalid())
14455 ExprResult rhs = getDerived().TransformExpr(e->getFalseExpr());
14456 if (rhs.isInvalid())
14459 if (!getDerived().AlwaysRebuild() &&
14460 commonExpr.get() == e->getCommon() &&
14461 rhs.get() == e->getFalseExpr())
14464 return getDerived().RebuildConditionalOperator(commonExpr.get(),
14465 e->getQuestionLoc(),
14471template<
typename Derived>
14474 ExprResult Cond = getDerived().TransformExpr(E->getCond());
14475 if (Cond.isInvalid())
14478 ExprResult LHS = getDerived().TransformExpr(E->getLHS());
14479 if (LHS.isInvalid())
14482 ExprResult RHS = getDerived().TransformExpr(E->getRHS());
14483 if (RHS.isInvalid())
14486 if (!getDerived().AlwaysRebuild() &&
14487 Cond.get() == E->getCond() &&
14488 LHS.get() == E->getLHS() &&
14489 RHS.get() == E->getRHS())
14492 return getDerived().RebuildConditionalOperator(Cond.get(),
14493 E->getQuestionLoc(),
14499template<
typename Derived>
14504 return getDerived().
TransformExpr(E->getSubExprAsWritten());
14507template<
typename Derived>
14515 = getDerived().TransformExpr(E->getSubExprAsWritten());
14516 if (SubExpr.isInvalid())
14519 if (!getDerived().AlwaysRebuild() &&
14520 Type == E->getTypeInfoAsWritten() &&
14521 SubExpr.get() == E->getSubExpr())
14524 return getDerived().RebuildCStyleCastExpr(E->getLParenLoc(),
14530template<
typename Derived>
14538 ExprResult Init = getDerived().TransformExpr(E->getInitializer());
14539 if (
Init.isInvalid())
14542 if (!getDerived().AlwaysRebuild() &&
14544 Init.get() == E->getInitializer())
14551 return getDerived().RebuildCompoundLiteralExpr(
14552 E->getLParenLoc(), NewT,
14553 E->getInitializer()->getEndLoc(),
Init.get());
14556template<
typename Derived>
14560 if (
Base.isInvalid())
14563 if (!getDerived().AlwaysRebuild() &&
14564 Base.get() == E->getBase())
14570 return getDerived().RebuildExtVectorOrMatrixElementExpr(
14571 Base.get(), FakeOperatorLoc, E->isArrow(), E->getAccessorLoc(),
14575template <
typename Derived>
14579 if (
Base.isInvalid())
14582 if (!getDerived().AlwaysRebuild() &&
Base.get() == E->getBase())
14588 return getDerived().RebuildExtVectorOrMatrixElementExpr(
14589 Base.get(), FakeOperatorLoc,
false, E->getAccessorLoc(),
14593template<
typename Derived>
14599 bool InitChanged =
false;
14605 if (getDerived().TransformExprs(E->getInits(), E->getNumInits(),
false,
14606 Inits, &InitChanged))
14609 if (!getDerived().AlwaysRebuild() && !InitChanged) {
14616 return getDerived().RebuildInitList(E->getLBraceLoc(),
Inits,
14617 E->getRBraceLoc(), E->isExplicit());
14620template<
typename Derived>
14627 if (
Init.isInvalid())
14632 bool ExprChanged =
false;
14634 if (D.isFieldDesignator()) {
14635 if (D.getFieldDecl()) {
14637 getDerived().TransformDecl(D.getFieldLoc(), D.getFieldDecl()));
14638 if (Field != D.getFieldDecl())
14641 ExprChanged =
true;
14642 if (
Field->isAnonymousStructOrUnion())
14648 ExprChanged =
true;
14651 D.getFieldName(), D.getDotLoc(), D.getFieldLoc()));
14655 if (D.isArrayDesignator()) {
14656 ExprResult Index = getDerived().TransformExpr(E->getArrayIndex(D));
14657 if (Index.isInvalid())
14660 Desig.AddDesignator(
14663 ExprChanged = ExprChanged || Index.get() != E->getArrayIndex(D);
14664 ArrayExprs.push_back(Index.get());
14668 assert(D.isArrayRangeDesignator() &&
"New kind of designator?");
14670 = getDerived().TransformExpr(E->getArrayRangeStart(D));
14671 if (Start.isInvalid())
14674 ExprResult End = getDerived().TransformExpr(E->getArrayRangeEnd(D));
14675 if (End.isInvalid())
14679 Start.get(), End.get(), D.getLBracketLoc(), D.getEllipsisLoc()));
14681 ExprChanged = ExprChanged || Start.get() != E->getArrayRangeStart(D) ||
14682 End.get() != E->getArrayRangeEnd(D);
14684 ArrayExprs.push_back(Start.get());
14685 ArrayExprs.push_back(End.get());
14688 if (!getDerived().AlwaysRebuild() &&
14689 Init.get() == E->getInit() &&
14693 return getDerived().RebuildDesignatedInitExpr(Desig, ArrayExprs,
14694 E->getEqualOrColonLoc(),
14695 E->usesGNUSyntax(),
Init.get());
14700template<
typename Derived>
14704 llvm_unreachable(
"Unexpected DesignatedInitUpdateExpr in syntactic form of "
14709template<
typename Derived>
14713 llvm_unreachable(
"Unexpected NoInitExpr in syntactic form of initializer");
14717template<
typename Derived>
14720 llvm_unreachable(
"Unexpected ArrayInitLoopExpr outside of initializer");
14724template<
typename Derived>
14727 llvm_unreachable(
"Unexpected ArrayInitIndexExpr outside of initializer");
14731template<
typename Derived>
14739 QualType T = getDerived().TransformType(E->getType());
14743 if (!getDerived().AlwaysRebuild() &&
14747 return getDerived().RebuildImplicitValueInitExpr(
T);
14750template<
typename Derived>
14753 TypeSourceInfo *TInfo = getDerived().TransformType(E->getWrittenTypeInfo());
14757 ExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
14758 if (SubExpr.isInvalid())
14761 if (!getDerived().AlwaysRebuild() &&
14762 TInfo == E->getWrittenTypeInfo() &&
14763 SubExpr.get() == E->getSubExpr())
14766 return getDerived().RebuildVAArgExpr(E->getBuiltinLoc(), SubExpr.get(),
14767 TInfo, E->getRParenLoc());
14770template<
typename Derived>
14773 bool ArgumentChanged =
false;
14775 if (TransformExprs(E->getExprs(), E->getNumExprs(),
true,
Inits,
14779 return getDerived().RebuildParenListExpr(E->getLParenLoc(),
14781 E->getRParenLoc());
14789template<
typename Derived>
14792 Decl *LD = getDerived().TransformDecl(E->getLabel()->getLocation(),
14797 return getDerived().RebuildAddrLabelExpr(E->getAmpAmpLoc(), E->getLabelLoc(),
14801template<
typename Derived>
14806 = getDerived().TransformCompoundStmt(E->getSubStmt(),
true);
14807 if (SubStmt.isInvalid()) {
14812 unsigned OldDepth = E->getTemplateDepth();
14813 unsigned NewDepth = getDerived().TransformTemplateDepth(OldDepth);
14815 if (!getDerived().AlwaysRebuild() && OldDepth == NewDepth &&
14816 SubStmt.get() == E->getSubStmt()) {
14822 return getDerived().RebuildStmtExpr(E->getLParenLoc(), SubStmt.get(),
14823 E->getRParenLoc(), NewDepth);
14826template<
typename Derived>
14829 ExprResult Cond = getDerived().TransformExpr(E->getCond());
14830 if (Cond.isInvalid())
14833 ExprResult LHS = getDerived().TransformExpr(E->getLHS());
14834 if (LHS.isInvalid())
14837 ExprResult RHS = getDerived().TransformExpr(E->getRHS());
14838 if (RHS.isInvalid())
14841 if (!getDerived().AlwaysRebuild() &&
14842 Cond.get() == E->getCond() &&
14843 LHS.get() == E->getLHS() &&
14844 RHS.get() == E->getRHS())
14847 return getDerived().RebuildChooseExpr(E->getBuiltinLoc(),
14848 Cond.get(), LHS.get(), RHS.get(),
14849 E->getRParenLoc());
14852template<
typename Derived>
14858template<
typename Derived>
14861 switch (E->getOperator()) {
14865 case OO_Array_Delete:
14866 llvm_unreachable(
"new and delete operators cannot use CXXOperatorCallExpr");
14871 assert(E->getNumArgs() >= 1 &&
"Object call is missing arguments");
14884 if (FakeLParenLoc.isInvalid() && EndLoc.isValid())
14885 FakeLParenLoc = EndLoc;
14889 if (getDerived().TransformExprs(E->getArgs() + 1, E->getNumArgs() - 1,
true,
14893 if (E->getOperator() == OO_Subscript)
14894 return getDerived().RebuildCxxSubscriptExpr(
Object.get(), FakeLParenLoc,
14895 Args, E->getEndLoc());
14897 return getDerived().RebuildCallExpr(
Object.get(), FakeLParenLoc, Args,
14901#define OVERLOADED_OPERATOR(Name, Spelling, Token, Unary, Binary, MemberOnly) \
14905#define OVERLOADED_OPERATOR_MULTI(Name,Spelling,Unary,Binary,MemberOnly)
14906#include "clang/Basic/OperatorKinds.def"
14908 case OO_Conditional:
14909 llvm_unreachable(
"conditional operator is not actually overloadable");
14913 llvm_unreachable(
"not an overloaded operator?");
14917 if (E->getNumArgs() == 1 && E->getOperator() == OO_Amp)
14918 First = getDerived().TransformAddressOfOperand(E->getArg(0));
14920 First = getDerived().TransformExpr(E->getArg(0));
14921 if (
First.isInvalid())
14925 if (E->getNumArgs() == 2) {
14927 getDerived().TransformInitializer(E->getArg(1),
false);
14928 if (Second.isInvalid())
14934 getSema().CurFPFeatures =
14935 NewOverrides.applyOverrides(getSema().getLangOpts());
14936 getSema().FpPragmaStack.CurrentValue = NewOverrides;
14942 if (getDerived().TransformOverloadExprDecls(ULE, ULE->requiresADL(), R))
14945 return getDerived().RebuildCXXOperatorCallExpr(
14946 E->getOperator(), E->getOperatorLoc(),
Callee->getBeginLoc(),
14947 ULE->requiresADL(),
R.asUnresolvedSet(),
First.get(), Second.get());
14952 Callee = ICE->getSubExprAsWritten();
14954 ValueDecl *VD = cast_or_null<ValueDecl>(
14955 getDerived().TransformDecl(DR->getLocation(), DR));
14960 Functions.addDecl(VD);
14962 return getDerived().RebuildCXXOperatorCallExpr(
14963 E->getOperator(), E->getOperatorLoc(),
Callee->getBeginLoc(),
14964 false, Functions,
First.get(), Second.get());
14967template<
typename Derived>
14970 return getDerived().TransformCallExpr(E);
14973template <
typename Derived>
14976 getSema().CurContext != E->getParentContext();
14978 if (!getDerived().AlwaysRebuild() && !NeedRebuildFunc)
14981 return getDerived().RebuildSourceLocExpr(E->getIdentKind(), E->getType(),
14982 E->getBeginLoc(), E->getEndLoc(),
14983 getSema().CurContext);
14986template <
typename Derived>
14991template<
typename Derived>
15000 ExprResult EC = getDerived().TransformCallExpr(E->getConfig());
15001 if (EC.isInvalid())
15005 bool ArgChanged =
false;
15007 if (getDerived().TransformExprs(E->getArgs(), E->getNumArgs(),
true, Args,
15011 if (!getDerived().AlwaysRebuild() &&
15012 Callee.get() == E->getCallee() &&
15018 = ((
Expr *)
Callee.get())->getSourceRange().getBegin();
15019 return getDerived().RebuildCallExpr(
Callee.get(), FakeLParenLoc,
15021 E->getRParenLoc(), EC.get());
15024template<
typename Derived>
15040 return getDerived().RebuildCXXNamedCastExpr(
15047template<
typename Derived>
15056 if (Sub.isInvalid())
15059 return getDerived().RebuildBuiltinBitCastExpr(BCE->
getBeginLoc(), TSI,
15063template<
typename Derived>
15065TreeTransform<Derived>::TransformCXXStaticCastExpr(CXXStaticCastExpr *E) {
15066 return getDerived().TransformCXXNamedCastExpr(E);
15069template<
typename Derived>
15075template<
typename Derived>
15082template<
typename Derived>
15088template<
typename Derived>
15094template<
typename Derived>
15099 getDerived().TransformTypeWithDeducedTST(E->getTypeInfoAsWritten());
15104 = getDerived().TransformExpr(E->getSubExprAsWritten());
15105 if (SubExpr.isInvalid())
15108 if (!getDerived().AlwaysRebuild() &&
15109 Type == E->getTypeInfoAsWritten() &&
15110 SubExpr.get() == E->getSubExpr())
15113 return getDerived().RebuildCXXFunctionalCastExpr(
Type,
15117 E->isListInitialization());
15120template<
typename Derived>
15123 if (E->isTypeOperand()) {
15125 = getDerived().TransformType(E->getTypeOperandSourceInfo());
15129 if (!getDerived().AlwaysRebuild() &&
15130 TInfo == E->getTypeOperandSourceInfo())
15133 return getDerived().RebuildCXXTypeidExpr(E->getType(), E->getBeginLoc(),
15134 TInfo, E->getEndLoc());
15140 Expr *Op = E->getExprOperand();
15142 if (E->isGLValue()) {
15144 if (
auto *RD = OpType->getAsCXXRecordDecl()) {
15146 diag::err_incomplete_typeid))
15149 if (RD->isPolymorphic())
15157 ExprResult SubExpr = getDerived().TransformExpr(Op);
15158 if (SubExpr.isInvalid())
15161 if (!getDerived().AlwaysRebuild() &&
15162 SubExpr.get() == E->getExprOperand())
15165 return getDerived().RebuildCXXTypeidExpr(E->getType(), E->getBeginLoc(),
15166 SubExpr.get(), E->getEndLoc());
15169template<
typename Derived>
15172 if (E->isTypeOperand()) {
15174 = getDerived().TransformType(E->getTypeOperandSourceInfo());
15178 if (!getDerived().AlwaysRebuild() &&
15179 TInfo == E->getTypeOperandSourceInfo())
15182 return getDerived().RebuildCXXUuidofExpr(E->getType(), E->getBeginLoc(),
15183 TInfo, E->getEndLoc());
15189 ExprResult SubExpr = getDerived().TransformExpr(E->getExprOperand());
15190 if (SubExpr.isInvalid())
15193 if (!getDerived().AlwaysRebuild() &&
15194 SubExpr.get() == E->getExprOperand())
15197 return getDerived().RebuildCXXUuidofExpr(E->getType(), E->getBeginLoc(),
15198 SubExpr.get(), E->getEndLoc());
15201template<
typename Derived>
15207template<
typename Derived>
15214template<
typename Derived>
15230 auto &S = getSema();
15231 if (E->isCapturedByCopyInLambdaWithExplicitObjectParameter())
15232 return S.getCurrentThisType();
15233 if (S.getCurLambda())
15234 return getDerived().TransformType(E->getType());
15235 return S.getCurrentThisType();
15238 if (!getDerived().AlwaysRebuild() &&
T == E->getType() &&
15239 !E->isCapturedByCopyInLambdaWithExplicitObjectParameter()) {
15242 getSema().MarkThisReferenced(E);
15246 return getDerived().RebuildCXXThisExpr(E->getBeginLoc(),
T, E->isImplicit());
15249template<
typename Derived>
15252 ExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
15253 if (SubExpr.isInvalid())
15256 getSema().DiagnoseExceptionUse(E->getThrowLoc(),
false);
15258 if (!getDerived().AlwaysRebuild() &&
15259 SubExpr.get() == E->getSubExpr())
15262 return getDerived().RebuildCXXThrowExpr(E->getThrowLoc(), SubExpr.get(),
15263 E->isThrownVariableInScope());
15266template<
typename Derived>
15270 getDerived().TransformDecl(E->getBeginLoc(), E->getParam()));
15275 if (E->hasRewrittenInit()) {
15276 InitRes = getDerived().TransformExpr(E->getRewrittenExpr());
15277 if (InitRes.isInvalid())
15281 if (!getDerived().AlwaysRebuild() && Param == E->getParam() &&
15282 E->getUsedContext() == SemaRef.
CurContext &&
15283 InitRes.get() == E->getRewrittenExpr())
15286 return getDerived().RebuildCXXDefaultArgExpr(E->getUsedLocation(), Param,
15290template<
typename Derived>
15294 getDerived().TransformDecl(E->getBeginLoc(), E->getField()));
15299 if (E->hasRewrittenInit()) {
15303 InitRes = getDerived().TransformExpr(E->getRewrittenExpr());
15304 if (InitRes.isInvalid())
15308 if (!getDerived().AlwaysRebuild() && Field == E->getField() &&
15309 E->getUsedContext() == SemaRef.
CurContext &&
15310 InitRes.get() == E->getRewrittenExpr())
15313 return getDerived().RebuildCXXDefaultInitExpr(E->getExprLoc(), Field,
15317template<
typename Derived>
15321 TypeSourceInfo *
T = getDerived().TransformType(E->getTypeSourceInfo());
15325 if (!getDerived().AlwaysRebuild() &&
15326 T == E->getTypeSourceInfo())
15329 return getDerived().RebuildCXXScalarValueInitExpr(
T,
15330 T->getTypeLoc().getEndLoc(),
15331 E->getRParenLoc());
15334template<
typename Derived>
15339 getDerived().TransformTypeWithDeducedTST(E->getAllocatedTypeSourceInfo());
15340 if (!AllocTypeInfo)
15344 std::optional<Expr *> ArraySize;
15345 if (E->isArray()) {
15347 if (std::optional<Expr *> OldArraySize = E->getArraySize()) {
15348 NewArraySize = getDerived().TransformExpr(*OldArraySize);
15349 if (NewArraySize.isInvalid())
15352 ArraySize = NewArraySize.get();
15356 bool ArgumentChanged =
false;
15358 if (getDerived().TransformExprs(E->getPlacementArgs(),
15359 E->getNumPlacementArgs(),
true,
15360 PlacementArgs, &ArgumentChanged))
15364 Expr *OldInit = E->getInitializer();
15367 NewInit = getDerived().TransformInitializer(OldInit,
true);
15368 if (NewInit.isInvalid())
15373 if (E->getOperatorNew()) {
15374 OperatorNew = cast_or_null<FunctionDecl>(
15375 getDerived().TransformDecl(E->getBeginLoc(), E->getOperatorNew()));
15381 if (E->getOperatorDelete()) {
15382 OperatorDelete = cast_or_null<FunctionDecl>(
15383 getDerived().TransformDecl(E->getBeginLoc(), E->getOperatorDelete()));
15384 if (!OperatorDelete)
15388 if (!getDerived().AlwaysRebuild() &&
15389 AllocTypeInfo == E->getAllocatedTypeSourceInfo() &&
15390 ArraySize == E->getArraySize() &&
15391 NewInit.get() == OldInit &&
15392 OperatorNew == E->getOperatorNew() &&
15393 OperatorDelete == E->getOperatorDelete() &&
15394 !ArgumentChanged) {
15399 if (OperatorDelete)
15402 if (E->isArray() && !E->getAllocatedType()->isDependentType()) {
15414 QualType AllocType = AllocTypeInfo->getType();
15425 = dyn_cast<ConstantArrayType>(ArrayT)) {
15429 AllocType = ConsArrayT->getElementType();
15431 = dyn_cast<DependentSizedArrayType>(ArrayT)) {
15432 if (DepArrayT->getSizeExpr()) {
15433 ArraySize = DepArrayT->getSizeExpr();
15434 AllocType = DepArrayT->getElementType();
15439 return getDerived().RebuildCXXNewExpr(
15440 E->getBeginLoc(), E->isGlobalNew(),
15441 E->getBeginLoc(), PlacementArgs,
15442 E->getBeginLoc(), E->getTypeIdParens(), AllocType,
15443 AllocTypeInfo, ArraySize, E->getDirectInitRange(), NewInit.get());
15446template<
typename Derived>
15455 if (E->getOperatorDelete()) {
15456 OperatorDelete = cast_or_null<FunctionDecl>(
15457 getDerived().TransformDecl(E->getBeginLoc(), E->getOperatorDelete()));
15458 if (!OperatorDelete)
15462 if (!getDerived().AlwaysRebuild() &&
15463 Operand.get() == E->getArgument() &&
15464 OperatorDelete == E->getOperatorDelete()) {
15467 if (OperatorDelete)
15470 if (!E->getArgument()->isTypeDependent()) {
15472 E->getDestroyedType());
15481 return getDerived().RebuildCXXDeleteExpr(
15482 E->getBeginLoc(), E->isGlobalDelete(), E->isArrayForm(),
Operand.get());
15485template<
typename Derived>
15490 if (
Base.isInvalid())
15494 bool MayBePseudoDestructor =
false;
15496 E->getOperatorLoc(),
15497 E->isArrow()? tok::arrow : tok::period,
15499 MayBePseudoDestructor);
15500 if (
Base.isInvalid())
15503 QualType ObjectType = ObjectTypePtr.get();
15505 if (QualifierLoc) {
15507 = getDerived().TransformNestedNameSpecifierLoc(QualifierLoc, ObjectType);
15512 SS.
Adopt(QualifierLoc);
15515 if (E->getDestroyedTypeInfo()) {
15516 TypeSourceInfo *DestroyedTypeInfo = getDerived().TransformTypeInObjectScope(
15517 E->getDestroyedTypeInfo(), ObjectType,
15519 if (!DestroyedTypeInfo)
15522 }
else if (!ObjectType.isNull() && ObjectType->isDependentType()) {
15526 E->getDestroyedTypeLoc());
15530 *E->getDestroyedTypeIdentifier(), E->getDestroyedTypeLoc(),
15531 nullptr, SS, ObjectTypePtr,
false);
15537 E->getDestroyedTypeLoc());
15541 if (E->getScopeTypeInfo()) {
15542 ScopeTypeInfo = getDerived().TransformTypeInObjectScope(
15543 E->getScopeTypeInfo(), ObjectType,
nullptr);
15544 if (!ScopeTypeInfo)
15548 return getDerived().RebuildCXXPseudoDestructorExpr(
Base.get(),
15549 E->getOperatorLoc(),
15553 E->getColonColonLoc(),
15558template <
typename Derived>
15563 bool AllEmptyPacks =
true;
15564 for (
auto *OldD : Old->
decls()) {
15580 if (
auto *UPD = dyn_cast<UsingPackDecl>(InstD))
15581 Decls = UPD->expansions();
15584 for (
auto *D : Decls) {
15585 if (
auto *UD = dyn_cast<UsingDecl>(D)) {
15586 for (
auto *SD : UD->shadows())
15593 AllEmptyPacks &= Decls.empty();
15602 if (AllEmptyPacks && !RequiresADL) {
15613 NamedDecl *FoundDecl = R.getRepresentativeDecl()->getUnderlyingDecl();
15614 getSema().FilterAcceptableTemplateNames(R,
15620 getSema().Diag(R.getNameLoc(),
15621 diag::err_template_kw_refers_to_non_template)
15625 diag::note_template_kw_refers_to_non_template)
15626 << R.getLookupName();
15634template <
typename Derived>
15640template <
typename Derived>
15643 bool IsAddressOfOperand) {
15648 if (TransformOverloadExprDecls(Old, Old->
requiresADL(), R))
15655 = getDerived().TransformNestedNameSpecifierLoc(Old->
getQualifierLoc());
15659 SS.
Adopt(QualifierLoc);
15663 CXXRecordDecl *NamingClass
15664 = cast_or_null<CXXRecordDecl>(getDerived().TransformDecl(
15667 if (!NamingClass) {
15672 R.setNamingClass(NamingClass);
15693 SS, TemplateKWLoc, R,
15700 return getDerived().RebuildDeclarationNameExpr(SS, R, Old->
requiresADL());
15703 return getDerived().RebuildTemplateIdExpr(SS, TemplateKWLoc, R,
15707template<
typename Derived>
15710 bool ArgChanged =
false;
15712 for (
unsigned I = 0, N = E->getNumArgs(); I != N; ++I) {
15714 TypeLoc FromTL = From->getTypeLoc();
15717 TLB.
reserve(FromTL.getFullDataSize());
15718 QualType To = getDerived().TransformType(TLB, FromTL);
15722 if (To == From->getType())
15723 Args.push_back(From);
15725 Args.push_back(TLB.getTypeSourceInfo(SemaRef.
Context, To));
15735 TypeLoc PatternTL = ExpansionTL.getPatternLoc();
15741 bool Expand =
true;
15742 bool RetainExpansion =
false;
15744 ExpansionTL.getTypePtr()->getNumExpansions();
15746 if (getDerived().TryExpandParameterPacks(
15747 ExpansionTL.getEllipsisLoc(), PatternTL.getSourceRange(),
15748 Unexpanded,
true, Expand,
15749 RetainExpansion, NumExpansions))
15759 TLB.
reserve(From->getTypeLoc().getFullDataSize());
15761 QualType To = getDerived().TransformType(TLB, PatternTL);
15765 To = getDerived().RebuildPackExpansionType(To,
15766 PatternTL.getSourceRange(),
15767 ExpansionTL.getEllipsisLoc(),
15775 Args.push_back(TLB.getTypeSourceInfo(SemaRef.
Context, To));
15781 for (
unsigned I = 0; I != *NumExpansions; ++I) {
15784 TLB.
reserve(PatternTL.getFullDataSize());
15785 QualType To = getDerived().TransformType(TLB, PatternTL);
15789 if (To->containsUnexpandedParameterPack()) {
15790 To = getDerived().RebuildPackExpansionType(To,
15791 PatternTL.getSourceRange(),
15792 ExpansionTL.getEllipsisLoc(),
15802 Args.push_back(TLB.getTypeSourceInfo(SemaRef.
Context, To));
15805 if (!RetainExpansion)
15810 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
15813 TLB.
reserve(From->getTypeLoc().getFullDataSize());
15815 QualType To = getDerived().TransformType(TLB, PatternTL);
15819 To = getDerived().RebuildPackExpansionType(To,
15820 PatternTL.getSourceRange(),
15821 ExpansionTL.getEllipsisLoc(),
15829 Args.push_back(TLB.getTypeSourceInfo(SemaRef.
Context, To));
15832 if (!getDerived().AlwaysRebuild() && !ArgChanged)
15835 return getDerived().RebuildTypeTrait(E->getTrait(), E->getBeginLoc(), Args,
15839template<
typename Derived>
15845 if (getDerived().TransformTemplateArguments(Old->getTemplateArgs(),
15846 Old->NumTemplateArgs, TransArgs))
15849 return getDerived().RebuildConceptSpecializationExpr(
15850 E->getNestedNameSpecifierLoc(), E->getTemplateKWLoc(),
15851 E->getConceptNameInfo(), E->getFoundDecl(), E->getConceptDecl(),
15855template<
typename Derived>
15869 getSema().Context, getSema().CurContext,
15870 E->getBody()->getBeginLoc());
15874 ExprResult TypeParamResult = getDerived().TransformRequiresTypeParams(
15875 E->getRequiresKWLoc(), E->getRBraceLoc(), E, Body,
15876 E->getLocalParameters(), TransParamTypes, TransParams, ExtParamInfos);
15880 Param->setDeclContext(Body);
15886 if (!TypeParamResult.isUnset())
15887 return TypeParamResult;
15890 if (getDerived().TransformRequiresExprRequirements(E->getRequirements(),
15895 if (
auto *ER = dyn_cast<concepts::ExprRequirement>(Req)) {
15896 if (ER->getReturnTypeRequirement().isTypeConstraint()) {
15897 ER->getReturnTypeRequirement()
15898 .getTypeConstraintTemplateParameterList()->getParam(0)
15899 ->setDeclContext(Body);
15904 return getDerived().RebuildRequiresExpr(
15905 E->getRequiresKWLoc(), Body, E->getLParenLoc(), TransParams,
15906 E->getRParenLoc(), TransReqs, E->getRBraceLoc());
15909template<
typename Derived>
15915 if (
auto *TypeReq = dyn_cast<concepts::TypeRequirement>(Req))
15916 TransReq =
getDerived().TransformTypeRequirement(TypeReq);
15917 else if (
auto *ExprReq = dyn_cast<concepts::ExprRequirement>(Req))
15918 TransReq =
getDerived().TransformExprRequirement(ExprReq);
15920 TransReq =
getDerived().TransformNestedRequirement(
15924 Transformed.push_back(TransReq);
15929template<
typename Derived>
15942 return getDerived().RebuildTypeRequirement(TransType);
15945template<
typename Derived>
15948 llvm::PointerUnion<Expr *, concepts::Requirement::SubstitutionDiagnostic *> TransExpr;
15954 TransExprRes =
SemaRef.CheckPlaceholderExpr(TransExprRes.
get());
15957 TransExpr = TransExprRes.
get();
15960 std::optional<concepts::ExprRequirement::ReturnTypeRequirement> TransRetReq;
15962 if (RetReq.isEmpty())
15963 TransRetReq.emplace();
15964 else if (RetReq.isSubstitutionFailure())
15965 TransRetReq.emplace(RetReq.getSubstitutionDiagnostic());
15966 else if (RetReq.isTypeConstraint()) {
15968 RetReq.getTypeConstraintTemplateParameterList();
15970 getDerived().TransformTemplateParameterList(OrigTPL);
15973 TransRetReq.emplace(TPL);
15975 assert(TransRetReq &&
"All code paths leading here must set TransRetReq");
15976 if (
Expr *E = dyn_cast<Expr *>(TransExpr))
15979 std::move(*TransRetReq));
15985template<
typename Derived>
15991 return getDerived().RebuildNestedRequirement(
15999 return getDerived().RebuildNestedRequirement(TransConstraint.
get());
16002template<
typename Derived>
16009 if (!getDerived().AlwaysRebuild() &&
16026template<
typename Derived>
16033 SubExpr = getDerived().TransformExpr(E->getQueriedExpression());
16034 if (SubExpr.isInvalid())
16037 if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getQueriedExpression())
16041 return getDerived().RebuildExpressionTrait(E->getTrait(), E->getBeginLoc(),
16042 SubExpr.get(), E->getEndLoc());
16045template <
typename Derived>
16050 DRE, AddrTaken, RecoveryTSI);
16063template <
typename Derived>
16070template <
typename Derived>
16086 getDerived().TransformDeclarationNameInfo(E->
getNameInfo());
16091 if (!getDerived().AlwaysRebuild() && QualifierLoc == E->
getQualifierLoc() &&
16097 return getDerived().RebuildDependentScopeDeclRefExpr(
16098 QualifierLoc, TemplateKWLoc, NameInfo,
nullptr,
16099 IsAddressOfOperand, RecoveryTSI);
16103 if (getDerived().TransformTemplateArguments(
16107 return getDerived().RebuildDependentScopeDeclRefExpr(
16108 QualifierLoc, TemplateKWLoc, NameInfo, &TransArgs, IsAddressOfOperand,
16112template<
typename Derived>
16118 if (getDerived().AllowSkippingCXXConstructExpr() &&
16119 ((E->getNumArgs() == 1 ||
16120 (E->getNumArgs() > 1 && getDerived().DropCallArgument(E->getArg(1)))) &&
16121 (!getDerived().DropCallArgument(E->getArg(0))) &&
16122 !E->isListInitialization()))
16128 QualType T = getDerived().TransformType(E->getType());
16133 getDerived().TransformDecl(E->getBeginLoc(), E->getConstructor()));
16137 bool ArgumentChanged =
false;
16142 E->isListInitialization());
16143 if (getDerived().TransformExprs(E->getArgs(), E->getNumArgs(),
true, Args,
16148 if (!getDerived().AlwaysRebuild() &&
16149 T == E->getType() &&
16151 !ArgumentChanged) {
16158 return getDerived().RebuildCXXConstructExpr(
16159 T, E->getBeginLoc(),
Constructor, E->isElidable(), Args,
16160 E->hadMultipleCandidates(), E->isListInitialization(),
16161 E->isStdInitListInitialization(), E->requiresZeroInitialization(),
16162 E->getConstructionKind(), E->getParenOrBraceRange());
16165template<
typename Derived>
16168 QualType T = getDerived().TransformType(E->getType());
16173 getDerived().TransformDecl(E->getBeginLoc(), E->getConstructor()));
16177 if (!getDerived().AlwaysRebuild() &&
16178 T == E->getType() &&
16186 return getDerived().RebuildCXXInheritedCtorInitExpr(
16188 E->constructsVBase(), E->inheritedFromVBase());
16195template<
typename Derived>
16198 if (
auto *Dtor = E->getTemporary()->getDestructor())
16201 return getDerived().TransformExpr(E->getSubExpr());
16209template<
typename Derived>
16215template<
typename Derived>
16220 getDerived().TransformTypeWithDeducedTST(E->getTypeSourceInfo());
16225 getDerived().TransformDecl(E->getBeginLoc(), E->getConstructor()));
16229 bool ArgumentChanged =
false;
16231 Args.reserve(E->getNumArgs());
16235 E->isListInitialization());
16236 if (TransformExprs(E->getArgs(), E->getNumArgs(),
true, Args,
16240 if (E->isListInitialization() && !E->isStdInitListInitialization()) {
16241 ExprResult Res = RebuildInitList(E->getBeginLoc(), Args, E->getEndLoc(),
16243 if (Res.isInvalid())
16245 Args = {Res.get()};
16249 if (!getDerived().AlwaysRebuild() &&
16250 T == E->getTypeSourceInfo() &&
16252 !ArgumentChanged) {
16259 return getDerived().RebuildCXXTemporaryObjectExpr(
16260 T, LParenLoc, Args, E->getEndLoc(), E->isListInitialization());
16263template<
typename Derived>
16268 typedef std::pair<ExprResult, QualType> InitCaptureInfoTy;
16269 struct TransformedInitCapture {
16271 SourceLocation EllipsisLoc;
16273 SmallVector<InitCaptureInfoTy, 4> Expansions;
16276 InitCaptures.resize(E->explicit_capture_end() - E->explicit_capture_begin());
16278 CEnd = E->capture_end();
16280 if (!E->isInitCapture(
C))
16283 TransformedInitCapture &
Result = InitCaptures[
C - E->capture_begin()];
16288 ExprResult NewExprInitResult = getDerived().TransformInitializer(
16291 if (NewExprInitResult.isInvalid()) {
16295 Expr *NewExprInit = NewExprInitResult.get();
16298 getSema().buildLambdaInitCaptureInitialization(
16299 C->getLocation(),
C->getCaptureKind() ==
LCK_ByRef,
16300 EllipsisLoc, NumExpansions, OldVD->getIdentifier(),
16304 Result.Expansions.push_back(
16305 InitCaptureInfoTy(NewExprInit, NewInitCaptureType));
16309 if (OldVD->isParameterPack()) {
16318 bool Expand =
true;
16319 bool RetainExpansion =
false;
16321 ExpansionTL.getTypePtr()->getNumExpansions();
16323 if (getDerived().TryExpandParameterPacks(
16324 ExpansionTL.getEllipsisLoc(), OldVD->getInit()->getSourceRange(),
16325 Unexpanded,
true, Expand,
16326 RetainExpansion, NumExpansions))
16328 assert(!RetainExpansion &&
"Should not need to retain expansion after a "
16329 "capture since it cannot be extended");
16331 for (
unsigned I = 0; I != *NumExpansions; ++I) {
16336 SubstInitCapture(ExpansionTL.getEllipsisLoc(), NumExpansions);
16337 Result.EllipsisLoc = ExpansionTL.getEllipsisLoc();
16376 if ((getSema().isUnevaluatedContext() ||
16377 getSema().isConstantEvaluatedContext()) &&
16378 !(dyn_cast_or_null<CXXRecordDecl>(DC->getParent()) &&
16380 (DC->isFileContext() || !DC->getParent()->isDependentContext()))
16385 E->getIntroducerRange(),
nullptr, DependencyKind,
16386 E->getCaptureDefault());
16387 getDerived().transformedLocalDecl(OldClass, {
Class});
16390 getSema().CreateLambdaCallOperator(E->getIntroducerRange(),
Class);
16393 getSema().buildLambdaScope(LSI, NewCallOperator, E->getIntroducerRange(),
16394 E->getCaptureDefault(), E->getCaptureDefaultLoc(),
16395 E->hasExplicitParameters(), E->isMutable());
16405 CEnd = E->capture_end();
16409 if (
C->isImplicit())
16413 if (
C->capturesThis()) {
16421 dyn_cast_if_present<CXXRecordDecl>(
16422 getSema().getFunctionLevelDeclContext()),
16424 getSema().CheckCXXThisCapture(
C->getLocation(),
C->isExplicit(),
16431 if (
C->capturesVLAType())
16435 if (E->isInitCapture(
C)) {
16436 TransformedInitCapture &NewC = InitCaptures[
C - E->capture_begin()];
16441 for (InitCaptureInfoTy &Info : NewC.Expansions) {
16443 QualType InitQualType = Info.second;
16444 if (
Init.isInvalid() || InitQualType.isNull()) {
16448 VarDecl *NewVD = getSema().createLambdaInitCaptureVarDecl(
16449 OldVD->getLocation(), InitQualType, NewC.EllipsisLoc,
16450 OldVD->getIdentifier(), OldVD->getInitStyle(),
Init.get(),
16451 getSema().CurContext);
16456 NewVDs.push_back(NewVD);
16457 getSema().addInitCapture(LSI, NewVD,
C->getCaptureKind() ==
LCK_ByRef);
16462 if (NewC.EllipsisLoc.isInvalid())
16463 LSI->ContainsUnexpandedParameterPack |=
16464 Init.get()->containsUnexpandedParameterPack();
16470 getDerived().transformedLocalDecl(OldVD, NewVDs);
16474 assert(
C->capturesVariable() &&
"unexpected kind of lambda capture");
16482 if (
C->isPackExpansion()) {
16484 bool ShouldExpand =
false;
16485 bool RetainExpansion =
false;
16487 if (getDerived().TryExpandParameterPacks(
16488 C->getEllipsisLoc(),
C->getLocation(), Unexpanded,
16489 true, ShouldExpand,
16490 RetainExpansion, NumExpansions)) {
16495 if (ShouldExpand) {
16500 for (
unsigned I = 0; I != *NumExpansions; ++I) {
16502 ValueDecl *CapturedVar = cast_if_present<ValueDecl>(
16503 getDerived().TransformDecl(
C->getLocation(), Pack));
16504 if (!CapturedVar) {
16510 getSema().tryCaptureVariable(CapturedVar,
C->getLocation(), Kind);
16518 EllipsisLoc =
C->getEllipsisLoc();
16522 auto *CapturedVar = cast_or_null<ValueDecl>(
16523 getDerived().TransformDecl(
C->getLocation(),
C->getCapturedVar()));
16524 if (!CapturedVar || CapturedVar->isInvalidDecl()) {
16531 if (
auto *VD = dyn_cast<VarDecl>(CapturedVar); VD && !
C->isPackExpansion())
16532 LSI->ContainsUnexpandedParameterPack |= VD->isParameterPack();
16535 getSema().tryCaptureVariable(CapturedVar,
C->getLocation(), Kind,
16538 getSema().finishLambdaExplicitCaptures(LSI);
16542 auto TPL = getDerived().TransformTemplateParameterList(
16543 E->getTemplateParameterList());
16544 LSI->GLTemplateParameterList = TPL;
16546 getSema().AddTemplateParametersToLambdaCallOperator(NewCallOperator,
Class,
16548 LSI->ContainsUnexpandedParameterPack |=
16549 TPL->containsUnexpandedParameterPack();
16554 E->getCallOperator()->getTypeSourceInfo()->getTypeLoc();
16556 getDerived().TransformType(NewCallOpTLBuilder, OldCallOpTypeLoc);
16557 if (NewCallOpType.isNull())
16559 LSI->ContainsUnexpandedParameterPack |=
16560 NewCallOpType->containsUnexpandedParameterPack();
16562 NewCallOpTLBuilder.getTypeSourceInfo(getSema().Context, NewCallOpType);
16567 assert(FPTL &&
"Not a FunctionProtoType?");
16571 ExprResult E = getDerived().TransformLambdaConstraint(
16572 const_cast<Expr *
>(TRC.ConstraintExpr));
16575 TRC.ConstraintExpr = E.get();
16578 LSI->BeforeCompoundStatement =
false;
16579 getSema().CompleteLambdaCallOperator(
16580 NewCallOperator, E->getCallOperator()->getLocation(),
16581 E->getCallOperator()->getInnerLocStart(), TRC, NewCallOpTSI,
16582 E->getCallOperator()->getConstexprKind(),
16583 E->getCallOperator()->getStorageClass(), FPTL.getParams(),
16584 E->hasExplicitResultType());
16586 getDerived().transformAttrs(E->getCallOperator(), NewCallOperator);
16587 getDerived().transformedLocalDecl(E->getCallOperator(), {NewCallOperator});
16593 std::optional<CXXRecordDecl::LambdaNumbering> Numbering;
16594 if (getDerived().ReplacingOriginal()) {
16595 Numbering = OldClass->getLambdaNumbering();
16598 getSema().handleLambdaNumbering(
Class, NewCallOperator, Numbering);
16603 getSema().PushExpressionEvaluationContextForFunction(
16605 E->getCallOperator());
16612 C.PointOfInstantiation = E->getBody()->getBeginLoc();
16613 getSema().pushCodeSynthesisContext(
C);
16617 : getDerived().TransformLambdaBody(E, E->getBody());
16619 getSema().popCodeSynthesisContext();
16623 FuncScopeCleanup.disable();
16625 if (Body.isInvalid()) {
16626 SavedContext.pop();
16627 getSema().ActOnLambdaError(E->getBeginLoc(),
nullptr,
16632 getSema().ActOnFinishFunctionBody(NewCallOperator, Body.get(),
16635 SavedContext.pop();
16670 DependencyKind = getDerived().ComputeLambdaDependency(LSI);
16671 Class->setLambdaDependencyKind(DependencyKind);
16673 return getDerived().RebuildLambdaExpr(E->getBeginLoc(),
16674 Body.get()->getEndLoc(), LSI);
16677template<
typename Derived>
16683template<
typename Derived>
16692 if (!
C->isImplicit())
16696 if (
C->capturesThis()) {
16697 getSema().CheckCXXThisCapture(
C->getLocation(),
C->isExplicit(),
16704 if (
C->capturesVLAType())
16707 assert(
C->capturesVariable() &&
"unexpected kind of lambda capture");
16711 VarDecl *CapturedVar = cast_or_null<VarDecl>(
16717 getSema().tryCaptureVariable(CapturedVar,
C->getLocation());
16723template<
typename Derived>
16732 bool ArgumentChanged =
false;
16744 if (!getDerived().AlwaysRebuild() &&
16750 return getDerived().RebuildCXXUnresolvedConstructExpr(
16754template <
typename Derived>
16758 TemplateName Name = getDerived().TransformConceptTemplateName(
16759 E->getTemplateName(), E->getNameLoc());
16764 if (getDerived().TransformTemplateArguments(
16765 E->template_arguments().data(), E->getNumTemplateArgs(), TransArgs))
16778 return getDerived().RebuildTemplateIdExpr(
16780 false, &TransArgs);
16783template<
typename Derived>
16792 if (!E->isImplicitAccess()) {
16793 OldBase = E->getBase();
16794 Base = getDerived().TransformExpr(OldBase);
16795 if (
Base.isInvalid())
16800 bool MayBePseudoDestructor =
false;
16802 E->getOperatorLoc(),
16803 E->isArrow()? tok::arrow : tok::period,
16805 MayBePseudoDestructor);
16806 if (
Base.isInvalid())
16809 ObjectType = ObjectTy.get();
16810 BaseType = ((
Expr*)
Base.get())->getType();
16813 BaseType = getDerived().TransformType(E->getBaseType());
16820 = getDerived().TransformFirstQualifierInScope(
16821 E->getFirstQualifierFoundInScope(),
16822 E->getQualifierLoc().getBeginLoc());
16825 if (E->getQualifier()) {
16827 = getDerived().TransformNestedNameSpecifierLoc(E->getQualifierLoc(),
16829 FirstQualifierInScope);
16841 = getDerived().TransformDeclarationNameInfo(E->getMemberNameInfo());
16842 if (!NameInfo.getName())
16845 if (!E->hasExplicitTemplateArgs()) {
16848 if (!getDerived().AlwaysRebuild() &&
16849 Base.get() == OldBase &&
16850 BaseType == E->getBaseType() &&
16851 QualifierLoc == E->getQualifierLoc() &&
16852 NameInfo.getName() == E->getMember() &&
16853 FirstQualifierInScope == E->getFirstQualifierFoundInScope())
16856 return getDerived().RebuildCXXDependentScopeMemberExpr(
Base.get(),
16859 E->getOperatorLoc(),
16862 FirstQualifierInScope,
16868 if (getDerived().TransformTemplateArguments(E->getTemplateArgs(),
16869 E->getNumTemplateArgs(),
16873 return getDerived().RebuildCXXDependentScopeMemberExpr(
Base.get(),
16876 E->getOperatorLoc(),
16879 FirstQualifierInScope,
16884template <
typename Derived>
16890 if (!Old->isImplicitAccess()) {
16891 Base = getDerived().TransformExpr(Old->getBase());
16892 if (
Base.isInvalid())
16895 getSema().PerformMemberExprBaseConversion(
Base.get(), Old->isArrow());
16896 if (
Base.isInvalid())
16898 BaseType =
Base.get()->getType();
16900 BaseType = getDerived().TransformType(Old->getBaseType());
16904 if (Old->getQualifierLoc()) {
16906 getDerived().TransformNestedNameSpecifierLoc(Old->getQualifierLoc());
16916 if (TransformOverloadExprDecls(Old,
false, R))
16920 if (Old->getNamingClass()) {
16922 getDerived().TransformDecl(Old->getMemberLoc(), Old->getNamingClass()));
16926 R.setNamingClass(NamingClass);
16930 if (Old->hasExplicitTemplateArgs()) {
16931 TransArgs.setLAngleLoc(Old->getLAngleLoc());
16932 TransArgs.setRAngleLoc(Old->getRAngleLoc());
16933 if (getDerived().TransformTemplateArguments(
16934 Old->getTemplateArgs(), Old->getNumTemplateArgs(), TransArgs))
16942 NamedDecl *FirstQualifierInScope =
nullptr;
16944 return getDerived().RebuildUnresolvedMemberExpr(
16945 Base.get(), BaseType, Old->getOperatorLoc(), Old->isArrow(), QualifierLoc,
16946 TemplateKWLoc, FirstQualifierInScope, R,
16947 (Old->hasExplicitTemplateArgs() ? &TransArgs :
nullptr));
16950template<
typename Derived>
16955 ExprResult SubExpr = getDerived().TransformExpr(E->getOperand());
16956 if (SubExpr.isInvalid())
16959 if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getOperand())
16962 return getDerived().RebuildCXXNoexceptExpr(E->getSourceRange(),SubExpr.get());
16965template<
typename Derived>
16968 ExprResult Pattern = getDerived().TransformExpr(E->getPattern());
16969 if (Pattern.isInvalid())
16972 if (!getDerived().AlwaysRebuild() && Pattern.get() == E->getPattern())
16975 return getDerived().RebuildPackExpansion(Pattern.get(), E->getEllipsisLoc(),
16976 E->getNumExpansions());
16979template <
typename Derived>
16984 if (!Arg.isPackExpansion()) {
16996 getSema().getTemplateArgumentPackExpansionPattern(ArgLoc, Ellipsis,
16997 OrigNumExpansions);
17009 if (!NumExpansions) {
17021template<
typename Derived>
17040 bool ShouldExpand =
false;
17041 bool RetainExpansion =
false;
17043 if (getDerived().TryExpandParameterPacks(
17045 true, ShouldExpand,
17046 RetainExpansion, NumExpansions))
17051 if (ShouldExpand) {
17053 if (
auto *TTPD = dyn_cast<TemplateTypeParmDecl>(Pack)) {
17054 ArgStorage = getSema().Context.getPackExpansionType(
17055 getSema().Context.getTypeDeclType(TTPD), std::nullopt);
17056 }
else if (
auto *TTPD = dyn_cast<TemplateTemplateParmDecl>(Pack)) {
17060 ExprResult DRE = getSema().BuildDeclRefExpr(
17061 VD, VD->getType().getNonLValueExprType(getSema().Context),
17064 if (DRE.isInvalid())
17067 new (getSema().Context)
17071 PackArgs = ArgStorage;
17076 if (!PackArgs.size()) {
17077 auto *Pack = cast_or_null<NamedDecl>(
17081 return getDerived().RebuildSizeOfPackExpr(
17088 getDerived().ComputeSizeOfPackExprWithoutSubstitution(PackArgs);
17100 TemporaryBase Rebase(*
this, E->
getPackLoc(), getBaseEntity());
17103 if (TransformTemplateArguments(PackLocIterator(*
this, PackArgs.begin()),
17104 PackLocIterator(*
this, PackArgs.end()),
17105 TransformedPackArgs,
true))
17112 bool PartialSubstitution =
false;
17113 for (
auto &Loc : TransformedPackArgs.arguments()) {
17114 Args.push_back(Loc.getArgument());
17115 if (Loc.getArgument().isPackExpansion())
17116 PartialSubstitution =
true;
17119 if (PartialSubstitution)
17120 return getDerived().RebuildSizeOfPackExpr(
17122 std::nullopt, Args);
17124 return getDerived().RebuildSizeOfPackExpr(
17126 static_cast<unsigned>(Args.size()),
17130template <
typename Derived>
17133 if (!E->isValueDependent())
17141 IndexExpr = getDerived().TransformExpr(E->getIndexExpr());
17142 if (IndexExpr.isInvalid())
17147 bool FullySubstituted =
true;
17148 if (!E->expandsToEmptyPack() && E->getExpressions().empty()) {
17149 Expr *Pattern = E->getPackIdExpression();
17151 getSema().collectUnexpandedParameterPacks(E->getPackIdExpression(),
17153 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
17157 bool ShouldExpand =
true;
17158 bool RetainExpansion =
false;
17160 NumExpansions = std::nullopt;
17161 if (getDerived().TryExpandParameterPacks(
17162 E->getEllipsisLoc(), Pattern->getSourceRange(), Unexpanded,
17163 true, ShouldExpand,
17164 RetainExpansion, NumExpansions))
17166 if (!ShouldExpand) {
17168 ExprResult Pack = getDerived().TransformExpr(Pattern);
17169 if (Pack.isInvalid())
17171 return getDerived().RebuildPackIndexingExpr(
17172 E->getEllipsisLoc(), E->getRSquareLoc(), Pack.get(), IndexExpr.get(),
17175 for (
unsigned I = 0; I != *NumExpansions; ++I) {
17178 if (
Out.isInvalid())
17180 if (
Out.get()->containsUnexpandedParameterPack()) {
17181 Out = getDerived().RebuildPackExpansion(
Out.get(), E->getEllipsisLoc(),
17182 OrigNumExpansions);
17183 if (
Out.isInvalid())
17185 FullySubstituted =
false;
17187 ExpandedExprs.push_back(
Out.get());
17191 if (RetainExpansion) {
17192 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
17195 if (
Out.isInvalid())
17198 Out = getDerived().RebuildPackExpansion(
Out.get(), E->getEllipsisLoc(),
17199 OrigNumExpansions);
17200 if (
Out.isInvalid())
17202 FullySubstituted =
false;
17203 ExpandedExprs.push_back(
Out.get());
17205 }
else if (!E->expandsToEmptyPack()) {
17206 if (getDerived().TransformExprs(E->getExpressions().data(),
17207 E->getExpressions().size(),
false,
17212 return getDerived().RebuildPackIndexingExpr(
17213 E->getEllipsisLoc(), E->getRSquareLoc(), E->getPackIdExpression(),
17214 IndexExpr.get(), ExpandedExprs, FullySubstituted);
17217template <
typename Derived>
17220 if (!getSema().ArgPackSubstIndex)
17226 return getDerived().RebuildSubstNonTypeTemplateParmExpr(
17227 E->getAssociatedDecl(), E->getParameterPack()->getPosition(),
17228 E->getParameterPack()->getType(), E->getParameterPackLocation(), Arg,
17232template <
typename Derived>
17249 ExprResult Replacement = getDerived().TransformExpr(OrigReplacement);
17250 if (Replacement.isInvalid())
17253 Decl *AssociatedDecl =
17254 getDerived().TransformDecl(E->getNameLoc(), E->getAssociatedDecl());
17255 if (!AssociatedDecl)
17258 QualType ParamType = TransformType(E->getParameterType());
17259 if (ParamType.isNull())
17262 if (Replacement.get() == OrigReplacement &&
17263 AssociatedDecl == E->getAssociatedDecl() &&
17264 ParamType == E->getParameterType())
17267 if (Replacement.get() != OrigReplacement ||
17268 ParamType != E->getParameterType()) {
17277 Param, ParamType, Replacement.get(), SugaredConverted,
17278 CanonicalConverted,
17280 if (Replacement.isInvalid())
17284 Replacement = E->getReplacement();
17287 return getDerived().RebuildSubstNonTypeTemplateParmExpr(
17288 AssociatedDecl, E->getIndex(), ParamType, E->getNameLoc(),
17290 E->getPackIndex(), E->getFinal());
17293template<
typename Derived>
17300template<
typename Derived>
17307template<
typename Derived>
17311 if (
Expr *OldCallee = E->getCallee()) {
17312 ExprResult CalleeResult = getDerived().TransformExpr(OldCallee);
17313 if (CalleeResult.isInvalid())
17318 Expr *Pattern = E->getPattern();
17321 getSema().collectUnexpandedParameterPacks(Pattern, Unexpanded);
17322 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
17326 bool Expand =
true;
17327 bool RetainExpansion =
false;
17329 NumExpansions = OrigNumExpansions;
17330 if (getDerived().TryExpandParameterPacks(
17331 E->getEllipsisLoc(), Pattern->getSourceRange(), Unexpanded,
17332 true, Expand, RetainExpansion,
17342 E->getLHS() ? getDerived().TransformExpr(E->getLHS()) :
ExprResult();
17343 if (LHS.isInvalid())
17347 E->getRHS() ? getDerived().TransformExpr(E->getRHS()) :
ExprResult();
17348 if (RHS.isInvalid())
17351 if (!getDerived().AlwaysRebuild() &&
17352 LHS.get() == E->getLHS() && RHS.get() == E->getRHS())
17355 return getDerived().RebuildCXXFoldExpr(
17356 Callee, E->getBeginLoc(), LHS.get(), E->getOperator(),
17357 E->getEllipsisLoc(), RHS.get(), E->getEndLoc(), NumExpansions);
17363 if (NumExpansions && SemaRef.
getLangOpts().BracketDepth < *NumExpansions) {
17364 SemaRef.
Diag(E->getEllipsisLoc(),
17365 clang::diag::err_fold_expression_limit_exceeded)
17366 << *NumExpansions << SemaRef.
getLangOpts().BracketDepth
17367 << E->getSourceRange();
17368 SemaRef.
Diag(E->getEllipsisLoc(), diag::note_bracket_depth);
17377 bool LeftFold = E->isLeftFold();
17381 if (!LeftFold && RetainExpansion) {
17382 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
17385 if (
Out.isInvalid())
17388 Result = getDerived().RebuildCXXFoldExpr(
17389 Callee, E->getBeginLoc(),
Out.get(), E->getOperator(),
17390 E->getEllipsisLoc(),
Result.get(), E->getEndLoc(), OrigNumExpansions);
17395 bool WarnedOnComparison =
false;
17396 for (
unsigned I = 0; I != *NumExpansions; ++I) {
17398 getSema(), LeftFold ? I : *NumExpansions - I - 1);
17400 if (
Out.isInvalid())
17403 if (
Out.get()->containsUnexpandedParameterPack()) {
17405 Result = getDerived().RebuildCXXFoldExpr(
17406 Callee, E->getBeginLoc(), LeftFold ?
Result.get() :
Out.get(),
17407 E->getOperator(), E->getEllipsisLoc(),
17408 LeftFold ?
Out.get() :
Result.get(), E->getEndLoc(),
17409 OrigNumExpansions);
17410 }
else if (
Result.isUsable()) {
17417 Result = getDerived().RebuildCXXOperatorCallExpr(
17419 E->getEllipsisLoc(),
Callee->getBeginLoc(),
Callee->requiresADL(),
17420 Functions, LHS, RHS);
17422 Result = getDerived().RebuildBinaryOperator(E->getEllipsisLoc(),
17423 E->getOperator(), LHS, RHS,
17425 if (!WarnedOnComparison &&
Result.isUsable()) {
17426 if (
auto *BO = dyn_cast<BinaryOperator>(
Result.get());
17427 BO && BO->isComparisonOp()) {
17428 WarnedOnComparison =
true;
17429 SemaRef.
Diag(BO->getBeginLoc(),
17430 diag::warn_comparison_in_fold_expression)
17431 << BO->getOpcodeStr();
17444 if (LeftFold && RetainExpansion) {
17445 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
17448 if (
Out.isInvalid())
17451 Result = getDerived().RebuildCXXFoldExpr(
17452 Callee, E->getBeginLoc(),
Result.get(), E->getOperator(),
17453 E->getEllipsisLoc(),
Out.get(), E->getEndLoc(), OrigNumExpansions);
17459 PE->setIsProducedByFoldExpansion();
17464 return getDerived().RebuildEmptyCXXFoldExpr(E->getEllipsisLoc(),
17469template <
typename Derived>
17475 QualType T = getDerived().TransformType(E->getType());
17477 bool ArgChanged =
false;
17479 if (getDerived().TransformExprs(InitExprs.data(), InitExprs.size(),
true,
17480 TransformedInits, &ArgChanged))
17483 if (!getDerived().AlwaysRebuild() && !ArgChanged &&
T == E->getType())
17486 return getDerived().RebuildCXXParenListInitExpr(
17487 TransformedInits,
T, E->getUserSpecifiedInitExprs().size(),
17488 E->getInitLoc(), E->getBeginLoc(), E->getEndLoc());
17491template<
typename Derived>
17498template<
typename Derived>
17504template<
typename Derived>
17510template<
typename Derived>
17513 ExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
17514 if (SubExpr.isInvalid())
17517 if (!getDerived().AlwaysRebuild() &&
17518 SubExpr.get() == E->getSubExpr())
17521 return getDerived().RebuildObjCBoxedExpr(E->getSourceRange(), SubExpr.get());
17524template<
typename Derived>
17529 bool ArgChanged =
false;
17530 if (getDerived().TransformExprs(E->getElements(), E->getNumElements(),
17531 false, Elements, &ArgChanged))
17534 if (!getDerived().AlwaysRebuild() && !ArgChanged)
17537 return getDerived().RebuildObjCArrayLiteral(E->getSourceRange(),
17542template<
typename Derived>
17548 bool ArgChanged =
false;
17549 for (
unsigned I = 0, N = E->getNumElements(); I != N; ++I) {
17552 if (OrigElement.isPackExpansion()) {
17555 getSema().collectUnexpandedParameterPacks(OrigElement.Key, Unexpanded);
17556 getSema().collectUnexpandedParameterPacks(OrigElement.Value, Unexpanded);
17557 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
17561 bool Expand =
true;
17562 bool RetainExpansion =
false;
17565 SourceRange PatternRange(OrigElement.Key->getBeginLoc(),
17566 OrigElement.Value->getEndLoc());
17567 if (getDerived().TryExpandParameterPacks(
17568 OrigElement.EllipsisLoc, PatternRange, Unexpanded,
17569 true, Expand, RetainExpansion,
17578 ExprResult Key = getDerived().TransformExpr(OrigElement.Key);
17579 if (Key.isInvalid())
17582 if (Key.get() != OrigElement.Key)
17586 if (
Value.isInvalid())
17593 Key.get(),
Value.get(), OrigElement.EllipsisLoc, NumExpansions
17595 Elements.push_back(Expansion);
17605 for (
unsigned I = 0; I != *NumExpansions; ++I) {
17607 ExprResult Key = getDerived().TransformExpr(OrigElement.Key);
17608 if (Key.isInvalid())
17612 if (
Value.isInvalid())
17622 if (Key.get()->containsUnexpandedParameterPack() ||
17623 Value.get()->containsUnexpandedParameterPack())
17624 Element.EllipsisLoc = OrigElement.EllipsisLoc;
17626 Elements.push_back(Element);
17636 ExprResult Key = getDerived().TransformExpr(OrigElement.Key);
17637 if (Key.isInvalid())
17640 if (Key.get() != OrigElement.Key)
17645 = getDerived().TransformExpr(OrigElement.Value);
17646 if (
Value.isInvalid())
17654 Elements.push_back(Element);
17657 if (!getDerived().AlwaysRebuild() && !ArgChanged)
17660 return getDerived().RebuildObjCDictionaryLiteral(E->getSourceRange(),
17664template<
typename Derived>
17668 = getDerived().TransformType(E->getEncodedTypeSourceInfo());
17669 if (!EncodedTypeInfo)
17672 if (!getDerived().AlwaysRebuild() &&
17673 EncodedTypeInfo == E->getEncodedTypeSourceInfo())
17676 return getDerived().RebuildObjCEncodeExpr(E->getAtLoc(),
17678 E->getRParenLoc());
17681template<
typename Derived>
17691template<
typename Derived>
17695 = getDerived().TransformType(E->getTypeInfoAsWritten());
17703 if (!getDerived().AlwaysRebuild() &&
17704 TSInfo == E->getTypeInfoAsWritten() &&
17705 Result.get() == E->getSubExpr())
17709 E->getLParenLoc(), E->getBridgeKind(), E->getBridgeKeywordLoc(), TSInfo,
17713template <
typename Derived>
17719template<
typename Derived>
17723 bool ArgChanged =
false;
17725 Args.reserve(E->getNumArgs());
17726 if (getDerived().TransformExprs(E->getArgs(), E->getNumArgs(),
false, Args,
17733 = getDerived().TransformType(E->getClassReceiverTypeInfo());
17734 if (!ReceiverTypeInfo)
17738 if (!getDerived().AlwaysRebuild() &&
17739 ReceiverTypeInfo == E->getClassReceiverTypeInfo() && !ArgChanged)
17744 E->getSelectorLocs(SelLocs);
17745 return getDerived().RebuildObjCMessageExpr(ReceiverTypeInfo,
17748 E->getMethodDecl(),
17755 if (!E->getMethodDecl())
17760 E->getSelectorLocs(SelLocs);
17761 return getDerived().RebuildObjCMessageExpr(E->getSuperLoc(),
17764 E->getReceiverType(),
17765 E->getMethodDecl(),
17773 "Only class and instance messages may be instantiated");
17775 = getDerived().TransformExpr(E->getInstanceReceiver());
17776 if (Receiver.isInvalid())
17780 if (!getDerived().AlwaysRebuild() &&
17781 Receiver.get() == E->getInstanceReceiver() && !ArgChanged)
17786 E->getSelectorLocs(SelLocs);
17787 return getDerived().RebuildObjCMessageExpr(Receiver.get(),
17790 E->getMethodDecl(),
17796template<
typename Derived>
17802template<
typename Derived>
17808template<
typename Derived>
17813 if (
Base.isInvalid())
17819 if (!getDerived().AlwaysRebuild() &&
17820 Base.get() == E->getBase())
17823 return getDerived().RebuildObjCIvarRefExpr(
Base.get(), E->getDecl(),
17825 E->isArrow(), E->isFreeIvar());
17828template<
typename Derived>
17833 if (!E->isObjectReceiver())
17838 if (
Base.isInvalid())
17844 if (!getDerived().AlwaysRebuild() &&
17845 Base.get() == E->getBase())
17848 if (E->isExplicitProperty())
17849 return getDerived().RebuildObjCPropertyRefExpr(
Base.get(),
17850 E->getExplicitProperty(),
17853 return getDerived().RebuildObjCPropertyRefExpr(
Base.get(),
17855 E->getImplicitPropertyGetter(),
17856 E->getImplicitPropertySetter(),
17860template<
typename Derived>
17865 if (
Base.isInvalid())
17869 ExprResult Key = getDerived().TransformExpr(E->getKeyExpr());
17870 if (Key.isInvalid())
17874 if (!getDerived().AlwaysRebuild() &&
17875 Key.get() == E->getKeyExpr() &&
Base.get() == E->getBaseExpr())
17878 return getDerived().RebuildObjCSubscriptRefExpr(E->getRBracket(),
17879 Base.get(), Key.get(),
17880 E->getAtIndexMethodDecl(),
17881 E->setAtIndexMethodDecl());
17884template<
typename Derived>
17889 if (
Base.isInvalid())
17893 if (!getDerived().AlwaysRebuild() &&
17894 Base.get() == E->getBase())
17897 return getDerived().RebuildObjCIsaExpr(
Base.get(), E->getIsaMemberLoc(),
17902template<
typename Derived>
17905 bool ArgumentChanged =
false;
17907 SubExprs.reserve(E->getNumSubExprs());
17908 if (getDerived().TransformExprs(E->getSubExprs(), E->getNumSubExprs(),
false,
17909 SubExprs, &ArgumentChanged))
17912 if (!getDerived().AlwaysRebuild() &&
17916 return getDerived().RebuildShuffleVectorExpr(E->getBuiltinLoc(),
17918 E->getRParenLoc());
17921template<
typename Derived>
17924 ExprResult SrcExpr = getDerived().TransformExpr(E->getSrcExpr());
17925 if (SrcExpr.isInvalid())
17932 if (!getDerived().AlwaysRebuild() &&
17933 Type == E->getTypeSourceInfo() &&
17934 SrcExpr.get() == E->getSrcExpr())
17937 return getDerived().RebuildConvertVectorExpr(E->getBuiltinLoc(),
17938 SrcExpr.get(),
Type,
17939 E->getRParenLoc());
17942template<
typename Derived>
17945 BlockDecl *oldBlock = E->getBlockDecl();
17951 blockScope->TheDecl->setBlockMissingReturnType(
17952 oldBlock->blockMissingReturnType());
17961 if (getDerived().TransformFunctionTypeParams(
17962 E->getCaretLocation(), oldBlock->parameters(),
nullptr,
17963 exprFunctionType->getExtParameterInfosOrNull(), paramTypes, ¶ms,
17965 getSema().ActOnBlockError(E->getCaretLocation(),
nullptr);
17970 getDerived().TransformType(exprFunctionType->getReturnType());
17972 auto epi = exprFunctionType->getExtProtoInfo();
17973 epi.ExtParameterInfos = extParamInfos.getPointerOrNull(paramTypes.size());
17976 getDerived().RebuildFunctionProtoType(exprResultType, paramTypes, epi);
17980 if (!params.empty())
17981 blockScope->TheDecl->setParams(params);
17983 if (!oldBlock->blockMissingReturnType()) {
17984 blockScope->HasImplicitReturnType =
false;
17985 blockScope->ReturnType = exprResultType;
17989 StmtResult body = getDerived().TransformStmt(E->getBody());
17990 if (body.isInvalid()) {
17991 getSema().ActOnBlockError(E->getCaretLocation(),
nullptr);
17999 for (
const auto &I : oldBlock->captures()) {
18000 VarDecl *oldCapture = I.getVariable();
18003 if (oldCapture->isParameterPack())
18007 cast<VarDecl>(getDerived().TransformDecl(E->getCaretLocation(),
18009 assert(blockScope->CaptureMap.count(newCapture));
18018template<
typename Derived>
18021 ExprResult SrcExpr = getDerived().TransformExpr(E->getSrcExpr());
18022 if (SrcExpr.isInvalid())
18025 QualType Type = getDerived().TransformType(E->getType());
18028 E->getRParenLoc());
18031template<
typename Derived>
18034 bool ArgumentChanged =
false;
18036 SubExprs.reserve(E->getNumSubExprs());
18037 if (getDerived().TransformExprs(E->getSubExprs(), E->getNumSubExprs(),
false,
18038 SubExprs, &ArgumentChanged))
18041 if (!getDerived().AlwaysRebuild() &&
18045 return getDerived().RebuildAtomicExpr(E->getBuiltinLoc(), SubExprs,
18046 E->getOp(), E->getRParenLoc());
18053template<
typename Derived>
18056 return SemaRef.BuildPointerType(PointeeType,
Star,
18060template<
typename Derived>
18063 return SemaRef.BuildBlockPointerType(PointeeType,
Star,
18067template<
typename Derived>
18070 bool WrittenAsLValue,
18072 return SemaRef.BuildReferenceType(ReferentType, WrittenAsLValue,
18076template <
typename Derived>
18080 return SemaRef.BuildMemberPointerType(PointeeType, SS, Cls, Sigil,
18084template<
typename Derived>
18091 return SemaRef.ObjC().BuildObjCTypeParamType(
18092 Decl, ProtocolLAngleLoc, Protocols, ProtocolLocs, ProtocolRAngleLoc,
18096template<
typename Derived>
18107 return SemaRef.ObjC().BuildObjCObjectType(
18108 BaseType, Loc, TypeArgsLAngleLoc, TypeArgs, TypeArgsRAngleLoc,
18109 ProtocolLAngleLoc, Protocols, ProtocolLocs, ProtocolRAngleLoc,
18114template<
typename Derived>
18118 return SemaRef.Context.getObjCObjectPointerType(PointeeType);
18121template <
typename Derived>
18124 Expr *SizeExpr,
unsigned IndexTypeQuals,
SourceRange BracketsRange) {
18125 if (SizeExpr || !Size)
18126 return SemaRef.BuildArrayType(ElementType, SizeMod, SizeExpr,
18127 IndexTypeQuals, BracketsRange,
18131 SemaRef.Context.UnsignedCharTy,
SemaRef.Context.UnsignedShortTy,
18133 SemaRef.Context.UnsignedLongLongTy,
SemaRef.Context.UnsignedInt128Ty
18136 for (
const auto &
T : Types)
18137 if (Size->getBitWidth() ==
SemaRef.Context.getIntWidth(
T)) {
18147 return SemaRef.BuildArrayType(ElementType, SizeMod, ArraySize,
18148 IndexTypeQuals, BracketsRange,
18152template <
typename Derived>
18155 Expr *SizeExpr,
unsigned IndexTypeQuals,
SourceRange BracketsRange) {
18156 return getDerived().RebuildArrayType(ElementType, SizeMod, &Size, SizeExpr,
18157 IndexTypeQuals, BracketsRange);
18160template <
typename Derived>
18164 return getDerived().RebuildArrayType(ElementType, SizeMod,
nullptr,
nullptr,
18165 IndexTypeQuals, BracketsRange);
18168template <
typename Derived>
18171 unsigned IndexTypeQuals,
SourceRange BracketsRange) {
18172 return getDerived().RebuildArrayType(ElementType, SizeMod,
nullptr,
18174 IndexTypeQuals, BracketsRange);
18177template <
typename Derived>
18180 unsigned IndexTypeQuals,
SourceRange BracketsRange) {
18181 return getDerived().RebuildArrayType(ElementType, SizeMod,
nullptr,
18183 IndexTypeQuals, BracketsRange);
18186template <
typename Derived>
18189 return SemaRef.BuildAddressSpaceAttr(PointeeType, AddrSpaceExpr,
18193template <
typename Derived>
18195 unsigned NumElements,
18198 return SemaRef.Context.getVectorType(ElementType, NumElements, VecKind);
18201template <
typename Derived>
18205 return SemaRef.BuildVectorType(ElementType, SizeExpr, AttributeLoc);
18208template<
typename Derived>
18210 unsigned NumElements,
18212 llvm::APInt numElements(
SemaRef.Context.getIntWidth(
SemaRef.Context.IntTy),
18213 NumElements,
true);
18217 return SemaRef.BuildExtVectorType(ElementType, VectorSize, AttributeLoc);
18220template<
typename Derived>
18225 return SemaRef.BuildExtVectorType(ElementType, SizeExpr, AttributeLoc);
18228template <
typename Derived>
18230 QualType ElementType,
unsigned NumRows,
unsigned NumColumns,
18236 Ctx, llvm::APInt(SizeWidth, NumRows), SizeTy, AttributeLoc);
18238 Ctx, llvm::APInt(SizeWidth, NumColumns), SizeTy, AttributeLoc);
18239 return SemaRef.BuildMatrixType(ElementType, RowExpr, ColumnExpr,
18243template <
typename Derived>
18247 return SemaRef.BuildMatrixType(ElementType, RowExpr, ColumnExpr,
18251template <
typename Derived>
18255 return SemaRef.BuildFunctionType(
T, ParamTypes,
18261template<
typename Derived>
18263 return SemaRef.Context.getFunctionNoProtoType(
T);
18266template <
typename Derived>
18270 assert(D &&
"no decl found");
18274 if (
auto *UPD = dyn_cast<UsingPackDecl>(D)) {
18278 if (UPD->expansions().empty()) {
18279 getSema().Diag(NameLoc, diag::err_using_pack_expansion_empty)
18280 << UPD->isCXXClassMember() << UPD;
18289 for (
auto *E : UPD->expansions()) {
18296 else if (
T.isNull())
18299 assert(
getSema().Context.hasSameType(ThisT,
T) &&
18300 "mismatched resolved types in using pack expansion");
18302 return T.isNull() ? FallbackT :
T;
18304 if (
auto *Using = dyn_cast<UsingDecl>(D)) {
18305 assert(Using->hasTypename() &&
18306 "UnresolvedUsingTypenameDecl transformed to non-typename using");
18309 assert(++Using->shadow_begin() == Using->shadow_end());
18314 return SemaRef.Context.getUsingType(
Keyword, Qualifier, Shadow);
18317 "UnresolvedUsingTypenameDecl transformed to non-using decl");
18318 return SemaRef.Context.getUnresolvedUsingType(
18322template <
typename Derived>
18325 return SemaRef.BuildTypeofExprType(E, Kind);
18328template<
typename Derived>
18331 return SemaRef.Context.getTypeOfType(Underlying, Kind);
18334template <
typename Derived>
18336 return SemaRef.BuildDecltypeType(E);
18339template <
typename Derived>
18344 return SemaRef.BuildPackIndexingType(Pattern, IndexExpr, Loc, EllipsisLoc,
18345 FullySubstituted, Expansions);
18348template<
typename Derived>
18350 UnaryTransformType::UTTKind UKind,
18352 return SemaRef.BuildUnaryTransformType(BaseType, UKind, Loc);
18355template <
typename Derived>
18359 return SemaRef.CheckTemplateIdType(
18364template<
typename Derived>
18367 return SemaRef.BuildAtomicType(ValueType, KWLoc);
18370template<
typename Derived>
18374 return isReadPipe ?
SemaRef.BuildReadPipeType(ValueType, KWLoc)
18375 :
SemaRef.BuildWritePipeType(ValueType, KWLoc);
18378template <
typename Derived>
18382 llvm::APInt NumBitsAP(
SemaRef.Context.getIntWidth(
SemaRef.Context.IntTy),
18386 return SemaRef.BuildBitIntType(IsUnsigned, Bits, Loc);
18389template <
typename Derived>
18392 return SemaRef.BuildBitIntType(IsUnsigned, NumBitsExpr, Loc);
18395template <
typename Derived>
18403template <
typename Derived>
18410 getSema().ActOnTemplateName(
nullptr, SS, TemplateKWLoc,
18413 AllowInjectedClassName);
18417template<
typename Derived>
18424 bool AllowInjectedClassName) {
18427 SourceLocation SymbolLocations[3] = { NameLoc, NameLoc, NameLoc };
18432 false,
Template, AllowInjectedClassName);
18436template <
typename Derived>
18441 bool isPostIncDec = Second && (Op == OO_PlusPlus || Op == OO_MinusMinus);
18446 return SemaRef.PseudoObject().checkAssignment(
nullptr, OpLoc,
18447 Opc,
First, Second);
18462 if (Op == OO_Subscript) {
18463 if (!
First->getType()->isOverloadableType() &&
18465 return getSema().CreateBuiltinArraySubscriptExpr(
First, CalleeLoc, Second,
18467 }
else if (Op == OO_Arrow) {
18470 if (
First->getType()->isDependentType())
18473 return SemaRef.BuildOverloadedArrowExpr(
nullptr,
First, OpLoc);
18474 }
else if (Second ==
nullptr || isPostIncDec) {
18475 if (!
First->getType()->isOverloadableType() ||
18476 (Op == OO_Amp &&
getSema().isQualifiedMemberAccess(
First))) {
18483 return getSema().CreateBuiltinUnaryOp(OpLoc, Opc,
First);
18487 !
First->getType()->isOverloadableType() &&
18493 =
SemaRef.CreateBuiltinBinOp(OpLoc, Opc,
First, Second);
18502 if (!Second || isPostIncDec) {
18505 return SemaRef.CreateOverloadedUnaryOp(OpLoc, Opc, Functions,
First,
18512 First, Second, RequiresADL);
18519template<
typename Derived>
18529 QualType CanonicalBaseType =
Base->getType().getCanonicalType();
18530 if (
Base->isTypeDependent() || Destroyed.getIdentifier() ||
18535 ->getAsCanonical<RecordType>())) {
18537 return SemaRef.BuildPseudoDestructorExpr(
18538 Base, OperatorLoc, isArrow ? tok::arrow : tok::period, SS, ScopeType,
18539 CCLoc, TildeLoc, Destroyed);
18551 if (!
isa<TagType>(ScopeType->getType().getCanonicalType())) {
18552 getSema().Diag(ScopeType->getTypeLoc().getBeginLoc(),
18553 diag::err_expected_class_or_namespace)
18554 << ScopeType->getType() <<
getSema().getLangOpts().CPlusPlus;
18558 SS.
Make(
SemaRef.Context, ScopeType->getTypeLoc(), CCLoc);
18562 return getSema().BuildMemberReferenceExpr(
18563 Base,
Base->getType(), OperatorLoc, isArrow, SS, TemplateKWLoc,
18569template<
typename Derived>
18577 for (
unsigned I = 0; I < NumParams; ++I) {
18578 if (I != ContextParamPos) {
18584 Params.push_back(std::make_pair(StringRef(), QualType()));
18587 getSema().ActOnCapturedRegionStart(Loc,
nullptr,
18595 if (Body.isInvalid()) {
18596 getSema().ActOnCapturedRegionError();
18600 return getSema().ActOnCapturedRegionEnd(Body.get());
18603template <
typename Derived>
18609 llvm_unreachable(
"SYCL kernel call statement cannot appear in dependent "
18613template <
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 '...
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.
ConstantExpr - An expression that occurs in a constant context and optionally the result of evaluatin...
Represents a concrete matrix type with constant number of rows and columns.
ContinueStmt - This represents a continue.
ConvertVectorExpr - Clang builtin function __builtin_convertvector This AST node provides support for...
Represents a 'co_return' statement in the C++ Coroutines TS.
Represents the body of a coroutine.
Represents a sugar type with __counted_by or __sized_by annotations, including their _or_null variant...
Represents a 'co_yield' expression.
Wrapper for source info for pointers decayed from arrays and functions.
static DeclAccessPair make(NamedDecl *D, AccessSpecifier AS)
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
DeclContext * getParent()
getParent - Returns the containing DeclContext.
DeclContextLookupResult lookup_result
lookup_result lookup(DeclarationName Name) const
lookup - Find the declarations (if any) with the given Name in this context.
void addDecl(Decl *D)
Add the declaration D into this context.
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.
llvm::omp::Version getOpenMPVersion() const
Return the OpenMP version.
void setAttrNameLoc(SourceLocation Loc)
Represents a placeholder type for late-parsed type attributes.
Represents the results of name lookup.
This represents a Microsoft inline-assembly statement extension.
Representation of a Microsoft __if_exists or __if_not_exists statement with a dependent name.
An instance of this class represents the declaration of a property member.
A member reference to an MSPropertyDecl.
MS property subscript expression.
void setExpansionLoc(SourceLocation Loc)
Represents a prvalue temporary that is written into memory so that a reference can bind to it.
MatrixSingleSubscriptExpr - Matrix single subscript expression for the MatrixType extension when you ...
MatrixSubscriptExpr - Matrix subscript expression for the MatrixType extension.
void setAttrNameLoc(SourceLocation loc)
MemberExpr - [C99 6.5.2.3] Structure and Union Members.
Wrapper for source info for member pointers.
A pointer to member type per C++ 8.3.3 - Pointers to members.
Data structure that captures multiple levels of template argument lists for use in template instantia...
This represents a decl that may have a name.
IdentifierInfo * getIdentifier() const
Get the identifier that names this declaration, if there is one.
StringRef getName() const
Get the name of identifier for this declaration as a StringRef.
DeclarationName getDeclName() const
Get the actual, stored name of the declaration, which may be a special name.
Represents C++ namespaces and their aliases.
Class that aids in the construction of nested-name-specifiers along with source-location information ...
void MakeTrivial(ASTContext &Context, NestedNameSpecifier Qualifier, SourceRange R)
Make a new nested-name-specifier from incomplete source-location information.
A C++ nested-name-specifier augmented with source location information.
NestedNameSpecifier getNestedNameSpecifier() const
Retrieve the nested-name-specifier to which this instance refers.
SourceLocation getLocalEndLoc() const
Retrieve the location of the end of this component of the nested-name-specifier.
SourceRange getSourceRange() const LLVM_READONLY
Retrieve the source range covering the entirety of this nested-name-specifier.
SourceLocation getEndLoc() const
Retrieve the location of the end of this nested-name-specifier.
SourceLocation getBeginLoc() const
Retrieve the location of the beginning of this nested-name-specifier.
TypeLoc castAsTypeLoc() const
For a nested-name-specifier that refers to a type, retrieve the type with source-location information...
void * getOpaqueData() const
Retrieve the opaque pointer that refers to source-location data.
SourceLocation getLocalBeginLoc() const
Retrieve the location of the beginning of this component of the nested-name-specifier.
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
NamespaceAndPrefix getAsNamespaceAndPrefix() const
CXXRecordDecl * getAsRecordDecl() const
Retrieve the record declaration stored in this nested name specifier, or null.
bool isDependent() const
Whether this nested name specifier refers to a dependent type or not.
@ MicrosoftSuper
Microsoft's '__super' specifier, stored as a CXXRecordDecl* of the class it appeared in.
@ Global
The global specifier '::'. There is no stored value.
@ Type
A type, stored as a Type*.
@ Namespace
A namespace-like entity, stored as a NamespaceBaseDecl*.
Represents a place-holder for an object not to be initialized by anything.
NullStmt - This is the null statement ";": C99 6.8.3p3.
This represents the 'align' clause in the 'pragma omp allocate' directive.
This represents clause 'allocate' in the 'pragma omp ...' directives.
This represents 'allocator' clause in the 'pragma omp ...' directive.
An explicit cast in C or a C-style cast in C++, which uses the syntax ([s1][s2]......
This is a basic class for representing single OpenMP clause.
OpenMPClauseKind getClauseKind() const
Returns kind of OpenMP clause (private, shared, reduction, etc.).
This represents 'collapse' clause in the 'pragma omp ...' directive.
This represents the 'counts' clause in the 'pragma omp split' directive.
This represents 'default' clause in the 'pragma omp ...' directive.
This represents the 'depth' clause on the 'pragma omp flatten' (and 'pragma omp fuse') loop-transform...
This represents 'final' clause in the 'pragma omp ...' directive.
Representation of the 'full' clause of the 'pragma omp unroll' directive.
This represents 'if' clause in the 'pragma omp ...' directive.
OpenMP 5.0 [2.1.6 Iterators] Iterators are identifiers that expand to multiple values in the clause o...
This class represents the 'looprange' clause in the 'pragma omp fuse' directive.
This represents 'num_threads' clause in the 'pragma omp ...' directive.
Representation of the 'partial' clause of the 'pragma omp unroll' directive.
This class represents the 'permutation' clause in the 'pragma omp interchange' directive.
This represents 'safelen' clause in the 'pragma omp ...' directive.
This represents 'simdlen' clause in the 'pragma omp ...' directive.
This represents the 'sizes' clause in the 'pragma omp tile' directive.
This represents 'threadset' clause in the 'pragma omp task ...' directive.
ObjCArrayLiteral - used for objective-c array containers; as in: @["Hello", NSApp,...
Represents Objective-C's @catch statement.
Represents Objective-C's @finally statement.
Represents Objective-C's @synchronized statement.
Represents Objective-C's @throw statement.
Represents Objective-C's @try ... @catch ... @finally statement.
Represents Objective-C's @autoreleasepool Statement.
A runtime availability query.
ObjCBoolLiteralExpr - Objective-C Boolean Literal.
ObjCBoxedExpr - used for generalized expression boxing.
An Objective-C "bridged" cast expression, which casts between Objective-C pointers and C pointers,...
ObjCDictionaryLiteral - AST node to represent objective-c dictionary literals; as in:"name" : NSUserN...
ObjCEncodeExpr, used for @encode in Objective-C.
Represents Objective-C's collection statement.
ObjCIndirectCopyRestoreExpr - Represents the passing of a function argument by indirect copy-restore ...
Wrapper for source info for ObjC interfaces.
ObjCIsaExpr - Represent X->isa and X.isa when X is an ObjC 'id' type.
ObjCIvarDecl - Represents an ObjC instance variable.
ObjCIvarRefExpr - A reference to an ObjC instance variable.
An expression that sends a message to the given Objective-C object or class.
@ SuperInstance
The receiver is the instance of the superclass object.
@ Instance
The receiver is an object instance.
@ SuperClass
The receiver is a superclass.
@ Class
The receiver is a class.
ObjCMethodDecl - Represents an instance or class method declaration.
Wraps an ObjCPointerType with source location information.
void setStarLoc(SourceLocation Loc)
void setHasBaseTypeAsWritten(bool HasBaseType)
Represents one property declaration in an Objective-C interface.
ObjCPropertyRefExpr - A dot-syntax expression to access an ObjC property.
ObjCProtocolExpr used for protocol expression in Objective-C.
ObjCSelectorExpr used for @selector in Objective-C.
ObjCStringLiteral, used for Objective-C string literals i.e.
ObjCSubscriptRefExpr - used for array and dictionary subscripting.
Represents the declaration of an Objective-C type parameter.
ProtocolLAngleLoc, ProtocolRAngleLoc, and the source locations for protocol qualifiers are stored aft...
@ Array
An index into an array.
@ Identifier
A field in a dependent type, known only by its name.
@ Base
An implicit indirection through a C++ base class, when the field found is in a base class.
static OpaquePtr make(QualType P)
OpaqueValueExpr - An expression referring to an opaque object of a fixed type and value class.
Expr * getSourceExpr() const
The source expression of an opaque value expression is the expression which originally generated the ...
This expression type represents an asterisk in an OpenACC Size-Expr, used in the 'tile' and 'gang' cl...
static OpenACCAsyncClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *IntExpr, SourceLocation EndLoc)
static OpenACCAttachClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCAutoClause * Create(const ASTContext &Ctx, SourceLocation BeginLoc, SourceLocation EndLoc)
This is the base type for all OpenACC Clauses.
Represents a 'collapse' clause on a 'loop' construct.
static OpenACCCollapseClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, bool HasForce, Expr *LoopCount, SourceLocation EndLoc)
static OpenACCCopyClause * Create(const ASTContext &C, OpenACCClauseKind Spelling, SourceLocation BeginLoc, SourceLocation LParenLoc, OpenACCModifierKind Mods, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCCopyInClause * Create(const ASTContext &C, OpenACCClauseKind Spelling, SourceLocation BeginLoc, SourceLocation LParenLoc, OpenACCModifierKind Mods, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCCopyOutClause * Create(const ASTContext &C, OpenACCClauseKind Spelling, SourceLocation BeginLoc, SourceLocation LParenLoc, OpenACCModifierKind Mods, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCCreateClause * Create(const ASTContext &C, OpenACCClauseKind Spelling, SourceLocation BeginLoc, SourceLocation LParenLoc, OpenACCModifierKind Mods, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCDefaultAsyncClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *IntExpr, SourceLocation EndLoc)
A 'default' clause, has the optional 'none' or 'present' argument.
static OpenACCDefaultClause * Create(const ASTContext &C, OpenACCDefaultClauseKind K, SourceLocation BeginLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
static OpenACCDeleteClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCDetachClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCDeviceClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCDeviceNumClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *IntExpr, SourceLocation EndLoc)
static OpenACCDevicePtrClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
A 'device_type' or 'dtype' clause, takes a list of either an 'asterisk' or an identifier.
static OpenACCDeviceTypeClause * Create(const ASTContext &C, OpenACCClauseKind K, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< DeviceTypeArgument > Archs, SourceLocation EndLoc)
static OpenACCFinalizeClause * Create(const ASTContext &Ctx, SourceLocation BeginLoc, SourceLocation EndLoc)
static OpenACCFirstPrivateClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, ArrayRef< OpenACCFirstPrivateRecipe > InitRecipes, SourceLocation EndLoc)
static OpenACCHostClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
An 'if' clause, which has a required condition expression.
static OpenACCIfClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *ConditionExpr, SourceLocation EndLoc)
static OpenACCIfPresentClause * Create(const ASTContext &Ctx, SourceLocation BeginLoc, SourceLocation EndLoc)
static OpenACCIndependentClause * Create(const ASTContext &Ctx, SourceLocation BeginLoc, SourceLocation EndLoc)
static OpenACCNoCreateClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCNumGangsClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > IntExprs, SourceLocation EndLoc)
static OpenACCNumWorkersClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *IntExpr, SourceLocation EndLoc)
static OpenACCPresentClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCPrivateClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, ArrayRef< OpenACCPrivateRecipe > InitRecipes, SourceLocation EndLoc)
A 'self' clause, which has an optional condition expression, or, in the event of an 'update' directiv...
static OpenACCSelfClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *ConditionExpr, SourceLocation EndLoc)
static OpenACCSeqClause * Create(const ASTContext &Ctx, SourceLocation BeginLoc, SourceLocation EndLoc)
static OpenACCTileClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > SizeExprs, SourceLocation EndLoc)
static OpenACCUseDeviceClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCVectorClause * Create(const ASTContext &Ctx, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *IntExpr, SourceLocation EndLoc)
static OpenACCVectorLengthClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *IntExpr, SourceLocation EndLoc)
static OpenACCWaitClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *DevNumExpr, SourceLocation QueuesLoc, ArrayRef< Expr * > QueueIdExprs, SourceLocation EndLoc)
static OpenACCWorkerClause * Create(const ASTContext &Ctx, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *IntExpr, SourceLocation EndLoc)
void initializeLocal(ASTContext &Context, SourceLocation loc)
A reference to an overloaded function set, either an UnresolvedLookupExpr or an UnresolvedMemberExpr.
bool hasExplicitTemplateArgs() const
Determines whether this expression had explicit template arguments.
SourceLocation getLAngleLoc() const
Retrieve the location of the left angle bracket starting the explicit template argument list followin...
SourceLocation getNameLoc() const
Gets the location of the name.
SourceLocation getTemplateKeywordLoc() const
Retrieve the location of the template keyword preceding this name, if any.
NestedNameSpecifierLoc getQualifierLoc() const
Fetches the nested-name qualifier with source-location information, if one was given.
TemplateArgumentLoc const * getTemplateArgs() const
llvm::iterator_range< decls_iterator > decls() const
unsigned getNumTemplateArgs() const
DeclarationName getName() const
Gets the name looked up.
SourceLocation getRAngleLoc() const
Retrieve the location of the right angle bracket ending the explicit template argument list following...
bool hasTemplateKeyword() const
Determines whether the name was preceded by the template keyword.
Represents a C++11 pack expansion that produces a sequence of expressions.
void setEllipsisLoc(SourceLocation Loc)
SourceLocation getEllipsisLoc() const
TypeLoc getPatternLoc() const
A structure for storing a pack-index-template-name ([temp.names]).
void setEllipsisLoc(SourceLocation Loc)
ParenExpr - This represents a parenthesized expression, e.g.
SourceLocation getLParen() const
Get the location of the left parentheses '('.
SourceLocation getRParen() const
Get the location of the right parentheses ')'.
void setLParenLoc(SourceLocation Loc)
Represents a parameter to a function.
unsigned getFunctionScopeIndex() const
Returns the index of this parameter in its prototype or method scope.
void setScopeInfo(unsigned scopeDepth, unsigned parameterIndex)
static ParmVarDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, const IdentifierInfo *Id, QualType T, TypeSourceInfo *TInfo, StorageClass S, Expr *DefArg)
unsigned getFunctionScopeDepth() const
void setKWLoc(SourceLocation Loc)
Pointer-authentication qualifiers.
void setSigilLoc(SourceLocation Loc)
TypeLoc getPointeeLoc() const
SourceLocation getSigilLoc() const
Wrapper for source info for pointers.
PointerType - C99 6.7.5.1 - Pointer Declarators.
[C99 6.4.2.2] - A predefined identifier such as func.
Stores the type being destroyed by a pseudo-destructor expression.
PseudoObjectExpr - An expression which accesses a pseudo-object l-value.
A (possibly-)qualified type.
bool isNull() const
Return true if this QualType doesn't point to a type yet.
Qualifiers getLocalQualifiers() const
Retrieve the set of qualifiers local to this particular QualType instance, not including any qualifie...
Represents a template name as written in source code.
Wrapper of type source information for a type with non-trivial direct qualifiers.
The collection of all-type qualifiers we support.
void removeObjCLifetime()
static Qualifiers fromCVRMask(unsigned CVR)
PointerAuthQualifier getPointerAuth() const
bool hasObjCLifetime() const
LangAS getAddressSpace() const
Frontend produces RecoveryExprs on semantic errors that prevent creating other well-formed expression...
Base for LValueReferenceType and RValueReferenceType.
QualType getPointeeTypeAsWritten() const
Represents the body of a requires-expression.
static RequiresExprBodyDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc)
C++2a [expr.prim.req]: A requires-expression provides a concise way to express requirements on templa...
static RequiresExpr * Create(ASTContext &C, SourceLocation RequiresKWLoc, RequiresExprBodyDecl *Body, SourceLocation LParenLoc, ArrayRef< ParmVarDecl * > LocalParameters, SourceLocation RParenLoc, ArrayRef< concepts::Requirement * > Requirements, SourceLocation RBraceLoc)
ReturnStmt - This represents a return, optionally of an expression: return; return 4;.
static SEHFinallyStmt * Create(const ASTContext &C, SourceLocation FinallyLoc, Stmt *Block)
Represents a __leave statement.
SYCLKernelCallStmt represents the transformation that is applied to the body of a function declared w...
Smart pointer class that efficiently represents Objective-C method names.
SemaDiagnosticBuilder Diag(SourceLocation Loc, unsigned DiagID)
Emit a diagnostic.
bool diagnoseMatrixLayoutInstantiation(attr::Kind K, QualType T, SourceLocation Loc)
VarDecl * BuildObjCExceptionDecl(TypeSourceInfo *TInfo, QualType ExceptionType, SourceLocation StartLoc, SourceLocation IdLoc, const IdentifierInfo *Id, bool Invalid=false)
Build a type-check a new Objective-C exception variable declaration.
StmtResult ActOnObjCForCollectionStmt(SourceLocation ForColLoc, Stmt *First, Expr *collection, SourceLocation RParenLoc)
StmtResult FinishObjCForCollectionStmt(Stmt *ForCollection, Stmt *Body)
FinishObjCForCollectionStmt - Attach the body to a objective-C foreach statement.
ExprResult BuildObjCDictionaryLiteral(SourceRange SR, MutableArrayRef< ObjCDictionaryElement > Elements)
StmtResult ActOnObjCAtSynchronizedStmt(SourceLocation AtLoc, Expr *SynchExpr, Stmt *SynchBody)
ExprResult BuildObjCArrayLiteral(SourceRange SR, MultiExprArg Elements)
ExprResult BuildObjCBoxedExpr(SourceRange SR, Expr *ValueExpr)
BuildObjCBoxedExpr - builds an ObjCBoxedExpr AST node for the '@' prefixed parenthesized expression.
StmtResult ActOnObjCAtTryStmt(SourceLocation AtLoc, Stmt *Try, MultiStmtArg Catch, Stmt *Finally)
StmtResult ActOnObjCAtFinallyStmt(SourceLocation AtLoc, Stmt *Body)
StmtResult BuildObjCAtThrowStmt(SourceLocation AtLoc, Expr *Throw)
ExprResult ActOnObjCAtSynchronizedOperand(SourceLocation atLoc, Expr *operand)
ExprResult BuildObjCBridgedCast(SourceLocation LParenLoc, ObjCBridgeCastKind Kind, SourceLocation BridgeKeywordLoc, TypeSourceInfo *TSInfo, Expr *SubExpr)
StmtResult ActOnObjCAtCatchStmt(SourceLocation AtLoc, SourceLocation RParen, Decl *Parm, Stmt *Body)
StmtResult ActOnObjCAutoreleasePoolStmt(SourceLocation AtLoc, Stmt *Body)
ExprResult BuildObjCSubscriptExpression(SourceLocation RB, Expr *BaseExpr, Expr *IndexExpr, ObjCMethodDecl *getterMethod, ObjCMethodDecl *setterMethod)
Build an ObjC subscript pseudo-object expression, given that that's supported by the runtime.
Helper type for the registration/assignment of constructs that need to 'know' about their parent cons...
Helper type to restore the state of various 'loop' constructs when we run into a loop (for,...
A type to represent all the data for an OpenACC Clause that has been parsed, but not yet created/sema...
void ActOnWhileStmt(SourceLocation WhileLoc)
ExprResult ActOnOpenACCAsteriskSizeExpr(SourceLocation AsteriskLoc)
void ActOnDoStmt(SourceLocation DoLoc)
void ActOnRangeForStmtBegin(SourceLocation ForLoc, const Stmt *OldRangeFor, const Stmt *RangeFor)
StmtResult ActOnEndStmtDirective(OpenACCDirectiveKind K, SourceLocation StartLoc, SourceLocation DirLoc, SourceLocation LParenLoc, SourceLocation MiscLoc, ArrayRef< Expr * > Exprs, OpenACCAtomicKind AK, SourceLocation RParenLoc, SourceLocation EndLoc, ArrayRef< OpenACCClause * > Clauses, StmtResult AssocStmt)
Called after the directive has been completely parsed, including the declaration group or associated ...
void ActOnForStmtEnd(SourceLocation ForLoc, StmtResult Body)
void ActOnForStmtBegin(SourceLocation ForLoc, const Stmt *First, const Stmt *Second, const Stmt *Third)
ExprResult ActOnArraySectionExpr(Expr *Base, SourceLocation LBLoc, Expr *LowerBound, SourceLocation ColonLocFirst, Expr *Length, SourceLocation RBLoc)
Checks and creates an Array Section used in an OpenACC construct/clause.
OMPClause * ActOnOpenMPNocontextClause(Expr *Condition, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'nocontext' clause.
OMPClause * ActOnOpenMPXDynCGroupMemClause(Expr *Size, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on a well-formed 'ompx_dyn_cgroup_mem' clause.
OMPClause * ActOnOpenMPSafelenClause(Expr *Length, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'safelen' clause.
OMPClause * ActOnOpenMPHoldsClause(Expr *E, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'holds' clause.
OMPClause * ActOnOpenMPFilterClause(Expr *ThreadID, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'filter' clause.
OMPClause * ActOnOpenMPFullClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-form 'full' clauses.
OMPClause * ActOnOpenMPDetachClause(Expr *Evt, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'detach' clause.
OMPClause * ActOnOpenMPUseClause(Expr *InteropVar, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation VarLoc, SourceLocation EndLoc)
Called on well-formed 'use' clause.
OMPClause * ActOnOpenMPPrivateClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'private' clause.
OMPClause * ActOnOpenMPOrderedClause(SourceLocation StartLoc, SourceLocation EndLoc, SourceLocation LParenLoc=SourceLocation(), Expr *NumForLoops=nullptr)
Called on well-formed 'ordered' clause.
OMPClause * ActOnOpenMPIsDevicePtrClause(ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs)
Called on well-formed 'is_device_ptr' clause.
OMPClause * ActOnOpenMPCountsClause(ArrayRef< Expr * > CountExprs, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc, std::optional< unsigned > FillIdx, SourceLocation FillLoc, unsigned FillCount)
Called on well-formed 'counts' clause after parsing its arguments.
OMPClause * ActOnOpenMPHasDeviceAddrClause(ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs)
Called on well-formed 'has_device_addr' clause.
OMPClause * ActOnOpenMPPartialClause(Expr *FactorExpr, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-form 'partial' clauses.
OMPClause * ActOnOpenMPLastprivateClause(ArrayRef< Expr * > VarList, OpenMPLastprivateModifier LPKind, SourceLocation LPKindLoc, SourceLocation ColonLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'lastprivate' clause.
OMPClause * ActOnOpenMPFirstprivateClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'firstprivate' clause.
OMPClause * ActOnOpenMPPriorityClause(Expr *Priority, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'priority' clause.
OMPClause * ActOnOpenMPDistScheduleClause(OpenMPDistScheduleClauseKind Kind, Expr *ChunkSize, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation KindLoc, SourceLocation CommaLoc, SourceLocation EndLoc)
Called on well-formed 'dist_schedule' clause.
OMPClause * ActOnOpenMPLoopRangeClause(Expr *First, Expr *Count, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation FirstLoc, SourceLocation CountLoc, SourceLocation EndLoc)
Called on well-form 'looprange' clause after parsing its arguments.
OMPClause * ActOnOpenMPPermutationClause(ArrayRef< Expr * > PermExprs, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-form 'permutation' clause after parsing its arguments.
OMPClause * ActOnOpenMPNontemporalClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'nontemporal' clause.
OMPClause * ActOnOpenMPBindClause(OpenMPBindClauseKind Kind, SourceLocation KindLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on a well-formed 'bind' clause.
OMPClause * ActOnOpenMPSharedClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'shared' clause.
OMPClause * ActOnOpenMPCopyinClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'copyin' clause.
OMPClause * ActOnOpenMPDestroyClause(Expr *InteropVar, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation VarLoc, SourceLocation EndLoc)
Called on well-formed 'destroy' clause.
OMPClause * ActOnOpenMPAffinityClause(SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc, Expr *Modifier, ArrayRef< Expr * > Locators)
Called on well-formed 'affinity' clause.
OMPClause * ActOnOpenMPDependClause(const OMPDependClause::DependDataTy &Data, Expr *DepModifier, ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'depend' clause.
OMPClause * ActOnOpenMPDoacrossClause(OpenMPDoacrossClauseModifier DepType, SourceLocation DepLoc, SourceLocation ColonLoc, ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'doacross' clause.
OMPClause * ActOnOpenMPUseDevicePtrClause(ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs, OpenMPUseDevicePtrFallbackModifier FallbackModifier, SourceLocation FallbackModifierLoc)
Called on well-formed 'use_device_ptr' clause.
OMPClause * ActOnOpenMPGrainsizeClause(OpenMPGrainsizeClauseModifier Modifier, Expr *Size, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ModifierLoc, SourceLocation EndLoc)
Called on well-formed 'grainsize' clause.
ExprResult ActOnOMPArraySectionExpr(Expr *Base, SourceLocation LBLoc, Expr *LowerBound, SourceLocation ColonLocFirst, SourceLocation ColonLocSecond, Expr *Length, Expr *Stride, SourceLocation RBLoc)
ExprResult ActOnOMPIteratorExpr(Scope *S, SourceLocation IteratorKwLoc, SourceLocation LLoc, SourceLocation RLoc, ArrayRef< OMPIteratorData > Data)
OMPClause * ActOnOpenMPUsesAllocatorClause(SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc, ArrayRef< UsesAllocatorsData > Data)
Called on well-formed 'uses_allocators' clause.
OMPClause * ActOnOpenMPAllocatorClause(Expr *Allocator, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'allocator' clause.
OMPClause * ActOnOpenMPInclusiveClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'inclusive' clause.
OMPClause * ActOnOpenMPTaskReductionClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc, CXXScopeSpec &ReductionIdScopeSpec, const DeclarationNameInfo &ReductionId, ArrayRef< Expr * > UnresolvedReductions={})
Called on well-formed 'task_reduction' clause.
OMPClause * ActOnOpenMPNowaitClause(SourceLocation StartLoc, SourceLocation EndLoc, SourceLocation LParenLoc, Expr *Condition)
Called on well-formed 'nowait' clause.
OMPClause * ActOnOpenMPOrderClause(OpenMPOrderClauseModifier Modifier, OpenMPOrderClauseKind Kind, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation MLoc, SourceLocation KindLoc, SourceLocation EndLoc)
Called on well-formed 'order' clause.
OMPClause * ActOnOpenMPSizesClause(ArrayRef< Expr * > SizeExprs, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-form 'sizes' clause.
OMPClause * ActOnOpenMPDeviceClause(OpenMPDeviceClauseModifier Modifier, Expr *Device, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ModifierLoc, SourceLocation EndLoc)
Called on well-formed 'device' clause.
OMPClause * ActOnOpenMPNumThreadsClause(ArrayRef< Expr * > VarList, OpenMPNumThreadsClauseModifier SimpleModifier, SourceLocation SimpleModifierLoc, OpenMPNumThreadsClauseModifier ComplexModifier, Expr *ComplexModifierExpr, SourceLocation ComplexModifierLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'num_threads' clause.
OMPClause * ActOnOpenMPInReductionClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc, CXXScopeSpec &ReductionIdScopeSpec, const DeclarationNameInfo &ReductionId, ArrayRef< Expr * > UnresolvedReductions={})
Called on well-formed 'in_reduction' clause.
OMPClause * ActOnOpenMPFlushClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'flush' pseudo clause.
StmtResult ActOnOpenMPExecutableDirective(OpenMPDirectiveKind Kind, const DeclarationNameInfo &DirName, OpenMPDirectiveKind CancelRegion, ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
OMPClause * ActOnOpenMPMessageClause(Expr *MS, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'message' clause.
OMPClause * ActOnOpenMPThreadLimitClause(ArrayRef< Expr * > VarList, OpenMPThreadLimitClauseModifier Modifier, Expr *ModifierExpr, SourceLocation ModifierLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'thread_limit' clause.
OMPClause * ActOnOpenMPScheduleClause(OpenMPScheduleClauseModifier M1, OpenMPScheduleClauseModifier M2, OpenMPScheduleClauseKind Kind, Expr *ChunkSize, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation M1Loc, SourceLocation M2Loc, SourceLocation KindLoc, SourceLocation CommaLoc, SourceLocation EndLoc)
Called on well-formed 'schedule' clause.
OMPClause * ActOnOpenMPSimdlenClause(Expr *Length, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'simdlen' clause.
OMPClause * ActOnOpenMPProcBindClause(llvm::omp::ProcBindKind Kind, SourceLocation KindLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'proc_bind' clause.
OMPClause * ActOnOpenMPXBareClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on a well-formed 'ompx_bare' clause.
StmtResult ActOnOpenMPInformationalDirective(OpenMPDirectiveKind Kind, const DeclarationNameInfo &DirName, ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Process an OpenMP informational directive.
StmtResult ActOnOpenMPCanonicalLoop(Stmt *AStmt)
Called for syntactical loops (ForStmt or CXXForRangeStmt) associated to an OpenMP loop directive.
OMPClause * ActOnOpenMPTransparentClause(Expr *Transparent, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'transparent' clause.
OMPClause * ActOnOpenMPHintClause(Expr *Hint, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'hint' clause.
OMPClause * ActOnOpenMPNumTeamsClause(ArrayRef< Expr * > VarList, OpenMPNumTeamsClauseModifier Modifier, Expr *ModifierExpr, SourceLocation ModifierLoc, OpenMPNumTeamsClauseModifier ModifierExtra, Expr *ModifierExtraExpr, SourceLocation ModifierExtraLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'num_teams' clause.
ExprResult ActOnOMPArrayShapingExpr(Expr *Base, SourceLocation LParenLoc, SourceLocation RParenLoc, ArrayRef< Expr * > Dims, ArrayRef< SourceRange > Brackets)
OMPClause * ActOnOpenMPAtClause(OpenMPAtClauseKind Kind, SourceLocation KindLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'at' clause.
OMPClause * ActOnOpenMPInitClause(Expr *InteropVar, OMPInteropInfo &InteropInfo, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation VarLoc, SourceLocation EndLoc)
Called on well-formed 'init' clause.
OMPClause * ActOnOpenMPUseDeviceAddrClause(ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs)
Called on well-formed 'use_device_addr' clause.
OMPClause * ActOnOpenMPAllocateClause(Expr *Allocator, Expr *Alignment, OpenMPAllocateClauseModifier FirstModifier, SourceLocation FirstModifierLoc, OpenMPAllocateClauseModifier SecondModifier, SourceLocation SecondModifierLoc, ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation ColonLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'allocate' clause.
OMPClause * ActOnOpenMPFinalClause(Expr *Condition, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'final' clause.
OMPClause * ActOnOpenMPMapClause(Expr *IteratorModifier, ArrayRef< OpenMPMapModifierKind > MapTypeModifiers, ArrayRef< SourceLocation > MapTypeModifiersLoc, CXXScopeSpec &MapperIdScopeSpec, DeclarationNameInfo &MapperId, OpenMPMapClauseKind MapType, bool IsMapTypeImplicit, SourceLocation MapLoc, SourceLocation ColonLoc, ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs, bool NoDiagnose=false, ArrayRef< Expr * > UnresolvedMappers={})
Called on well-formed 'map' clause.
OMPClause * ActOnOpenMPNumTasksClause(OpenMPNumTasksClauseModifier Modifier, Expr *NumTasks, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ModifierLoc, SourceLocation EndLoc)
Called on well-formed 'num_tasks' clause.
OMPClause * ActOnOpenMPFromClause(ArrayRef< OpenMPMotionModifierKind > MotionModifiers, ArrayRef< SourceLocation > MotionModifiersLoc, Expr *IteratorModifier, CXXScopeSpec &MapperIdScopeSpec, DeclarationNameInfo &MapperId, SourceLocation ColonLoc, ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs, ArrayRef< Expr * > UnresolvedMappers={})
Called on well-formed 'from' clause.
OMPClause * ActOnOpenMPDynGroupprivateClause(OpenMPDynGroupprivateClauseModifier M1, OpenMPDynGroupprivateClauseFallbackModifier M2, Expr *Size, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation M1Loc, SourceLocation M2Loc, SourceLocation EndLoc)
Called on a well-formed 'dyn_groupprivate' clause.
void StartOpenMPDSABlock(OpenMPDirectiveKind K, const DeclarationNameInfo &DirName, Scope *CurScope, SourceLocation Loc)
Called on start of new data sharing attribute block.
OMPClause * ActOnOpenMPSeverityClause(OpenMPSeverityClauseKind Kind, SourceLocation KindLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'severity' clause.
OMPClause * ActOnOpenMPToClause(ArrayRef< OpenMPMotionModifierKind > MotionModifiers, ArrayRef< SourceLocation > MotionModifiersLoc, Expr *IteratorModifier, CXXScopeSpec &MapperIdScopeSpec, DeclarationNameInfo &MapperId, SourceLocation ColonLoc, ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs, ArrayRef< Expr * > UnresolvedMappers={})
Called on well-formed 'to' clause.
OMPClause * ActOnOpenMPLinearClause(ArrayRef< Expr * > VarList, Expr *Step, SourceLocation StartLoc, SourceLocation LParenLoc, OpenMPLinearClauseKind LinKind, SourceLocation LinLoc, SourceLocation ColonLoc, SourceLocation StepModifierLoc, SourceLocation EndLoc)
Called on well-formed 'linear' clause.
OMPClause * ActOnOpenMPDefaultmapClause(OpenMPDefaultmapClauseModifier M, OpenMPDefaultmapClauseKind Kind, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation MLoc, SourceLocation KindLoc, SourceLocation EndLoc)
Called on well-formed 'defaultmap' clause.
OMPClause * ActOnOpenMPReductionClause(ArrayRef< Expr * > VarList, OpenMPVarListDataTy::OpenMPReductionClauseModifiers Modifiers, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ModifierLoc, SourceLocation ColonLoc, SourceLocation EndLoc, CXXScopeSpec &ReductionIdScopeSpec, const DeclarationNameInfo &ReductionId, ArrayRef< Expr * > UnresolvedReductions={})
Called on well-formed 'reduction' clause.
OMPClause * ActOnOpenMPAlignedClause(ArrayRef< Expr * > VarList, Expr *Alignment, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc)
Called on well-formed 'aligned' clause.
OMPClause * ActOnOpenMPDepobjClause(Expr *Depobj, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'depobj' pseudo clause.
OMPClause * ActOnOpenMPNovariantsClause(Expr *Condition, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'novariants' clause.
OMPClause * ActOnOpenMPCopyprivateClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'copyprivate' clause.
OMPClause * ActOnOpenMPCollapseClause(Expr *NumForLoops, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'collapse' clause.
OMPClause * ActOnOpenMPDefaultClause(llvm::omp::DefaultKind M, SourceLocation MLoc, OpenMPDefaultClauseVariableCategory VCKind, SourceLocation VCKindLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'default' clause.
OMPClause * ActOnOpenMPAlignClause(Expr *Alignment, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'align' clause.
OMPClause * ActOnOpenMPXAttributeClause(ArrayRef< const Attr * > Attrs, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on a well-formed 'ompx_attribute' clause.
OMPClause * ActOnOpenMPExclusiveClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'exclusive' clause.
OMPClause * ActOnOpenMPIfClause(OpenMPDirectiveKind NameModifier, Expr *Condition, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation NameModifierLoc, SourceLocation ColonLoc, SourceLocation EndLoc)
Called on well-formed 'if' clause.
OMPClause * ActOnOpenMPDepthClause(Expr *DepthExpr, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'depth' clause.
Expr * recreateSyntacticForm(PseudoObjectExpr *E)
Given a pseudo-object expression, recreate what it looks like syntactically without the attendant Opa...
ExprResult checkRValue(Expr *E)
StmtResult BuildSYCLKernelCallStmt(FunctionDecl *FD, CompoundStmt *Body, Expr *LaunchIdExpr)
Builds a SYCLKernelCallStmt to wrap 'Body' and to be used as the body of 'FD'.
ExprResult BuildUniqueStableNameExpr(SourceLocation OpLoc, SourceLocation LParen, SourceLocation RParen, TypeSourceInfo *TSI)
RAII object used to change the argument pack substitution index within a Sema object.
RAII object used to temporarily allow the C++ 'this' expression to be used, with the given qualifiers...
A RAII object to enter scope of a compound statement.
std::optional< bool > getKnownValue() const
A helper class for building up ExtParameterInfos.
const FunctionProtoType::ExtParameterInfo * getPointerOrNull(unsigned numParams)
Return a pointer (suitable for setting in an ExtProtoInfo) to the ExtParameterInfo array we've built ...
void set(unsigned index, FunctionProtoType::ExtParameterInfo info)
Set the ExtParameterInfo for the parameter at the given index,.
Records and restores the CurFPFeatures state on entry/exit of compound statements.
Sema - This implements semantic analysis and AST building for C.
ParsedType CreateParsedType(QualType T, TypeSourceInfo *TInfo)
Package the given type and TSI into a ParsedType.
ExprResult ActOnCXXParenListInitExpr(ArrayRef< Expr * > Args, QualType T, unsigned NumUserSpecifiedExprs, SourceLocation InitLoc, SourceLocation LParenLoc, SourceLocation RParenLoc)
ExprResult BuildOperatorCoawaitCall(SourceLocation Loc, Expr *E, UnresolvedLookupExpr *Lookup)
Build a call to 'operator co_await' if there is a suitable operator for the given expression.
ExprResult BuildMemberReferenceExpr(Expr *Base, QualType BaseType, SourceLocation OpLoc, bool IsArrow, CXXScopeSpec &SS, SourceLocation TemplateKWLoc, NamedDecl *FirstQualifierInScope, const DeclarationNameInfo &NameInfo, const TemplateArgumentListInfo *TemplateArgs, const Scope *S, ActOnMemberAccessExtraArgs *ExtraArgs=nullptr)
StmtResult BuildMSDependentExistsStmt(SourceLocation KeywordLoc, bool IsIfExists, NestedNameSpecifierLoc QualifierLoc, DeclarationNameInfo NameInfo, Stmt *Nested)
@ LookupOrdinaryName
Ordinary name lookup, which finds ordinary names (functions, variables, typedefs, etc....
@ LookupMemberName
Member name lookup, which finds the names of class/struct/union members.
@ LookupTagName
Tag name lookup, which finds the names of enums, classes, structs, and unions.
bool checkFinalSuspendNoThrow(const Stmt *FinalSuspend)
Check that the expression co_await promise.final_suspend() shall not be potentially-throwing.
ExprResult CreateBuiltinMatrixSingleSubscriptExpr(Expr *Base, Expr *RowIdx, SourceLocation RBLoc)
ExprResult ActOnConstantExpression(ExprResult Res)
StmtResult ActOnMSAsmStmt(SourceLocation AsmLoc, SourceLocation LBraceLoc, ArrayRef< Token > AsmToks, StringRef AsmString, unsigned NumOutputs, unsigned NumInputs, ArrayRef< StringRef > Constraints, ArrayRef< StringRef > Clobbers, ArrayRef< Expr * > Exprs, SourceLocation EndLoc)
StmtResult BuildCoroutineBodyStmt(CoroutineBodyStmt::CtorArgs)
ExprResult BuildCoyieldExpr(SourceLocation KwLoc, Expr *E)
void ActOnStartStmtExpr()
void ActOnStmtExprError()
void MarkDeclarationsReferencedInExpr(Expr *E, bool SkipLocalVariables=false, ArrayRef< const Expr * > StopAt={})
Mark any declarations that appear within this expression or any potentially-evaluated subexpressions ...
VarDecl * buildCoroutinePromise(SourceLocation Loc)
ExprResult CheckBooleanCondition(SourceLocation Loc, Expr *E, bool IsConstexpr=false)
CheckBooleanCondition - Diagnose problems involving the use of the given expression as a boolean cond...
@ Boolean
A boolean condition, from 'if', 'while', 'for', or 'do'.
@ Switch
An integral condition for a 'switch' statement.
@ ConstexprIf
A constant boolean condition from 'if constexpr'.
const ExpressionEvaluationContextRecord & currentEvaluationContext() const
ExprResult BuildBuiltinBitCastExpr(SourceLocation KWLoc, TypeSourceInfo *TSI, Expr *Operand, SourceLocation RParenLoc)
StmtResult ActOnGotoStmt(SourceLocation GotoLoc, SourceLocation LabelLoc, LabelDecl *TheDecl)
ExprResult MaybeBindToTemporary(Expr *E)
MaybeBindToTemporary - If the passed in expression has a record type with a non-trivial destructor,...
StmtResult BuildCoreturnStmt(SourceLocation KwLoc, Expr *E, bool IsImplicit=false)
ExprResult ActOnStartCXXMemberReference(Scope *S, Expr *Base, SourceLocation OpLoc, tok::TokenKind OpKind, ParsedType &ObjectType, bool &MayBePseudoDestructor)
ExprResult ActOnCaseExpr(SourceLocation CaseLoc, ExprResult Val)
StmtResult BuildNonEnumeratingCXXExpansionStmtPattern(CXXExpansionStmtDecl *ESD, Stmt *Init, DeclStmt *ExpansionVarStmt, Expr *ExpansionInitializer, SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation RParenLoc, ArrayRef< MaterializeTemporaryExpr * > LifetimeExtendTemps={})
ExprResult BuildStmtExpr(SourceLocation LPLoc, Stmt *SubStmt, SourceLocation RPLoc, unsigned TemplateDepth)
TemplateName BuildPackIndexingTemplateName(TemplateName Pattern, Expr *IndexExpr, bool FullySubstituted=false, ArrayRef< TemplateName > Expansions={})
ExprResult BuildResolvedCoawaitExpr(SourceLocation KwLoc, Expr *Operand, Expr *Awaiter, bool IsImplicit=false)
ExprResult BuildVAArgExpr(SourceLocation BuiltinLoc, Expr *E, TypeSourceInfo *TInfo, SourceLocation RPLoc)
@ CTAK_Specified
The template argument was specified in the code or was instantiated with some deduced template argume...
ExprResult ActOnCXXDelete(SourceLocation StartLoc, bool UseGlobal, bool ArrayForm, Expr *Operand)
ActOnCXXDelete - Parsed a C++ 'delete' expression (C++ 5.3.5), as in:
ExprResult BuildCXXTypeId(QualType TypeInfoType, SourceLocation TypeidLoc, TypeSourceInfo *Operand, SourceLocation RParenLoc)
Build a C++ typeid expression with a type operand.
ExprResult PerformMemberExprBaseConversion(Expr *Base, bool IsArrow)
Perform conversions on the LHS of a member access expression.
DiagnosticsEngine & getDiagnostics() const
ExprResult BuildPackIndexingExpr(Expr *PackExpression, SourceLocation EllipsisLoc, Expr *IndexExpr, SourceLocation RSquareLoc, ArrayRef< Expr * > ExpandedExprs={}, bool FullySubstituted=false)
ParsedType getDestructorName(const IdentifierInfo &II, SourceLocation NameLoc, Scope *S, CXXScopeSpec &SS, ParsedType ObjectType, bool EnteringContext)
ASTContext & getASTContext() const
CXXDestructorDecl * LookupDestructor(CXXRecordDecl *Class)
Look for the destructor of the given class.
ExprResult BuildUnaryOp(Scope *S, SourceLocation OpLoc, UnaryOperatorKind Opc, Expr *Input, bool IsAfterAmp=false)
ExprResult BuildTemplateIdExpr(const CXXScopeSpec &SS, SourceLocation TemplateKWLoc, LookupResult &R, bool RequiresADL, const TemplateArgumentListInfo *TemplateArgs)
ExprResult CreateOverloadedBinOp(SourceLocation OpLoc, BinaryOperatorKind Opc, const UnresolvedSetImpl &Fns, Expr *LHS, Expr *RHS, bool RequiresADL=true, bool AllowRewrittenCandidates=true, FunctionDecl *DefaultedFn=nullptr)
Create a binary operation that may resolve to an overloaded operator.
StmtResult ActOnSEHTryBlock(bool IsCXXTry, SourceLocation TryLoc, Stmt *TryBlock, Stmt *Handler)
ExprResult BuildPredefinedExpr(SourceLocation Loc, PredefinedIdentKind IK)
ExprResult CheckConceptTemplateId(const CXXScopeSpec &SS, SourceLocation TemplateKWLoc, const DeclarationNameInfo &ConceptNameInfo, NamedDecl *FoundDecl, TemplateDecl *NamedConcept, const TemplateArgumentListInfo *TemplateArgs, bool DoCheckConstraintSatisfaction=true)
ExprResult BuildCompoundLiteralExpr(SourceLocation LParenLoc, TypeSourceInfo *TInfo, SourceLocation RParenLoc, Expr *LiteralExpr)
ExprResult ActOnAddrLabel(SourceLocation OpLoc, SourceLocation LabLoc, LabelDecl *TheDecl)
ActOnAddrLabel - Parse the GNU address of label extension: "&&foo".
ExprResult ActOnParenListExpr(SourceLocation L, SourceLocation R, MultiExprArg Val)
QualType BuildCountAttributedArrayOrPointerType(QualType WrappedTy, Expr *CountExpr, bool CountInBytes, bool OrNull)
ExprResult BuildCXXNew(SourceRange Range, bool UseGlobal, SourceLocation PlacementLParen, MultiExprArg PlacementArgs, SourceLocation PlacementRParen, SourceRange TypeIdParens, QualType AllocType, TypeSourceInfo *AllocTypeInfo, std::optional< Expr * > ArraySize, SourceRange DirectInitRange, Expr *Initializer)
ExprResult BuildBuiltinOffsetOf(SourceLocation BuiltinLoc, TypeSourceInfo *TInfo, const Designation &Desig, SourceLocation RParenLoc)
__builtin_offsetof(type, a.b[123][456].c)
DeclRefExpr * BuildDeclRefExpr(ValueDecl *D, QualType Ty, ExprValueKind VK, SourceLocation Loc, const CXXScopeSpec *SS=nullptr)
ExprResult BuildCXXFoldExpr(UnresolvedLookupExpr *Callee, SourceLocation LParenLoc, Expr *LHS, BinaryOperatorKind Operator, SourceLocation EllipsisLoc, Expr *RHS, SourceLocation RParenLoc, UnsignedOrNone NumExpansions)
ExprResult CreateGenericSelectionExpr(SourceLocation KeyLoc, SourceLocation DefaultLoc, SourceLocation RParenLoc, bool PredicateIsExpr, void *ControllingExprOrType, ArrayRef< TypeSourceInfo * > Types, ArrayRef< Expr * > Exprs)
ControllingExprOrType is either a TypeSourceInfo * or an Expr *.
bool CheckTemplateArgument(NamedDecl *Param, TemplateArgumentLoc &Arg, NamedDecl *Template, SourceLocation TemplateLoc, SourceLocation RAngleLoc, unsigned ArgumentPackIndex, CheckTemplateArgumentInfo &CTAI, CheckTemplateArgumentKind CTAK)
Check that the given template argument corresponds to the given template parameter.
StmtResult ActOnFinishSwitchStmt(SourceLocation SwitchLoc, Stmt *Switch, Stmt *Body)
SourceLocation getLocForEndOfToken(SourceLocation Loc, unsigned Offset=0)
Calls Lexer::getLocForEndOfToken()
const LangOptions & getLangOpts() const
StmtResult ActOnWhileStmt(SourceLocation WhileLoc, SourceLocation LParenLoc, ConditionResult Cond, SourceLocation RParenLoc, Stmt *Body)
bool isPotentialImplicitMemberAccess(const CXXScopeSpec &SS, LookupResult &R, bool IsAddressOfOperand)
Check whether an expression might be an implicit class member access.
void collectUnexpandedParameterPacks(TemplateArgument Arg, SmallVectorImpl< UnexpandedParameterPack > &Unexpanded)
Collect the set of unexpanded parameter packs within the given template argument.
ExprResult BuildSourceLocExpr(SourceLocIdentKind Kind, QualType ResultTy, SourceLocation BuiltinLoc, SourceLocation RPLoc, DeclContext *ParentContext)
ExprResult BuildCXXTypeConstructExpr(TypeSourceInfo *Type, SourceLocation LParenLoc, MultiExprArg Exprs, SourceLocation RParenLoc, bool ListInitialization)
ExprResult TemporaryMaterializationConversion(Expr *E)
If E is a prvalue denoting an unmaterialized temporary, materialize it as an xvalue.
ExprResult BuildCXXReflectExpr(SourceLocation OperatorLoc, TypeSourceInfo *TSI)
ExprResult BuildTypeTrait(TypeTrait Kind, SourceLocation KWLoc, ArrayRef< TypeSourceInfo * > Args, SourceLocation RParenLoc)
TemplateArgument getPackSubstitutedTemplateArgument(TemplateArgument Arg) const
ExprResult BuildUnresolvedCoawaitExpr(SourceLocation KwLoc, Expr *Operand, UnresolvedLookupExpr *Lookup)
ExprResult BuildExpressionTrait(ExpressionTrait OET, SourceLocation KWLoc, Expr *Queried, SourceLocation RParen)
bool buildCoroutineParameterMoves(SourceLocation Loc)
ExprResult BuildCStyleCastExpr(SourceLocation LParenLoc, TypeSourceInfo *Ty, SourceLocation RParenLoc, Expr *Op)
ExprResult BuildCXXUuidof(QualType TypeInfoType, SourceLocation TypeidLoc, TypeSourceInfo *Operand, SourceLocation RParenLoc)
Build a Microsoft __uuidof expression with a type operand.
sema::FunctionScopeInfo * getCurFunction() const
DeclGroupPtrTy BuildDeclaratorGroup(MutableArrayRef< Decl * > Group)
BuildDeclaratorGroup - convert a list of declarations into a declaration group, performing any necess...
Expr * BuildCXXThisExpr(SourceLocation Loc, QualType Type, bool IsImplicit)
Build a CXXThisExpr and mark it referenced in the current context.
UnsignedOrNone getPackIndex(TemplateArgument Pack) const
ExprResult BuildDeclarationNameExpr(const CXXScopeSpec &SS, LookupResult &R, bool NeedsADL, bool AcceptInvalidDecl=false)
sema::BlockScopeInfo * getCurBlock()
Retrieve the current block, if any.
void ApplyForRangeOrExpansionStatementLifetimeExtension(VarDecl *RangeVar, ArrayRef< MaterializeTemporaryExpr * > Temporaries)
DeclContext * CurContext
CurContext - This is the current declaration context of parsing.
VarDecl * BuildExceptionDeclaration(Scope *S, TypeSourceInfo *TInfo, SourceLocation StartLoc, SourceLocation IdLoc, const IdentifierInfo *Id)
Perform semantic analysis for the variable declaration that occurs within a C++ catch clause,...
void MarkDeclRefReferenced(DeclRefExpr *E, const Expr *Base=nullptr)
Perform reference-marking and odr-use handling for a DeclRefExpr.
ExprResult BuildQualifiedDeclarationNameExpr(CXXScopeSpec &SS, const DeclarationNameInfo &NameInfo, bool IsAddressOfOperand, TypeSourceInfo **RecoveryTSI=nullptr)
BuildQualifiedDeclarationNameExpr - Build a C++ qualified declaration name, generally during template...
StmtResult ActOnForStmt(SourceLocation ForLoc, SourceLocation LParenLoc, Stmt *First, ConditionResult Second, FullExprArg Third, SourceLocation RParenLoc, Stmt *Body)
StmtResult ActOnIndirectGotoStmt(SourceLocation GotoLoc, SourceLocation StarLoc, Expr *DestExp)
ExprResult ActOnParenExpr(SourceLocation L, SourceLocation R, Expr *E)
ExprResult CheckVarOrConceptTemplateTemplateId(const DeclarationNameInfo &NameInfo, TemplateName Template, const TemplateArgumentListInfo *TemplateArgs)
ExprResult BuildSubstNonTypeTemplateParmExpr(Decl *AssociatedDecl, unsigned Index, QualType ParamType, SourceLocation loc, TemplateArgument Replacement, UnsignedOrNone PackIndex, bool Final)
ExprResult BuildCXXConstructExpr(SourceLocation ConstructLoc, QualType DeclInitType, NamedDecl *FoundDecl, CXXConstructorDecl *Constructor, MultiExprArg Exprs, bool HadMultipleCandidates, bool IsListInitialization, bool IsStdInitListInitialization, bool RequiresZeroInit, CXXConstructionKind ConstructKind, SourceRange ParenRange)
BuildCXXConstructExpr - Creates a complete call to a constructor, including handling of its default a...
ExprResult BuildAsTypeExpr(Expr *E, QualType DestTy, SourceLocation BuiltinLoc, SourceLocation RParenLoc)
Create a new AsTypeExpr node (bitcast) from the arguments.
ExprResult BuildFieldReferenceExpr(Expr *BaseExpr, bool IsArrow, SourceLocation OpLoc, const CXXScopeSpec &SS, FieldDecl *Field, DeclAccessPair FoundDecl, const DeclarationNameInfo &MemberNameInfo)
ExprResult ActOnConditionalOp(SourceLocation QuestionLoc, SourceLocation ColonLoc, Expr *CondExpr, Expr *LHSExpr, Expr *RHSExpr)
ActOnConditionalOp - Parse a ?
ExprResult BuildPossibleImplicitMemberExpr(const CXXScopeSpec &SS, SourceLocation TemplateKWLoc, LookupResult &R, const TemplateArgumentListInfo *TemplateArgs, const Scope *S)
Builds an expression which might be an implicit member expression.
StmtResult BuildReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp, bool AllowRecovery=false)
StmtResult BuildCXXForRangeStmt(SourceLocation ForLoc, SourceLocation CoawaitLoc, Stmt *InitStmt, SourceLocation ColonLoc, Stmt *RangeDecl, Stmt *Begin, Stmt *End, Expr *Cond, Expr *Inc, Stmt *LoopVarDecl, SourceLocation RParenLoc, BuildForRangeKind Kind, ArrayRef< MaterializeTemporaryExpr * > LifetimeExtendTemps={})
BuildCXXForRangeStmt - Build or instantiate a C++11 for-range statement.
StmtResult ActOnDoStmt(SourceLocation DoLoc, Stmt *Body, SourceLocation WhileLoc, SourceLocation CondLParen, Expr *Cond, SourceLocation CondRParen)
StmtResult ActOnStartOfSwitchStmt(SourceLocation SwitchLoc, SourceLocation LParenLoc, Stmt *InitStmt, ConditionResult Cond, SourceLocation RParenLoc)
ExprResult BuildQualifiedTemplateIdExpr(CXXScopeSpec &SS, SourceLocation TemplateKWLoc, const DeclarationNameInfo &NameInfo, const TemplateArgumentListInfo *TemplateArgs, bool IsAddressOfOperand)
@ ConstantEvaluated
The current context is "potentially evaluated" in C++11 terms, but the expression is evaluated at com...
@ PotentiallyEvaluated
The current expression is potentially evaluated at run time, which means that code may be generated t...
@ Unevaluated
The current expression and its subexpressions occur within an unevaluated operand (C++11 [expr]p7),...
@ ImmediateFunctionContext
In addition of being constant evaluated, the current expression occurs in an immediate function conte...
StmtResult ActOnSEHExceptBlock(SourceLocation Loc, Expr *FilterExpr, Stmt *Block)
ExprResult CreateUnaryExprOrTypeTraitExpr(TypeSourceInfo *TInfo, SourceLocation OpLoc, UnaryExprOrTypeTrait ExprKind, SourceRange R)
Build a sizeof or alignof expression given a type operand.
StmtResult ActOnDeclStmt(DeclGroupPtrTy Decl, SourceLocation StartLoc, SourceLocation EndLoc)
bool RequireCompleteType(SourceLocation Loc, QualType T, CompleteTypeKind Kind, TypeDiagnoser &Diagnoser)
Ensure that the type T is a complete type.
ExprResult PerformObjectMemberConversion(Expr *From, NestedNameSpecifier Qualifier, NamedDecl *FoundDecl, NamedDecl *Member)
Cast a base object to a member's actual type.
Expr * MaybeCreateExprWithCleanups(Expr *SubExpr)
MaybeCreateExprWithCleanups - If the current full-expression requires any cleanups,...
SmallVector< ExpressionEvaluationContextRecord, 8 > ExprEvalContexts
A stack of expression evaluation contexts.
ExprResult BuildEmptyCXXFoldExpr(SourceLocation EllipsisLoc, BinaryOperatorKind Operator)
ExprResult BuildCXXThrow(SourceLocation OpLoc, Expr *Ex, bool IsThrownVarInScope)
ExprResult BuildCXXExpansionSelectExpr(InitListExpr *Range, Expr *Idx)
ExprResult BuildBinOp(Scope *S, SourceLocation OpLoc, BinaryOperatorKind Opc, Expr *LHSExpr, Expr *RHSExpr, bool ForFoldExpression=false)
StmtResult FinishCXXExpansionStmt(Stmt *Expansion, Stmt *Body)
ExprResult BuildLambdaExpr(SourceLocation StartLoc, SourceLocation EndLoc)
Complete a lambda-expression having processed and attached the lambda body.
@ BFRK_Rebuild
Instantiation or recovery rebuild of a for-range statement.
void ActOnCaseStmtBody(Stmt *CaseStmt, Stmt *SubStmt)
ActOnCaseStmtBody - This installs a statement as the body of a case.
ExprResult ActOnBlockStmtExpr(SourceLocation CaretLoc, Stmt *Body, Scope *CurScope)
ActOnBlockStmtExpr - This is called when the body of a block statement literal was successfully compl...
ExprResult BuildArrayTypeTrait(ArrayTypeTrait ATT, SourceLocation KWLoc, TypeSourceInfo *TSInfo, Expr *DimExpr, SourceLocation RParen)
void MarkMemberReferenced(MemberExpr *E)
Perform reference-marking and odr-use handling for a MemberExpr.
ExprResult BuildCXXNamedCast(SourceLocation OpLoc, tok::TokenKind Kind, TypeSourceInfo *Ty, Expr *E, SourceRange AngleBrackets, SourceRange Parens)
void MarkFunctionReferenced(SourceLocation Loc, FunctionDecl *Func, bool MightBeOdrUse=true)
Mark a function referenced, and check whether it is odr-used (C++ [basic.def.odr]p2,...
ExprResult CreateRecoveryExpr(SourceLocation Begin, SourceLocation End, ArrayRef< Expr * > SubExprs, QualType T=QualType())
Attempts to produce a RecoveryExpr after some AST node cannot be created.
ExprResult ActOnGCCAsmStmtString(Expr *Stm, bool ForAsmLabel)
StmtResult ActOnIfStmt(SourceLocation IfLoc, IfStatementKind StatementKind, SourceLocation LParenLoc, Stmt *InitStmt, ConditionResult Cond, SourceLocation RParenLoc, Stmt *ThenVal, SourceLocation ElseLoc, Stmt *ElseVal)
void ActOnBlockStart(SourceLocation CaretLoc, Scope *CurScope)
ActOnBlockStart - This callback is invoked when a block literal is started.
ExprResult ActOnArraySubscriptExpr(Scope *S, Expr *Base, SourceLocation LLoc, MultiExprArg ArgExprs, SourceLocation RLoc)
ExprResult BuildAtomicExpr(SourceRange CallRange, SourceRange ExprRange, SourceLocation RParenLoc, MultiExprArg Args, AtomicExpr::AtomicOp Op, AtomicArgumentOrder ArgOrder=AtomicArgumentOrder::API)
ExprResult ActOnCallExpr(Scope *S, Expr *Fn, SourceLocation LParenLoc, MultiExprArg ArgExprs, SourceLocation RParenLoc, Expr *ExecConfig=nullptr)
ActOnCallExpr - Handle a call to Fn with the specified array of arguments.
OpaquePtr< TemplateName > TemplateTy
static QualType GetTypeFromParser(ParsedType Ty, TypeSourceInfo **TInfo=nullptr)
static ConditionResult ConditionError()
StmtResult ActOnCompoundStmt(SourceLocation L, SourceLocation R, ArrayRef< Stmt * > Elts, bool isStmtExpr)
SemaPseudoObject & PseudoObject()
StmtResult ActOnCXXTryBlock(SourceLocation TryLoc, Stmt *TryBlock, ArrayRef< Stmt * > Handlers)
ActOnCXXTryBlock - Takes a try compound-statement and a number of handlers and creates a try statemen...
OpaquePtr< DeclGroupRef > DeclGroupPtrTy
StmtResult ActOnDefaultStmt(SourceLocation DefaultLoc, SourceLocation ColonLoc, Stmt *SubStmt, Scope *CurScope)
ExprResult HandleExprEvaluationContextForTypeof(Expr *E)
StmtResult ActOnCaseStmt(SourceLocation CaseLoc, ExprResult LHS, SourceLocation DotDotDotLoc, ExprResult RHS, SourceLocation ColonLoc)
TypeSourceInfo * CheckPackExpansion(TypeSourceInfo *Pattern, SourceLocation EllipsisLoc, UnsignedOrNone NumExpansions)
Construct a pack expansion type from the pattern of the pack expansion.
StmtResult FinishCXXForRangeStmt(Stmt *ForRange, Stmt *Body)
FinishCXXForRangeStmt - Attach the body to a C++0x for-range statement.
ExprResult ActOnFinishFullExpr(Expr *Expr, bool DiscardedValue)
ExprResult CreateBuiltinMatrixSubscriptExpr(Expr *Base, Expr *RowIdx, Expr *ColumnIdx, SourceLocation RBLoc)
StmtResult ActOnGCCAsmStmt(SourceLocation AsmLoc, bool IsSimple, bool IsVolatile, unsigned NumOutputs, unsigned NumInputs, IdentifierInfo **Names, MultiExprArg Constraints, MultiExprArg Exprs, Expr *AsmString, MultiExprArg Clobbers, unsigned NumLabels, SourceLocation RParenLoc)
ShuffleVectorExpr - clang-specific builtin-in function __builtin_shufflevector.
Represents an expression that computes the length of a parameter pack.
SourceLocation getPackLoc() const
Determine the location of the parameter pack.
bool isPartiallySubstituted() const
Determine whether this represents a partially-substituted sizeof... expression, such as is produced f...
static SizeOfPackExpr * Create(ASTContext &Context, SourceLocation OperatorLoc, NamedDecl *Pack, SourceLocation PackLoc, SourceLocation RParenLoc, UnsignedOrNone Length=std::nullopt, ArrayRef< TemplateArgument > PartialArgs={})
ArrayRef< TemplateArgument > getPartialArguments() const
Get.
SourceLocation getOperatorLoc() const
Determine the location of the 'sizeof' keyword.
SourceLocation getRParenLoc() const
Determine the location of the right parenthesis.
NamedDecl * getPack() const
Retrieve the parameter pack.
Represents a function call to one of __builtin_LINE(), __builtin_COLUMN(), __builtin_FUNCTION(),...
static bool MayBeDependent(SourceLocIdentKind Kind)
Encodes a location in the source.
bool isValid() const
Return true if this is a valid SourceLocation object.
A trivial tuple used to represent a source range.
SourceLocation getEnd() const
SourceLocation getBegin() const
StmtExpr - This is the GNU Statement Expression extension: ({int X=4; X;}).
Stmt - This represents one statement.
SourceLocation getEndLoc() const LLVM_READONLY
StmtClass getStmtClass() const
SourceRange getSourceRange() const LLVM_READONLY
SourceLocation tokens are not useful in isolation - they are low level value objects created/interpre...
StringLiteral - This represents a string literal expression, e.g.
Wrapper for substituted template type parameters.
Represents a reference to a non-type template parameter that has been substituted with a template arg...
Represents a reference to a non-type template parameter pack that has been substituted with a non-tem...
A structure for storing an already-substituted template template parameter pack.
A structure for storing the information associated with a substituted template template parameter.
Wrapper for substituted template type parameters.
SwitchStmt - This represents a 'switch' stmt.
Represents the declaration of a struct/union/class/enum.
SourceLocation getNameLoc() const
SourceLocation getElaboratedKeywordLoc() const
NestedNameSpecifierLoc getQualifierLoc() const
void setQualifierLoc(NestedNameSpecifierLoc QualifierLoc)
void setNameLoc(SourceLocation Loc)
void setElaboratedKeywordLoc(SourceLocation Loc)
A convenient class for passing around template argument information.
void setLAngleLoc(SourceLocation Loc)
void setRAngleLoc(SourceLocation Loc)
void addArgument(const TemplateArgumentLoc &Loc)
const TemplateArgumentLoc * operator->() const
pointer(TemplateArgumentLoc Arg)
Simple iterator that traverses the template arguments in a container that provides a getArgLoc() memb...
TemplateArgumentLoc operator*() const
TemplateArgumentLocContainerIterator operator++(int)
friend bool operator!=(const TemplateArgumentLocContainerIterator &X, const TemplateArgumentLocContainerIterator &Y)
TemplateArgumentLocContainerIterator()
TemplateArgumentLoc value_type
TemplateArgumentLocContainerIterator(ArgLocContainer &Container, unsigned Index)
friend bool operator==(const TemplateArgumentLocContainerIterator &X, const TemplateArgumentLocContainerIterator &Y)
TemplateArgumentLocContainerIterator & operator++()
std::input_iterator_tag iterator_category
TemplateArgumentLoc reference
pointer operator->() const
const TemplateArgumentLoc * operator->() const
pointer(TemplateArgumentLoc Arg)
Iterator adaptor that invents template argument location information for each of the template argumen...
TemplateArgumentLocInventIterator & operator++()
pointer operator->() const
std::iterator_traits< InputIterator >::difference_type difference_type
reference operator*() const
TemplateArgumentLocInventIterator operator++(int)
friend bool operator==(const TemplateArgumentLocInventIterator &X, const TemplateArgumentLocInventIterator &Y)
TemplateArgumentLocInventIterator(TreeTransform< Derived > &Self, InputIterator Iter)
friend bool operator!=(const TemplateArgumentLocInventIterator &X, const TemplateArgumentLocInventIterator &Y)
std::input_iterator_tag iterator_category
TemplateArgumentLoc reference
TemplateArgumentLoc value_type
Location wrapper for a TemplateArgument.
const TemplateArgument & getArgument() const
SourceLocation getTemplateNameLoc() const
SourceLocation getTemplateKWLoc() const
TypeSourceInfo * getTypeSourceInfo() const
Expr * getSourceExpression() const
NestedNameSpecifierLoc getTemplateQualifierLoc() const
Represents a template argument.
Expr * getAsExpr() const
Retrieve the template argument as an expression.
const TemplateArgument * pack_iterator
Iterator that traverses the elements of a template argument pack.
QualType getNonTypeTemplateArgumentType() const
If this is a non-type template argument, get its type.
QualType getAsType() const
Retrieve the type for a type template argument.
llvm::APSInt getAsIntegral() const
Retrieve the template argument as an integral value.
TemplateName getAsTemplate() const
Retrieve the template name for a template name argument.
bool containsUnexpandedParameterPack() const
Whether this template argument contains an unexpanded parameter pack.
ValueDecl * getAsDecl() const
Retrieve the declaration for a declaration non-type template argument.
@ Declaration
The template argument is a declaration that was provided for a pointer, reference,...
@ Template
The template argument is a template name that was provided for a template template parameter.
@ StructuralValue
The template argument is a non-type template argument that can't be represented by the special-case D...
@ Pack
The template argument is actually a parameter pack.
@ TemplateExpansion
The template argument is a pack expansion of a template name that was provided for a template templat...
@ NullPtr
The template argument is a null pointer or null pointer to member that was provided for a non-type te...
@ Type
The template argument is a type.
@ Null
Represents an empty template argument, e.g., one that has not been deduced.
@ Integral
The template argument is an integral value stored in an llvm::APSInt that was provided for an integra...
@ Expression
The template argument is an expression, and we've not resolved it to one of the other forms yet,...
ArgKind getKind() const
Return the kind of stored template argument.
bool isPackExpansion() const
Determine whether this template argument is a pack expansion.
const APValue & getAsStructuralValue() const
Get the value of a StructuralValue.
The base class of all kinds of template declarations (e.g., class, function, etc.).
Represents a C++ template name within the type system.
TemplateDecl * getAsTemplateDecl(bool IgnoreDeduced=false) const
Retrieve the underlying template declaration that this template name refers to, if known.
DeducedTemplateStorage * getAsDeducedTemplateName() const
Retrieve the deduced template info, if any.
bool isNull() const
Determine whether this template name is NULL.
DependentTemplateName * getAsDependentTemplateName() const
Retrieve the underlying dependent template name structure, if any.
QualifiedTemplateName * getAsQualifiedTemplateName() const
Retrieve the underlying qualified template name structure, if any.
NestedNameSpecifier getQualifier() const
SubstTemplateTemplateParmPackStorage * getAsSubstTemplateTemplateParmPack() const
Retrieve the substituted template template parameter pack, if known.
SubstTemplateTemplateParmStorage * getAsSubstTemplateTemplateParm() const
Retrieve the substituted template template parameter, if known.
PackIndexingTemplateStorage * getAsPackIndexingTemplate() const
Retrieve the pack-index-template-name storage, if any.
Stores a list of template parameters for a TemplateDecl and its derived classes.
unsigned getNumArgs() const
SourceLocation getLAngleLoc() const
SourceLocation getRAngleLoc() const
SourceLocation getTemplateNameLoc() const
SourceLocation getTemplateKeywordLoc() const
NestedNameSpecifierLoc getQualifierLoc() const
SourceLocation getElaboratedKeywordLoc() const
Wrapper for template type parameters.
The top declaration context.
TypeLoc getTypeLocInContext(ASTContext &Context, QualType T)
Copies the type-location information to the given AST context and returns a TypeLoc referring into th...
TyLocType push(QualType T)
Pushes space for a new TypeLoc of the given type.
void reserve(size_t Requested)
Ensures that this buffer has at least as much capacity as described.
void TypeWasModifiedSafely(QualType T)
Tell the TypeLocBuilder that the type it is storing has been modified in some safe way that doesn't a...
TypeSourceInfo * getTypeSourceInfo(ASTContext &Context, QualType T)
Creates a TypeSourceInfo for the given type.
Base wrapper for a particular "section" of type source info.
UnqualTypeLoc getUnqualifiedLoc() const
Skips past any qualifiers, if this is qualified.
QualType getType() const
Get the type for which this source info wrapper provides information.
T getAs() const
Convert to the specified TypeLoc type, returning a null TypeLoc if this TypeLoc is not of the desired...
T castAs() const
Convert to the specified TypeLoc type, asserting that this TypeLoc is of the desired type.
SourceRange getSourceRange() const LLVM_READONLY
Get the full source range.
unsigned getFullDataSize() const
Returns the size of the type source info data block.
TypeLocClass getTypeLocClass() const
T getAsAdjusted() const
Convert to the specified TypeLoc type, returning a null TypeLoc if this TypeLoc is not of the desired...
SourceLocation getBeginLoc() const
Get the begin source location.
Represents a typeof (or typeof) expression (a C23 feature and GCC extension) or a typeof_unqual expre...
A container of type source information.
TypeLoc getTypeLoc() const
Return the TypeLoc wrapper for the type source info.
QualType getType() const
Return the type wrapped by this type source info.
void setNameLoc(SourceLocation Loc)
A type trait used in the implementation of various C++11 and Library TR1 trait templates.
The base class of the type hierarchy.
bool containsUnexpandedParameterPack() const
Whether this type is or contains an unexpanded parameter pack, used to support C++0x variadic templat...
bool isOverloadableType() const
Determines whether this is a type for which one can define an overloaded operator.
bool isObjCObjectPointerType() const
const T * getAs() const
Member-template getAs<specific type>'.
Base class for declarations which introduce a typedef-name.
Wrapper for source info for typedefs.
void setTypeofLoc(SourceLocation Loc)
UnaryExprOrTypeTraitExpr - expression with either a type or (unevaluated) expression operand.
UnaryOperator - This represents the unary-expression's (except sizeof and alignof),...
SourceLocation getOperatorLoc() const
getOperatorLoc - Return the location of the operator.
Expr * getSubExpr() const
static Opcode getOverloadedOpcode(OverloadedOperatorKind OO, bool Postfix)
Retrieve the unary opcode that corresponds to the given overloaded operator.
Represents a C++ unqualified-id that has been parsed.
void setOperatorFunctionId(SourceLocation OperatorLoc, OverloadedOperatorKind Op, SourceLocation SymbolLocations[3])
Specify that this unqualified-id was parsed as an operator-function-id.
A reference to a name which we were able to look up during parsing but could not resolve to a specifi...
CXXRecordDecl * getNamingClass()
Gets the 'naming class' (in the sense of C++0x [class.access.base]p5) of the lookup.
bool requiresADL() const
True if this declaration should be extended by argument-dependent lookup.
static UnresolvedLookupExpr * Create(const ASTContext &Context, CXXRecordDecl *NamingClass, NestedNameSpecifierLoc QualifierLoc, const DeclarationNameInfo &NameInfo, bool RequiresADL, UnresolvedSetIterator Begin, UnresolvedSetIterator End, bool KnownDependent, bool KnownInstantiationDependent)
Represents a C++ member access expression for which lookup produced a set of overloaded functions.
A set of unresolved declarations.
void append(iterator I, iterator E)
A set of unresolved declarations.
Wrapper for source info for unresolved typename using decls.
Represents the dependent type named by a dependently-scoped typename using declaration,...
A call to a literal operator (C++11 [over.literal]) written as a user-defined literal (C++11 [lit....
Represents a shadow declaration implicitly introduced into a scope by a (resolved) using-declaration ...
NamedDecl * getTargetDecl() const
Gets the underlying declaration which has been brought into the local scope.
Wrapper for source info for types used via transparent aliases.
Represents a call to the builtin function __builtin_va_arg.
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
bool isParameterPack() const
Determine whether this value is actually a function parameter pack, init-capture pack,...
Represents a variable declaration or definition.
@ CInit
C-style initialization with assignment.
@ CallInit
Call-style initialization (C++98)
StorageClass getStorageClass() const
Returns the storage class as written in the source.
Represents a C array with a specified size that is not an integer-constant-expression.
void setNameLoc(SourceLocation Loc)
Represents a GCC generic vector type.
WhileStmt - This represents a 'while' stmt.
A requires-expression requirement which queries the validity and properties of an expression ('simple...
SubstitutionDiagnostic * getExprSubstitutionDiagnostic() const
bool isExprSubstitutionFailure() const
const ReturnTypeRequirement & getReturnTypeRequirement() const
SourceLocation getNoexceptLoc() const
A requires-expression requirement which is satisfied when a general constraint expression is satisfie...
const ASTConstraintSatisfaction & getConstraintSatisfaction() const
bool hasInvalidConstraint() const
Expr * getConstraintExpr() const
StringRef getInvalidConstraintEntity()
A static requirement that can be used in a requires-expression to check properties of types and expre...
A requires-expression requirement which queries the existence of a type name or type template special...
bool isSubstitutionFailure() const
SubstitutionDiagnostic * getSubstitutionDiagnostic() const
TypeSourceInfo * getType() const
Retains information about a block that is currently being parsed.
bool ContainsUnexpandedParameterPack
Whether this contains an unexpanded parameter pack.
CXXRecordDecl * Lambda
The class that describes the lambda.
CXXMethodDecl * CallOperator
The lambda's compiler-generated operator().
@ AttributedType
The l-value was considered opaque, so the alignment was determined from a type, but that type was an ...
const AstTypeMatcher< FunctionType > functionType
bool Inc(InterpState &S, CodePtr OpPC, bool CanOverflow)
1) Pops a pointer from the stack 2) Load the value from the pointer 3) Writes the value increased by ...
Top level wrappers for InstallAPI frontend operations.
CanQual< Type > CanQualType
Represents a canonical, potentially-qualified type.
OpenMPOriginalSharingModifier
OpenMP 6.0 original sharing modifiers.
OverloadedOperatorKind
Enumeration specifying the different kinds of C++ overloaded operators.
@ OO_None
Not an overloaded operator.
@ NUM_OVERLOADED_OPERATORS
bool isa(CodeGen::Address addr)
OpenMPDefaultClauseVariableCategory
OpenMP variable-category for 'default' clause.
AutoTypeKeyword
Which keyword(s) were used to create an AutoType.
QualType pointeeType(QualType T)
OpenMPDefaultmapClauseModifier
OpenMP modifiers for 'defaultmap' clause.
OpenMPOrderClauseModifier
OpenMP modifiers for 'order' clause.
@ Ambiguous
Name lookup results in an ambiguity; use getAmbiguityKind to figure out what kind of ambiguity we hav...
@ NotFound
No entity found met the criteria.
@ FoundOverloaded
Name lookup found a set of overloaded functions that met the criteria.
@ Found
Name lookup found a single declaration that met the criteria.
@ FoundUnresolvedValue
Name lookup found an unresolvable value declaration and cannot yet complete.
@ NotFoundInCurrentInstantiation
No entity found met the criteria within the current instantiation,, but there were dependent base cla...
IfStatementKind
In an if statement, this denotes whether the statement is a constexpr or consteval if statement.
@ TemplateName
The identifier is a template name. FIXME: Add an annotation for that.
@ OK_ObjCProperty
An Objective-C property is a logical field of an Objective-C object which is read and written via Obj...
OpenMPAtClauseKind
OpenMP attributes for 'at' clause.
@ LCK_ByCopy
Capturing by copy (a.k.a., by value)
@ LCK_ByRef
Capturing by reference.
@ LCK_StarThis
Capturing the *this object by copy.
NonTagKind
Common ways to introduce type names without a tag for use in diagnostics.
OpenMPReductionClauseModifier
OpenMP modifiers for 'reduction' clause.
std::pair< llvm::PointerUnion< const TemplateTypeParmType *, NamedDecl *, const TemplateSpecializationType *, const SubstBuiltinTemplatePackType * >, SourceLocation > UnexpandedParameterPack
@ DevicePtr
'deviceptr' clause, allowed on Compute and Combined Constructs, plus 'data' and 'declare'.
@ Invalid
Represents an invalid clause, for the purposes of parsing.
@ Attach
'attach' clause, allowed on Compute and Combined constructs, plus 'data' and 'enter data'.
@ Self
'self' clause, allowed on Compute and Combined Constructs, plus 'update'.
@ Detach
'detach' clause, allowed on the 'exit data' construct.
TypeOfKind
The kind of 'typeof' expression we're after.
OpenMPScheduleClauseModifier
OpenMP modifiers for 'schedule' clause.
OpenMPNumTeamsClauseModifier
OpenACCComputeConstruct(OpenACCDirectiveKind K, SourceLocation Start, SourceLocation DirectiveLoc, SourceLocation End, ArrayRef< const OpenACCClause * > Clauses, Stmt *StructuredBlock)
OpenMPDistScheduleClauseKind
OpenMP attributes for 'dist_schedule' clause.
OpenMPDoacrossClauseModifier
OpenMP dependence types for 'doacross' clause.
@ Dependent
Parse the block as a dependent block, which may be used in some template instantiations but not other...
std::pair< NullabilityKind, bool > DiagNullabilityKind
A nullability kind paired with a bit indicating whether it used a context-sensitive keyword.
OpenMPDynGroupprivateClauseFallbackModifier
MutableArrayRef< Expr * > MultiExprArg
@ Property
The type of a property.
@ Result
The result type of a method or function.
OpenMPBindClauseKind
OpenMP bindings for the 'bind' clause.
ArraySizeModifier
Capture whether this is a normal array (e.g.
OptionalUnsigned< unsigned > UnsignedOrNone
const FunctionProtoType * T
bool isComputedNoexcept(ExceptionSpecificationType ESpecType)
OpenMPLastprivateModifier
OpenMP 'lastprivate' clause modifier.
@ Template
We are parsing a template declaration.
ActionResult< CXXBaseSpecifier * > BaseResult
OpenMPGrainsizeClauseModifier
OpenMPNumTasksClauseModifier
TagTypeKind
The kind of a tag type.
bool transformOMPMappableExprListClause(TreeTransform< Derived > &TT, OMPMappableExprListClause< T > *C, llvm::SmallVectorImpl< Expr * > &Vars, CXXScopeSpec &MapperIdScopeSpec, DeclarationNameInfo &MapperIdInfo, llvm::SmallVectorImpl< Expr * > &UnresolvedMappers)
OpenMPUseDevicePtrFallbackModifier
OpenMP 6.1 use_device_ptr fallback modifier.
@ Keyword
The name has been typo-corrected to a keyword.
bool isOpenMPLoopDirective(OpenMPDirectiveKind DKind)
Checks if the specified directive is a directive with an associated loop construct.
OpenMPSeverityClauseKind
OpenMP attributes for 'severity' clause.
@ Deduced
The normal deduced case.
@ Undeduced
Not deduced yet. This is for example an 'auto' which was just parsed.
std::tuple< NamedDecl *, TemplateArgument > getReplacedTemplateParameter(Decl *D, unsigned Index)
Internal helper used by Subst* nodes to retrieve a parameter from the AssociatedDecl,...
OpenMPDefaultmapClauseKind
OpenMP attributes for 'defaultmap' clause.
OpenMPAllocateClauseModifier
OpenMP modifiers for 'allocate' clause.
OpenMPLinearClauseKind
OpenMP attributes for 'linear' clause.
llvm::omp::Directive OpenMPDirectiveKind
OpenMP directives.
OpenMPDynGroupprivateClauseModifier
@ VK_PRValue
A pr-value expression (in the C++11 taxonomy) produces a temporary value.
@ VK_LValue
An l-value expression is a reference to an object with independent storage.
OpenMPThreadLimitClauseModifier
@ Dependent
The name is a dependent name, so the results will differ from one instantiation to the next.
@ Exists
The symbol exists.
@ Error
An error occurred.
@ DoesNotExist
The symbol does not exist.
MutableArrayRef< Stmt * > MultiStmtArg
OpenMPNumThreadsClauseModifier
U cast(CodeGen::Address addr)
@ PackIndex
Index of a pack indexing expression or specifier.
OpenMPDeviceClauseModifier
OpenMP modifiers for 'device' clause.
OpaquePtr< QualType > ParsedType
An opaque type for threading parsed type information through the parser.
ElaboratedTypeKeyword
The elaboration keyword that precedes a qualified type name or introduces an elaborated-type-specifie...
@ None
No keyword precedes the qualified type name.
@ Class
The "class" keyword introduces the elaborated-type-specifier.
@ Typename
The "typename" keyword precedes the qualified type name, e.g., typename T::type.
ActionResult< Expr * > ExprResult
OpenMPOrderClauseKind
OpenMP attributes for 'order' clause.
@ Parens
New-expression has a C++98 paren-delimited initializer.
ExceptionSpecificationType
The various types of exception specifications that exist in C++11.
@ EST_Uninstantiated
not instantiated yet
@ EST_Unevaluated
not evaluated yet, for special member function
@ EST_Dynamic
throw(T1, T2)
OpenMPScheduleClauseKind
OpenMP attributes for 'schedule' clause.
static QualType TransformTypeSpecType(TypeLocBuilder &TLB, TyLoc T)
ActionResult< Stmt * > StmtResult
OpenMPMapClauseKind
OpenMP mapping kind for 'map' clause.
Expr * AllocatorTraits
Allocator traits.
Expr * Allocator
Allocator.
SourceLocation LParenLoc
Locations of '(' and ')' symbols.
The result of a constraint satisfaction check, containing the necessary information to diagnose an un...
Represents an explicit template argument list in C++, e.g., the "<int>" in "sort<int>".
static const ASTTemplateArgumentListInfo * Create(const ASTContext &C, const TemplateArgumentListInfo &List)
DeclarationNameInfo - A collector data type for bundling together a DeclarationName and the correspon...
SourceLocation getLoc() const
getLoc - Returns the main location of the declaration name.
DeclarationName getName() const
getName - Returns the embedded declaration name.
void setNamedTypeInfo(TypeSourceInfo *TInfo)
setNamedTypeInfo - Sets the source type info associated to the name.
void setName(DeclarationName N)
setName - Sets the embedded declaration name.
TypeSourceInfo * getNamedTypeInfo() const
A FunctionEffect plus a potential boolean expression determining whether the effect is declared (e....
Holds information about the various types of exception specification.
FunctionDecl * SourceTemplate
The function template whose exception specification this is instantiated from, for EST_Uninstantiated...
ExceptionSpecificationType Type
The kind of exception specification this is.
ArrayRef< QualType > Exceptions
Explicitly-specified list of exception types.
Expr * NoexceptExpr
Noexcept expression, if this is a computed noexcept specification.
Extra information about a function prototype.
ExceptionSpecInfo ExceptionSpec
FunctionEffectsRef FunctionEffects
const ExtParameterInfo * ExtParameterInfos
const IdentifierInfo * getIdentifier() const
Returns the identifier to which this template name refers.
OverloadedOperatorKind getOperator() const
Return the overloaded operator to which this template name refers.
static TagTypeKind getTagTypeKindForKeyword(ElaboratedTypeKeyword Keyword)
Converts an elaborated type keyword into a TagTypeKind.
const NamespaceBaseDecl * Namespace
Iterator range representation begin:end[:step].
This structure contains most locations needed for by an OMPVarListClause.
An element in an Objective-C dictionary literal.
Data for list of allocators.
A context in which code is being synthesized (where a source location alone is not sufficient to iden...
@ LambdaExpressionSubstitution
We are substituting into a lambda expression.
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