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);
1065 Expr *AddrSpaceExpr,
1089 return SemaRef.Context.getUsingType(
Keyword, Qualifier, D, UnderlyingType);
1102 return SemaRef.Context.getMacroQualifiedType(
T, MacroII);
1112 return SemaRef.Context.getCanonicalTagType(Tag);
1129 UnaryTransformType::UTTKind UKind,
1141 bool FullySubstituted,
1151 return SemaRef.Context.getAutoType(
1152 DK, DeducedAsType,
Keyword, TypeConstraintConcept, TypeConstraintArgs);
1160 return SemaRef.Context.getDeducedTemplateSpecializationType(
1179 return SemaRef.BuildParenType(InnerType);
1192 bool DeducedTSTContext) {
1194 SS.
Adopt(QualifierLoc);
1198 if (!
SemaRef.computeDeclContext(SS))
1206 return SemaRef.CheckTypenameType(
Keyword, KeywordLoc, QualifierLoc,
1207 *Id, IdLoc, DeducedTSTContext);
1220 if (
SemaRef.RequireCompleteDeclContext(SS, DC))
1225 switch (
Result.getResultKind()) {
1236 llvm_unreachable(
"Tag lookup cannot find non-tags");
1248 switch (
Result.getResultKind()) {
1254 SemaRef.Diag(IdLoc, diag::err_tag_reference_non_tag)
1255 << SomeDecl << NTK << Kind;
1260 SemaRef.Diag(IdLoc, diag::err_not_tag_in_scope)
1266 if (!
SemaRef.isAcceptableTagRedeclaration(Tag, Kind,
false,
1268 SemaRef.Diag(KeywordLoc, diag::err_use_with_wrong_tag) << Id;
1269 SemaRef.Diag(Tag->getLocation(), diag::note_previous_use);
1325 bool AllowInjectedClassName);
1338 bool AllowInjectedClassName);
1344 bool AllowInjectedClassName);
1354 Decl *AssociatedDecl,
unsigned Index,
1357 ArgPack, AssociatedDecl, Index, Final);
1366 bool FullySubstituted,
1369 Pattern, IndexExpr, FullySubstituted, Expansions);
1423 return SemaRef.ActOnLabelStmt(IdentLoc, L, ColonLoc, SubStmt);
1433 if (
SemaRef.CheckRebuiltStmtAttributes(Attrs))
1435 return SemaRef.BuildAttributedStmt(AttrLoc, Attrs, SubStmt);
1447 Then, ElseLoc, Else);
1501 Inc, RParenLoc, Body);
1546 bool IsVolatile,
unsigned NumOutputs,
1553 NumInputs, Names, Constraints, Exprs,
1554 AsmString, Clobbers, NumLabels, RParenLoc);
1563 StringRef AsmString,
1564 unsigned NumOutputs,
unsigned NumInputs,
1570 NumOutputs, NumInputs,
1571 Constraints, Clobbers, Exprs, EndLoc);
1600 CoawaitLoc, Operand, OpCoawaitLookup);
1604 Suspend.
get(),
true);
1705 Kind, DirName, CancelRegion, Clauses, AStmt, StartLoc, EndLoc);
1717 Kind, DirName, Clauses, AStmt, StartLoc, EndLoc);
1731 NameModifier,
Condition, StartLoc, LParenLoc, NameModifierLoc, ColonLoc,
1758 VarList, PrescriptivenessModifier, PrescriptivenessModifierLoc,
1759 DimsModifier, DimsModifierExpr, DimsModifierLoc, StartLoc, LParenLoc,
1797 std::optional<unsigned> FillIdx,
1799 unsigned FillCount = FillIdx ? 1 : 0;
1801 Counts, StartLoc, LParenLoc, EndLoc, FillIdx, FillLoc, FillCount);
1832 First, Count, StartLoc, LParenLoc, FirstLoc, CountLoc, EndLoc);
1868 Kind, KindKwLoc, VCKind, VCLoc, StartLoc, LParenLoc, EndLoc);
1881 Kind, KindKwLoc, StartLoc, LParenLoc, EndLoc);
1888 ImpexTypeArg, StartLoc, LParenLoc, EndLoc);
1901 M1, M2, Kind, ChunkSize, StartLoc, LParenLoc, M1Loc, M2Loc, KindLoc,
1963 VarList, LPKind, LPKindLoc, ColonLoc, StartLoc, LParenLoc, EndLoc);
1991 VarList, {Modifier, OriginalSharingModifier}, StartLoc, LParenLoc,
1992 ModifierLoc, ColonLoc, EndLoc, ReductionIdScopeSpec, ReductionId,
1993 UnresolvedReductions);
2007 VarList, StartLoc, LParenLoc, ColonLoc, EndLoc, ReductionIdScopeSpec,
2008 ReductionId, UnresolvedReductions);
2023 VarList, StartLoc, LParenLoc, ColonLoc, EndLoc, ReductionIdScopeSpec,
2024 ReductionId, UnresolvedReductions);
2037 VarList, Step, StartLoc, LParenLoc, Modifier, ModifierLoc, ColonLoc,
2038 StepModifierLoc, EndLoc);
2051 VarList, Alignment, StartLoc, LParenLoc, ColonLoc, EndLoc);
2111 Data, DepModifier, VarList, StartLoc, LParenLoc, EndLoc);
2124 Modifier,
Device, StartLoc, LParenLoc, ModifierLoc, EndLoc);
2139 IteratorModifier, MapTypeModifiers, MapTypeModifiersLoc,
2140 MapperIdScopeSpec, MapperId, MapType, IsMapTypeImplicit, MapLoc,
2141 ColonLoc, VarList, Locs,
2142 false, UnresolvedMappers);
2159 Allocate, Alignment, FirstModifier, FirstModifierLoc, SecondModifier,
2160 SecondModifierLoc, VarList, StartLoc, LParenLoc, ColonLoc, EndLoc);
2174 VarList, Modifier, ModifierExpr, ModifierLoc, ModifierExtra,
2175 ModifierExtraExpr, ModifierExtraLoc, StartLoc, LParenLoc, EndLoc);
2187 VarList, Modifier, ModifierExpr, ModifierLoc, StartLoc, LParenLoc,
2212 Modifier,
Device, StartLoc, LParenLoc, ModifierLoc, EndLoc);
2225 Modifier, NumTasks, StartLoc, LParenLoc, ModifierLoc, EndLoc);
2260 Kind, ChunkSize, StartLoc, LParenLoc, KindLoc, CommaLoc, EndLoc);
2275 MotionModifiers, MotionModifiersLoc, IteratorModifier,
2276 MapperIdScopeSpec, MapperId, ColonLoc, VarList, Locs,
2292 MotionModifiers, MotionModifiersLoc, IteratorModifier,
2293 MapperIdScopeSpec, MapperId, ColonLoc, VarList, Locs,
2306 VarList, Locs, FallbackModifier, FallbackModifierLoc);
2348 M, Kind, StartLoc, LParenLoc, MLoc, KindLoc, EndLoc);
2395 StartLoc, LParenLoc, EndLoc,
Data);
2408 StartLoc, LParenLoc, ColonLoc, EndLoc, Modifier, Locators);
2420 Modifier, Kind, StartLoc, LParenLoc, ModifierKwLoc, KindKwLoc, EndLoc);
2433 InteropVar, InteropInfo, StartLoc, LParenLoc, VarLoc, EndLoc);
2444 LParenLoc, VarLoc, EndLoc);
2456 InteropVar, StartLoc, LParenLoc, VarLoc, EndLoc);
2527 M1, M2, Size, StartLoc, LParenLoc, M1Loc, M2Loc, EndLoc);
2608 DepType, DepLoc, ColonLoc, VarList, StartLoc, LParenLoc, EndLoc);
2656 ForLoc, Element, Collection, RParenLoc);
2674 StartLoc, IdLoc, Id);
2711 if (
DeclStmt *RangeStmt = dyn_cast<DeclStmt>(Range)) {
2712 if (RangeStmt->isSingleDecl()) {
2713 if (
VarDecl *RangeVar = dyn_cast<VarDecl>(RangeStmt->getSingleDecl())) {
2714 if (RangeVar->isInvalidDecl())
2717 Expr *RangeExpr = RangeVar->getInit();
2724 diag::err_objc_for_range_init_stmt)
2725 <<
Init->getSourceRange();
2728 ForLoc, LoopVar, RangeExpr, RParenLoc);
2735 ForLoc, CoawaitLoc,
Init, ColonLoc, Range, Begin, End, Cond, Inc,
2749 QualifierLoc, NameInfo, Nested);
2811 SS.
Adopt(QualifierLoc);
2865 UnaryExprOrTypeTrait ExprKind,
2876 UnaryExprOrTypeTrait ExprKind,
2931 if (IsOMPArraySection)
2933 Base, LBracketLoc, LowerBound, ColonLocFirst, ColonLocSecond, Length,
2934 Stride, RBracketLoc);
2936 assert(Stride ==
nullptr && !ColonLocSecond.
isValid() &&
2937 "Stride/second colon not allowed for OpenACC");
2940 Base, LBracketLoc, LowerBound, ColonLocFirst, Length, RBracketLoc);
2952 Base, LParenLoc, RParenLoc, Dims, BracketsRanges);
2964 nullptr, IteratorKwLoc, LLoc, RLoc,
Data);
2974 Expr *ExecConfig =
nullptr) {
2976 nullptr, Callee, LParenLoc, Args, RParenLoc, ExecConfig);
2983 nullptr, Callee, LParenLoc, Args, RParenLoc);
3001 if (!
Member->getDeclName()) {
3005 assert(
Member->getType()->isRecordType() &&
3006 "unnamed member not of record type?");
3019 if (!isArrow &&
Base->isPRValue()) {
3034 SS.
Adopt(QualifierLoc);
3037 if (
Base->containsErrors())
3042 if (isArrow && !BaseType->isPointerType())
3048 R.addDecl(FoundDecl);
3051 if (
getSema().isUnevaluatedContext() &&
Base->isImplicitCXXThis() &&
3056 ->getAsCXXRecordDecl()) {
3060 if (!ThisClass->Equals(
Class) && !ThisClass->isDerivedFrom(
Class))
3068 FirstQualifierInScope,
3069 R, ExplicitTemplateArgs,
3079 bool ForFoldExpression =
false) {
3157 return SemaRef.BuildInitList(LBraceLoc,
Inits, RBraceLoc, IsExplicit);
3170 =
SemaRef.ActOnDesignatedInitializer(Desig, EqualOrColonLoc, GNUSyntax,
3210 unsigned NumUserSpecifiedExprs,
3215 InitLoc, LParenLoc, RParenLoc);
3245 return SemaRef.ActOnChooseExpr(BuiltinLoc,
3257 Expr *ControllingExpr,
3262 ControllingExpr, Types, Exprs);
3277 ControllingType, Types, Exprs);
3310 case Stmt::CXXStaticCastExprClass:
3311 return getDerived().RebuildCXXStaticCastExpr(OpLoc, LAngleLoc, TInfo,
3312 RAngleLoc, LParenLoc,
3313 SubExpr, RParenLoc);
3315 case Stmt::CXXDynamicCastExprClass:
3316 return getDerived().RebuildCXXDynamicCastExpr(OpLoc, LAngleLoc, TInfo,
3317 RAngleLoc, LParenLoc,
3318 SubExpr, RParenLoc);
3320 case Stmt::CXXReinterpretCastExprClass:
3321 return getDerived().RebuildCXXReinterpretCastExpr(OpLoc, LAngleLoc, TInfo,
3322 RAngleLoc, LParenLoc,
3326 case Stmt::CXXConstCastExprClass:
3327 return getDerived().RebuildCXXConstCastExpr(OpLoc, LAngleLoc, TInfo,
3328 RAngleLoc, LParenLoc,
3329 SubExpr, RParenLoc);
3331 case Stmt::CXXAddrspaceCastExprClass:
3332 return getDerived().RebuildCXXAddrspaceCastExpr(
3333 OpLoc, LAngleLoc, TInfo, RAngleLoc, LParenLoc, SubExpr, RParenLoc);
3336 llvm_unreachable(
"Invalid C++ named cast");
3414 OpLoc, tok::kw_addrspace_cast, TInfo, SubExpr,
3426 bool ListInitialization) {
3430 if (
auto *PLE = dyn_cast<ParenListExpr>(Sub))
3432 TInfo, LParenLoc,
MultiExprArg(PLE->getExprs(), PLE->getNumExprs()),
3433 RParenLoc, ListInitialization);
3435 if (
auto *PLE = dyn_cast<CXXParenListInitExpr>(Sub))
3437 TInfo, LParenLoc, PLE->getUserSpecifiedInitExprs(), RParenLoc,
3438 ListInitialization);
3442 ListInitialization);
3506 if (
getSema().CheckCXXThisType(ThisLoc, ThisType))
3516 bool IsThrownVariableInScope) {
3526 Expr *RewrittenExpr) {
3528 RewrittenExpr,
getSema().CurContext);
3562 std::optional<Expr *> ArraySize,
3581 bool IsGlobalDelete,
3632 bool IsAddressOfOperand,
3635 SS.
Adopt(QualifierLoc);
3637 if (TemplateArgs || TemplateKWLoc.
isValid())
3639 SS, TemplateKWLoc, NameInfo, TemplateArgs, IsAddressOfOperand);
3642 SS, NameInfo, IsAddressOfOperand, RecoveryTSI);
3664 bool IsElidable,
MultiExprArg Args,
bool HadMultipleCandidates,
3665 bool ListInitialization,
bool StdInitListInitialization,
3672 FoundCtor =
Constructor->getInheritedConstructor().getConstructor();
3675 if (
getSema().CompleteConstructorCall(FoundCtor,
T, Args, Loc,
3682 HadMultipleCandidates,
3684 StdInitListInitialization,
3685 RequiresZeroInit, ConstructKind,
3693 bool ConstructsVBase,
3694 bool InheritedFromVBase) {
3696 Loc,
T,
Constructor, ConstructsVBase, InheritedFromVBase);
3707 bool ListInitialization) {
3709 TSInfo, LParenOrBraceLoc, Args, RParenOrBraceLoc, ListInitialization);
3720 bool ListInitialization) {
3722 RParenLoc, ListInitialization);
3739 SS.
Adopt(QualifierLoc);
3741 return SemaRef.BuildMemberReferenceExpr(BaseE, BaseType,
3742 OperatorLoc, IsArrow,
3744 FirstQualifierInScope,
3746 TemplateArgs,
nullptr);
3762 SS.
Adopt(QualifierLoc);
3764 return SemaRef.BuildMemberReferenceExpr(BaseE, BaseType,
3765 OperatorLoc, IsArrow,
3767 FirstQualifierInScope,
3768 R, TemplateArgs,
nullptr);
3776 return SemaRef.BuildCXXNoexceptExpr(Range.getBegin(), Arg, Range.getEnd());
3789 RParenLoc, Length, PartialArgs);
3794 Expr *PackIdExpression,
Expr *IndexExpr,
3796 bool FullySubstituted =
false) {
3798 IndexExpr, RSquareLoc, ExpandedExprs,
3824 NamedConcept, TALI);
3842 LocalParameters, RParenLoc, Requirements,
3849 return SemaRef.BuildTypeRequirement(SubstDiag);
3853 return SemaRef.BuildTypeRequirement(
T);
3861 return SemaRef.BuildExprRequirement(SubstDiag, IsSimple, NoexceptLoc,
3868 return SemaRef.BuildExprRequirement(E, IsSimple, NoexceptLoc,
3875 return SemaRef.BuildNestedRequirement(InvalidConstraintEntity,
3880 return SemaRef.BuildNestedRequirement(Constraint);
3896 Expr **Elements,
unsigned NumElements) {
3906 RB,
Base, Key, getterMethod, setterMethod);
3925 return SemaRef.ObjC().BuildObjCEncodeExpression(AtLoc, EncodeTypeInfo,
3937 return SemaRef.ObjC().BuildClassMessage(
3938 ReceiverTypeInfo, ReceiverTypeInfo->
getType(),
3951 return SemaRef.ObjC().BuildInstanceMessage(Receiver, Receiver->
getType(),
3954 SelectorLocs, RBracLoc, Args);
3966 return Method->isInstanceMethod()
3967 ?
SemaRef.ObjC().BuildInstanceMessage(
3968 nullptr, SuperType, SuperLoc, Sel,
Method, LBracLoc,
3969 SelectorLocs, RBracLoc, Args)
3970 :
SemaRef.ObjC().BuildClassMessage(
nullptr, SuperType, SuperLoc,
3972 SelectorLocs, RBracLoc, Args);
3981 bool IsArrow,
bool IsFreeIvar) {
3990 if (IsFreeIvar &&
Result.isUsable())
4027 PropertyLoc,
Base));
4056 =
SemaRef.Context.Idents.get(
"__builtin_shufflevector");
4059 assert(!Lookup.
empty() &&
"No __builtin_shufflevector?");
4067 Callee =
SemaRef.ImpCastExprToType(Callee, CalleePtrTy,
4068 CK_BuiltinFnToFnPtr).get();
4084 return SemaRef.ConvertVectorExpr(SrcExpr, DstTInfo, BuiltinLoc, RParenLoc);
4099 EllipsisLoc, NumExpansions);
4123 llvm_unreachable(
"Pack expansion pattern has no parameter packs");
4159 EllipsisLoc, RHS, RParenLoc,
4168 Init->containsUnexpandedParameterPack();
4169 else if (PVD->hasUninstantiatedDefaultArg())
4171 PVD->getUninstantiatedDefaultArg()
4172 ->containsUnexpandedParameterPack();
4326 Exprs.push_back(DevNumExpr);
4327 llvm::append_range(Exprs, QueueIdExprs);
4364 AssociatedDecl, Index, ParamType, Loc, Arg,
PackIndex, Final);
4388 ObjectType, FirstQualifierInScope);
4394 QualType TransformDependentNameType(TypeLocBuilder &TLB,
4395 DependentNameTypeLoc TL,
4396 bool DeducibleTSTContext,
4397 QualType ObjectType = QualType(),
4398 NamedDecl *UnqualLookup =
nullptr);
4401 TransformOpenACCClauseList(OpenACCDirectiveKind DirKind,
4406 OpenACCDirectiveKind DirKind,
4407 const OpenACCClause *OldClause);
4410template <
typename Derived>
4420#define STMT(Node, Parent) \
4421 case Stmt::Node##Class: return getDerived().Transform##Node(cast<Node>(S));
4422#define VALUESTMT(Node, Parent) \
4423 case Stmt::Node##Class: \
4424 return getDerived().Transform##Node(cast<Node>(S), SDK);
4425#define ABSTRACT_STMT(Node)
4426#define EXPR(Node, Parent)
4427#include "clang/AST/StmtNodes.inc"
4430#define STMT(Node, Parent)
4431#define ABSTRACT_STMT(Stmt)
4432#define EXPR(Node, Parent) case Stmt::Node##Class:
4433#include "clang/AST/StmtNodes.inc"
4438 E =
getSema().ActOnStmtExprResult(E);
4446template<
typename Derived>
4454#define GEN_CLANG_CLAUSE_CLASS
4455#define CLAUSE_CLASS(Enum, Str, Class) \
4457 return getDerived().Transform##Class(cast<Class>(S));
4458#include "llvm/Frontend/OpenMP/OMP.inc"
4465template<
typename Derived>
4472#define STMT(Node, Parent) case Stmt::Node##Class: break;
4473#define ABSTRACT_STMT(Stmt)
4474#define EXPR(Node, Parent) \
4475 case Stmt::Node##Class: return getDerived().Transform##Node(cast<Node>(E));
4476#include "clang/AST/StmtNodes.inc"
4482template<
typename Derived>
4490 if (
auto *FE = dyn_cast<FullExpr>(
Init))
4491 Init = FE->getSubExpr();
4493 if (
auto *AIL = dyn_cast<ArrayInitLoopExpr>(
Init)) {
4499 Init = MTE->getSubExpr();
4502 Init = Binder->getSubExpr();
4505 Init = ICE->getSubExprAsWritten();
4508 dyn_cast<CXXStdInitializerListExpr>(
Init))
4545 getSema().currentEvaluationContext().InLifetimeExtendingContext =
4546 getSema().parentEvaluationContext().InLifetimeExtendingContext;
4547 getSema().currentEvaluationContext().RebuildDefaultArgOrDefaultInit =
4548 getSema().parentEvaluationContext().RebuildDefaultArgOrDefaultInit;
4550 bool ArgChanged =
false;
4552 true, NewArgs, &ArgChanged))
4563 if (
Parens.isInvalid()) {
4566 assert(NewArgs.empty() &&
4567 "no parens or braces but have direct init with arguments?");
4574template<
typename Derived>
4580 for (
unsigned I = 0; I != NumInputs; ++I) {
4590 Expr *Pattern = Expansion->getPattern();
4593 getSema().collectUnexpandedParameterPacks(Pattern, Unexpanded);
4594 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
4599 bool RetainExpansion =
false;
4600 UnsignedOrNone OrigNumExpansions = Expansion->getNumExpansions();
4604 Unexpanded,
true, Expand,
4605 RetainExpansion, NumExpansions))
4618 Expansion->getEllipsisLoc(),
4620 if (Out.isInvalid())
4625 Outputs.push_back(Out.get());
4631 if (ArgChanged) *ArgChanged =
true;
4635 for (
unsigned I = 0; I != *NumExpansions; ++I) {
4638 if (Out.isInvalid())
4641 if (Out.get()->containsUnexpandedParameterPack()) {
4643 Out.get(), Expansion->getEllipsisLoc(), OrigNumExpansions);
4644 if (Out.isInvalid())
4648 Outputs.push_back(Out.get());
4653 if (RetainExpansion) {
4654 ForgetPartiallySubstitutedPackRAII Forget(
getDerived());
4657 if (Out.isInvalid())
4661 Out.get(), Expansion->getEllipsisLoc(), OrigNumExpansions);
4662 if (Out.isInvalid())
4665 Outputs.push_back(Out.get());
4672 IsCall ?
getDerived().TransformInitializer(Inputs[I],
false)
4677 if (
Result.get() != Inputs[I] && ArgChanged)
4680 Outputs.push_back(
Result.get());
4686template <
typename Derived>
4697 VarDecl *ConditionVar = cast_or_null<VarDecl>(
4703 return getSema().ActOnConditionVariable(ConditionVar, Loc, Kind);
4712 return getSema().ActOnCondition(
nullptr, Loc, CondExpr.
get(), Kind,
4719template <
typename Derived>
4727 Qualifier = Qualifier.getAsNamespaceAndPrefix().Prefix)
4739 llvm_unreachable(
"unexpected null nested name specifier");
4770 QualifierLoc =
getDerived().TransformNestedNameSpecifierLoc(
4771 QualifierLoc, ObjectType, FirstQualifierInScope);
4775 FirstQualifierInScope =
nullptr;
4777 SS.
Adopt(QualifierLoc);
4781 if (
SemaRef.BuildCXXNestedNameSpecifier(
nullptr, IdInfo,
4783 FirstQualifierInScope,
false))
4791 T = TransformTypeInObjectScope(TLB, TL, ObjectType,
4792 FirstQualifierInScope);
4798 if (
T->isDependentType() ||
T->isRecordType() ||
4799 (
SemaRef.getLangOpts().CPlusPlus11 &&
T->isEnumeralType())) {
4800 if (
T->isEnumeralType())
4802 diag::warn_cxx98_compat_enum_nested_name_spec);
4809 if (!TTL || !TTL.
getDecl()->isInvalidDecl()) {
4833template<
typename Derived>
4853 TemplateDecl *NewTemplate = cast_or_null<TemplateDecl>(
4860 SemaRef.Context.DeclarationNames.getCXXDeductionGuideName(NewTemplate));
4870 NewTInfo =
getDerived().TransformType(OldTInfo);
4873 NewCanTy =
SemaRef.Context.getCanonicalType(NewTInfo->
getType());
4881 NewCanTy =
SemaRef.Context.getCanonicalType(NewT);
4894 llvm_unreachable(
"Unknown name kind.");
4897template <
typename Derived>
4901 QualType ObjectType,
bool AllowInjectedClassName) {
4903 return getDerived().RebuildTemplateName(SS, TemplateKWLoc, *II, NameLoc,
4904 ObjectType, AllowInjectedClassName);
4906 NameLoc, ObjectType,
4907 AllowInjectedClassName);
4910template <
typename Derived>
4914 NamedDecl *FirstQualifierInScope,
bool AllowInjectedClassName) {
4916 TemplateName UnderlyingName = QTN->getUnderlyingTemplate();
4919 QualifierLoc =
getDerived().TransformNestedNameSpecifierLoc(
4920 QualifierLoc, ObjectType, FirstQualifierInScope);
4927 UnderlyingQualifier, TemplateKWLoc, UnderlyingName, NameLoc, ObjectType,
4928 FirstQualifierInScope, AllowInjectedClassName);
4929 if (NewUnderlyingName.
isNull())
4931 assert(!UnderlyingQualifier &&
"unexpected qualifier");
4935 NewUnderlyingName == UnderlyingName)
4938 SS.
Adopt(QualifierLoc);
4939 return getDerived().RebuildTemplateName(SS, QTN->hasTemplateKeyword(),
4945 QualifierLoc =
getDerived().TransformNestedNameSpecifierLoc(
4946 QualifierLoc, ObjectType, FirstQualifierInScope);
4960 SS.
Adopt(QualifierLoc);
4961 return getDerived().RebuildTemplateName(SS, TemplateKWLoc, DTN->getName(),
4962 NameLoc, ObjectType,
4963 AllowInjectedClassName);
4968 assert(!QualifierLoc &&
"Unexpected qualified SubstTemplateTemplateParm");
4975 ReplacementQualifierLoc = Builder.getWithLocInContext(
SemaRef.Context);
4979 ReplacementQualifierLoc, TemplateKWLoc, ReplacementName, NameLoc,
4980 ObjectType, FirstQualifierInScope, AllowInjectedClassName);
4983 Decl *AssociatedDecl =
4984 getDerived().TransformDecl(NameLoc, S->getAssociatedDecl());
4986 AssociatedDecl == S->getAssociatedDecl())
4988 return SemaRef.Context.getSubstTemplateTemplateParm(
4989 NewName, AssociatedDecl, S->getIndex(), S->getPackIndex(),
4994 assert(!QualifierLoc &&
"Unexpected qualified pack-index-template-name");
5000 IndexExpr =
getDerived().TransformExpr(PI->getIndexExpr());
5008 NoQualifier, TemplateKWLoc, N, NameLoc, ObjectType,
5009 FirstQualifierInScope, AllowInjectedClassName);
5016 bool NotYetExpanded = Names.empty();
5017 bool FullySubstituted =
true;
5019 if (Names.empty() && !PI->expandsToEmptyPack())
5023 if (!N.containsUnexpandedParameterPack()) {
5025 if (Transformed.
isNull())
5027 SubstitutedNames.push_back(Transformed);
5032 getSema().collectUnexpandedParameterPacks(N, Unexpanded);
5033 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
5035 bool ShouldExpand =
true;
5036 bool RetainExpansion =
false;
5041 RetainExpansion, NumExpansions))
5044 if (!ShouldExpand) {
5049 if (NotYetExpanded) {
5050 FullySubstituted =
false;
5051 return getDerived().RebuildPackIndexingTemplateName(
5052 Pack, IndexExpr.
get(), FullySubstituted);
5054 SubstitutedNames.push_back(Pack);
5058 for (
unsigned I = 0; I != *NumExpansions; ++I) {
5063 SubstitutedNames.push_back(Out);
5064 FullySubstituted &= !Out.containsUnexpandedParameterPack();
5069 if (RetainExpansion) {
5070 FullySubstituted =
false;
5071 ForgetPartiallySubstitutedPackRAII Forget(
getDerived());
5075 SubstitutedNames.push_back(Out);
5084 return getDerived().RebuildPackIndexingTemplateName(
5085 NewPattern, IndexExpr.
get(), FullySubstituted, SubstitutedNames);
5089 "DeducedTemplateName should not escape partial ordering");
5093 assert(!QualifierLoc &&
"Unexpected qualifier");
5100 assert(!QualifierLoc &&
5101 "Unexpected qualified SubstTemplateTemplateParmPack");
5103 SubstPack->getArgumentPack(), SubstPack->getAssociatedDecl(),
5104 SubstPack->getIndex(), SubstPack->getFinal());
5108 llvm_unreachable(
"overloaded function decl survived to here");
5111template <
typename Derived>
5120template <
typename Derived>
5125 QualifierLoc, TemplateKeywordLoc, Name, NameLoc);
5131template<
typename Derived>
5135 Output =
getSema().getTrivialTemplateArgumentLoc(
5139template <
typename Derived>
5147 llvm_unreachable(
"Unexpected TemplateArgument");
5170 if (NewT ==
T && D == NewD)
5187 llvm_unreachable(
"unexpected template argument kind");
5219 llvm_unreachable(
"Caller should expand pack expansions");
5235 E =
SemaRef.ActOnConstantExpression(E);
5250template<
typename Derived,
typename InputIterator>
5258 typedef typename std::iterator_traits<InputIterator>::difference_type
5273 : Self(Self), Iter(Iter) { }
5288 Self.InventTemplateArgumentLoc(*Iter,
Result);
5296 return X.Iter == Y.Iter;
5301 return X.Iter != Y.Iter;
5305template<
typename Derived>
5306template<
typename InputIterator>
5326 PackLocIterator(*
this, In.getArgument().pack_begin()),
5327 PackLocIterator(*
this, In.getArgument().pack_end()), *PackOutput,
5334 if (In.getArgument().isPackExpansion()) {
5346 std::optional<ForgetSubstitutionRAII> ForgetSubst;
5356 if (Out.getArgument().containsUnexpandedParameterPack()) {
5359 if (Out.getArgument().isNull())
5369 ForgetPartiallySubstitutedPackRAII Forget(
getDerived());
5377 if (Out.getArgument().isNull())
5396template <
typename Derived>
5397template <
typename InputIterator>
5406 return !Arg.isDependent() && Arg.isConceptOrConceptTemplateParameter();
5418 PackLocIterator(*
this, In.getArgument().pack_begin()),
5419 PackLocIterator(*
this, In.getArgument().pack_end()), Outputs,
5425 if (!isNonDependentConceptArgument(In.getArgument())) {
5440template <
typename Derived>
5451 Pattern =
getSema().getTemplateArgumentPackExpansionPattern(
5454 getSema().collectUnexpandedParameterPacks(Pattern, Unexpanded);
5455 if (IsLateExpansionAttempt) {
5460 return P.first.dyn_cast<
const SubstBuiltinTemplatePackType *>();
5462 if (!SawPackTypes) {
5467 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
5475 Info.
Ellipsis, Pattern.getSourceRange(), Unexpanded,
5481 if (ComputeInfo(In,
false, Info, Pattern))
5493 std::optional<Sema::ArgPackSubstIndexRAII> SubstIndex(
5494 std::in_place,
getSema(), std::nullopt);
5500 if (Out.getArgument().isNull())
5537 ForgetSubstitutionRAII ForgetSubst(
getDerived());
5538 if (ComputeInfo(Out,
true, Info, OutPattern))
5551template<
typename Derived>
5569template <
typename Derived>
5589template<
typename Derived>
5592 switch (
T.getTypeLocClass()) {
5593#define ABSTRACT_TYPELOC(CLASS, PARENT)
5594#define TYPELOC(CLASS, PARENT) \
5595 case TypeLoc::CLASS: \
5596 return getDerived().Transform##CLASS##Type(TLB, \
5597 T.castAs<CLASS##TypeLoc>());
5598#include "clang/AST/TypeLocNodes.def"
5601 llvm_unreachable(
"unhandled type loc!");
5604template<
typename Derived>
5617template <
typename Derived>
5655template<
typename Derived>
5660 TypeLoc UnqualTL =
T.getUnqualifiedLoc();
5661 auto SuppressObjCLifetime =
5662 T.getType().getLocalQualifiers().hasObjCLifetime();
5664 Result = getDerived().TransformTemplateTypeParmType(TLB, TTP,
5665 SuppressObjCLifetime);
5666 }
else if (
auto STTP = UnqualTL.
getAs<SubstTemplateTypeParmPackTypeLoc>()) {
5667 Result = getDerived().TransformSubstTemplateTypeParmPackType(
5668 TLB, STTP, SuppressObjCLifetime);
5670 Result = getDerived().TransformType(TLB, UnqualTL);
5689template <
typename Derived>
5699 SemaRef.Diag(Loc, diag::err_address_space_mismatch_templ_inst)
5706 if (
T.getPointerAuth().isPresent()) {
5707 SemaRef.Diag(Loc, diag::err_ptrauth_qualifier_redundant) << TL.
getType();
5710 if (!
T->isDependentType()) {
5711 if (!
T->isSignableType(
SemaRef.getASTContext())) {
5712 SemaRef.Diag(Loc, diag::err_ptrauth_qualifier_invalid_target) <<
T;
5720 if (
T->isFunctionType()) {
5721 T =
SemaRef.getASTContext().getAddrSpaceQualType(
T,
5731 if (
T->isReferenceType()) {
5741 if (!
T->isObjCLifetimeType() && !
T->isDependentType())
5743 else if (
T.getObjCLifetime()) {
5747 const AutoType *AutoTy;
5748 if ((AutoTy = dyn_cast<AutoType>(
T)) && AutoTy->isDeduced()) {
5754 SemaRef.Context.getQualifiedType(
Deduced.getUnqualifiedType(), Qs);
5756 AutoTy->getKeyword(),
5757 AutoTy->getTypeConstraintConcept(),
5758 AutoTy->getTypeConstraintArguments());
5763 SemaRef.Diag(Loc, diag::err_attr_objc_ownership_redundant) <<
T;
5769 return SemaRef.BuildQualifiedType(
T, Loc, Quals);
5772template <
typename Derived>
5773QualType TreeTransform<Derived>::TransformTypeInObjectScope(
5776 assert(!getDerived().AlreadyTransformed(TL.
getType()));
5779 case TypeLoc::TemplateSpecialization:
5780 return getDerived().TransformTemplateSpecializationType(
5782 FirstQualifierInScope,
true);
5783 case TypeLoc::DependentName:
5784 return getDerived().TransformDependentNameType(
5786 ObjectType, FirstQualifierInScope);
5790 return getDerived().TransformType(TLB, TL);
5794template <
class TyLoc>
static inline
5796 TyLoc NewT = TLB.
push<TyLoc>(
T.getType());
5797 NewT.setNameLoc(
T.getNameLoc());
5801template<
typename Derived>
5802QualType TreeTransform<Derived>::TransformBuiltinType(TypeLocBuilder &TLB,
5804 BuiltinTypeLoc NewT = TLB.push<BuiltinTypeLoc>(T.getType());
5805 NewT.setBuiltinLoc(T.getBuiltinLoc());
5806 if (T.needsExtraLocalData())
5807 NewT.getWrittenBuiltinSpecs() = T.getWrittenBuiltinSpecs();
5811template<
typename Derived>
5818template <
typename Derived>
5822 return getDerived().
TransformType(TLB, TL.getOriginalLoc());
5825template<
typename Derived>
5828 QualType OriginalType = getDerived().TransformType(TLB, TL.getOriginalLoc());
5829 if (OriginalType.isNull())
5833 if (getDerived().AlwaysRebuild() ||
5834 OriginalType != TL.getOriginalLoc().getType())
5841template <
typename Derived>
5845 QualType OriginalType = getDerived().TransformType(TLB, TL.getElementLoc());
5846 if (OriginalType.isNull())
5850 if (getDerived().AlwaysRebuild() ||
5851 OriginalType != TL.getElementLoc().getType())
5858template<
typename Derived>
5862 = getDerived().TransformType(TLB, TL.getPointeeLoc());
5863 if (PointeeType.isNull())
5867 if (PointeeType->getAs<ObjCObjectType>()) {
5879 if (getDerived().AlwaysRebuild() ||
5880 PointeeType != TL.getPointeeLoc().getType()) {
5881 Result = getDerived().RebuildPointerType(PointeeType, TL.getSigilLoc());
5888 TLB.TypeWasModifiedSafely(
Result->getPointeeType());
5895template<
typename Derived>
5900 = getDerived().TransformType(TLB, TL.getPointeeLoc());
5901 if (PointeeType.isNull())
5905 if (getDerived().AlwaysRebuild() ||
5906 PointeeType != TL.getPointeeLoc().getType()) {
5907 Result = getDerived().RebuildBlockPointerType(PointeeType,
5922template<
typename Derived>
5930 if (PointeeType.
isNull())
5935 PointeeType !=
T->getPointeeTypeAsWritten()) {
5937 T->isSpelledAsLValue(),
5959template<
typename Derived>
5963 return TransformReferenceType(TLB, TL);
5966template<
typename Derived>
5968TreeTransform<Derived>::TransformRValueReferenceType(TypeLocBuilder &TLB,
5969 RValueReferenceTypeLoc TL) {
5970 return TransformReferenceType(TLB, TL);
5973template<
typename Derived>
5977 QualType PointeeType = getDerived().TransformType(TLB, TL.getPointeeLoc());
5978 if (PointeeType.isNull())
5985 getDerived().TransformNestedNameSpecifierLoc(OldQualifierLoc);
5986 if (!NewQualifierLoc)
5989 CXXRecordDecl *OldCls =
T->getMostRecentCXXRecordDecl(), *NewCls =
nullptr;
5991 NewCls = cast_or_null<CXXRecordDecl>(
5992 getDerived().TransformDecl(TL.getStarLoc(), OldCls));
5998 if (getDerived().AlwaysRebuild() || PointeeType !=
T->getPointeeType() ||
5999 NewQualifierLoc.getNestedNameSpecifier() !=
6000 OldQualifierLoc.getNestedNameSpecifier() ||
6003 SS.
Adopt(NewQualifierLoc);
6004 Result = getDerived().RebuildMemberPointerType(PointeeType, SS, NewCls,
6013 if (MPT && PointeeType != MPT->getPointeeType()) {
6020 NewTL.setQualifierLoc(NewQualifierLoc);
6025template<
typename Derived>
6030 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
6031 if (ElementType.isNull())
6035 Expr *OldSize = TL.getSizeExpr();
6037 OldSize =
const_cast<Expr*
>(
T->getSizeExpr());
6038 Expr *NewSize =
nullptr;
6042 NewSize = getDerived().TransformExpr(OldSize).template getAs<Expr>();
6047 if (getDerived().AlwaysRebuild() ||
6048 ElementType !=
T->getElementType() ||
6049 (
T->getSizeExpr() && NewSize != OldSize)) {
6050 Result = getDerived().RebuildConstantArrayType(ElementType,
6051 T->getSizeModifier(),
6052 T->getSize(), NewSize,
6053 T->getIndexTypeCVRQualifiers(),
6054 TL.getBracketsRange());
6065 NewTL.setRBracketLoc(TL.getRBracketLoc());
6066 NewTL.setSizeExpr(NewSize);
6071template<
typename Derived>
6076 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
6077 if (ElementType.isNull())
6081 if (getDerived().AlwaysRebuild() ||
6082 ElementType !=
T->getElementType()) {
6083 Result = getDerived().RebuildIncompleteArrayType(ElementType,
6084 T->getSizeModifier(),
6085 T->getIndexTypeCVRQualifiers(),
6086 TL.getBracketsRange());
6093 NewTL.setRBracketLoc(TL.getRBracketLoc());
6094 NewTL.setSizeExpr(
nullptr);
6099template<
typename Derived>
6104 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
6105 if (ElementType.isNull())
6112 SizeResult = getDerived().TransformExpr(
T->getSizeExpr());
6114 if (SizeResult.isInvalid())
6118 if (SizeResult.isInvalid())
6124 if (getDerived().AlwaysRebuild() ||
6125 ElementType !=
T->getElementType() ||
6126 Size !=
T->getSizeExpr()) {
6127 Result = getDerived().RebuildVariableArrayType(ElementType,
6128 T->getSizeModifier(),
6130 T->getIndexTypeCVRQualifiers(),
6131 TL.getBracketsRange());
6140 NewTL.setRBracketLoc(TL.getRBracketLoc());
6141 NewTL.setSizeExpr(Size);
6146template<
typename Derived>
6151 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
6152 if (ElementType.isNull())
6160 SemaRef.
ExprEvalContexts.back().InConditionallyConstantEvaluateContext =
true;
6163 Expr *origSize = TL.getSizeExpr();
6164 if (!origSize) origSize =
T->getSizeExpr();
6167 = getDerived().TransformExpr(origSize);
6169 if (sizeResult.isInvalid())
6172 Expr *size = sizeResult.get();
6175 if (getDerived().AlwaysRebuild() ||
6176 ElementType !=
T->getElementType() ||
6178 Result = getDerived().RebuildDependentSizedArrayType(ElementType,
6179 T->getSizeModifier(),
6181 T->getIndexTypeCVRQualifiers(),
6182 TL.getBracketsRange());
6191 NewTL.setRBracketLoc(TL.getRBracketLoc());
6192 NewTL.setSizeExpr(size);
6197template <
typename Derived>
6201 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
6202 if (ElementType.isNull())
6210 if (
Size.isInvalid())
6214 if (getDerived().AlwaysRebuild() || ElementType !=
T->getElementType() ||
6215 Size.get() !=
T->getSizeExpr()) {
6216 Result = getDerived().RebuildDependentVectorType(
6217 ElementType,
Size.get(),
T->getAttributeLoc(),
T->getVectorKind());
6235template<
typename Derived>
6242 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
6243 if (ElementType.isNull())
6252 if (
Size.isInvalid())
6256 if (getDerived().AlwaysRebuild() ||
6257 ElementType !=
T->getElementType() ||
6258 Size.get() !=
T->getSizeExpr()) {
6259 Result = getDerived().RebuildDependentSizedExtVectorType(ElementType,
6261 T->getAttributeLoc());
6279template <
typename Derived>
6284 QualType ElementType = getDerived().TransformType(
T->getElementType());
6285 if (ElementType.isNull())
6289 if (getDerived().AlwaysRebuild() || ElementType !=
T->getElementType()) {
6290 Result = getDerived().RebuildConstantMatrixType(
6291 ElementType,
T->getNumRows(),
T->getNumColumns());
6298 NewTL.setAttrOperandParensRange(TL.getAttrOperandParensRange());
6299 NewTL.setAttrRowOperand(TL.getAttrRowOperand());
6300 NewTL.setAttrColumnOperand(TL.getAttrColumnOperand());
6305template <
typename Derived>
6310 QualType ElementType = getDerived().TransformType(
T->getElementType());
6311 if (ElementType.isNull()) {
6319 Expr *origRows = TL.getAttrRowOperand();
6321 origRows =
T->getRowExpr();
6322 Expr *origColumns = TL.getAttrColumnOperand();
6324 origColumns =
T->getColumnExpr();
6326 ExprResult rowResult = getDerived().TransformExpr(origRows);
6328 if (rowResult.isInvalid())
6331 ExprResult columnResult = getDerived().TransformExpr(origColumns);
6333 if (columnResult.isInvalid())
6336 Expr *rows = rowResult.get();
6337 Expr *columns = columnResult.get();
6340 if (getDerived().AlwaysRebuild() || ElementType !=
T->getElementType() ||
6341 rows != origRows || columns != origColumns) {
6342 Result = getDerived().RebuildDependentSizedMatrixType(
6343 ElementType, rows, columns,
T->getAttributeLoc());
6353 NewTL.setAttrOperandParensRange(TL.getAttrOperandParensRange());
6354 NewTL.setAttrRowOperand(rows);
6355 NewTL.setAttrColumnOperand(columns);
6359template <
typename Derived>
6365 getDerived().TransformType(TLB, TL.getPointeeTypeLoc());
6367 if (pointeeType.isNull())
6374 ExprResult AddrSpace = getDerived().TransformExpr(
T->getAddrSpaceExpr());
6376 if (AddrSpace.isInvalid())
6380 if (getDerived().AlwaysRebuild() || pointeeType !=
T->getPointeeType() ||
6381 AddrSpace.get() !=
T->getAddrSpaceExpr()) {
6382 Result = getDerived().RebuildDependentAddressSpaceType(
6383 pointeeType, AddrSpace.get(),
T->getAttributeLoc());
6394 NewTL.setAttrExprOperand(TL.getAttrExprOperand());
6395 NewTL.setAttrNameLoc(TL.getAttrNameLoc());
6398 TLB.TypeWasModifiedSafely(
Result);
6404template <
typename Derived>
6408 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
6409 if (ElementType.isNull())
6413 if (getDerived().AlwaysRebuild() ||
6414 ElementType !=
T->getElementType()) {
6415 Result = getDerived().RebuildVectorType(ElementType,
T->getNumElements(),
6416 T->getVectorKind());
6427template<
typename Derived>
6431 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
6432 if (ElementType.isNull())
6436 if (getDerived().AlwaysRebuild() ||
6437 ElementType !=
T->getElementType()) {
6438 Result = getDerived().RebuildExtVectorType(ElementType,
6439 T->getNumElements(),
6451template <
typename Derived>
6454 bool ExpectParameterPack) {
6489 if (NewTSI == OldTSI && indexAdjustment == 0)
6499 getDerived().transformedLocalDecl(OldParm, {newParm});
6503template <
typename Derived>
6511 unsigned *LastParamTransformed) {
6512 int indexAdjustment = 0;
6514 unsigned NumParams = Params.size();
6515 for (
unsigned i = 0; i != NumParams; ++i) {
6516 if (LastParamTransformed)
6517 *LastParamTransformed = i;
6519 assert(OldParm->getFunctionScopeIndex() == i);
6523 if (OldParm->isParameterPack()) {
6528 TypeLoc TL = OldParm->getTypeSourceInfo()->getTypeLoc();
6531 SemaRef.collectUnexpandedParameterPacks(Pattern, Unexpanded);
6534 bool ShouldExpand =
false;
6535 bool RetainExpansion =
false;
6537 if (Unexpanded.size() > 0) {
6538 OrigNumExpansions = ExpansionTL.
getTypePtr()->getNumExpansions();
6539 NumExpansions = OrigNumExpansions;
6543 ShouldExpand, RetainExpansion, NumExpansions)) {
6548 const AutoType *AT =
6549 Pattern.getType().getTypePtr()->getContainedAutoType();
6550 assert((AT && (!AT->isDeduced() || AT->getDeducedType().isNull())) &&
6551 "Could not find parameter packs or undeduced auto type!");
6558 getDerived().ExpandingFunctionParameterPack(OldParm);
6559 for (
unsigned I = 0; I != *NumExpansions; ++I) {
6562 =
getDerived().TransformFunctionTypeParam(OldParm,
6570 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6571 OutParamTypes.push_back(NewParm->
getType());
6573 PVars->push_back(NewParm);
6578 if (RetainExpansion) {
6579 ForgetPartiallySubstitutedPackRAII Forget(
getDerived());
6581 =
getDerived().TransformFunctionTypeParam(OldParm,
6589 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6590 OutParamTypes.push_back(NewParm->
getType());
6592 PVars->push_back(NewParm);
6608 NewParm =
getDerived().TransformFunctionTypeParam(OldParm,
6613 "Parameter pack no longer a parameter pack after "
6616 NewParm =
getDerived().TransformFunctionTypeParam(
6617 OldParm, indexAdjustment, std::nullopt,
6625 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6626 OutParamTypes.push_back(NewParm->
getType());
6628 PVars->push_back(NewParm);
6636 bool IsPackExpansion =
false;
6639 if (
const PackExpansionType *Expansion
6640 = dyn_cast<PackExpansionType>(OldType)) {
6642 QualType Pattern = Expansion->getPattern();
6644 getSema().collectUnexpandedParameterPacks(Pattern, Unexpanded);
6647 bool ShouldExpand =
false;
6648 bool RetainExpansion =
false;
6652 RetainExpansion, NumExpansions)) {
6659 for (
unsigned I = 0; I != *NumExpansions; ++I) {
6666 NewType =
getSema().getASTContext().getPackExpansionType(
6667 NewType, std::nullopt);
6674 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6675 OutParamTypes.push_back(NewType);
6677 PVars->push_back(
nullptr);
6686 if (RetainExpansion) {
6687 ForgetPartiallySubstitutedPackRAII Forget(
getDerived());
6693 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6694 OutParamTypes.push_back(NewType);
6696 PVars->push_back(
nullptr);
6701 OldType = Expansion->getPattern();
6702 IsPackExpansion =
true;
6704 NewType =
getDerived().TransformType(OldType);
6706 NewType =
getDerived().TransformType(OldType);
6712 if (IsPackExpansion)
6713 NewType =
getSema().Context.getPackExpansionType(NewType,
6717 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6718 OutParamTypes.push_back(NewType);
6720 PVars->push_back(
nullptr);
6725 for (
unsigned i = 0, e = PVars->size(); i != e; ++i)
6727 assert(parm->getFunctionScopeIndex() == i);
6734template<
typename Derived>
6739 return getDerived().TransformFunctionProtoType(
6743 ExceptionStorage, Changed);
6747template<
typename Derived>
template<
typename Fn>
6766 if (
T->hasTrailingReturn()) {
6770 T->getExtParameterInfosOrNull(),
6771 ParamTypes, &ParamDecls, ExtParamInfos))
6781 auto *RD = dyn_cast<CXXRecordDecl>(
SemaRef.getCurLexicalContext());
6783 SemaRef, !ThisContext && RD ? RD : ThisContext, ThisTypeQuals);
6798 T->getExtParameterInfosOrNull(),
6799 ParamTypes, &ParamDecls, ExtParamInfos))
6805 bool EPIChanged =
false;
6810 if (
auto NewExtParamInfos =
6826 std::optional<FunctionEffectSet> NewFX;
6838 std::optional<FunctionEffectMode> Mode =
6858 "FunctionEffectMode::None shouldn't be possible here");
6861 if (!
SemaRef.diagnoseConflictingFunctionEffect(*NewFX, NewEC,
6864 NewFX->insert(NewEC, Errs);
6865 assert(Errs.empty());
6875 Result =
getDerived().RebuildFunctionProtoType(ResultType, ParamTypes, EPI);
6886 for (
unsigned i = 0, e = NewTL.
getNumParams(); i != e; ++i)
6892template<
typename Derived>
6915 getSema().ActOnNoexceptSpec(NoexceptExpr.
get(), EST);
6930 if (
const PackExpansionType *PackExpansion =
6931 T->getAs<PackExpansionType>()) {
6936 SemaRef.collectUnexpandedParameterPacks(PackExpansion->getPattern(),
6938 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
6943 bool Expand =
false;
6944 bool RetainExpansion =
false;
6945 UnsignedOrNone NumExpansions = PackExpansion->getNumExpansions();
6950 true, Expand, RetainExpansion,
6963 U =
SemaRef.Context.getPackExpansionType(
U, NumExpansions);
6964 Exceptions.push_back(
U);
6970 for (
unsigned ArgIdx = 0; ArgIdx != *NumExpansions; ++ArgIdx) {
6974 if (
U.isNull() ||
SemaRef.CheckSpecifiedExceptionType(
U, Loc))
6977 Exceptions.push_back(
U);
6981 if (
U.isNull() ||
SemaRef.CheckSpecifiedExceptionType(
U, Loc))
6986 Exceptions.push_back(
U);
6996template<
typename Derived>
7006 if (getDerived().AlwaysRebuild() || ResultType !=
T->getReturnType())
7007 Result = getDerived().RebuildFunctionNoProtoType(ResultType);
7018template <
typename Derived>
7019QualType TreeTransform<Derived>::TransformUnresolvedUsingType(
7020 TypeLocBuilder &TLB, UnresolvedUsingTypeLoc TL) {
7022 const UnresolvedUsingType *T = TL.getTypePtr();
7023 bool Changed =
false;
7025 NestedNameSpecifierLoc QualifierLoc = TL.getQualifierLoc();
7026 if (NestedNameSpecifierLoc OldQualifierLoc = QualifierLoc) {
7027 QualifierLoc = getDerived().TransformNestedNameSpecifierLoc(QualifierLoc);
7030 Changed |= QualifierLoc != OldQualifierLoc;
7033 auto *D = getDerived().TransformDecl(TL.getNameLoc(),
T->getDecl());
7039 if (getDerived().AlwaysRebuild() || Changed) {
7040 Result = getDerived().RebuildUnresolvedUsingType(
7041 T->getKeyword(), QualifierLoc.getNestedNameSpecifier(), TL.getNameLoc(),
7049 QualifierLoc, TL.getNameLoc());
7052 QualifierLoc, TL.getNameLoc());
7056template <
typename Derived>
7064 QualifierLoc = getDerived().TransformNestedNameSpecifierLoc(QualifierLoc);
7067 Changed |= QualifierLoc != OldQualifierLoc;
7070 auto *D = cast_or_null<UsingShadowDecl>(
7071 getDerived().TransformDecl(TL.getNameLoc(),
T->getDecl()));
7076 QualType UnderlyingType = getDerived().TransformType(
T->desugar());
7077 if (UnderlyingType.isNull())
7079 Changed |= UnderlyingType !=
T->desugar();
7082 if (getDerived().AlwaysRebuild() || Changed) {
7083 Result = getDerived().RebuildUsingType(
7084 T->getKeyword(), QualifierLoc.getNestedNameSpecifier(), D,
7094template<
typename Derived>
7102 QualifierLoc = getDerived().TransformNestedNameSpecifierLoc(QualifierLoc);
7105 Changed |= QualifierLoc != OldQualifierLoc;
7108 auto *
Typedef = cast_or_null<TypedefNameDecl>(
7109 getDerived().TransformDecl(TL.getNameLoc(),
T->getDecl()));
7117 if (getDerived().AlwaysRebuild() || Changed) {
7118 Result = getDerived().RebuildTypedefType(
7119 T->getKeyword(), QualifierLoc.getNestedNameSpecifier(),
Typedef);
7125 QualifierLoc, TL.getNameLoc());
7129template<
typename Derived>
7137 ExprResult E = getDerived().TransformExpr(TL.getUnderlyingExpr());
7147 if (getDerived().AlwaysRebuild() || E.get() != TL.getUnderlyingExpr()) {
7149 getDerived().RebuildTypeOfExprType(E.get(), TL.getTypeofLoc(), Kind);
7156 NewTL.setLParenLoc(TL.getLParenLoc());
7157 NewTL.setRParenLoc(TL.getRParenLoc());
7162template<
typename Derived>
7166 TypeSourceInfo* New_Under_TI = getDerived().TransformType(Old_Under_TI);
7172 if (getDerived().AlwaysRebuild() || New_Under_TI != Old_Under_TI) {
7173 Result = getDerived().RebuildTypeOfType(New_Under_TI->getType(), Kind);
7180 NewTL.setLParenLoc(TL.getLParenLoc());
7181 NewTL.setRParenLoc(TL.getRParenLoc());
7182 NewTL.setUnmodifiedTInfo(New_Under_TI);
7187template<
typename Derived>
7190 const DecltypeType *
T = TL.getTypePtr();
7197 ExprResult E = getDerived().TransformExpr(
T->getUnderlyingExpr());
7201 E = getSema().ActOnDecltypeExpression(E.get());
7206 if (getDerived().AlwaysRebuild() ||
7207 E.get() !=
T->getUnderlyingExpr()) {
7208 Result = getDerived().RebuildDecltypeType(E.get(), TL.getDecltypeLoc());
7216 NewTL.setRParenLoc(TL.getRParenLoc());
7220template <
typename Derived>
7230 IndexExpr = getDerived().TransformExpr(TL.getIndexExpr());
7231 if (IndexExpr.isInvalid())
7234 QualType Pattern = TL.getPattern();
7236 const PackIndexingType *PIT = TL.getTypePtr();
7240 bool NotYetExpanded = Types.empty();
7241 bool FullySubstituted =
true;
7243 if (Types.empty() && !PIT->expandsToEmptyPack())
7247 if (!
T->containsUnexpandedParameterPack()) {
7248 QualType Transformed = getDerived().TransformType(
T);
7249 if (Transformed.isNull())
7251 SubtitutedTypes.push_back(Transformed);
7256 getSema().collectUnexpandedParameterPacks(
T, Unexpanded);
7257 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
7260 bool ShouldExpand =
true;
7261 bool RetainExpansion =
false;
7263 if (getDerived().TryExpandParameterPacks(
7266 RetainExpansion, NumExpansions))
7268 if (!ShouldExpand) {
7274 QualType Pack = getDerived().TransformType(TLB, TI->getTypeLoc());
7277 if (NotYetExpanded) {
7278 FullySubstituted =
false;
7279 QualType Out = getDerived().RebuildPackIndexingType(
7289 SubtitutedTypes.push_back(Pack);
7292 for (
unsigned I = 0; I != *NumExpansions; ++I) {
7297 SubtitutedTypes.push_back(Out);
7298 FullySubstituted &= !
Out->containsUnexpandedParameterPack();
7302 if (RetainExpansion) {
7303 FullySubstituted =
false;
7304 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
7308 SubtitutedTypes.push_back(Out);
7316 QualType Result = getDerived().TransformType(TLB, TL.getPatternLoc());
7318 QualType Out = getDerived().RebuildPackIndexingType(
7320 FullySubstituted, SubtitutedTypes);
7329template<
typename Derived>
7335 if (
Result->isDependentType()) {
7336 const UnaryTransformType *
T = TL.getTypePtr();
7338 NewBaseTSI = getDerived().TransformType(TL.getUnderlyingTInfo());
7341 QualType NewBase = NewBaseTSI->getType();
7343 Result = getDerived().RebuildUnaryTransformType(NewBase,
7352 NewTL.setParensRange(TL.getParensRange());
7353 NewTL.setUnderlyingTInfo(NewBaseTSI);
7357template<
typename Derived>
7360 const DeducedTemplateSpecializationType *
T = TL.getTypePtr();
7365 TL.getTemplateNameLoc());
7369 QualType OldDeduced =
T->getDeducedType();
7371 if (!OldDeduced.isNull()) {
7372 NewDeduced = getDerived().TransformType(OldDeduced);
7373 if (NewDeduced.isNull())
7377 QualType Result = getDerived().RebuildDeducedTemplateSpecializationType(
7385 NewTL.setTemplateNameLoc(TL.getTemplateNameLoc());
7386 NewTL.setQualifierLoc(QualifierLoc);
7390template <
typename Derived>
7397 QualifierLoc =
getDerived().TransformNestedNameSpecifierLoc(QualifierLoc);
7402 auto *TD = cast_or_null<TagDecl>(
7409 TD !=
T->getDecl()) {
7410 if (
T->isCanonicalUnqualified())
7427template <
typename Derived>
7433template <
typename Derived>
7434QualType TreeTransform<Derived>::TransformRecordType(TypeLocBuilder &TLB,
7436 return getDerived().TransformTagType(TLB, TL);
7439template<
typename Derived>
7446template<
typename Derived>
7450 return getDerived().TransformTemplateTypeParmType(
7455template <
typename Derived>
7461template<
typename Derived>
7462QualType TreeTransform<Derived>::TransformSubstTemplateTypeParmType(
7463 TypeLocBuilder &TLB,
7464 SubstTemplateTypeParmTypeLoc TL) {
7465 const SubstTemplateTypeParmType *T = TL.getTypePtr();
7468 getDerived().TransformDecl(TL.getNameLoc(), T->getAssociatedDecl());
7473 TemporaryBase Rebase(*
this, TL.getNameLoc(), DeclarationName());
7474 QualType Replacement = getDerived().TransformType(T->getReplacementType());
7475 if (Replacement.isNull())
7479 Replacement, NewReplaced, T->getIndex(), T->getPackIndex(),
7483 SubstTemplateTypeParmTypeLoc NewTL
7484 = TLB.push<SubstTemplateTypeParmTypeLoc>(
Result);
7485 NewTL.setNameLoc(TL.getNameLoc());
7489template <
typename Derived>
7495template<
typename Derived>
7499 return getDerived().TransformSubstTemplateTypeParmPackType(
7503template <
typename Derived>
7509template<
typename Derived>
7510QualType TreeTransform<Derived>::TransformAtomicType(TypeLocBuilder &TLB,
7512 QualType ValueType = getDerived().TransformType(TLB, TL.getValueLoc());
7513 if (ValueType.isNull())
7516 QualType
Result = TL.getType();
7517 if (getDerived().AlwaysRebuild() ||
7518 ValueType != TL.getValueLoc().getType()) {
7519 Result = getDerived().RebuildAtomicType(ValueType, TL.getKWLoc());
7526 NewTL.setLParenLoc(TL.getLParenLoc());
7527 NewTL.setRParenLoc(TL.getRParenLoc());
7532template <
typename Derived>
7535 QualType ValueType = getDerived().TransformType(TLB, TL.getValueLoc());
7536 if (ValueType.isNull())
7540 if (getDerived().AlwaysRebuild() || ValueType != TL.getValueLoc().getType()) {
7543 Result = getDerived().RebuildPipeType(ValueType, TL.getKWLoc(), isReadPipe);
7554template <
typename Derived>
7560 if (getDerived().AlwaysRebuild()) {
7561 Result = getDerived().RebuildBitIntType(EIT->isUnsigned(),
7562 EIT->getNumBits(), TL.getNameLoc());
7572template <
typename Derived>
7579 ExprResult BitsExpr = getDerived().TransformExpr(EIT->getNumBitsExpr());
7582 if (BitsExpr.isInvalid())
7587 if (getDerived().AlwaysRebuild() || BitsExpr.get() != EIT->getNumBitsExpr()) {
7588 Result = getDerived().RebuildDependentBitIntType(
7589 EIT->isUnsigned(), BitsExpr.get(), TL.getNameLoc());
7605template <
typename Derived>
7608 llvm_unreachable(
"This type does not need to be transformed.");
7616 template<
typename ArgLocContainer>
7618 ArgLocContainer *Container;
7643 : Container(&Container), Index(Index) { }
7657 return Container->getArgLoc(Index);
7661 return pointer(Container->getArgLoc(Index));
7666 return X.Container == Y.Container &&
X.Index == Y.Index;
7675template<
typename Derived>
7676QualType TreeTransform<Derived>::TransformAutoType(TypeLocBuilder &TLB,
7678 const AutoType *T = TL.getTypePtr();
7679 QualType OldDeduced = T->getDeducedType();
7680 QualType NewDeduced;
7681 if (!OldDeduced.isNull()) {
7682 NewDeduced = getDerived().TransformType(OldDeduced);
7683 if (NewDeduced.isNull())
7690 if (
T->isConstrained()) {
7691 assert(TL.getConceptReference());
7692 NewCD = getDerived().TransformConceptTemplateName(
7693 T->getTypeConstraintConcept(), TL.getConceptNameLoc());
7697 NewTemplateArgs.setLAngleLoc(TL.getLAngleLoc());
7698 NewTemplateArgs.setRAngleLoc(TL.getRAngleLoc());
7700 if (getDerived().TransformTemplateArguments(
7701 ArgIterator(TL, 0), ArgIterator(TL, TL.getNumArgs()),
7705 if (TL.getNestedNameSpecifierLoc()) {
7707 = getDerived().TransformNestedNameSpecifierLoc(
7708 TL.getNestedNameSpecifierLoc());
7709 if (!NewNestedNameSpec)
7715 if (getDerived().AlwaysRebuild() || NewDeduced != OldDeduced ||
7716 T->isDependentType() ||
T->isConstrained()) {
7719 NewArgList.reserve(NewTemplateArgs.size());
7720 for (
const auto &ArgLoc : NewTemplateArgs.arguments())
7721 NewArgList.push_back(ArgLoc.getArgument());
7722 Result = getDerived().RebuildAutoType(
7724 NewDeduced,
T->getKeyword(), NewCD, NewArgList);
7731 NewTL.setRParenLoc(TL.getRParenLoc());
7732 NewTL.setConceptReference(
nullptr);
7734 if (
T->isConstrained()) {
7738 TL.getConceptNameLoc())
7743 SemaRef.
Context, NewNestedNameSpec, TL.getTemplateKWLoc(), DNI,
7744 TL.getFoundDecl(), TL.getTypePtr()->getTypeConstraintConcept(),
7746 NewTL.setConceptReference(CR);
7752template <
typename Derived>
7755 return getDerived().TransformTemplateSpecializationType(
7760template <
typename Derived>
7763 NamedDecl *FirstQualifierInScope,
bool AllowInjectedClassName) {
7764 const TemplateSpecializationType *
T = TL.
getTypePtr();
7770 AllowInjectedClassName);
7779 if (getDerived().TransformTemplateArguments(ArgIterator(TL, 0),
7788 QualType Result = getDerived().RebuildTemplateSpecializationType(
7801template <
typename Derived>
7805 QualType modifiedType = getDerived().TransformType(TLB, TL.getModifiedLoc());
7806 if (modifiedType.isNull())
7813 oldType->getAttrKind(), modifiedType,
7814 TL.getAttr() ? TL.getAttr()->getLocation()
7815 : TL.getModifiedLoc().getBeginLoc()))
7819 const Attr *oldAttr = TL.getAttr();
7820 const Attr *newAttr = oldAttr ? getDerived().TransformAttr(oldAttr) :
nullptr;
7821 if (oldAttr && !newAttr)
7827 if (getDerived().AlwaysRebuild() ||
7828 modifiedType != oldType->getModifiedType()) {
7841 QualType equivalentType = modifiedType;
7842 if (TL.getModifiedLoc().getType() != TL.getEquivalentTypeLoc().getType()) {
7844 AuxiliaryTLB.
reserve(TL.getFullDataSize());
7846 getDerived().TransformType(AuxiliaryTLB, TL.getEquivalentTypeLoc());
7847 if (equivalentType.isNull())
7853 if (
auto nullability = oldType->getImmediateNullability()) {
7854 if (!modifiedType->canHaveNullability()) {
7855 SemaRef.
Diag((TL.getAttr() ? TL.getAttr()->getLocation()
7856 : TL.getModifiedLoc().getBeginLoc()),
7857 diag::err_nullability_nonpointer)
7874template <
typename Derived>
7878 QualType InnerTy = getDerived().TransformType(TLB, TL.getInnerLoc());
7879 if (InnerTy.isNull())
7882 Expr *OldCount = TL.getCountExpr();
7883 Expr *NewCount =
nullptr;
7885 ExprResult CountResult = getDerived().TransformExpr(OldCount);
7886 if (CountResult.isInvalid())
7888 NewCount = CountResult.get();
7892 if (getDerived().AlwaysRebuild() || InnerTy != OldTy->desugar() ||
7893 OldCount != NewCount) {
7896 InnerTy, NewCount, OldTy->isCountInBytes(), OldTy->isOrNull());
7903template <
typename Derived>
7908 QualType InnerTy = getDerived().TransformType(TLB, TL.getInnerLoc());
7909 if (InnerTy.isNull())
7913 if (getDerived().AlwaysRebuild() || InnerTy != OldTy->getWrappedType()) {
7915 InnerTy, OldTy->getLateParsedAttribute());
7923template <
typename Derived>
7927 llvm_unreachable(
"Unexpected TreeTransform for BTFTagAttributedType");
7930template <
typename Derived>
7933 const OverflowBehaviorType *OldTy = TL.getTypePtr();
7934 QualType InnerTy = getDerived().TransformType(TLB, TL.getWrappedLoc());
7935 if (InnerTy.isNull())
7939 if (getDerived().AlwaysRebuild() || InnerTy != OldTy->getUnderlyingType()) {
7951template <
typename Derived>
7955 const HLSLAttributedResourceType *oldType = TL.getTypePtr();
7957 QualType WrappedTy = getDerived().TransformType(TLB, TL.getWrappedLoc());
7958 if (WrappedTy.isNull())
7962 QualType OldContainedTy = oldType->getContainedType();
7964 if (!OldContainedTy.isNull()) {
7965 TypeSourceInfo *oldContainedTSI = TL.getContainedTypeSourceInfo();
7966 if (!oldContainedTSI)
7967 oldContainedTSI = getSema().getASTContext().getTrivialTypeSourceInfo(
7969 ContainedTSI = getDerived().TransformType(oldContainedTSI);
7972 ContainedTy = ContainedTSI->getType();
7975 HLSLAttributedResourceType::Attributes Attrs = oldType->getAttrs();
7976 if (Attrs.SampleCountExpr) {
7978 getDerived().TransformExpr(Attrs.SampleCountExpr);
7979 if (SampleCountResult.isInvalid())
7981 Attrs.SampleCountExpr = SampleCountResult.get();
7985 if (getDerived().AlwaysRebuild() || WrappedTy != oldType->getWrappedType() ||
7986 ContainedTy != oldType->getContainedType() ||
7987 Attrs.SampleCountExpr != oldType->getSampleCountExpr()) {
7989 ContainedTy, Attrs);
7995 NewTL.setContainedTypeSourceInfo(ContainedTSI);
7999template <
typename Derived>
8003 return TL.getType();
8006template<
typename Derived>
8010 QualType Inner = getDerived().TransformType(TLB, TL.getInnerLoc());
8015 if (getDerived().AlwaysRebuild() ||
8016 Inner != TL.getInnerLoc().getType()) {
8017 Result = getDerived().RebuildParenType(Inner);
8024 NewTL.setRParenLoc(TL.getRParenLoc());
8028template <
typename Derived>
8032 QualType Inner = getDerived().TransformType(TLB, TL.getInnerLoc());
8037 if (getDerived().AlwaysRebuild() || Inner != TL.getInnerLoc().getType()) {
8039 getDerived().RebuildMacroQualifiedType(Inner, TL.getMacroIdentifier());
8049template<
typename Derived>
8050QualType TreeTransform<Derived>::TransformDependentNameType(
8052 return TransformDependentNameType(TLB, TL,
false);
8055template <
typename Derived>
8056QualType TreeTransform<Derived>::TransformDependentNameType(
8059 const DependentNameType *
T = TL.getTypePtr();
8063 QualifierLoc = getDerived().TransformNestedNameSpecifierLoc(
8064 QualifierLoc, ObjectType, UnqualLookup);
8068 assert((ObjectType.isNull() && !UnqualLookup) &&
8069 "must be transformed by TransformNestedNameSpecifierLoc");
8073 = getDerived().RebuildDependentNameType(
T->getKeyword(),
8074 TL.getElaboratedKeywordLoc(),
8085 NewTL.setQualifierLoc(QualifierLoc);
8086 NewTL.setNameLoc(TL.getNameLoc());
8090 NewTL.setTemplateNameLoc(TL.getNameLoc());
8091 NewTL.setQualifierLoc(QualifierLoc);
8094 QualifierLoc, TL.getNameLoc());
8097 NewTL.
set(TL.getElaboratedKeywordLoc(), QualifierLoc, TL.getNameLoc());
8101 NewTL.setQualifierLoc(QualifierLoc);
8102 NewTL.setNameLoc(TL.getNameLoc());
8107template<
typename Derived>
8111 = getDerived().TransformType(TLB, TL.getPatternLoc());
8112 if (Pattern.isNull())
8116 if (getDerived().AlwaysRebuild() ||
8117 Pattern != TL.getPatternLoc().getType()) {
8118 Result = getDerived().RebuildPackExpansionType(Pattern,
8119 TL.getPatternLoc().getSourceRange(),
8120 TL.getEllipsisLoc(),
8121 TL.getTypePtr()->getNumExpansions());
8131template<
typename Derived>
8136 TLB.pushFullCopy(TL);
8137 return TL.getType();
8140template<
typename Derived>
8144 const ObjCTypeParamType *
T = TL.getTypePtr();
8146 getDerived().TransformDecl(
T->getDecl()->getLocation(),
T->getDecl()));
8151 if (getDerived().AlwaysRebuild() ||
8152 OTP !=
T->getDecl()) {
8153 Result = getDerived().RebuildObjCTypeParamType(
8154 OTP, TL.getProtocolLAngleLoc(),
8155 llvm::ArrayRef(TL.getTypePtr()->qual_begin(), TL.getNumProtocols()),
8156 TL.getProtocolLocs(), TL.getProtocolRAngleLoc());
8162 if (TL.getNumProtocols()) {
8163 NewTL.setProtocolLAngleLoc(TL.getProtocolLAngleLoc());
8164 for (
unsigned i = 0, n = TL.getNumProtocols(); i != n; ++i)
8165 NewTL.setProtocolLoc(i, TL.getProtocolLoc(i));
8166 NewTL.setProtocolRAngleLoc(TL.getProtocolRAngleLoc());
8171template<
typename Derived>
8176 QualType BaseType = getDerived().TransformType(TLB, TL.getBaseLoc());
8177 if (BaseType.isNull())
8180 bool AnyChanged = BaseType != TL.getBaseLoc().getType();
8184 for (
unsigned i = 0, n = TL.getNumTypeArgs(); i != n; ++i) {
8186 TypeLoc TypeArgLoc = TypeArgInfo->getTypeLoc();
8187 QualType TypeArg = TypeArgInfo->getType();
8192 const auto *PackExpansion = PackExpansionLoc.getType()
8193 ->castAs<PackExpansionType>();
8197 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
8201 TypeLoc PatternLoc = PackExpansionLoc.getPatternLoc();
8202 bool Expand =
false;
8203 bool RetainExpansion =
false;
8204 UnsignedOrNone NumExpansions = PackExpansion->getNumExpansions();
8205 if (getDerived().TryExpandParameterPacks(
8206 PackExpansionLoc.getEllipsisLoc(), PatternLoc.getSourceRange(),
8207 Unexpanded,
true, Expand,
8208 RetainExpansion, NumExpansions))
8218 TypeArgBuilder.
reserve(PatternLoc.getFullDataSize());
8219 QualType NewPatternType = getDerived().TransformType(TypeArgBuilder,
8221 if (NewPatternType.isNull())
8225 NewPatternType, NumExpansions);
8227 NewExpansionLoc.
setEllipsisLoc(PackExpansionLoc.getEllipsisLoc());
8228 NewTypeArgInfos.push_back(
8229 TypeArgBuilder.getTypeSourceInfo(SemaRef.
Context, NewExpansionType));
8235 for (
unsigned ArgIdx = 0; ArgIdx != *NumExpansions; ++ArgIdx) {
8239 TypeArgBuilder.
reserve(PatternLoc.getFullDataSize());
8241 QualType NewTypeArg = getDerived().TransformType(TypeArgBuilder,
8243 if (NewTypeArg.isNull())
8246 NewTypeArgInfos.push_back(
8247 TypeArgBuilder.getTypeSourceInfo(SemaRef.
Context, NewTypeArg));
8254 TypeArgBuilder.
reserve(TypeArgLoc.getFullDataSize());
8256 getDerived().TransformType(TypeArgBuilder, TypeArgLoc);
8257 if (NewTypeArg.isNull())
8261 if (NewTypeArg == TypeArg) {
8262 NewTypeArgInfos.push_back(TypeArgInfo);
8266 NewTypeArgInfos.push_back(
8267 TypeArgBuilder.getTypeSourceInfo(SemaRef.
Context, NewTypeArg));
8272 if (getDerived().AlwaysRebuild() || AnyChanged) {
8274 Result = getDerived().RebuildObjCObjectType(
8275 BaseType, TL.getBeginLoc(), TL.getTypeArgsLAngleLoc(), NewTypeArgInfos,
8276 TL.getTypeArgsRAngleLoc(), TL.getProtocolLAngleLoc(),
8277 llvm::ArrayRef(TL.getTypePtr()->qual_begin(), TL.getNumProtocols()),
8278 TL.getProtocolLocs(), TL.getProtocolRAngleLoc());
8286 NewT.setTypeArgsLAngleLoc(TL.getTypeArgsLAngleLoc());
8287 for (
unsigned i = 0, n = TL.getNumTypeArgs(); i != n; ++i)
8288 NewT.setTypeArgTInfo(i, NewTypeArgInfos[i]);
8289 NewT.setTypeArgsRAngleLoc(TL.getTypeArgsRAngleLoc());
8290 NewT.setProtocolLAngleLoc(TL.getProtocolLAngleLoc());
8291 for (
unsigned i = 0, n = TL.getNumProtocols(); i != n; ++i)
8292 NewT.setProtocolLoc(i, TL.getProtocolLoc(i));
8293 NewT.setProtocolRAngleLoc(TL.getProtocolRAngleLoc());
8297template<
typename Derived>
8301 QualType PointeeType = getDerived().TransformType(TLB, TL.getPointeeLoc());
8302 if (PointeeType.isNull())
8306 if (getDerived().AlwaysRebuild() ||
8307 PointeeType != TL.getPointeeLoc().getType()) {
8308 Result = getDerived().RebuildObjCObjectPointerType(PointeeType,
8322template<
typename Derived>
8328template<
typename Derived>
8331 return getDerived().TransformCompoundStmt(S,
false);
8334template<
typename Derived>
8341 getSema().resetFPOptions(
8344 bool SubStmtInvalid =
false;
8345 bool SubStmtChanged =
false;
8347 for (
auto *B : S->
body()) {
8349 B, IsStmtExpr && B == S->
body_back() ? StmtDiscardKind::StmtExprResult
8350 : StmtDiscardKind::Discarded);
8352 if (
Result.isInvalid()) {
8359 SubStmtInvalid =
true;
8363 SubStmtChanged = SubStmtChanged ||
Result.get() != B;
8364 Statements.push_back(
Result.getAs<Stmt>());
8370 if (!getDerived().AlwaysRebuild() &&
8374 return getDerived().RebuildCompoundStmt(S->
getLBracLoc(),
8380template<
typename Derived>
8389 LHS = getDerived().TransformExpr(S->getLHS());
8391 if (LHS.isInvalid())
8395 RHS = getDerived().TransformExpr(S->getRHS());
8397 if (RHS.isInvalid())
8404 StmtResult Case = getDerived().RebuildCaseStmt(S->getCaseLoc(),
8406 S->getEllipsisLoc(),
8409 if (Case.isInvalid())
8414 getDerived().TransformStmt(S->getSubStmt());
8415 if (SubStmt.isInvalid())
8419 return getDerived().RebuildCaseStmtBody(Case.get(), SubStmt.get());
8422template <
typename Derived>
8426 getDerived().TransformStmt(S->getSubStmt());
8427 if (SubStmt.isInvalid())
8431 return getDerived().RebuildDefaultStmt(S->getDefaultLoc(), S->getColonLoc(),
8435template<
typename Derived>
8438 StmtResult SubStmt = getDerived().TransformStmt(S->getSubStmt(), SDK);
8439 if (SubStmt.isInvalid())
8442 Decl *LD = getDerived().TransformDecl(S->getDecl()->getLocation(),
8450 if (LD == S->getDecl())
8451 S->getDecl()->setStmt(
nullptr);
8454 return getDerived().RebuildLabelStmt(S->getIdentLoc(),
8459template <
typename Derived>
8464 switch (R->getKind()) {
8468 return getDerived().Transform##X##Attr(cast<X##Attr>(R));
8469#include "clang/Basic/AttrList.inc"
8474template <
typename Derived>
8481 switch (R->getKind()) {
8485 return getDerived().TransformStmt##X##Attr(OrigS, InstS, cast<X##Attr>(R));
8486#include "clang/Basic/AttrList.inc"
8491template <
typename Derived>
8494 StmtDiscardKind SDK) {
8499 bool AttrsChanged =
false;
8503 for (
const auto *I : S->
getAttrs()) {
8505 getDerived().TransformStmtAttr(S->
getSubStmt(), SubStmt.
get(), I);
8506 AttrsChanged |= (I != R);
8519 return getDerived().RebuildAttributedStmt(S->
getAttrLoc(), Attrs,
8523template<
typename Derived>
8528 if (
Init.isInvalid())
8532 if (!S->isConsteval()) {
8534 Cond = getDerived().TransformCondition(
8535 S->getIfLoc(), S->getConditionVariable(), S->getCond(),
8538 if (Cond.isInvalid())
8543 std::optional<bool> ConstexprConditionValue;
8544 if (S->isConstexpr())
8549 if (!ConstexprConditionValue || *ConstexprConditionValue) {
8553 S->isNonNegatedConsteval());
8555 Then = getDerived().TransformStmt(S->getThen());
8556 if (Then.isInvalid())
8562 Then =
new (getSema().Context)
8563 CompoundStmt(S->getThen()->getBeginLoc(), S->getThen()->getEndLoc());
8568 if (!ConstexprConditionValue || !*ConstexprConditionValue) {
8572 S->isNegatedConsteval());
8574 Else = getDerived().TransformStmt(S->getElse());
8575 if (Else.isInvalid())
8577 }
else if (S->getElse() && ConstexprConditionValue &&
8578 *ConstexprConditionValue) {
8582 Else =
new (getSema().Context)
8583 CompoundStmt(S->getElse()->getBeginLoc(), S->getElse()->getEndLoc());
8586 if (!getDerived().AlwaysRebuild() &&
8587 Init.get() == S->getInit() &&
8588 Cond.get() == std::make_pair(S->getConditionVariable(), S->getCond()) &&
8589 Then.get() == S->getThen() &&
8590 Else.get() == S->getElse())
8593 return getDerived().RebuildIfStmt(
8594 S->getIfLoc(), S->getStatementKind(), S->getLParenLoc(), Cond,
8595 S->getRParenLoc(),
Init.get(), Then.get(), S->getElseLoc(), Else.get());
8598template<
typename Derived>
8603 if (
Init.isInvalid())
8608 S->getSwitchLoc(), S->getConditionVariable(), S->getCond(),
8610 if (Cond.isInvalid())
8615 getDerived().RebuildSwitchStmtStart(S->getSwitchLoc(), S->getLParenLoc(),
8616 Init.get(), Cond, S->getRParenLoc());
8621 StmtResult Body = getDerived().TransformStmt(S->getBody());
8624 return getDerived().RebuildSwitchStmtBody(S->getSwitchLoc(),
Switch.get(),
8628template<
typename Derived>
8633 S->getWhileLoc(), S->getConditionVariable(), S->getCond(),
8635 if (Cond.isInvalid())
8644 StmtResult Body = getDerived().TransformStmt(S->getBody());
8645 if (Body.isInvalid())
8648 if (!getDerived().AlwaysRebuild() &&
8649 Cond.get() == std::make_pair(S->getConditionVariable(), S->getCond()) &&
8650 Body.get() == S->getBody())
8653 return getDerived().RebuildWhileStmt(S->getWhileLoc(), S->getLParenLoc(),
8654 Cond, S->getRParenLoc(), Body.get());
8657template<
typename Derived>
8666 StmtResult Body = getDerived().TransformStmt(S->getBody());
8667 if (Body.isInvalid())
8671 ExprResult Cond = getDerived().TransformExpr(S->getCond());
8672 if (Cond.isInvalid())
8675 if (!getDerived().AlwaysRebuild() &&
8676 Cond.get() == S->getCond() &&
8677 Body.get() == S->getBody())
8680 return getDerived().RebuildDoStmt(S->getDoLoc(), Body.get(), S->getWhileLoc(),
8681 S->getWhileLoc(), Cond.get(),
8685template<
typename Derived>
8688 if (getSema().getLangOpts().getOpenMPVersion())
8689 getSema().OpenMP().startOpenMPLoop();
8693 if (
Init.isInvalid())
8698 if (getSema().getLangOpts().getOpenMPVersion() &&
Init.isUsable())
8699 getSema().OpenMP().ActOnOpenMPLoopInitialization(S->getForLoc(),
8704 S->getForLoc(), S->getConditionVariable(), S->getCond(),
8706 if (Cond.isInvalid())
8711 if (
Inc.isInvalid())
8715 if (S->getInc() && !FullInc.get())
8722 S->getBeginLoc(), S->getInit(),
Init.get(), S->getCond(),
8723 Cond.get().second, S->getInc(),
Inc.get());
8726 StmtResult Body = getDerived().TransformStmt(S->getBody());
8727 if (Body.isInvalid())
8732 if (!getDerived().AlwaysRebuild() &&
8733 Init.get() == S->getInit() &&
8734 Cond.get() == std::make_pair(S->getConditionVariable(), S->getCond()) &&
8735 Inc.get() == S->getInc() &&
8736 Body.get() == S->getBody())
8739 return getDerived().RebuildForStmt(S->getForLoc(), S->getLParenLoc(),
8740 Init.get(), Cond, FullInc,
8741 S->getRParenLoc(), Body.get());
8744template<
typename Derived>
8747 Decl *LD = getDerived().TransformDecl(S->getLabel()->getLocation(),
8753 return getDerived().RebuildGotoStmt(S->getGotoLoc(), S->getLabelLoc(),
8757template<
typename Derived>
8765 if (!getDerived().AlwaysRebuild() &&
8766 Target.get() == S->getTarget())
8769 return getDerived().RebuildIndirectGotoStmt(S->getGotoLoc(), S->getStarLoc(),
8773template<
typename Derived>
8776 if (!S->hasLabelTarget())
8779 Decl *LD = getDerived().TransformDecl(S->getLabelDecl()->getLocation(),
8788template<
typename Derived>
8791 if (!S->hasLabelTarget())
8794 Decl *LD = getDerived().TransformDecl(S->getLabelDecl()->getLocation(),
8803template <
typename Derived>
8811template<
typename Derived>
8821 return getDerived().RebuildReturnStmt(S->getReturnLoc(),
Result.get());
8824template<
typename Derived>
8827 bool DeclChanged =
false;
8830 for (
auto *D : S->decls()) {
8831 Decl *Transformed = getDerived().TransformDefinition(D->getLocation(), D);
8835 if (Transformed != D)
8839 if (
auto *TD = dyn_cast<TypeDecl>(Transformed)) {
8840 if (
auto *TN = dyn_cast<TypedefNameDecl>(TD)) {
8841 LSI->ContainsUnexpandedParameterPack |=
8842 TN->getUnderlyingType()->containsUnexpandedParameterPack();
8844 LSI->ContainsUnexpandedParameterPack |=
8847 .getTypeDeclType(TD)
8848 ->containsUnexpandedParameterPack();
8851 if (
auto *VD = dyn_cast<VarDecl>(Transformed))
8852 LSI->ContainsUnexpandedParameterPack |=
8853 VD->getType()->containsUnexpandedParameterPack();
8856 Decls.push_back(Transformed);
8859 if (!getDerived().AlwaysRebuild() && !DeclChanged)
8862 return getDerived().RebuildDeclStmt(Decls, S->getBeginLoc(), S->getEndLoc());
8865template<
typename Derived>
8875 bool ExprsChanged =
false;
8877 auto RebuildString = [&](
Expr *E) {
8882 ExprsChanged =
true;
8889 for (
unsigned I = 0, E = S->getNumOutputs(); I != E; ++I) {
8890 Names.push_back(S->getOutputIdentifier(I));
8896 Constraints.push_back(
Result.get());
8899 Expr *OutputExpr = S->getOutputExpr(I);
8900 Result = getDerived().TransformExpr(OutputExpr);
8904 ExprsChanged |=
Result.get() != OutputExpr;
8906 Exprs.push_back(
Result.get());
8910 for (
unsigned I = 0, E = S->getNumInputs(); I != E; ++I) {
8911 Names.push_back(S->getInputIdentifier(I));
8917 Constraints.push_back(
Result.get());
8920 Expr *InputExpr = S->getInputExpr(I);
8921 Result = getDerived().TransformExpr(InputExpr);
8925 ExprsChanged |=
Result.get() != InputExpr;
8927 Exprs.push_back(
Result.get());
8931 for (
unsigned I = 0, E = S->getNumLabels(); I != E; ++I) {
8932 Names.push_back(S->getLabelIdentifier(I));
8937 ExprsChanged |=
Result.get() != S->getLabelExpr(I);
8938 Exprs.push_back(
Result.get());
8942 for (
unsigned I = 0, E = S->getNumClobbers(); I != E; ++I) {
8946 Clobbers.push_back(
Result.get());
8949 ExprResult AsmString = RebuildString(S->getAsmStringExpr());
8950 if (AsmString.isInvalid())
8953 if (!getDerived().AlwaysRebuild() && !ExprsChanged)
8956 return getDerived().RebuildGCCAsmStmt(S->getAsmLoc(), S->isSimple(),
8957 S->isVolatile(), S->getNumOutputs(),
8958 S->getNumInputs(), Names.data(),
8959 Constraints, Exprs, AsmString.get(),
8960 Clobbers, S->getNumLabels(),
8964template<
typename Derived>
8969 bool HadError =
false, HadChange =
false;
8973 TransformedExprs.reserve(SrcExprs.size());
8974 for (
unsigned i = 0, e = SrcExprs.size(); i != e; ++i) {
8976 if (!
Result.isUsable()) {
8979 HadChange |= (
Result.get() != SrcExprs[i]);
8980 TransformedExprs.push_back(
Result.get());
8985 if (!HadChange && !getDerived().AlwaysRebuild())
8988 return getDerived().RebuildMSAsmStmt(S->getAsmLoc(), S->getLBraceLoc(),
8989 AsmToks, S->getAsmString(),
8990 S->getNumOutputs(), S->getNumInputs(),
8991 S->getAllConstraints(), S->getClobbers(),
8992 TransformedExprs, S->getEndLoc());
8996template<
typename Derived>
9001 assert(FD && ScopeInfo && !ScopeInfo->CoroutinePromise &&
9002 ScopeInfo->NeedsCoroutineSuspends &&
9003 ScopeInfo->CoroutineSuspends.first ==
nullptr &&
9004 ScopeInfo->CoroutineSuspends.second ==
nullptr &&
9005 "expected clean scope info");
9009 ScopeInfo->setNeedsCoroutineSuspends(
false);
9022 getDerived().transformedLocalDecl(S->getPromiseDecl(), {Promise});
9023 ScopeInfo->CoroutinePromise = Promise;
9028 StmtResult InitSuspend = getDerived().TransformStmt(S->getInitSuspendStmt());
9029 if (InitSuspend.isInvalid())
9032 getDerived().TransformStmt(S->getFinalSuspendStmt());
9033 if (FinalSuspend.isInvalid() ||
9036 ScopeInfo->setCoroutineSuspends(InitSuspend.get(), FinalSuspend.get());
9039 StmtResult BodyRes = getDerived().TransformStmt(S->getBody());
9040 if (BodyRes.isInvalid())
9044 if (Builder.isInvalid())
9047 Expr *ReturnObject = S->getReturnValueInit();
9048 assert(ReturnObject &&
"the return object is expected to be valid");
9049 ExprResult Res = getDerived().TransformInitializer(ReturnObject,
9051 if (Res.isInvalid())
9053 Builder.ReturnValue = Res.get();
9058 if (S->hasDependentPromiseType()) {
9061 if (!Promise->getType()->isDependentType()) {
9062 assert(!S->getFallthroughHandler() && !S->getExceptionHandler() &&
9063 !S->getReturnStmtOnAllocFailure() && !S->getDeallocate() &&
9064 "these nodes should not have been built yet");
9065 if (!Builder.buildDependentStatements())
9069 if (
auto *OnFallthrough = S->getFallthroughHandler()) {
9070 StmtResult Res = getDerived().TransformStmt(OnFallthrough);
9071 if (Res.isInvalid())
9073 Builder.OnFallthrough = Res.get();
9076 if (
auto *OnException = S->getExceptionHandler()) {
9077 StmtResult Res = getDerived().TransformStmt(OnException);
9078 if (Res.isInvalid())
9080 Builder.OnException = Res.get();
9083 if (
auto *OnAllocFailure = S->getReturnStmtOnAllocFailure()) {
9084 StmtResult Res = getDerived().TransformStmt(OnAllocFailure);
9085 if (Res.isInvalid())
9087 Builder.ReturnStmtOnAllocFailure = Res.get();
9091 assert(S->getAllocate() && S->getDeallocate() &&
9092 "allocation and deallocation calls must already be built");
9093 ExprResult AllocRes = getDerived().TransformExpr(S->getAllocate());
9094 if (AllocRes.isInvalid())
9096 Builder.Allocate = AllocRes.get();
9098 ExprResult DeallocRes = getDerived().TransformExpr(S->getDeallocate());
9099 if (DeallocRes.isInvalid())
9101 Builder.Deallocate = DeallocRes.get();
9103 if (
auto *ResultDecl = S->getResultDecl()) {
9104 StmtResult Res = getDerived().TransformStmt(ResultDecl);
9105 if (Res.isInvalid())
9107 Builder.ResultDecl = Res.get();
9112 if (Res.isInvalid())
9114 Builder.ReturnStmt = Res.get();
9118 return getDerived().RebuildCoroutineBodyStmt(Builder);
9121template<
typename Derived>
9131 return getDerived().RebuildCoreturnStmt(S->getKeywordLoc(),
Result.get(),
9135template <
typename Derived>
9148 ExprResult Lookup = getSema().BuildOperatorCoawaitLookupExpr(
9149 getSema().getCurScope(), E->getKeywordLoc());
9153 return getDerived().RebuildCoawaitExpr(
9154 E->getKeywordLoc(),
Operand.get(),
9158template <
typename Derived>
9161 ExprResult OperandResult = getDerived().TransformInitializer(E->getOperand(),
9163 if (OperandResult.isInvalid())
9167 E->getOperatorCoawaitLookup());
9174 return getDerived().RebuildDependentCoawaitExpr(
9175 E->getKeywordLoc(), OperandResult.get(),
9179template<
typename Derived>
9189 return getDerived().RebuildCoyieldExpr(E->getKeywordLoc(),
Result.get());
9194template<
typename Derived>
9198 StmtResult TryBody = getDerived().TransformStmt(S->getTryBody());
9199 if (TryBody.isInvalid())
9203 bool AnyCatchChanged =
false;
9205 for (
unsigned I = 0, N = S->getNumCatchStmts(); I != N; ++I) {
9206 StmtResult Catch = getDerived().TransformStmt(S->getCatchStmt(I));
9207 if (Catch.isInvalid())
9209 if (Catch.get() != S->getCatchStmt(I))
9210 AnyCatchChanged =
true;
9211 CatchStmts.push_back(Catch.get());
9216 if (S->getFinallyStmt()) {
9217 Finally = getDerived().TransformStmt(S->getFinallyStmt());
9218 if (Finally.isInvalid())
9223 if (!getDerived().AlwaysRebuild() &&
9224 TryBody.get() == S->getTryBody() &&
9226 Finally.get() == S->getFinallyStmt())
9230 return getDerived().RebuildObjCAtTryStmt(S->getAtTryLoc(), TryBody.get(),
9231 CatchStmts, Finally.get());
9234template<
typename Derived>
9239 if (
VarDecl *FromVar = S->getCatchParamDecl()) {
9241 if (FromVar->getTypeSourceInfo()) {
9242 TSInfo = getDerived().TransformType(FromVar->getTypeSourceInfo());
9249 T = TSInfo->getType();
9251 T = getDerived().TransformType(FromVar->getType());
9256 Var = getDerived().RebuildObjCExceptionDecl(FromVar, TSInfo,
T);
9261 StmtResult Body = getDerived().TransformStmt(S->getCatchBody());
9262 if (Body.isInvalid())
9265 return getDerived().RebuildObjCAtCatchStmt(S->getAtCatchLoc(),
9270template<
typename Derived>
9274 StmtResult Body = getDerived().TransformStmt(S->getFinallyBody());
9275 if (Body.isInvalid())
9279 if (!getDerived().AlwaysRebuild() &&
9280 Body.get() == S->getFinallyBody())
9284 return getDerived().RebuildObjCAtFinallyStmt(S->getAtFinallyLoc(),
9288template<
typename Derived>
9292 if (S->getThrowExpr()) {
9293 Operand = getDerived().TransformExpr(S->getThrowExpr());
9298 if (!getDerived().AlwaysRebuild() &&
9299 Operand.get() == S->getThrowExpr())
9302 return getDerived().RebuildObjCAtThrowStmt(S->getThrowLoc(),
Operand.get());
9305template<
typename Derived>
9314 getDerived().RebuildObjCAtSynchronizedOperand(S->getAtSynchronizedLoc(),
9320 StmtResult Body = getDerived().TransformStmt(S->getSynchBody());
9321 if (Body.isInvalid())
9325 if (!getDerived().AlwaysRebuild() &&
9326 Object.get() == S->getSynchExpr() &&
9327 Body.get() == S->getSynchBody())
9331 return getDerived().RebuildObjCAtSynchronizedStmt(S->getAtSynchronizedLoc(),
9332 Object.get(), Body.get());
9335template<
typename Derived>
9340 StmtResult Body = getDerived().TransformStmt(S->getSubStmt());
9341 if (Body.isInvalid())
9345 if (!getDerived().AlwaysRebuild() &&
9346 Body.get() == S->getSubStmt())
9350 return getDerived().RebuildObjCAutoreleasePoolStmt(
9351 S->getAtLoc(), Body.get());
9354template<
typename Derived>
9359 StmtResult Element = getDerived().TransformStmt(
9360 S->getElement(), StmtDiscardKind::NotDiscarded);
9361 if (Element.isInvalid())
9365 ExprResult Collection = getDerived().TransformExpr(S->getCollection());
9366 if (Collection.isInvalid())
9370 StmtResult Body = getDerived().TransformStmt(S->getBody());
9371 if (Body.isInvalid())
9375 if (!getDerived().AlwaysRebuild() &&
9376 Element.get() == S->getElement() &&
9377 Collection.get() == S->getCollection() &&
9378 Body.get() == S->getBody())
9382 return getDerived().RebuildObjCForCollectionStmt(S->getForLoc(),
9389template <
typename Derived>
9393 if (
VarDecl *ExceptionDecl = S->getExceptionDecl()) {
9395 getDerived().TransformType(ExceptionDecl->getTypeSourceInfo());
9399 Var = getDerived().RebuildExceptionDecl(
9400 ExceptionDecl,
T, ExceptionDecl->getInnerLocStart(),
9401 ExceptionDecl->getLocation(), ExceptionDecl->getIdentifier());
9402 if (!Var || Var->isInvalidDecl())
9407 StmtResult Handler = getDerived().TransformStmt(S->getHandlerBlock());
9408 if (Handler.isInvalid())
9411 if (!getDerived().AlwaysRebuild() && !Var &&
9412 Handler.get() == S->getHandlerBlock())
9415 return getDerived().RebuildCXXCatchStmt(S->getCatchLoc(), Var, Handler.get());
9418template <
typename Derived>
9421 StmtResult TryBlock = getDerived().TransformCompoundStmt(S->getTryBlock());
9422 if (TryBlock.isInvalid())
9426 bool HandlerChanged =
false;
9428 for (
unsigned I = 0, N = S->getNumHandlers(); I != N; ++I) {
9429 StmtResult Handler = getDerived().TransformCXXCatchStmt(S->getHandler(I));
9430 if (Handler.isInvalid())
9433 HandlerChanged = HandlerChanged || Handler.get() != S->getHandler(I);
9434 Handlers.push_back(Handler.getAs<
Stmt>());
9437 getSema().DiagnoseExceptionUse(S->getTryLoc(),
true);
9439 if (!getDerived().AlwaysRebuild() && TryBlock.get() == S->getTryBlock() &&
9443 return getDerived().RebuildCXXTryStmt(S->getTryLoc(), TryBlock.get(),
9447template<
typename Derived>
9458 auto &LastRecord = getSema().currentEvaluationContext();
9459 LastRecord.InLifetimeExtendingContext =
true;
9460 LastRecord.RebuildDefaultArgOrDefaultInit =
true;
9463 S->getInit() ? getDerived().TransformStmt(S->getInit()) :
StmtResult();
9464 if (
Init.isInvalid())
9468 if (
Range.isInvalid())
9473 getSema().ExprEvalContexts.back().ForRangeLifetimeExtendTemps.empty());
9474 auto ForRangeLifetimeExtendTemps =
9475 getSema().ExprEvalContexts.back().ForRangeLifetimeExtendTemps;
9477 StmtResult Begin = getDerived().TransformStmt(S->getBeginStmt());
9478 if (Begin.isInvalid())
9480 StmtResult End = getDerived().TransformStmt(S->getEndStmt());
9481 if (End.isInvalid())
9484 ExprResult Cond = getDerived().TransformExpr(S->getCond());
9485 if (Cond.isInvalid())
9489 if (Cond.isInvalid())
9495 if (
Inc.isInvalid())
9500 StmtResult LoopVar = getDerived().TransformStmt(S->getLoopVarStmt());
9501 if (LoopVar.isInvalid())
9505 if (getDerived().AlwaysRebuild() ||
9506 Init.get() != S->getInit() ||
9507 Range.get() != S->getRangeStmt() ||
9508 Begin.get() != S->getBeginStmt() ||
9509 End.get() != S->getEndStmt() ||
9510 Cond.get() != S->getCond() ||
9511 Inc.get() != S->getInc() ||
9512 LoopVar.get() != S->getLoopVarStmt()) {
9513 NewStmt = getDerived().RebuildCXXForRangeStmt(
9514 S->getForLoc(), S->getCoawaitLoc(),
Init.get(), S->getColonLoc(),
9515 Range.get(), Begin.get(), End.get(), Cond.get(),
Inc.get(),
9516 LoopVar.get(), S->getRParenLoc(), ForRangeLifetimeExtendTemps);
9517 if (NewStmt.isInvalid() && LoopVar.get() != S->getLoopVarStmt()) {
9519 getSema().ActOnInitializerError(
9530 StmtResult Body = getDerived().TransformStmt(S->getBody());
9531 if (Body.isInvalid())
9538 if (Body.get() != S->getBody() && NewStmt.get() == S) {
9539 NewStmt = getDerived().RebuildCXXForRangeStmt(
9540 S->getForLoc(), S->getCoawaitLoc(),
Init.get(), S->getColonLoc(),
9541 Range.get(), Begin.get(), End.get(), Cond.get(),
Inc.get(),
9542 LoopVar.get(), S->getRParenLoc(), ForRangeLifetimeExtendTemps);
9543 if (NewStmt.isInvalid())
9547 if (NewStmt.get() == S)
9550 return FinishCXXForRangeStmt(NewStmt.get(), Body.get());
9553template <
typename Derived>
9559 getDerived().TransformDecl(S->getDecl()->getLocation(), S->getDecl());
9560 if (!ESD || ESD->isInvalidDecl())
9567 auto TransformStmtInParentContext = [&](
Stmt *SubStmt) ->
StmtResult {
9570 return getDerived().TransformStmt(SubStmt);
9589 if (S->isDependent() || S->isIterating()) {
9595 if (S->isDependent()) {
9601 ExpansionInitializer =
9602 getDerived().TransformExpr(S->getExpansionInitializer());
9603 if (ExpansionInitializer.isInvalid())
9605 }
else if (S->isIterating()) {
9606 Range = TransformStmtInParentContext(S->getRangeVarStmt());
9607 if (
Range.isInvalid())
9611 ExpansionInitializer =
9614 LifetimeExtendTemps =
9619 if (S->isEnumerating()) {
9621 getDerived().TransformStmt(S->getExpansionVarStmt());
9622 if (ExpansionVar.isInvalid())
9627 S->getLParenLoc(), S->getColonLoc(), S->getRParenLoc());
9628 }
else if (S->isIterating()) {
9629 StmtResult Begin = TransformStmtInParentContext(S->getBeginVarStmt());
9630 StmtResult Iter = TransformStmtInParentContext(S->getIterVarStmt());
9631 if (Begin.isInvalid() || Iter.isInvalid())
9638 getDerived().TransformStmt(S->getExpansionVarStmt());
9639 if (ExpansionVar.isInvalid())
9645 Iter.getAs<
DeclStmt>(), S->getLParenLoc(), S->getColonLoc(),
9649 NewPattern->getRangeVar(), LifetimeExtendTemps);
9650 }
else if (S->isDependent()) {
9652 getDerived().TransformStmt(S->getExpansionVarStmt());
9653 if (ExpansionVar.isInvalid())
9658 ExpansionInitializer.get(), S->getLParenLoc(), S->getColonLoc(),
9659 S->getRParenLoc(), LifetimeExtendTemps);
9661 if (Res.isInvalid())
9671 llvm_unreachable(
"destructuring pattern should never be instantiated");
9674 StmtResult Body = getDerived().TransformStmt(S->getBody());
9675 if (Body.isInvalid())
9681template <
typename Derived>
9684 bool SubStmtChanged =
false;
9687 for (
Stmt *OldDS : OldStmts) {
9688 StmtResult NewDS = getDerived().TransformStmt(OldDS);
9689 if (NewDS.isInvalid())
9692 SubStmtChanged |= NewDS.get() != OldDS;
9693 NewStmts.push_back(NewDS.get());
9700 getDerived().TransformDecl(S->getParent()->getLocation(), S->getParent());
9701 if (!ESD || ESD->isInvalidDecl())
9715 if (TransformStmts(PreambleStmts, S->getPreambleStmts()))
9718 if (S->shouldApplyLifetimeExtensionToPreamble()) {
9726 if (TransformStmts(Instantiations, S->getInstantiations()))
9729 if (!getDerived().AlwaysRebuild() && !SubStmtChanged)
9733 SemaRef.
Context, NewESD, Instantiations, PreambleStmts,
9734 S->shouldApplyLifetimeExtensionToPreamble());
9737template <
typename Derived>
9741 ExprResult Idx = getDerived().TransformExpr(E->getIndexExpr());
9742 if (
Range.isInvalid() || Idx.isInvalid())
9745 if (!getDerived().AlwaysRebuild() &&
Range.get() == E->getRangeExpr() &&
9746 Idx.get() == E->getIndexExpr())
9753template<
typename Derived>
9759 if (S->getQualifierLoc()) {
9761 = getDerived().TransformNestedNameSpecifierLoc(S->getQualifierLoc());
9768 if (NameInfo.getName()) {
9769 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
9770 if (!NameInfo.getName())
9775 if (!getDerived().AlwaysRebuild() &&
9776 QualifierLoc == S->getQualifierLoc() &&
9777 NameInfo.getName() == S->getNameInfo().getName())
9782 SS.
Adopt(QualifierLoc);
9784 switch (getSema().CheckMicrosoftIfExistsSymbol(
nullptr, SS, NameInfo)) {
9786 if (S->isIfExists())
9789 return new (getSema().Context)
NullStmt(S->getKeywordLoc());
9792 if (S->isIfNotExists())
9795 return new (getSema().Context)
NullStmt(S->getKeywordLoc());
9806 StmtResult SubStmt = getDerived().TransformCompoundStmt(S->getSubStmt());
9807 if (SubStmt.isInvalid())
9815 return getDerived().RebuildMSDependentExistsStmt(S->getKeywordLoc(),
9822template<
typename Derived>
9826 if (E->getQualifierLoc()) {
9828 = getDerived().TransformNestedNameSpecifierLoc(E->getQualifierLoc());
9834 getDerived().TransformDecl(E->getMemberLoc(), E->getPropertyDecl()));
9839 if (
Base.isInvalid())
9845 QualifierLoc, E->getMemberLoc());
9848template <
typename Derived>
9852 if (BaseRes.isInvalid())
9854 auto IdxRes = getDerived().TransformExpr(E->getIdx());
9855 if (IdxRes.isInvalid())
9858 if (!getDerived().AlwaysRebuild() &&
9859 BaseRes.get() == E->getBase() &&
9860 IdxRes.get() == E->getIdx())
9863 return getDerived().RebuildArraySubscriptExpr(
9864 BaseRes.get(),
SourceLocation(), IdxRes.get(), E->getRBracketLoc());
9867template <
typename Derived>
9869 StmtResult TryBlock = getDerived().TransformCompoundStmt(S->getTryBlock());
9870 if (TryBlock.isInvalid())
9873 StmtResult Handler = getDerived().TransformSEHHandler(S->getHandler());
9874 if (Handler.isInvalid())
9877 if (!getDerived().AlwaysRebuild() && TryBlock.get() == S->getTryBlock() &&
9878 Handler.get() == S->getHandler())
9881 return getDerived().RebuildSEHTryStmt(S->getIsCXXTry(), S->getTryLoc(),
9882 TryBlock.get(), Handler.get());
9885template <
typename Derived>
9888 if (
Block.isInvalid())
9891 return getDerived().RebuildSEHFinallyStmt(S->getFinallyLoc(),
Block.get());
9894template <
typename Derived>
9896 ExprResult FilterExpr = getDerived().TransformExpr(S->getFilterExpr());
9897 if (FilterExpr.isInvalid())
9901 if (
Block.isInvalid())
9904 return getDerived().RebuildSEHExceptStmt(S->getExceptLoc(), FilterExpr.get(),
9908template <
typename Derived>
9916template<
typename Derived>
9926template <
typename Derived>
9928TreeTransform<Derived>::TransformOMPCanonicalLoop(OMPCanonicalLoop *L) {
9932 return getDerived().TransformStmt(L->getLoopStmt());
9935template <
typename Derived>
9942 TClauses.reserve(Clauses.size());
9946 getDerived().getSema().OpenMP().StartOpenMPClause((*I)->getClauseKind());
9948 getDerived().getSema().OpenMP().EndOpenMPClause();
9950 TClauses.push_back(Clause);
9952 TClauses.push_back(
nullptr);
9956 if (D->hasAssociatedStmt() && D->getAssociatedStmt()) {
9957 getDerived().getSema().OpenMP().ActOnOpenMPRegionStart(
9958 D->getDirectiveKind(),
9964 if (D->getDirectiveKind() == OMPD_atomic ||
9965 D->getDirectiveKind() == OMPD_critical ||
9966 D->getDirectiveKind() == OMPD_section ||
9967 D->getDirectiveKind() == OMPD_master)
9968 CS = D->getAssociatedStmt();
9970 CS = D->getRawStmt();
9973 getSema().getLangOpts().OpenMPIRBuilder)
9977 getDerived().getSema().OpenMP().ActOnOpenMPRegionEnd(Body, TClauses);
9982 if (TClauses.size() != Clauses.size()) {
9988 if (D->getDirectiveKind() == OMPD_critical) {
9990 DirName =
getDerived().TransformDeclarationNameInfo(DirName);
9993 if (D->getDirectiveKind() == OMPD_cancellation_point) {
9995 }
else if (D->getDirectiveKind() == OMPD_cancel) {
9999 return getDerived().RebuildOMPExecutableDirective(
10000 D->getDirectiveKind(), DirName, CancelRegion, TClauses,
10001 AssociatedStmt.
get(), D->getBeginLoc(), D->getEndLoc());
10009template <
typename Derived>
10016 TClauses.reserve(Clauses.size());
10019 getDerived().getSema().OpenMP().StartOpenMPClause(
C->getClauseKind());
10021 getDerived().getSema().OpenMP().EndOpenMPClause();
10023 TClauses.push_back(Clause);
10025 TClauses.push_back(
nullptr);
10029 if (D->hasAssociatedStmt() && D->getAssociatedStmt()) {
10030 getDerived().getSema().OpenMP().ActOnOpenMPRegionStart(
10031 D->getDirectiveKind(),
10036 assert(D->getDirectiveKind() == OMPD_assume &&
10037 "Unexpected informational directive");
10038 Stmt *CS = D->getAssociatedStmt();
10042 getDerived().getSema().OpenMP().ActOnOpenMPRegionEnd(Body, TClauses);
10046 if (TClauses.size() != Clauses.size())
10051 return getDerived().RebuildOMPInformationalDirective(
10052 D->getDirectiveKind(), DirName, TClauses, AssociatedStmt.
get(),
10053 D->getBeginLoc(), D->getEndLoc());
10056template <
typename Derived>
10060 llvm::omp::Version OMPVersion =
10062 SemaRef.
Diag(D->getBeginLoc(), diag::err_omp_instantiation_not_supported)
10063 << getOpenMPDirectiveName(D->getDirectiveKind(), OMPVersion);
10067template <
typename Derived>
10069TreeTransform<Derived>::TransformOMPParallelDirective(OMPParallelDirective *D) {
10070 DeclarationNameInfo DirName;
10071 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10072 OMPD_parallel, DirName,
nullptr, D->getBeginLoc());
10073 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10074 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10078template <
typename Derived>
10082 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10083 OMPD_simd, DirName,
nullptr, D->getBeginLoc());
10084 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10085 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10089template <
typename Derived>
10093 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10094 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
10095 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10096 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10100template <
typename Derived>
10104 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10105 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
10106 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10107 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10111template <
typename Derived>
10115 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10116 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
10117 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10118 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10122template <
typename Derived>
10126 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10127 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
10128 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10129 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10133template <
typename Derived>
10135 OMPInterchangeDirective *D) {
10137 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10138 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
10139 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10140 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10144template <
typename Derived>
10148 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10149 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
10150 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10151 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10155template <
typename Derived>
10159 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10160 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
10161 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10162 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10166template <
typename Derived>
10170 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10171 OMPD_for, DirName,
nullptr, D->getBeginLoc());
10172 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10173 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10177template <
typename Derived>
10181 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10182 OMPD_for_simd, DirName,
nullptr, D->getBeginLoc());
10183 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10184 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10188template <
typename Derived>
10192 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10193 OMPD_sections, DirName,
nullptr, D->getBeginLoc());
10194 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10195 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10199template <
typename Derived>
10203 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10204 OMPD_section, DirName,
nullptr, D->getBeginLoc());
10205 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10206 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10210template <
typename Derived>
10214 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10215 OMPD_scope, DirName,
nullptr, D->getBeginLoc());
10216 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10217 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10221template <
typename Derived>
10225 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10226 OMPD_single, DirName,
nullptr, D->getBeginLoc());
10227 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10228 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10232template <
typename Derived>
10236 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10237 OMPD_master, DirName,
nullptr, D->getBeginLoc());
10238 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10239 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10243template <
typename Derived>
10248 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10249 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10253template <
typename Derived>
10255 OMPParallelForDirective *D) {
10257 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10258 OMPD_parallel_for, DirName,
nullptr, D->getBeginLoc());
10259 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10260 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10264template <
typename Derived>
10266 OMPParallelForSimdDirective *D) {
10268 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10269 OMPD_parallel_for_simd, DirName,
nullptr, D->getBeginLoc());
10270 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10271 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10275template <
typename Derived>
10277 OMPParallelMasterDirective *D) {
10279 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10280 OMPD_parallel_master, DirName,
nullptr, D->getBeginLoc());
10281 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10282 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10286template <
typename Derived>
10288 OMPParallelMaskedDirective *D) {
10290 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10291 OMPD_parallel_masked, DirName,
nullptr, D->getBeginLoc());
10292 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10293 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10297template <
typename Derived>
10299 OMPParallelSectionsDirective *D) {
10301 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10302 OMPD_parallel_sections, DirName,
nullptr, D->getBeginLoc());
10303 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10304 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10308template <
typename Derived>
10312 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10313 OMPD_task, DirName,
nullptr, D->getBeginLoc());
10314 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10315 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10319template <
typename Derived>
10321 OMPTaskyieldDirective *D) {
10323 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10324 OMPD_taskyield, DirName,
nullptr, D->getBeginLoc());
10325 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10326 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10330template <
typename Derived>
10334 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10335 OMPD_barrier, DirName,
nullptr, D->getBeginLoc());
10336 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10337 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10341template <
typename Derived>
10345 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10346 OMPD_taskwait, DirName,
nullptr, D->getBeginLoc());
10347 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10348 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10352template <
typename Derived>
10356 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10357 OMPD_assume, DirName,
nullptr, D->getBeginLoc());
10358 StmtResult Res = getDerived().TransformOMPInformationalDirective(D);
10359 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10363template <
typename Derived>
10367 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10368 OMPD_error, DirName,
nullptr, D->getBeginLoc());
10369 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10370 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10374template <
typename Derived>
10376 OMPTaskgroupDirective *D) {
10378 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10379 OMPD_taskgroup, DirName,
nullptr, D->getBeginLoc());
10380 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10381 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10385template <
typename Derived>
10389 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10390 OMPD_flush, DirName,
nullptr, D->getBeginLoc());
10391 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10392 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10396template <
typename Derived>
10400 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10401 OMPD_depobj, DirName,
nullptr, D->getBeginLoc());
10402 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10403 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10407template <
typename Derived>
10411 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10412 OMPD_scan, DirName,
nullptr, D->getBeginLoc());
10413 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10414 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10418template <
typename Derived>
10420 OMPOrderedStandaloneDirective *D) {
10422 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10423 OMPD_ordered_standalone, DirName,
nullptr, D->getBeginLoc());
10424 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10425 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10429template <
typename Derived>
10431 OMPOrderedBlockAssocDirective *D) {
10433 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10434 OMPD_ordered_blockassoc, DirName,
nullptr, D->getBeginLoc());
10435 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10436 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10440template <
typename Derived>
10444 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10445 OMPD_atomic, DirName,
nullptr, D->getBeginLoc());
10446 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10447 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10451template <
typename Derived>
10455 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10456 OMPD_target, DirName,
nullptr, D->getBeginLoc());
10457 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10458 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10462template <
typename Derived>
10464 OMPTargetDataDirective *D) {
10466 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10467 OMPD_target_data, DirName,
nullptr, D->getBeginLoc());
10468 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10469 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10473template <
typename Derived>
10475 OMPTargetEnterDataDirective *D) {
10477 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10478 OMPD_target_enter_data, DirName,
nullptr, D->getBeginLoc());
10479 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10480 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10484template <
typename Derived>
10486 OMPTargetExitDataDirective *D) {
10488 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10489 OMPD_target_exit_data, DirName,
nullptr, D->getBeginLoc());
10490 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10491 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10495template <
typename Derived>
10497 OMPTargetParallelDirective *D) {
10499 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10500 OMPD_target_parallel, DirName,
nullptr, D->getBeginLoc());
10501 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10502 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10506template <
typename Derived>
10508 OMPTargetParallelForDirective *D) {
10510 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10511 OMPD_target_parallel_for, DirName,
nullptr, D->getBeginLoc());
10512 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10513 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10517template <
typename Derived>
10519 OMPTargetUpdateDirective *D) {
10521 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10522 OMPD_target_update, DirName,
nullptr, D->getBeginLoc());
10523 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10524 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10528template <
typename Derived>
10532 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10533 OMPD_teams, DirName,
nullptr, D->getBeginLoc());
10534 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10535 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10539template <
typename Derived>
10541 OMPCancellationPointDirective *D) {
10543 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10544 OMPD_cancellation_point, DirName,
nullptr, D->getBeginLoc());
10545 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10546 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10550template <
typename Derived>
10554 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10555 OMPD_cancel, DirName,
nullptr, D->getBeginLoc());
10556 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10557 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10561template <
typename Derived>
10565 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10566 OMPD_taskloop, DirName,
nullptr, D->getBeginLoc());
10567 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10568 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10572template <
typename Derived>
10574 OMPTaskLoopSimdDirective *D) {
10576 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10577 OMPD_taskloop_simd, DirName,
nullptr, D->getBeginLoc());
10578 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10579 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10583template <
typename Derived>
10585 OMPMasterTaskLoopDirective *D) {
10587 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10588 OMPD_master_taskloop, DirName,
nullptr, D->getBeginLoc());
10589 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10590 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10594template <
typename Derived>
10596 OMPMaskedTaskLoopDirective *D) {
10598 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10599 OMPD_masked_taskloop, DirName,
nullptr, D->getBeginLoc());
10600 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10601 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10605template <
typename Derived>
10607 OMPMasterTaskLoopSimdDirective *D) {
10609 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10610 OMPD_master_taskloop_simd, DirName,
nullptr, D->getBeginLoc());
10611 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10612 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10616template <
typename Derived>
10618 OMPMaskedTaskLoopSimdDirective *D) {
10620 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10621 OMPD_masked_taskloop_simd, DirName,
nullptr, D->getBeginLoc());
10622 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10623 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10627template <
typename Derived>
10629 OMPParallelMasterTaskLoopDirective *D) {
10631 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10632 OMPD_parallel_master_taskloop, DirName,
nullptr, D->getBeginLoc());
10633 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10634 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10638template <
typename Derived>
10640 OMPParallelMaskedTaskLoopDirective *D) {
10642 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10643 OMPD_parallel_masked_taskloop, DirName,
nullptr, D->getBeginLoc());
10644 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10645 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10649template <
typename Derived>
10652 OMPParallelMasterTaskLoopSimdDirective *D) {
10654 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10655 OMPD_parallel_master_taskloop_simd, DirName,
nullptr, D->getBeginLoc());
10656 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10657 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10661template <
typename Derived>
10664 OMPParallelMaskedTaskLoopSimdDirective *D) {
10666 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10667 OMPD_parallel_masked_taskloop_simd, DirName,
nullptr, D->getBeginLoc());
10668 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10669 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10673template <
typename Derived>
10675 OMPDistributeDirective *D) {
10677 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10678 OMPD_distribute, DirName,
nullptr, D->getBeginLoc());
10679 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10680 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10684template <
typename Derived>
10686 OMPDistributeParallelForDirective *D) {
10688 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10689 OMPD_distribute_parallel_for, DirName,
nullptr, D->getBeginLoc());
10690 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10691 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10695template <
typename Derived>
10698 OMPDistributeParallelForSimdDirective *D) {
10700 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10701 OMPD_distribute_parallel_for_simd, DirName,
nullptr, D->getBeginLoc());
10702 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10703 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10707template <
typename Derived>
10709 OMPDistributeSimdDirective *D) {
10711 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10712 OMPD_distribute_simd, DirName,
nullptr, D->getBeginLoc());
10713 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10714 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10718template <
typename Derived>
10720 OMPTargetParallelForSimdDirective *D) {
10722 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10723 OMPD_target_parallel_for_simd, DirName,
nullptr, D->getBeginLoc());
10724 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10725 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10729template <
typename Derived>
10731 OMPTargetSimdDirective *D) {
10733 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10734 OMPD_target_simd, DirName,
nullptr, D->getBeginLoc());
10735 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10736 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10740template <
typename Derived>
10742 OMPTeamsDistributeDirective *D) {
10744 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10745 OMPD_teams_distribute, DirName,
nullptr, D->getBeginLoc());
10746 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10747 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10751template <
typename Derived>
10753 OMPTeamsDistributeSimdDirective *D) {
10755 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10756 OMPD_teams_distribute_simd, DirName,
nullptr, D->getBeginLoc());
10757 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10758 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10762template <
typename Derived>
10764 OMPTeamsDistributeParallelForSimdDirective *D) {
10766 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10767 OMPD_teams_distribute_parallel_for_simd, DirName,
nullptr,
10769 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10770 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10774template <
typename Derived>
10776 OMPTeamsDistributeParallelForDirective *D) {
10778 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10779 OMPD_teams_distribute_parallel_for, DirName,
nullptr, D->getBeginLoc());
10780 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10781 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10785template <
typename Derived>
10787 OMPTargetTeamsDirective *D) {
10789 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10790 OMPD_target_teams, DirName,
nullptr, D->getBeginLoc());
10791 auto Res = getDerived().TransformOMPExecutableDirective(D);
10792 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10796template <
typename Derived>
10798 OMPTargetTeamsDistributeDirective *D) {
10800 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10801 OMPD_target_teams_distribute, DirName,
nullptr, D->getBeginLoc());
10802 auto Res = getDerived().TransformOMPExecutableDirective(D);
10803 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10807template <
typename Derived>
10810 OMPTargetTeamsDistributeParallelForDirective *D) {
10812 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10813 OMPD_target_teams_distribute_parallel_for, DirName,
nullptr,
10815 auto Res = getDerived().TransformOMPExecutableDirective(D);
10816 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10820template <
typename Derived>
10823 OMPTargetTeamsDistributeParallelForSimdDirective *D) {
10825 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10826 OMPD_target_teams_distribute_parallel_for_simd, DirName,
nullptr,
10828 auto Res = getDerived().TransformOMPExecutableDirective(D);
10829 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10833template <
typename Derived>
10836 OMPTargetTeamsDistributeSimdDirective *D) {
10838 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10839 OMPD_target_teams_distribute_simd, DirName,
nullptr, D->getBeginLoc());
10840 auto Res = getDerived().TransformOMPExecutableDirective(D);
10841 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10845template <
typename Derived>
10849 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10850 OMPD_interop, DirName,
nullptr, D->getBeginLoc());
10851 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10852 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10856template <
typename Derived>
10860 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10861 OMPD_dispatch, DirName,
nullptr, D->getBeginLoc());
10862 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10863 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10867template <
typename Derived>
10871 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10872 OMPD_masked, DirName,
nullptr, D->getBeginLoc());
10873 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10874 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10878template <
typename Derived>
10880 OMPGenericLoopDirective *D) {
10882 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10883 OMPD_loop, DirName,
nullptr, D->getBeginLoc());
10884 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10885 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10889template <
typename Derived>
10891 OMPTeamsGenericLoopDirective *D) {
10893 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10894 OMPD_teams_loop, DirName,
nullptr, D->getBeginLoc());
10895 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10896 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10900template <
typename Derived>
10902 OMPTargetTeamsGenericLoopDirective *D) {
10904 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10905 OMPD_target_teams_loop, DirName,
nullptr, D->getBeginLoc());
10906 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10907 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10911template <
typename Derived>
10913 OMPParallelGenericLoopDirective *D) {
10915 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10916 OMPD_parallel_loop, DirName,
nullptr, D->getBeginLoc());
10917 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10918 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10922template <
typename Derived>
10925 OMPTargetParallelGenericLoopDirective *D) {
10927 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10928 OMPD_target_parallel_loop, DirName,
nullptr, D->getBeginLoc());
10929 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10930 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10937template <
typename Derived>
10939 ExprResult Cond = getDerived().TransformExpr(
C->getCondition());
10940 if (Cond.isInvalid())
10942 return getDerived().RebuildOMPIfClause(
10943 C->getNameModifier(), Cond.get(),
C->getBeginLoc(),
C->getLParenLoc(),
10944 C->getNameModifierLoc(),
C->getColonLoc(),
C->getEndLoc());
10947template <
typename Derived>
10949 ExprResult Cond = getDerived().TransformExpr(
C->getCondition());
10950 if (Cond.isInvalid())
10952 return getDerived().RebuildOMPFinalClause(Cond.get(),
C->getBeginLoc(),
10953 C->getLParenLoc(),
C->getEndLoc());
10956template <
typename Derived>
10960 Vars.reserve(
C->varlist_size());
10961 for (
auto *
VE :
C->varlist()) {
10963 if (EVar.isInvalid())
10965 Vars.push_back(EVar.get());
10967 Expr *DimsModifierExpr =
C->getDimsModifierExpr();
10968 if (DimsModifierExpr) {
10970 if (EVar.isInvalid())
10972 DimsModifierExpr = EVar.get();
10974 return getDerived().RebuildOMPNumThreadsClause(
10975 Vars,
C->getPrescriptivenessModifier(),
10976 C->getPrescriptivenessModifierLoc(),
C->getDimsModifier(),
10977 DimsModifierExpr,
C->getDimsModifierLoc(),
C->getBeginLoc(),
10978 C->getLParenLoc(),
C->getEndLoc());
10981template <
typename Derived>
10984 ExprResult E = getDerived().TransformExpr(
C->getSafelen());
10987 return getDerived().RebuildOMPSafelenClause(
10988 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10991template <
typename Derived>
10994 ExprResult E = getDerived().TransformExpr(
C->getAllocator());
10997 return getDerived().RebuildOMPAllocatorClause(
10998 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11001template <
typename Derived>
11004 ExprResult E = getDerived().TransformExpr(
C->getSimdlen());
11007 return getDerived().RebuildOMPSimdlenClause(
11008 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11011template <
typename Derived>
11014 TransformedSizes.reserve(
C->getNumSizes());
11016 for (
Expr *E :
C->getSizesRefs()) {
11018 TransformedSizes.push_back(
nullptr);
11027 TransformedSizes.push_back(
T.get());
11030 if (!Changed && !getDerived().AlwaysRebuild())
11032 return RebuildOMPSizesClause(TransformedSizes,
C->getBeginLoc(),
11033 C->getLParenLoc(),
C->getEndLoc());
11036template <
typename Derived>
11040 TransformedCounts.reserve(
C->getNumCounts());
11041 for (
Expr *E :
C->getCountsRefs()) {
11043 TransformedCounts.push_back(
nullptr);
11050 TransformedCounts.push_back(
T.get());
11053 return RebuildOMPCountsClause(TransformedCounts,
C->getBeginLoc(),
11054 C->getLParenLoc(),
C->getEndLoc(),
11055 C->getOmpFillIndex(),
C->getOmpFillLoc());
11058template <
typename Derived>
11062 TransformedArgs.reserve(
C->getNumLoops());
11064 for (
Expr *E :
C->getArgsRefs()) {
11066 TransformedArgs.push_back(
nullptr);
11075 TransformedArgs.push_back(
T.get());
11078 if (!Changed && !getDerived().AlwaysRebuild())
11080 return RebuildOMPPermutationClause(TransformedArgs,
C->getBeginLoc(),
11081 C->getLParenLoc(),
C->getEndLoc());
11084template <
typename Derived>
11086 if (!getDerived().AlwaysRebuild())
11088 return RebuildOMPFullClause(
C->getBeginLoc(),
C->getEndLoc());
11091template <
typename Derived>
11094 ExprResult T = getDerived().TransformExpr(
C->getFactor());
11097 Expr *Factor =
T.get();
11098 bool Changed = Factor !=
C->getFactor();
11100 if (!Changed && !getDerived().AlwaysRebuild())
11102 return RebuildOMPPartialClause(Factor,
C->getBeginLoc(),
C->getLParenLoc(),
11106template <
typename Derived>
11109 ExprResult F = getDerived().TransformExpr(
C->getFirst());
11113 ExprResult Cn = getDerived().TransformExpr(
C->getCount());
11114 if (Cn.isInvalid())
11118 Expr *Count = Cn.get();
11120 bool Changed = (
First !=
C->getFirst()) || (Count !=
C->getCount());
11123 if (!Changed && !getDerived().AlwaysRebuild())
11126 return RebuildOMPLoopRangeClause(
First, Count,
C->getBeginLoc(),
11127 C->getLParenLoc(),
C->getFirstLoc(),
11128 C->getCountLoc(),
C->getEndLoc());
11131template <
typename Derived>
11134 ExprResult E = getDerived().TransformExpr(
C->getNumForLoops());
11137 return getDerived().RebuildOMPCollapseClause(
11138 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11141template <
typename Derived>
11145 C->getDefaultKind(),
C->getDefaultKindKwLoc(),
C->getDefaultVC(),
11146 C->getDefaultVCLoc(),
C->getBeginLoc(),
C->getLParenLoc(),
11150template <
typename Derived>
11157template <
typename Derived>
11160 Expr *Impex =
C->getImpexType();
11161 ExprResult TransformedImpex = getDerived().TransformExpr(Impex);
11163 if (TransformedImpex.isInvalid())
11166 return getDerived().RebuildOMPTransparentClause(
11167 TransformedImpex.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11171template <
typename Derived>
11175 C->getProcBindKind(),
C->getProcBindKindKwLoc(),
C->getBeginLoc(),
11176 C->getLParenLoc(),
C->getEndLoc());
11179template <
typename Derived>
11182 ExprResult E = getDerived().TransformExpr(
C->getChunkSize());
11185 return getDerived().RebuildOMPScheduleClause(
11186 C->getFirstScheduleModifier(),
C->getSecondScheduleModifier(),
11187 C->getScheduleKind(), E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11188 C->getFirstScheduleModifierLoc(),
C->getSecondScheduleModifierLoc(),
11189 C->getScheduleKindLoc(),
C->getCommaLoc(),
C->getEndLoc());
11192template <
typename Derived>
11196 if (
auto *
Num =
C->getNumForLoops()) {
11197 E = getDerived().TransformExpr(
Num);
11201 return getDerived().RebuildOMPOrderedClause(
C->getBeginLoc(),
C->getEndLoc(),
11202 C->getLParenLoc(), E.get());
11205template <
typename Derived>
11209 if (
Expr *Evt =
C->getEventHandler()) {
11210 E = getDerived().TransformExpr(Evt);
11214 return getDerived().RebuildOMPDetachClause(E.get(),
C->getBeginLoc(),
11215 C->getLParenLoc(),
C->getEndLoc());
11218template <
typename Derived>
11223 Cond = getDerived().TransformExpr(
Condition);
11224 if (Cond.isInvalid())
11227 return getDerived().RebuildOMPNowaitClause(Cond.get(),
C->getBeginLoc(),
11228 C->getLParenLoc(),
C->getEndLoc());
11231template <
typename Derived>
11238template <
typename Derived>
11245template <
typename Derived>
11251template <
typename Derived>
11257template <
typename Derived>
11264template <
typename Derived>
11266 OMPUpdateDependObjectsClause *
C) {
11271template <
typename Derived>
11278template <
typename Derived>
11285template <
typename Derived>
11291template <
typename Derived>
11297template <
typename Derived>
11299 ExprResult E = getDerived().TransformExpr(
C->getExpr());
11302 return getDerived().RebuildOMPHoldsClause(E.get(),
C->getBeginLoc(),
11303 C->getLParenLoc(),
C->getEndLoc());
11306template <
typename Derived>
11312template <
typename Derived>
11317template <
typename Derived>
11319 OMPNoOpenMPRoutinesClause *
C) {
11322template <
typename Derived>
11324 OMPNoOpenMPConstructsClause *
C) {
11327template <
typename Derived>
11329 OMPNoParallelismClause *
C) {
11333template <
typename Derived>
11340template <
typename Derived>
11347template <
typename Derived>
11354template <
typename Derived>
11361template <
typename Derived>
11368template <
typename Derived>
11374template <
typename Derived>
11381template <
typename Derived>
11387template <
typename Derived>
11394template <
typename Derived>
11396 ExprResult IVR = getDerived().TransformExpr(
C->getInteropVar());
11397 if (IVR.isInvalid())
11401 for (OMPInitClause::PrefView P :
C->prefs()) {
11402 Expr *NewFr =
nullptr;
11404 ExprResult ER = getDerived().TransformExpr(P.Fr);
11405 if (ER.isInvalid())
11410 NewAttrs.reserve(P.Attrs.size());
11411 for (
Expr *A : P.Attrs) {
11412 ExprResult ER = getDerived().TransformExpr(A);
11413 if (ER.isInvalid())
11415 NewAttrs.push_back(ER.get());
11417 InteropInfo.Prefs.emplace_back(NewFr, std::move(NewAttrs));
11419 InteropInfo.HasPreferAttrs =
C->hasPreferAttrs();
11420 return getDerived().RebuildOMPInitClause(IVR.get(), InteropInfo,
11421 C->getBeginLoc(),
C->getLParenLoc(),
11422 C->getVarLoc(),
C->getEndLoc());
11425template <
typename Derived>
11427 ExprResult ER = getDerived().TransformExpr(
C->getInteropVar());
11428 if (ER.isInvalid())
11430 return getDerived().RebuildOMPUseClause(ER.get(),
C->getBeginLoc(),
11431 C->getLParenLoc(),
C->getVarLoc(),
11435template <
typename Derived>
11439 if (
Expr *IV =
C->getInteropVar()) {
11440 ER = getDerived().TransformExpr(IV);
11441 if (ER.isInvalid())
11444 return getDerived().RebuildOMPDestroyClause(ER.get(),
C->getBeginLoc(),
11445 C->getLParenLoc(),
C->getVarLoc(),
11449template <
typename Derived>
11452 ExprResult Cond = getDerived().TransformExpr(
C->getCondition());
11453 if (Cond.isInvalid())
11455 return getDerived().RebuildOMPNovariantsClause(
11456 Cond.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11459template <
typename Derived>
11462 ExprResult Cond = getDerived().TransformExpr(
C->getCondition());
11463 if (Cond.isInvalid())
11465 return getDerived().RebuildOMPNocontextClause(
11466 Cond.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11469template <
typename Derived>
11472 ExprResult ThreadID = getDerived().TransformExpr(
C->getThreadID());
11473 if (ThreadID.isInvalid())
11475 return getDerived().RebuildOMPFilterClause(ThreadID.get(),
C->getBeginLoc(),
11476 C->getLParenLoc(),
C->getEndLoc());
11479template <
typename Derived>
11481 ExprResult E = getDerived().TransformExpr(
C->getAlignment());
11484 return getDerived().RebuildOMPAlignClause(E.get(),
C->getBeginLoc(),
11485 C->getLParenLoc(),
C->getEndLoc());
11488template <
typename Derived>
11490 OMPUnifiedAddressClause *
C) {
11491 llvm_unreachable(
"unified_address clause cannot appear in dependent context");
11494template <
typename Derived>
11496 OMPUnifiedSharedMemoryClause *
C) {
11498 "unified_shared_memory clause cannot appear in dependent context");
11501template <
typename Derived>
11503 OMPReverseOffloadClause *
C) {
11504 llvm_unreachable(
"reverse_offload clause cannot appear in dependent context");
11507template <
typename Derived>
11509 OMPDynamicAllocatorsClause *
C) {
11511 "dynamic_allocators clause cannot appear in dependent context");
11514template <
typename Derived>
11516 OMPAtomicDefaultMemOrderClause *
C) {
11518 "atomic_default_mem_order clause cannot appear in dependent context");
11521template <
typename Derived>
11524 llvm_unreachable(
"self_maps clause cannot appear in dependent context");
11527template <
typename Derived>
11530 C->getBeginLoc(),
C->getLParenLoc(),
11534template <
typename Derived>
11538 C->getSeverityKind(),
C->getSeverityKindKwLoc(),
C->getBeginLoc(),
11539 C->getLParenLoc(),
C->getEndLoc());
11542template <
typename Derived>
11545 ExprResult E = getDerived().TransformExpr(
C->getMessageString());
11548 return getDerived().RebuildOMPMessageClause(
11549 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11552template <
typename Derived>
11556 Vars.reserve(
C->varlist_size());
11557 for (
auto *
VE :
C->varlist()) {
11559 if (EVar.isInvalid())
11561 Vars.push_back(EVar.get());
11563 return getDerived().RebuildOMPPrivateClause(
11564 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11567template <
typename Derived>
11569 OMPFirstprivateClause *
C) {
11571 Vars.reserve(
C->varlist_size());
11572 for (
auto *
VE :
C->varlist()) {
11574 if (EVar.isInvalid())
11576 Vars.push_back(EVar.get());
11578 return getDerived().RebuildOMPFirstprivateClause(
11579 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11582template <
typename Derived>
11586 Vars.reserve(
C->varlist_size());
11587 for (
auto *
VE :
C->varlist()) {
11589 if (EVar.isInvalid())
11591 Vars.push_back(EVar.get());
11593 return getDerived().RebuildOMPLastprivateClause(
11594 Vars,
C->getKind(),
C->getKindLoc(),
C->getColonLoc(),
C->getBeginLoc(),
11595 C->getLParenLoc(),
C->getEndLoc());
11598template <
typename Derived>
11602 Vars.reserve(
C->varlist_size());
11603 for (
auto *
VE :
C->varlist()) {
11605 if (EVar.isInvalid())
11607 Vars.push_back(EVar.get());
11609 return getDerived().RebuildOMPSharedClause(Vars,
C->getBeginLoc(),
11610 C->getLParenLoc(),
C->getEndLoc());
11613template <
typename Derived>
11617 Vars.reserve(
C->varlist_size());
11618 for (
auto *
VE :
C->varlist()) {
11620 if (EVar.isInvalid())
11622 Vars.push_back(EVar.get());
11625 ReductionIdScopeSpec.
Adopt(
C->getQualifierLoc());
11628 if (NameInfo.getName()) {
11629 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
11630 if (!NameInfo.getName())
11636 for (
auto *E :
C->reduction_ops()) {
11641 for (
auto *D : ULE->decls()) {
11644 Decls.addDecl(InstD, InstD->getAccess());
11648 ReductionIdScopeSpec.getWithLocInContext(SemaRef.
Context), NameInfo,
11649 true, Decls.begin(), Decls.end(),
11652 UnresolvedReductions.push_back(
nullptr);
11654 return getDerived().RebuildOMPReductionClause(
11655 Vars,
C->getModifier(),
C->getOriginalSharingModifier(),
C->getBeginLoc(),
11656 C->getLParenLoc(),
C->getModifierLoc(),
C->getColonLoc(),
C->getEndLoc(),
11657 ReductionIdScopeSpec, NameInfo, UnresolvedReductions);
11660template <
typename Derived>
11662 OMPTaskReductionClause *
C) {
11664 Vars.reserve(
C->varlist_size());
11665 for (
auto *
VE :
C->varlist()) {
11667 if (EVar.isInvalid())
11669 Vars.push_back(EVar.get());
11672 ReductionIdScopeSpec.
Adopt(
C->getQualifierLoc());
11675 if (NameInfo.getName()) {
11676 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
11677 if (!NameInfo.getName())
11683 for (
auto *E :
C->reduction_ops()) {
11688 for (
auto *D : ULE->decls()) {
11691 Decls.addDecl(InstD, InstD->getAccess());
11695 ReductionIdScopeSpec.getWithLocInContext(SemaRef.
Context), NameInfo,
11696 true, Decls.begin(), Decls.end(),
11699 UnresolvedReductions.push_back(
nullptr);
11701 return getDerived().RebuildOMPTaskReductionClause(
11702 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getColonLoc(),
11703 C->getEndLoc(), ReductionIdScopeSpec, NameInfo, UnresolvedReductions);
11706template <
typename Derived>
11710 Vars.reserve(
C->varlist_size());
11711 for (
auto *
VE :
C->varlist()) {
11713 if (EVar.isInvalid())
11715 Vars.push_back(EVar.get());
11718 ReductionIdScopeSpec.
Adopt(
C->getQualifierLoc());
11721 if (NameInfo.getName()) {
11722 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
11723 if (!NameInfo.getName())
11729 for (
auto *E :
C->reduction_ops()) {
11734 for (
auto *D : ULE->decls()) {
11737 Decls.addDecl(InstD, InstD->getAccess());
11741 ReductionIdScopeSpec.getWithLocInContext(SemaRef.
Context), NameInfo,
11742 true, Decls.begin(), Decls.end(),
11745 UnresolvedReductions.push_back(
nullptr);
11747 return getDerived().RebuildOMPInReductionClause(
11748 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getColonLoc(),
11749 C->getEndLoc(), ReductionIdScopeSpec, NameInfo, UnresolvedReductions);
11752template <
typename Derived>
11756 Vars.reserve(
C->varlist_size());
11757 for (
auto *
VE :
C->varlist()) {
11759 if (EVar.isInvalid())
11761 Vars.push_back(EVar.get());
11763 ExprResult Step = getDerived().TransformExpr(
C->getStep());
11764 if (Step.isInvalid())
11766 return getDerived().RebuildOMPLinearClause(
11767 Vars, Step.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getModifier(),
11768 C->getModifierLoc(),
C->getColonLoc(),
C->getStepModifierLoc(),
11772template <
typename Derived>
11776 Vars.reserve(
C->varlist_size());
11777 for (
auto *
VE :
C->varlist()) {
11779 if (EVar.isInvalid())
11781 Vars.push_back(EVar.get());
11783 ExprResult Alignment = getDerived().TransformExpr(
C->getAlignment());
11784 if (Alignment.isInvalid())
11786 return getDerived().RebuildOMPAlignedClause(
11787 Vars, Alignment.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11788 C->getColonLoc(),
C->getEndLoc());
11791template <
typename Derived>
11795 Vars.reserve(
C->varlist_size());
11796 for (
auto *
VE :
C->varlist()) {
11798 if (EVar.isInvalid())
11800 Vars.push_back(EVar.get());
11802 return getDerived().RebuildOMPCopyinClause(Vars,
C->getBeginLoc(),
11803 C->getLParenLoc(),
C->getEndLoc());
11806template <
typename Derived>
11810 Vars.reserve(
C->varlist_size());
11811 for (
auto *
VE :
C->varlist()) {
11813 if (EVar.isInvalid())
11815 Vars.push_back(EVar.get());
11817 return getDerived().RebuildOMPCopyprivateClause(
11818 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11821template <
typename Derived>
11824 Vars.reserve(
C->varlist_size());
11825 for (
auto *
VE :
C->varlist()) {
11827 if (EVar.isInvalid())
11829 Vars.push_back(EVar.get());
11831 return getDerived().RebuildOMPFlushClause(Vars,
C->getBeginLoc(),
11832 C->getLParenLoc(),
C->getEndLoc());
11835template <
typename Derived>
11838 ExprResult E = getDerived().TransformExpr(
C->getDepobj());
11841 return getDerived().RebuildOMPDepobjClause(E.get(),
C->getBeginLoc(),
11842 C->getLParenLoc(),
C->getEndLoc());
11845template <
typename Derived>
11849 Expr *DepModifier =
C->getModifier();
11851 ExprResult DepModRes = getDerived().TransformExpr(DepModifier);
11852 if (DepModRes.isInvalid())
11854 DepModifier = DepModRes.get();
11856 Vars.reserve(
C->varlist_size());
11857 for (
auto *
VE :
C->varlist()) {
11859 if (EVar.isInvalid())
11861 Vars.push_back(EVar.get());
11863 return getDerived().RebuildOMPDependClause(
11864 {
C->getDependencyKind(),
C->getDependencyLoc(),
C->getColonLoc(),
11865 C->getOmpAllMemoryLoc()},
11866 DepModifier, Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11869template <
typename Derived>
11872 ExprResult E = getDerived().TransformExpr(
C->getDevice());
11875 return getDerived().RebuildOMPDeviceClause(
11876 C->getModifier(), E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11877 C->getModifierLoc(),
C->getEndLoc());
11880template <
typename Derived,
class T>
11887 Vars.reserve(
C->varlist_size());
11888 for (
auto *
VE :
C->varlist()) {
11892 Vars.push_back(EVar.
get());
11896 if (
C->getMapperQualifierLoc()) {
11897 QualifierLoc = TT.
getDerived().TransformNestedNameSpecifierLoc(
11898 C->getMapperQualifierLoc());
11902 MapperIdScopeSpec.
Adopt(QualifierLoc);
11903 MapperIdInfo =
C->getMapperIdInfo();
11904 if (MapperIdInfo.
getName()) {
11905 MapperIdInfo = TT.
getDerived().TransformDeclarationNameInfo(MapperIdInfo);
11911 for (
auto *E :
C->mapperlists()) {
11916 for (
auto *D : ULE->decls()) {
11919 Decls.addDecl(InstD, InstD->
getAccess());
11924 MapperIdInfo,
true, Decls.begin(), Decls.end(),
11927 UnresolvedMappers.push_back(
nullptr);
11933template <
typename Derived>
11935 OMPVarListLocTy Locs(
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11937 Expr *IteratorModifier =
C->getIteratorModifier();
11938 if (IteratorModifier) {
11939 ExprResult MapModRes = getDerived().TransformExpr(IteratorModifier);
11940 if (MapModRes.isInvalid())
11942 IteratorModifier = MapModRes.
get();
11948 *
this,
C, Vars, MapperIdScopeSpec, MapperIdInfo, UnresolvedMappers))
11950 return getDerived().RebuildOMPMapClause(
11951 IteratorModifier,
C->getMapTypeModifiers(),
C->getMapTypeModifiersLoc(),
11952 MapperIdScopeSpec, MapperIdInfo,
C->getMapType(),
C->isImplicitMapType(),
11953 C->getMapLoc(),
C->getColonLoc(), Vars, Locs, UnresolvedMappers);
11956template <
typename Derived>
11959 Expr *Allocator =
C->getAllocator();
11961 ExprResult AllocatorRes = getDerived().TransformExpr(Allocator);
11962 if (AllocatorRes.isInvalid())
11964 Allocator = AllocatorRes.get();
11966 Expr *Alignment =
C->getAlignment();
11968 ExprResult AlignmentRes = getDerived().TransformExpr(Alignment);
11969 if (AlignmentRes.isInvalid())
11971 Alignment = AlignmentRes.get();
11974 Vars.reserve(
C->varlist_size());
11975 for (
auto *
VE :
C->varlist()) {
11977 if (EVar.isInvalid())
11979 Vars.push_back(EVar.get());
11981 return getDerived().RebuildOMPAllocateClause(
11982 Allocator, Alignment,
C->getFirstAllocateModifier(),
11983 C->getFirstAllocateModifierLoc(),
C->getSecondAllocateModifier(),
11984 C->getSecondAllocateModifierLoc(), Vars,
C->getBeginLoc(),
11985 C->getLParenLoc(),
C->getColonLoc(),
C->getEndLoc());
11988template <
typename Derived>
11992 Vars.reserve(
C->varlist_size());
11993 for (
auto *
VE :
C->varlist()) {
11995 if (EVar.isInvalid())
11997 Vars.push_back(EVar.get());
11999 Expr *ModifierExpr =
C->getModifierExpr();
12000 if (ModifierExpr) {
12002 if (EVar.isInvalid())
12004 ModifierExpr = EVar.get();
12006 return getDerived().RebuildOMPNumTeamsClause(
12007 Vars,
C->getModifier(), ModifierExpr,
C->getModifierLoc(),
12009 C->getLParenLoc(),
C->getEndLoc());
12012template <
typename Derived>
12016 Vars.reserve(
C->varlist_size());
12017 for (
auto *
VE :
C->varlist()) {
12019 if (EVar.isInvalid())
12021 Vars.push_back(EVar.get());
12023 Expr *ModifierExpr =
C->getModifierExpr();
12024 if (ModifierExpr) {
12026 if (EVar.isInvalid())
12028 ModifierExpr = EVar.get();
12030 return getDerived().RebuildOMPThreadLimitClause(
12031 Vars,
C->getModifier(), ModifierExpr,
C->getModifierLoc(),
12032 C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
12035template <
typename Derived>
12038 ExprResult E = getDerived().TransformExpr(
C->getPriority());
12041 return getDerived().RebuildOMPPriorityClause(
12042 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
12045template <
typename Derived>
12048 ExprResult E = getDerived().TransformExpr(
C->getGrainsize());
12051 return getDerived().RebuildOMPGrainsizeClause(
12052 C->getModifier(), E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
12053 C->getModifierLoc(),
C->getEndLoc());
12056template <
typename Derived>
12059 ExprResult E = getDerived().TransformExpr(
C->getNumTasks());
12062 return getDerived().RebuildOMPNumTasksClause(
12063 C->getModifier(), E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
12064 C->getModifierLoc(),
C->getEndLoc());
12067template <
typename Derived>
12069 ExprResult E = getDerived().TransformExpr(
C->getHint());
12072 return getDerived().RebuildOMPHintClause(E.get(),
C->getBeginLoc(),
12073 C->getLParenLoc(),
C->getEndLoc());
12076template <
typename Derived>
12078 OMPDistScheduleClause *
C) {
12079 ExprResult E = getDerived().TransformExpr(
C->getChunkSize());
12082 return getDerived().RebuildOMPDistScheduleClause(
12083 C->getDistScheduleKind(), E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
12084 C->getDistScheduleKindLoc(),
C->getCommaLoc(),
C->getEndLoc());
12087template <
typename Derived>
12093 C->getDefaultmapKind(),
12096 C->getDefaultmapModifierLoc(),
12097 C->getDefaultmapKindLoc(),
12101template <
typename Derived>
12105 Expr *IteratorModifier =
C->getIteratorModifier();
12106 if (IteratorModifier) {
12107 ExprResult MapModRes = getDerived().TransformExpr(IteratorModifier);
12108 if (MapModRes.isInvalid())
12110 IteratorModifier = MapModRes.get();
12116 *
this,
C, Vars, MapperIdScopeSpec, MapperIdInfo, UnresolvedMappers))
12118 return getDerived().RebuildOMPToClause(
12119 C->getMotionModifiers(),
C->getMotionModifiersLoc(), IteratorModifier,
12120 MapperIdScopeSpec, MapperIdInfo,
C->getColonLoc(), Vars, Locs,
12121 UnresolvedMappers);
12124template <
typename Derived>
12128 Expr *IteratorModifier =
C->getIteratorModifier();
12129 if (IteratorModifier) {
12130 ExprResult MapModRes = getDerived().TransformExpr(IteratorModifier);
12131 if (MapModRes.isInvalid())
12133 IteratorModifier = MapModRes.get();
12139 *
this,
C, Vars, MapperIdScopeSpec, MapperIdInfo, UnresolvedMappers))
12141 return getDerived().RebuildOMPFromClause(
12142 C->getMotionModifiers(),
C->getMotionModifiersLoc(), IteratorModifier,
12143 MapperIdScopeSpec, MapperIdInfo,
C->getColonLoc(), Vars, Locs,
12144 UnresolvedMappers);
12147template <
typename Derived>
12149 OMPUseDevicePtrClause *
C) {
12151 Vars.reserve(
C->varlist_size());
12152 for (
auto *
VE :
C->varlist()) {
12154 if (EVar.isInvalid())
12156 Vars.push_back(EVar.get());
12159 return getDerived().RebuildOMPUseDevicePtrClause(
12160 Vars, Locs,
C->getFallbackModifier(),
C->getFallbackModifierLoc());
12163template <
typename Derived>
12165 OMPUseDeviceAddrClause *
C) {
12167 Vars.reserve(
C->varlist_size());
12168 for (
auto *
VE :
C->varlist()) {
12170 if (EVar.isInvalid())
12172 Vars.push_back(EVar.get());
12175 return getDerived().RebuildOMPUseDeviceAddrClause(Vars, Locs);
12178template <
typename Derived>
12182 Vars.reserve(
C->varlist_size());
12183 for (
auto *
VE :
C->varlist()) {
12185 if (EVar.isInvalid())
12187 Vars.push_back(EVar.get());
12190 return getDerived().RebuildOMPIsDevicePtrClause(Vars, Locs);
12193template <
typename Derived>
12195 OMPHasDeviceAddrClause *
C) {
12197 Vars.reserve(
C->varlist_size());
12198 for (
auto *
VE :
C->varlist()) {
12200 if (EVar.isInvalid())
12202 Vars.push_back(EVar.get());
12205 return getDerived().RebuildOMPHasDeviceAddrClause(Vars, Locs);
12208template <
typename Derived>
12212 Vars.reserve(
C->varlist_size());
12213 for (
auto *
VE :
C->varlist()) {
12215 if (EVar.isInvalid())
12217 Vars.push_back(EVar.get());
12219 return getDerived().RebuildOMPNontemporalClause(
12220 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
12223template <
typename Derived>
12227 Vars.reserve(
C->varlist_size());
12228 for (
auto *
VE :
C->varlist()) {
12230 if (EVar.isInvalid())
12232 Vars.push_back(EVar.get());
12234 return getDerived().RebuildOMPInclusiveClause(
12235 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
12238template <
typename Derived>
12242 Vars.reserve(
C->varlist_size());
12243 for (
auto *
VE :
C->varlist()) {
12245 if (EVar.isInvalid())
12247 Vars.push_back(EVar.get());
12249 return getDerived().RebuildOMPExclusiveClause(
12250 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
12253template <
typename Derived>
12255 OMPUsesAllocatorsClause *
C) {
12257 Data.reserve(
C->getNumberOfAllocators());
12258 for (
unsigned I = 0, E =
C->getNumberOfAllocators(); I < E; ++I) {
12259 OMPUsesAllocatorsClause::Data D =
C->getAllocatorData(I);
12261 if (Allocator.isInvalid())
12265 AllocatorTraits = getDerived().TransformExpr(AT);
12266 if (AllocatorTraits.isInvalid())
12270 NewD.Allocator = Allocator.get();
12271 NewD.AllocatorTraits = AllocatorTraits.get();
12275 return getDerived().RebuildOMPUsesAllocatorsClause(
12276 Data,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
12279template <
typename Derived>
12283 Locators.reserve(
C->varlist_size());
12285 if (
Expr *Modifier =
C->getModifier()) {
12286 ModifierRes = getDerived().TransformExpr(Modifier);
12287 if (ModifierRes.isInvalid())
12290 for (
Expr *E :
C->varlist()) {
12291 ExprResult Locator = getDerived().TransformExpr(E);
12292 if (Locator.isInvalid())
12294 Locators.push_back(Locator.get());
12296 return getDerived().RebuildOMPAffinityClause(
12297 C->getBeginLoc(),
C->getLParenLoc(),
C->getColonLoc(),
C->getEndLoc(),
12298 ModifierRes.get(), Locators);
12301template <
typename Derived>
12304 C->getKind(),
C->getKindKwLoc(),
C->getBeginLoc(),
C->getLParenLoc(),
12305 C->getEndLoc(),
C->getModifier(),
C->getModifierKwLoc());
12308template <
typename Derived>
12311 C->getBindKind(),
C->getBindKindLoc(),
C->getBeginLoc(),
12312 C->getLParenLoc(),
C->getEndLoc());
12315template <
typename Derived>
12317 OMPXDynCGroupMemClause *
C) {
12319 if (
Size.isInvalid())
12321 return getDerived().RebuildOMPXDynCGroupMemClause(
12322 Size.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
12325template <
typename Derived>
12327 OMPDynGroupprivateClause *
C) {
12329 if (
Size.isInvalid())
12331 return getDerived().RebuildOMPDynGroupprivateClause(
12332 C->getDynGroupprivateModifier(),
C->getDynGroupprivateFallbackModifier(),
12333 Size.get(),
C->getBeginLoc(),
C->getLParenLoc(),
12334 C->getDynGroupprivateModifierLoc(),
12335 C->getDynGroupprivateFallbackModifierLoc(),
C->getEndLoc());
12338template <
typename Derived>
12342 Vars.reserve(
C->varlist_size());
12343 for (
auto *
VE :
C->varlist()) {
12345 if (EVar.isInvalid())
12347 Vars.push_back(EVar.get());
12349 return getDerived().RebuildOMPDoacrossClause(
12350 C->getDependenceType(),
C->getDependenceLoc(),
C->getColonLoc(), Vars,
12351 C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
12354template <
typename Derived>
12358 for (
auto *A :
C->getAttrs())
12359 NewAttrs.push_back(getDerived().TransformAttr(A));
12360 return getDerived().RebuildOMPXAttributeClause(
12361 NewAttrs,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
12364template <
typename Derived>
12373template <
typename Derived>
12374class OpenACCClauseTransform final
12376 TreeTransform<Derived> &Self;
12377 ArrayRef<const OpenACCClause *> ExistingClauses;
12378 SemaOpenACC::OpenACCParsedClause &ParsedClause;
12379 OpenACCClause *NewClause =
nullptr;
12382 ExprResult Res = Self.TransformExpr(VarRef);
12384 if (!Res.isUsable())
12387 Res = Self.getSema().OpenACC().ActOnVar(ParsedClause.getDirectiveKind(),
12388 ParsedClause.getClauseKind(),
12394 llvm::SmallVector<Expr *> VisitVarList(ArrayRef<Expr *> VarList) {
12395 llvm::SmallVector<Expr *> InstantiatedVarList;
12396 for (Expr *CurVar : VarList) {
12399 if (VarRef.isUsable())
12400 InstantiatedVarList.push_back(VarRef.get());
12403 return InstantiatedVarList;
12407 OpenACCClauseTransform(TreeTransform<Derived> &Self,
12408 ArrayRef<const OpenACCClause *> ExistingClauses,
12409 SemaOpenACC::OpenACCParsedClause &PC)
12410 : Self(Self), ExistingClauses(ExistingClauses), ParsedClause(PC) {}
12412 OpenACCClause *CreatedClause()
const {
return NewClause; }
12414#define VISIT_CLAUSE(CLAUSE_NAME) \
12415 void Visit##CLAUSE_NAME##Clause(const OpenACC##CLAUSE_NAME##Clause &Clause);
12416#include "clang/Basic/OpenACCClauses.def"
12419template <
typename Derived>
12420void OpenACCClauseTransform<Derived>::VisitDefaultClause(
12422 ParsedClause.setDefaultDetails(
C.getDefaultClauseKind());
12425 Self.getSema().getASTContext(), ParsedClause.getDefaultClauseKind(),
12426 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12427 ParsedClause.getEndLoc());
12430template <
typename Derived>
12431void OpenACCClauseTransform<Derived>::VisitIfClause(
const OpenACCIfClause &
C) {
12432 Expr *Cond =
const_cast<Expr *
>(
C.getConditionExpr());
12433 assert(Cond &&
"If constructed with invalid Condition");
12437 if (Res.isInvalid() || !Res.get().second)
12440 ParsedClause.setConditionDetails(Res.get().second);
12443 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12444 ParsedClause.getLParenLoc(), ParsedClause.getConditionExpr(),
12445 ParsedClause.getEndLoc());
12448template <
typename Derived>
12449void OpenACCClauseTransform<Derived>::VisitSelfClause(
12455 for (
Expr *CurVar :
C.getVarList()) {
12458 if (!Res.isUsable())
12461 Res =
Self.getSema().OpenACC().ActOnVar(ParsedClause.getDirectiveKind(),
12462 ParsedClause.getClauseKind(),
12465 if (Res.isUsable())
12466 InstantiatedVarList.push_back(Res.get());
12469 ParsedClause.setVarListDetails(InstantiatedVarList,
12473 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12474 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12475 ParsedClause.getEndLoc());
12478 if (
C.hasConditionExpr()) {
12479 Expr *Cond =
const_cast<Expr *
>(
C.getConditionExpr());
12481 Self.TransformCondition(Cond->getExprLoc(),
nullptr, Cond,
12484 if (Res.isInvalid() || !Res.get().second)
12487 ParsedClause.setConditionDetails(Res.get().second);
12491 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12492 ParsedClause.getLParenLoc(), ParsedClause.getConditionExpr(),
12493 ParsedClause.getEndLoc());
12497template <
typename Derived>
12498void OpenACCClauseTransform<Derived>::VisitNumGangsClause(
12502 for (
Expr *CurIntExpr :
C.getIntExprs()) {
12505 if (!Res.isUsable())
12510 C.getBeginLoc(), Res.get());
12511 if (!Res.isUsable())
12514 InstantiatedIntExprs.push_back(Res.get());
12517 ParsedClause.setIntExprDetails(InstantiatedIntExprs);
12519 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12520 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs(),
12521 ParsedClause.getEndLoc());
12524template <
typename Derived>
12525void OpenACCClauseTransform<Derived>::VisitPrivateClause(
12530 for (
const auto [RefExpr, InitRecipe] :
12531 llvm::zip(
C.getVarList(),
C.getInitRecipes())) {
12534 if (VarRef.isUsable()) {
12535 InstantiatedVarList.push_back(VarRef.get());
12539 if (InitRecipe.isSet())
12540 InitRecipes.push_back(InitRecipe);
12542 InitRecipes.push_back(
12543 Self.getSema().OpenACC().CreatePrivateInitRecipe(VarRef.get()));
12546 ParsedClause.setVarListDetails(InstantiatedVarList,
12550 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12551 ParsedClause.getLParenLoc(), ParsedClause.getVarList(), InitRecipes,
12552 ParsedClause.getEndLoc());
12555template <
typename Derived>
12556void OpenACCClauseTransform<Derived>::VisitHostClause(
12558 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12562 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12563 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12564 ParsedClause.getEndLoc());
12567template <
typename Derived>
12568void OpenACCClauseTransform<Derived>::VisitDeviceClause(
12570 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12574 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12575 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12576 ParsedClause.getEndLoc());
12579template <
typename Derived>
12580void OpenACCClauseTransform<Derived>::VisitFirstPrivateClause(
12585 for (
const auto [RefExpr, InitRecipe] :
12586 llvm::zip(
C.getVarList(),
C.getInitRecipes())) {
12589 if (VarRef.isUsable()) {
12590 InstantiatedVarList.push_back(VarRef.get());
12594 if (InitRecipe.isSet())
12595 InitRecipes.push_back(InitRecipe);
12597 InitRecipes.push_back(
12598 Self.getSema().OpenACC().CreateFirstPrivateInitRecipe(
12602 ParsedClause.setVarListDetails(InstantiatedVarList,
12606 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12607 ParsedClause.getLParenLoc(), ParsedClause.getVarList(), InitRecipes,
12608 ParsedClause.getEndLoc());
12611template <
typename Derived>
12612void OpenACCClauseTransform<Derived>::VisitNoCreateClause(
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>::VisitPresentClause(
12626 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12630 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12631 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12632 ParsedClause.getEndLoc());
12635template <
typename Derived>
12636void OpenACCClauseTransform<Derived>::VisitCopyClause(
12638 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12639 C.getModifierList());
12642 Self.getSema().getASTContext(), ParsedClause.getClauseKind(),
12643 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12644 ParsedClause.getModifierList(), ParsedClause.getVarList(),
12645 ParsedClause.getEndLoc());
12648template <
typename Derived>
12649void OpenACCClauseTransform<Derived>::VisitLinkClause(
12651 llvm_unreachable(
"link clause not valid unless a decl transform");
12654template <
typename Derived>
12655void OpenACCClauseTransform<Derived>::VisitDeviceResidentClause(
12657 llvm_unreachable(
"device_resident clause not valid unless a decl transform");
12659template <
typename Derived>
12660void OpenACCClauseTransform<Derived>::VisitNoHostClause(
12662 llvm_unreachable(
"nohost clause not valid unless a decl transform");
12664template <
typename Derived>
12665void OpenACCClauseTransform<Derived>::VisitBindClause(
12667 llvm_unreachable(
"bind clause not valid unless a decl transform");
12670template <
typename Derived>
12671void OpenACCClauseTransform<Derived>::VisitCopyInClause(
12673 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12674 C.getModifierList());
12677 Self.getSema().getASTContext(), ParsedClause.getClauseKind(),
12678 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12679 ParsedClause.getModifierList(), ParsedClause.getVarList(),
12680 ParsedClause.getEndLoc());
12683template <
typename Derived>
12684void OpenACCClauseTransform<Derived>::VisitCopyOutClause(
12686 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12687 C.getModifierList());
12690 Self.getSema().getASTContext(), ParsedClause.getClauseKind(),
12691 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12692 ParsedClause.getModifierList(), ParsedClause.getVarList(),
12693 ParsedClause.getEndLoc());
12696template <
typename Derived>
12697void OpenACCClauseTransform<Derived>::VisitCreateClause(
12699 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12700 C.getModifierList());
12703 Self.getSema().getASTContext(), ParsedClause.getClauseKind(),
12704 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12705 ParsedClause.getModifierList(), ParsedClause.getVarList(),
12706 ParsedClause.getEndLoc());
12708template <
typename Derived>
12709void OpenACCClauseTransform<Derived>::VisitAttachClause(
12714 llvm::erase_if(VarList, [&](
Expr *E) {
12715 return Self.getSema().OpenACC().CheckVarIsPointerType(
12721 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12722 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12723 ParsedClause.getEndLoc());
12726template <
typename Derived>
12727void OpenACCClauseTransform<Derived>::VisitDetachClause(
12732 llvm::erase_if(VarList, [&](
Expr *E) {
12733 return Self.getSema().OpenACC().CheckVarIsPointerType(
12739 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12740 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12741 ParsedClause.getEndLoc());
12744template <
typename Derived>
12745void OpenACCClauseTransform<Derived>::VisitDeleteClause(
12747 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12750 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12751 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12752 ParsedClause.getEndLoc());
12755template <
typename Derived>
12756void OpenACCClauseTransform<Derived>::VisitUseDeviceClause(
12758 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12761 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12762 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12763 ParsedClause.getEndLoc());
12766template <
typename Derived>
12767void OpenACCClauseTransform<Derived>::VisitDevicePtrClause(
12772 llvm::erase_if(VarList, [&](
Expr *E) {
12773 return Self.getSema().OpenACC().CheckVarIsPointerType(
12779 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12780 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12781 ParsedClause.getEndLoc());
12784template <
typename Derived>
12785void OpenACCClauseTransform<Derived>::VisitNumWorkersClause(
12787 Expr *IntExpr =
const_cast<Expr *
>(
C.getIntExpr());
12788 assert(IntExpr &&
"num_workers clause constructed with invalid int expr");
12791 if (!Res.isUsable())
12796 C.getBeginLoc(), Res.get());
12797 if (!Res.isUsable())
12800 ParsedClause.setIntExprDetails(Res.get());
12802 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12803 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs()[0],
12804 ParsedClause.getEndLoc());
12807template <
typename Derived>
12808void OpenACCClauseTransform<Derived>::VisitDeviceNumClause (
12810 Expr *IntExpr =
const_cast<Expr *
>(
C.getIntExpr());
12811 assert(IntExpr &&
"device_num clause constructed with invalid int expr");
12814 if (!Res.isUsable())
12819 C.getBeginLoc(), Res.get());
12820 if (!Res.isUsable())
12823 ParsedClause.setIntExprDetails(Res.get());
12825 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12826 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs()[0],
12827 ParsedClause.getEndLoc());
12830template <
typename Derived>
12831void OpenACCClauseTransform<Derived>::VisitDefaultAsyncClause(
12833 Expr *IntExpr =
const_cast<Expr *
>(
C.getIntExpr());
12834 assert(IntExpr &&
"default_async clause constructed with invalid int expr");
12837 if (!Res.isUsable())
12842 C.getBeginLoc(), Res.get());
12843 if (!Res.isUsable())
12846 ParsedClause.setIntExprDetails(Res.get());
12848 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12849 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs()[0],
12850 ParsedClause.getEndLoc());
12853template <
typename Derived>
12854void OpenACCClauseTransform<Derived>::VisitVectorLengthClause(
12856 Expr *IntExpr =
const_cast<Expr *
>(
C.getIntExpr());
12857 assert(IntExpr &&
"vector_length clause constructed with invalid int expr");
12860 if (!Res.isUsable())
12865 C.getBeginLoc(), Res.get());
12866 if (!Res.isUsable())
12869 ParsedClause.setIntExprDetails(Res.get());
12871 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12872 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs()[0],
12873 ParsedClause.getEndLoc());
12876template <
typename Derived>
12877void OpenACCClauseTransform<Derived>::VisitAsyncClause(
12879 if (
C.hasIntExpr()) {
12881 if (!Res.isUsable())
12886 C.getBeginLoc(), Res.get());
12887 if (!Res.isUsable())
12889 ParsedClause.setIntExprDetails(Res.get());
12893 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12894 ParsedClause.getLParenLoc(),
12895 ParsedClause.getNumIntExprs() != 0 ? ParsedClause.getIntExprs()[0]
12897 ParsedClause.getEndLoc());
12900template <
typename Derived>
12901void OpenACCClauseTransform<Derived>::VisitWorkerClause(
12903 if (
C.hasIntExpr()) {
12908 if (!Res.isUsable())
12913 C.getBeginLoc(), Res.get());
12914 if (!Res.isUsable())
12916 ParsedClause.setIntExprDetails(Res.get());
12920 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12921 ParsedClause.getLParenLoc(),
12922 ParsedClause.getNumIntExprs() != 0 ? ParsedClause.getIntExprs()[0]
12924 ParsedClause.getEndLoc());
12927template <
typename Derived>
12928void OpenACCClauseTransform<Derived>::VisitVectorClause(
12930 if (
C.hasIntExpr()) {
12935 if (!Res.isUsable())
12940 C.getBeginLoc(), Res.get());
12941 if (!Res.isUsable())
12943 ParsedClause.setIntExprDetails(Res.get());
12947 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12948 ParsedClause.getLParenLoc(),
12949 ParsedClause.getNumIntExprs() != 0 ? ParsedClause.getIntExprs()[0]
12951 ParsedClause.getEndLoc());
12954template <
typename Derived>
12955void OpenACCClauseTransform<Derived>::VisitWaitClause(
12957 if (
C.hasExprs()) {
12958 Expr *DevNumExpr =
nullptr;
12962 if (
C.getDevNumExpr()) {
12964 if (!Res.isUsable())
12968 C.getBeginLoc(), Res.get());
12969 if (!Res.isUsable())
12972 DevNumExpr = Res.get();
12976 for (
Expr *CurQueueIdExpr :
C.getQueueIdExprs()) {
12978 if (!Res.isUsable())
12982 C.getBeginLoc(), Res.get());
12983 if (!Res.isUsable())
12986 InstantiatedQueueIdExprs.push_back(Res.get());
12989 ParsedClause.setWaitDetails(DevNumExpr,
C.getQueuesLoc(),
12990 std::move(InstantiatedQueueIdExprs));
12994 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12995 ParsedClause.getLParenLoc(), ParsedClause.getDevNumExpr(),
12996 ParsedClause.getQueuesLoc(), ParsedClause.getQueueIdExprs(),
12997 ParsedClause.getEndLoc());
13000template <
typename Derived>
13001void OpenACCClauseTransform<Derived>::VisitDeviceTypeClause(
13005 Self.getSema().getASTContext(),
C.getClauseKind(),
13006 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
13007 C.getArchitectures(), ParsedClause.getEndLoc());
13010template <
typename Derived>
13011void OpenACCClauseTransform<Derived>::VisitAutoClause(
13015 ParsedClause.getBeginLoc(),
13016 ParsedClause.getEndLoc());
13019template <
typename Derived>
13020void OpenACCClauseTransform<Derived>::VisitIndependentClause(
13023 ParsedClause.getBeginLoc(),
13024 ParsedClause.getEndLoc());
13027template <
typename Derived>
13028void OpenACCClauseTransform<Derived>::VisitSeqClause(
13031 ParsedClause.getBeginLoc(),
13032 ParsedClause.getEndLoc());
13034template <
typename Derived>
13035void OpenACCClauseTransform<Derived>::VisitFinalizeClause(
13038 ParsedClause.getBeginLoc(),
13039 ParsedClause.getEndLoc());
13042template <
typename Derived>
13043void OpenACCClauseTransform<Derived>::VisitIfPresentClause(
13046 ParsedClause.getBeginLoc(),
13047 ParsedClause.getEndLoc());
13050template <
typename Derived>
13051void OpenACCClauseTransform<Derived>::VisitReductionClause(
13057 for (
const auto [Var, OrigRecipe] :
13058 llvm::zip(TransformedVars,
C.getRecipes())) {
13060 ParsedClause.getDirectiveKind(),
C.getReductionOp(), Var);
13061 if (Res.isUsable()) {
13062 ValidVars.push_back(Res.get());
13064 if (OrigRecipe.isSet())
13065 Recipes.emplace_back(OrigRecipe.AllocaDecl, OrigRecipe.CombinerRecipes);
13067 Recipes.push_back(
Self.getSema().OpenACC().CreateReductionInitRecipe(
13068 C.getReductionOp(), Res.get()));
13072 NewClause =
Self.getSema().OpenACC().CheckReductionClause(
13073 ExistingClauses, ParsedClause.getDirectiveKind(),
13074 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
13075 C.getReductionOp(), ValidVars, Recipes, ParsedClause.getEndLoc());
13078template <
typename Derived>
13079void OpenACCClauseTransform<Derived>::VisitCollapseClause(
13081 Expr *LoopCount =
const_cast<Expr *
>(
C.getLoopCount());
13082 assert(LoopCount &&
"collapse clause constructed with invalid loop count");
13086 if (!NewLoopCount.isUsable())
13089 NewLoopCount =
Self.getSema().OpenACC().ActOnIntExpr(
13091 NewLoopCount.get()->getBeginLoc(), NewLoopCount.get());
13095 if (!NewLoopCount.isUsable())
13099 Self.getSema().OpenACC().CheckCollapseLoopCount(NewLoopCount.get());
13103 if (!NewLoopCount.isUsable())
13106 ParsedClause.setCollapseDetails(
C.hasForce(), NewLoopCount.get());
13108 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
13109 ParsedClause.getLParenLoc(), ParsedClause.isForce(),
13110 ParsedClause.getLoopCount(), ParsedClause.getEndLoc());
13113template <
typename Derived>
13114void OpenACCClauseTransform<Derived>::VisitTileClause(
13119 for (
Expr *E :
C.getSizeExprs()) {
13122 if (!NewSizeExpr.isUsable())
13125 NewSizeExpr =
Self.getSema().OpenACC().ActOnIntExpr(
13127 NewSizeExpr.get()->getBeginLoc(), NewSizeExpr.get());
13131 if (!NewSizeExpr.isUsable())
13134 NewSizeExpr =
Self.getSema().OpenACC().CheckTileSizeExpr(NewSizeExpr.get());
13136 if (!NewSizeExpr.isUsable())
13138 TransformedExprs.push_back(NewSizeExpr.get());
13141 ParsedClause.setIntExprDetails(TransformedExprs);
13143 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
13144 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs(),
13145 ParsedClause.getEndLoc());
13147template <
typename Derived>
13148void OpenACCClauseTransform<Derived>::VisitGangClause(
13153 for (
unsigned I = 0; I <
C.getNumExprs(); ++I) {
13155 if (!ER.isUsable())
13158 ER =
Self.getSema().OpenACC().CheckGangExpr(ExistingClauses,
13159 ParsedClause.getDirectiveKind(),
13160 C.getExpr(I).first, ER.get());
13161 if (!ER.isUsable())
13163 TransformedGangKinds.push_back(
C.getExpr(I).first);
13164 TransformedIntExprs.push_back(ER.get());
13167 NewClause =
Self.getSema().OpenACC().CheckGangClause(
13168 ParsedClause.getDirectiveKind(), ExistingClauses,
13169 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
13170 TransformedGangKinds, TransformedIntExprs, ParsedClause.getEndLoc());
13173template <
typename Derived>
13174OpenACCClause *TreeTransform<Derived>::TransformOpenACCClause(
13179 DirKind, OldClause->getClauseKind(), OldClause->getBeginLoc());
13180 ParsedClause.setEndLoc(OldClause->getEndLoc());
13182 if (
const auto *WithParms = dyn_cast<OpenACCClauseWithParams>(OldClause))
13183 ParsedClause.setLParenLoc(WithParms->getLParenLoc());
13185 OpenACCClauseTransform<Derived> Transform{*
this, ExistingClauses,
13187 Transform.Visit(OldClause);
13189 return Transform.CreatedClause();
13192template <
typename Derived>
13194TreeTransform<Derived>::TransformOpenACCClauseList(
13197 for (
const auto *Clause : OldClauses) {
13198 if (
OpenACCClause *TransformedClause = getDerived().TransformOpenACCClause(
13199 TransformedClauses, DirKind, Clause))
13200 TransformedClauses.push_back(TransformedClause);
13202 return TransformedClauses;
13205template <
typename Derived>
13208 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13211 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
13214 if (getSema().OpenACC().ActOnStartStmtDirective(
13215 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
13220 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
13221 C->clauses(), TransformedClauses);
13222 StmtResult StrBlock = getDerived().TransformStmt(
C->getStructuredBlock());
13223 StrBlock = getSema().OpenACC().ActOnAssociatedStmt(
13224 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses, StrBlock);
13226 return getDerived().RebuildOpenACCComputeConstruct(
13227 C->getDirectiveKind(),
C->getBeginLoc(),
C->getDirectiveLoc(),
13228 C->getEndLoc(), TransformedClauses, StrBlock);
13231template <
typename Derived>
13235 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13238 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
13241 if (getSema().OpenACC().ActOnStartStmtDirective(
13242 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
13247 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
13248 C->clauses(), TransformedClauses);
13250 Loop = getSema().OpenACC().ActOnAssociatedStmt(
13251 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses,
Loop);
13253 return getDerived().RebuildOpenACCLoopConstruct(
13254 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
13255 TransformedClauses,
Loop);
13258template <
typename Derived>
13260 OpenACCCombinedConstruct *
C) {
13261 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13264 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
13267 if (getSema().OpenACC().ActOnStartStmtDirective(
13268 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
13273 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
13274 C->clauses(), TransformedClauses);
13276 Loop = getSema().OpenACC().ActOnAssociatedStmt(
13277 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses,
Loop);
13279 return getDerived().RebuildOpenACCCombinedConstruct(
13280 C->getDirectiveKind(),
C->getBeginLoc(),
C->getDirectiveLoc(),
13281 C->getEndLoc(), TransformedClauses,
Loop);
13284template <
typename Derived>
13287 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13290 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
13292 if (getSema().OpenACC().ActOnStartStmtDirective(
13293 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
13297 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
13298 C->clauses(), TransformedClauses);
13299 StmtResult StrBlock = getDerived().TransformStmt(
C->getStructuredBlock());
13300 StrBlock = getSema().OpenACC().ActOnAssociatedStmt(
13301 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses, StrBlock);
13303 return getDerived().RebuildOpenACCDataConstruct(
13304 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
13305 TransformedClauses, StrBlock);
13308template <
typename Derived>
13310 OpenACCEnterDataConstruct *
C) {
13311 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13314 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
13316 if (getSema().OpenACC().ActOnStartStmtDirective(
13317 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
13320 return getDerived().RebuildOpenACCEnterDataConstruct(
13321 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
13322 TransformedClauses);
13325template <
typename Derived>
13327 OpenACCExitDataConstruct *
C) {
13328 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13331 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
13333 if (getSema().OpenACC().ActOnStartStmtDirective(
13334 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
13337 return getDerived().RebuildOpenACCExitDataConstruct(
13338 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
13339 TransformedClauses);
13342template <
typename Derived>
13344 OpenACCHostDataConstruct *
C) {
13345 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13348 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
13350 if (getSema().OpenACC().ActOnStartStmtDirective(
13351 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
13355 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
13356 C->clauses(), TransformedClauses);
13357 StmtResult StrBlock = getDerived().TransformStmt(
C->getStructuredBlock());
13358 StrBlock = getSema().OpenACC().ActOnAssociatedStmt(
13359 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses, StrBlock);
13361 return getDerived().RebuildOpenACCHostDataConstruct(
13362 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
13363 TransformedClauses, StrBlock);
13366template <
typename Derived>
13369 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13372 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
13374 if (getSema().OpenACC().ActOnStartStmtDirective(
13375 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
13378 return getDerived().RebuildOpenACCInitConstruct(
13379 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
13380 TransformedClauses);
13383template <
typename Derived>
13385 OpenACCShutdownConstruct *
C) {
13386 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13389 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
13391 if (getSema().OpenACC().ActOnStartStmtDirective(
13392 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
13395 return getDerived().RebuildOpenACCShutdownConstruct(
13396 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
13397 TransformedClauses);
13399template <
typename Derived>
13402 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13405 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
13407 if (getSema().OpenACC().ActOnStartStmtDirective(
13408 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
13411 return getDerived().RebuildOpenACCSetConstruct(
13412 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
13413 TransformedClauses);
13416template <
typename Derived>
13418 OpenACCUpdateConstruct *
C) {
13419 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13422 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
13424 if (getSema().OpenACC().ActOnStartStmtDirective(
13425 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
13428 return getDerived().RebuildOpenACCUpdateConstruct(
13429 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
13430 TransformedClauses);
13433template <
typename Derived>
13436 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13439 if (
C->hasDevNumExpr()) {
13440 DevNumExpr = getDerived().TransformExpr(
C->getDevNumExpr());
13442 if (DevNumExpr.isUsable())
13443 DevNumExpr = getSema().OpenACC().ActOnIntExpr(
13445 C->getBeginLoc(), DevNumExpr.get());
13450 for (
Expr *QE :
C->getQueueIdExprs()) {
13451 assert(QE &&
"Null queue id expr?");
13452 ExprResult NewEQ = getDerived().TransformExpr(QE);
13454 if (!NewEQ.isUsable())
13458 C->getBeginLoc(), NewEQ.get());
13459 if (NewEQ.isUsable())
13460 QueueIdExprs.push_back(NewEQ.get());
13464 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
13467 if (getSema().OpenACC().ActOnStartStmtDirective(
13468 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
13471 return getDerived().RebuildOpenACCWaitConstruct(
13472 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getLParenLoc(),
13473 DevNumExpr.isUsable() ? DevNumExpr.get() :
nullptr,
C->getQueuesLoc(),
13474 QueueIdExprs,
C->getRParenLoc(),
C->getEndLoc(), TransformedClauses);
13476template <
typename Derived>
13478 OpenACCCacheConstruct *
C) {
13479 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13482 for (
Expr *Var :
C->getVarList()) {
13483 assert(Var &&
"Null var listexpr?");
13485 ExprResult NewVar = getDerived().TransformExpr(Var);
13487 if (!NewVar.isUsable())
13490 NewVar = getSema().OpenACC().ActOnVar(
13492 if (!NewVar.isUsable())
13495 TransformedVarList.push_back(NewVar.get());
13498 if (getSema().OpenACC().ActOnStartStmtDirective(
C->getDirectiveKind(),
13499 C->getBeginLoc(), {}))
13502 return getDerived().RebuildOpenACCCacheConstruct(
13503 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getLParenLoc(),
13504 C->getReadOnlyLoc(), TransformedVarList,
C->getRParenLoc(),
13508template <
typename Derived>
13510 OpenACCAtomicConstruct *
C) {
13511 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13514 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
13517 if (getSema().OpenACC().ActOnStartStmtDirective(
C->getDirectiveKind(),
13518 C->getBeginLoc(), {}))
13523 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(), {}, {});
13525 StmtResult AssocStmt = getDerived().TransformStmt(
C->getAssociatedStmt());
13526 AssocStmt = getSema().OpenACC().ActOnAssociatedStmt(
13527 C->getBeginLoc(),
C->getDirectiveKind(),
C->getAtomicKind(), {},
13530 return getDerived().RebuildOpenACCAtomicConstruct(
13531 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getAtomicKind(),
13532 C->getEndLoc(), TransformedClauses, AssocStmt);
13535template <
typename Derived>
13538 if (getDerived().AlwaysRebuild())
13547template<
typename Derived>
13550 return TransformExpr(E->getSubExpr());
13553template <
typename Derived>
13556 if (!E->isTypeDependent())
13559 TypeSourceInfo *NewT = getDerived().TransformType(E->getTypeSourceInfo());
13564 if (!getDerived().AlwaysRebuild() && E->getTypeSourceInfo() == NewT)
13567 return getDerived().RebuildSYCLUniqueStableNameExpr(
13568 E->getLocation(), E->getLParenLocation(), E->getRParenLocation(), NewT);
13571template <
typename Derived>
13575 const auto *SKEPAttr = FD->template getAttr<SYCLKernelEntryPointAttr>();
13576 if (!SKEPAttr || SKEPAttr->isInvalidAttr())
13579 ExprResult IdExpr = getDerived().TransformExpr(S->getKernelLaunchIdExpr());
13580 if (IdExpr.isInvalid())
13583 StmtResult Body = getDerived().TransformStmt(S->getOriginalStmt());
13584 if (Body.isInvalid())
13590 if (SR.isInvalid())
13596template <
typename Derived>
13599 assert(
false &&
"not implemented yet");
13603template<
typename Derived>
13606 if (!E->isTypeDependent())
13610 E->getIdentKind());
13613template<
typename Derived>
13617 if (E->getQualifierLoc()) {
13619 = getDerived().TransformNestedNameSpecifierLoc(E->getQualifierLoc());
13625 = cast_or_null<ValueDecl>(getDerived().TransformDecl(E->getLocation(),
13627 if (!ND || ND->isInvalidDecl())
13631 if (E->getFoundDecl() != E->getDecl()) {
13632 Found = cast_or_null<NamedDecl>(
13633 getDerived().TransformDecl(E->getLocation(), E->getFoundDecl()));
13639 if (NameInfo.getName()) {
13640 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
13641 if (!NameInfo.getName())
13645 if (!getDerived().AlwaysRebuild() &&
13646 !E->isCapturedByCopyInLambdaWithExplicitObjectParameter() &&
13647 QualifierLoc == E->getQualifierLoc() && ND == E->getDecl() &&
13648 Found == E->getFoundDecl() &&
13649 NameInfo.getName() == E->getDecl()->getDeclName() &&
13650 !E->hasExplicitTemplateArgs()) {
13660 if (E->hasExplicitTemplateArgs()) {
13661 TemplateArgs = &TransArgs;
13662 TransArgs.setLAngleLoc(E->getLAngleLoc());
13663 TransArgs.setRAngleLoc(E->getRAngleLoc());
13664 if (getDerived().TransformTemplateArguments(E->getTemplateArgs(),
13665 E->getNumTemplateArgs(),
13670 return getDerived().RebuildDeclRefExpr(QualifierLoc, ND, NameInfo,
13671 Found, TemplateArgs);
13674template<
typename Derived>
13680template <
typename Derived>
13686template<
typename Derived>
13692template<
typename Derived>
13698template<
typename Derived>
13704template<
typename Derived>
13710template<
typename Derived>
13713 return getDerived().TransformCallExpr(E);
13716template<
typename Derived>
13721 if (E->isExprPredicate())
13722 ControllingExpr = getDerived().TransformExpr(E->getControllingExpr());
13724 ControllingType = getDerived().TransformType(E->getControllingType());
13726 if (ControllingExpr.isInvalid() && !ControllingType)
13737 AssocTypes.push_back(AssocType);
13739 AssocTypes.push_back(
nullptr);
13743 getDerived().TransformExpr(Assoc.getAssociationExpr());
13744 if (AssocExpr.isInvalid())
13746 AssocExprs.push_back(AssocExpr.get());
13749 if (!ControllingType)
13750 return getDerived().RebuildGenericSelectionExpr(E->getGenericLoc(),
13751 E->getDefaultLoc(),
13753 ControllingExpr.get(),
13756 return getDerived().RebuildGenericSelectionExpr(
13757 E->getGenericLoc(), E->getDefaultLoc(), E->getRParenLoc(),
13758 ControllingType, AssocTypes, AssocExprs);
13761template<
typename Derived>
13764 ExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
13765 if (SubExpr.isInvalid())
13768 if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getSubExpr())
13771 return getDerived().RebuildParenExpr(SubExpr.get(), E->getLParen(),
13778template<
typename Derived>
13782 return getDerived().TransformDependentScopeDeclRefExpr(
13783 DRE,
true,
nullptr);
13785 return getDerived().TransformUnresolvedLookupExpr(
13791template<
typename Derived>
13796 SubExpr = TransformAddressOfOperand(E->
getSubExpr());
13802 if (!getDerived().AlwaysRebuild() && SubExpr.
get() == E->
getSubExpr())
13810template<
typename Derived>
13812TreeTransform<Derived>::TransformOffsetOfExpr(OffsetOfExpr *E) {
13814 TypeSourceInfo *Type = getDerived().TransformType(E->getTypeSourceInfo());
13824 bool ExprChanged =
false;
13826 for (
unsigned I = 0, N = E->getNumComponents(); I != N; ++I) {
13827 const OffsetOfNode &ON = E->getComponent(I);
13828 switch (ON.getKind()) {
13830 Expr *FromIndex = E->getIndexExpr(ON.getArrayExprIndex());
13831 ExprResult Index = getDerived().TransformExpr(FromIndex);
13832 if (Index.isInvalid())
13835 ExprChanged = ExprChanged || Index.get() != FromIndex;
13838 AD.setRBracketLoc(ON.getEndLoc());
13839 Desig.AddDesignator(AD);
13851 Desig.AddDesignator(
13863 if (!getDerived().AlwaysRebuild() &&
13864 Type == E->getTypeSourceInfo() &&
13869 return getDerived().RebuildOffsetOfExpr(E->getOperatorLoc(),
Type, Desig,
13870 E->getRParenLoc());
13873template<
typename Derived>
13876 assert((!E->getSourceExpr() || getDerived().AlreadyTransformed(E->getType())) &&
13877 "opaque value expression requires transformation");
13881template <
typename Derived>
13885 for (
Expr *
C : E->subExpressions()) {
13887 if (NewC.isInvalid())
13893 if (!getDerived().AlwaysRebuild() && !Changed)
13895 return getDerived().RebuildRecoveryExpr(E->getBeginLoc(), E->getEndLoc(),
13899template<
typename Derived>
13909 ExprResult result = getDerived().TransformExpr(newSyntacticForm);
13910 if (result.isInvalid())
return ExprError();
13915 if (result.get()->hasPlaceholderType(BuiltinType::PseudoObject))
13921template<
typename Derived>
13925 if (E->isArgumentType()) {
13932 if (!getDerived().AlwaysRebuild() && OldT == NewT)
13935 return getDerived().RebuildUnaryExprOrTypeTrait(NewT, E->getOperatorLoc(),
13937 E->getSourceRange());
13951 auto *PE = dyn_cast<ParenExpr>(E->getArgumentExpr());
13953 PE ? dyn_cast<DependentScopeDeclRefExpr>(PE->getSubExpr()) :
nullptr)
13954 SubExpr = getDerived().TransformParenDependentScopeDeclRefExpr(
13955 PE, DRE,
false, &RecoveryTSI);
13957 SubExpr = getDerived().TransformExpr(E->getArgumentExpr());
13960 return getDerived().RebuildUnaryExprOrTypeTrait(
13961 RecoveryTSI, E->getOperatorLoc(), E->getKind(), E->getSourceRange());
13962 }
else if (SubExpr.isInvalid())
13965 if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getArgumentExpr())
13968 return getDerived().RebuildUnaryExprOrTypeTrait(SubExpr.get(),
13969 E->getOperatorLoc(),
13971 E->getSourceRange());
13974template<
typename Derived>
13977 ExprResult LHS = getDerived().TransformExpr(E->getLHS());
13978 if (LHS.isInvalid())
13981 ExprResult RHS = getDerived().TransformExpr(E->getRHS());
13982 if (RHS.isInvalid())
13986 if (!getDerived().AlwaysRebuild() &&
13987 LHS.get() == E->getLHS() &&
13988 RHS.get() == E->getRHS())
13991 return getDerived().RebuildArraySubscriptExpr(
13993 E->getLHS()->getBeginLoc(), RHS.get(), E->getRBracketLoc());
13996template <
typename Derived>
14000 if (
Base.isInvalid())
14003 ExprResult RowIdx = getDerived().TransformExpr(E->getRowIdx());
14004 if (RowIdx.isInvalid())
14007 if (!getDerived().AlwaysRebuild() &&
Base.get() == E->getBase() &&
14008 RowIdx.get() == E->getRowIdx())
14011 return getDerived().RebuildMatrixSingleSubscriptExpr(
Base.get(), RowIdx.get(),
14012 E->getRBracketLoc());
14015template <
typename Derived>
14019 if (
Base.isInvalid())
14022 ExprResult RowIdx = getDerived().TransformExpr(E->getRowIdx());
14023 if (RowIdx.isInvalid())
14026 ExprResult ColumnIdx = getDerived().TransformExpr(E->getColumnIdx());
14027 if (ColumnIdx.isInvalid())
14030 if (!getDerived().AlwaysRebuild() &&
Base.get() == E->getBase() &&
14031 RowIdx.get() == E->getRowIdx() && ColumnIdx.get() == E->getColumnIdx())
14034 return getDerived().RebuildMatrixSubscriptExpr(
14035 Base.get(), RowIdx.get(), ColumnIdx.get(), E->getRBracketLoc());
14038template <
typename Derived>
14042 if (
Base.isInvalid())
14046 if (E->getLowerBound()) {
14047 LowerBound = getDerived().TransformExpr(E->getLowerBound());
14048 if (LowerBound.isInvalid())
14053 if (E->getLength()) {
14054 Length = getDerived().TransformExpr(E->getLength());
14055 if (Length.isInvalid())
14060 if (E->isOMPArraySection()) {
14061 if (
Expr *Str = E->getStride()) {
14062 Stride = getDerived().TransformExpr(Str);
14063 if (Stride.isInvalid())
14068 if (!getDerived().AlwaysRebuild() &&
Base.get() == E->getBase() &&
14069 LowerBound.get() == E->getLowerBound() &&
14070 Length.get() == E->getLength() &&
14071 (E->isOpenACCArraySection() || Stride.get() == E->getStride()))
14074 return getDerived().RebuildArraySectionExpr(
14075 E->isOMPArraySection(),
Base.get(), E->getBase()->getEndLoc(),
14076 LowerBound.get(), E->getColonLocFirst(),
14077 E->isOMPArraySection() ? E->getColonLocSecond() :
SourceLocation{},
14078 Length.get(), Stride.get(), E->getRBracketLoc());
14081template <
typename Derived>
14085 if (
Base.isInvalid())
14089 bool ErrorFound =
false;
14090 for (
Expr *
Dim : E->getDimensions()) {
14092 if (DimRes.isInvalid()) {
14096 Dims.push_back(DimRes.get());
14101 return getDerived().RebuildOMPArrayShapingExpr(
Base.get(), E->getLParenLoc(),
14102 E->getRParenLoc(), Dims,
14103 E->getBracketsRanges());
14106template <
typename Derived>
14109 unsigned NumIterators = E->numOfIterators();
14112 bool ErrorFound =
false;
14113 bool NeedToRebuild = getDerived().AlwaysRebuild();
14114 for (
unsigned I = 0; I < NumIterators; ++I) {
14116 Data[I].DeclIdent = D->getIdentifier();
14117 Data[I].DeclIdentLoc = D->getLocation();
14118 if (D->getLocation() == D->getBeginLoc()) {
14120 "Implicit type must be int.");
14122 TypeSourceInfo *TSI = getDerived().TransformType(D->getTypeSourceInfo());
14123 QualType DeclTy = getDerived().TransformType(D->getType());
14130 ErrorFound = ErrorFound ||
14131 !(!D->getTypeSourceInfo() || (
Data[I].
Type.getAsOpaquePtr() &&
14132 !
Data[I].Type.get().isNull())) ||
14133 Begin.isInvalid() || End.isInvalid() || Step.isInvalid();
14136 Data[I].Range.Begin = Begin.get();
14137 Data[I].Range.End = End.get();
14138 Data[I].Range.Step = Step.get();
14139 Data[I].AssignLoc = E->getAssignLoc(I);
14140 Data[I].ColonLoc = E->getColonLoc(I);
14141 Data[I].SecColonLoc = E->getSecondColonLoc(I);
14144 (D->getTypeSourceInfo() &&
Data[I].
Type.get().getTypePtrOrNull() !=
14145 D->getType().getTypePtrOrNull()) ||
14151 if (!NeedToRebuild)
14154 ExprResult Res = getDerived().RebuildOMPIteratorExpr(
14155 E->getIteratorKwLoc(), E->getLParenLoc(), E->getRParenLoc(),
Data);
14156 if (!Res.isUsable())
14159 for (
unsigned I = 0; I < NumIterators; ++I)
14160 getDerived().transformedLocalDecl(E->getIteratorDecl(I),
14161 IE->getIteratorDecl(I));
14165template<
typename Derived>
14174 bool ArgChanged =
false;
14176 if (getDerived().TransformExprs(E->getArgs(), E->getNumArgs(),
true, Args,
14180 if (!getDerived().AlwaysRebuild() &&
14181 Callee.get() == E->getCallee() &&
14187 = ((
Expr *)
Callee.get())->getSourceRange().getBegin();
14190 if (E->hasStoredFPFeatures()) {
14192 getSema().CurFPFeatures =
14194 getSema().FpPragmaStack.CurrentValue = NewOverrides;
14197 return getDerived().RebuildCallExpr(
Callee.get(), FakeLParenLoc,
14199 E->getRParenLoc());
14202template<
typename Derived>
14206 if (
Base.isInvalid())
14210 if (E->hasQualifier()) {
14212 = getDerived().TransformNestedNameSpecifierLoc(E->getQualifierLoc());
14220 = cast_or_null<ValueDecl>(getDerived().TransformDecl(E->getMemberLoc(),
14221 E->getMemberDecl()));
14225 NamedDecl *FoundDecl = E->getFoundDecl();
14226 if (FoundDecl == E->getMemberDecl()) {
14229 FoundDecl = cast_or_null<NamedDecl>(
14230 getDerived().TransformDecl(E->getMemberLoc(), FoundDecl));
14235 if (!getDerived().AlwaysRebuild() &&
14236 Base.get() == E->getBase() &&
14237 QualifierLoc == E->getQualifierLoc() &&
14238 Member == E->getMemberDecl() &&
14239 FoundDecl == E->getFoundDecl() &&
14240 !E->hasExplicitTemplateArgs()) {
14245 getSema().OpenMP().isOpenMPRebuildMemberExpr(
14255 if (E->hasExplicitTemplateArgs()) {
14256 TransArgs.setLAngleLoc(E->getLAngleLoc());
14257 TransArgs.setRAngleLoc(E->getRAngleLoc());
14258 if (getDerived().TransformTemplateArguments(E->getTemplateArgs(),
14259 E->getNumTemplateArgs(),
14272 NamedDecl *FirstQualifierInScope =
nullptr;
14274 if (MemberNameInfo.getName()) {
14275 MemberNameInfo = getDerived().TransformDeclarationNameInfo(MemberNameInfo);
14276 if (!MemberNameInfo.getName())
14280 return getDerived().RebuildMemberExpr(
Base.get(), FakeOperatorLoc,
14287 (E->hasExplicitTemplateArgs()
14288 ? &TransArgs :
nullptr),
14289 FirstQualifierInScope);
14292template<
typename Derived>
14295 ExprResult LHS = getDerived().TransformExpr(E->getLHS());
14296 if (LHS.isInvalid())
14300 getDerived().TransformInitializer(E->getRHS(),
false);
14301 if (RHS.isInvalid())
14304 if (!getDerived().AlwaysRebuild() &&
14305 LHS.get() == E->getLHS() &&
14306 RHS.get() == E->getRHS())
14309 if (E->isCompoundAssignmentOp())
14311 return getDerived().RebuildBinaryOperator(
14312 E->getOperatorLoc(), E->getOpcode(), LHS.get(), RHS.get());
14315 getSema().CurFPFeatures =
14316 NewOverrides.applyOverrides(getSema().getLangOpts());
14317 getSema().FpPragmaStack.CurrentValue = NewOverrides;
14318 return getDerived().RebuildBinaryOperator(E->getOperatorLoc(), E->getOpcode(),
14319 LHS.get(), RHS.get());
14322template <
typename Derived>
14327 ExprResult LHS = getDerived().TransformExpr(
const_cast<Expr*
>(Decomp.LHS));
14328 if (LHS.isInvalid())
14331 ExprResult RHS = getDerived().TransformExpr(
const_cast<Expr*
>(Decomp.RHS));
14332 if (RHS.isInvalid())
14338 bool ChangedAnyLookups =
false;
14339 Expr *PossibleBinOps[] = {E->getSemanticForm(),
14340 const_cast<Expr *
>(Decomp.InnerBinOp)};
14341 for (
Expr *PossibleBinOp : PossibleBinOps) {
14342 auto *Op = dyn_cast<CXXOperatorCallExpr>(PossibleBinOp->IgnoreImplicit());
14345 auto *
Callee = dyn_cast<DeclRefExpr>(Op->getCallee()->IgnoreImplicit());
14351 NamedDecl *
Found = cast_or_null<NamedDecl>(getDerived().TransformDecl(
14352 E->getOperatorLoc(),
Callee->getFoundDecl()));
14356 ChangedAnyLookups =
true;
14357 UnqualLookups.addDecl(
Found);
14360 if (!getDerived().AlwaysRebuild() && !ChangedAnyLookups &&
14361 LHS.get() == Decomp.LHS && RHS.get() == Decomp.RHS) {
14367 const Expr *StopAt[] = {Decomp.LHS, Decomp.RHS};
14372 return getDerived().RebuildCXXRewrittenBinaryOperator(
14373 E->getOperatorLoc(), Decomp.Opcode, UnqualLookups, LHS.get(), RHS.get());
14376template<
typename Derived>
14382 getSema().CurFPFeatures =
14383 NewOverrides.applyOverrides(getSema().getLangOpts());
14384 getSema().FpPragmaStack.CurrentValue = NewOverrides;
14385 return getDerived().TransformBinaryOperator(E);
14388template<
typename Derived>
14394 ExprResult commonExpr = getDerived().TransformExpr(e->getCommon());
14395 if (commonExpr.isInvalid())
14398 ExprResult rhs = getDerived().TransformExpr(e->getFalseExpr());
14399 if (rhs.isInvalid())
14402 if (!getDerived().AlwaysRebuild() &&
14403 commonExpr.get() == e->getCommon() &&
14404 rhs.get() == e->getFalseExpr())
14407 return getDerived().RebuildConditionalOperator(commonExpr.get(),
14408 e->getQuestionLoc(),
14414template<
typename Derived>
14417 ExprResult Cond = getDerived().TransformExpr(E->getCond());
14418 if (Cond.isInvalid())
14421 ExprResult LHS = getDerived().TransformExpr(E->getLHS());
14422 if (LHS.isInvalid())
14425 ExprResult RHS = getDerived().TransformExpr(E->getRHS());
14426 if (RHS.isInvalid())
14429 if (!getDerived().AlwaysRebuild() &&
14430 Cond.get() == E->getCond() &&
14431 LHS.get() == E->getLHS() &&
14432 RHS.get() == E->getRHS())
14435 return getDerived().RebuildConditionalOperator(Cond.get(),
14436 E->getQuestionLoc(),
14442template<
typename Derived>
14447 return getDerived().
TransformExpr(E->getSubExprAsWritten());
14450template<
typename Derived>
14458 = getDerived().TransformExpr(E->getSubExprAsWritten());
14459 if (SubExpr.isInvalid())
14462 if (!getDerived().AlwaysRebuild() &&
14463 Type == E->getTypeInfoAsWritten() &&
14464 SubExpr.get() == E->getSubExpr())
14467 return getDerived().RebuildCStyleCastExpr(E->getLParenLoc(),
14473template<
typename Derived>
14481 ExprResult Init = getDerived().TransformExpr(E->getInitializer());
14482 if (
Init.isInvalid())
14485 if (!getDerived().AlwaysRebuild() &&
14487 Init.get() == E->getInitializer())
14494 return getDerived().RebuildCompoundLiteralExpr(
14495 E->getLParenLoc(), NewT,
14496 E->getInitializer()->getEndLoc(),
Init.get());
14499template<
typename Derived>
14503 if (
Base.isInvalid())
14506 if (!getDerived().AlwaysRebuild() &&
14507 Base.get() == E->getBase())
14513 return getDerived().RebuildExtVectorOrMatrixElementExpr(
14514 Base.get(), FakeOperatorLoc, E->isArrow(), E->getAccessorLoc(),
14518template <
typename Derived>
14522 if (
Base.isInvalid())
14525 if (!getDerived().AlwaysRebuild() &&
Base.get() == E->getBase())
14531 return getDerived().RebuildExtVectorOrMatrixElementExpr(
14532 Base.get(), FakeOperatorLoc,
false, E->getAccessorLoc(),
14536template<
typename Derived>
14542 bool InitChanged =
false;
14548 if (getDerived().TransformExprs(E->getInits(), E->getNumInits(),
false,
14549 Inits, &InitChanged))
14552 if (!getDerived().AlwaysRebuild() && !InitChanged) {
14559 return getDerived().RebuildInitList(E->getLBraceLoc(),
Inits,
14560 E->getRBraceLoc(), E->isExplicit());
14563template<
typename Derived>
14570 if (
Init.isInvalid())
14575 bool ExprChanged =
false;
14577 if (D.isFieldDesignator()) {
14578 if (D.getFieldDecl()) {
14580 getDerived().TransformDecl(D.getFieldLoc(), D.getFieldDecl()));
14581 if (Field != D.getFieldDecl())
14584 ExprChanged =
true;
14585 if (
Field->isAnonymousStructOrUnion())
14591 ExprChanged =
true;
14594 D.getFieldName(), D.getDotLoc(), D.getFieldLoc()));
14598 if (D.isArrayDesignator()) {
14599 ExprResult Index = getDerived().TransformExpr(E->getArrayIndex(D));
14600 if (Index.isInvalid())
14603 Desig.AddDesignator(
14606 ExprChanged = ExprChanged || Index.get() != E->getArrayIndex(D);
14607 ArrayExprs.push_back(Index.get());
14611 assert(D.isArrayRangeDesignator() &&
"New kind of designator?");
14613 = getDerived().TransformExpr(E->getArrayRangeStart(D));
14614 if (Start.isInvalid())
14617 ExprResult End = getDerived().TransformExpr(E->getArrayRangeEnd(D));
14618 if (End.isInvalid())
14622 Start.get(), End.get(), D.getLBracketLoc(), D.getEllipsisLoc()));
14624 ExprChanged = ExprChanged || Start.get() != E->getArrayRangeStart(D) ||
14625 End.get() != E->getArrayRangeEnd(D);
14627 ArrayExprs.push_back(Start.get());
14628 ArrayExprs.push_back(End.get());
14631 if (!getDerived().AlwaysRebuild() &&
14632 Init.get() == E->getInit() &&
14636 return getDerived().RebuildDesignatedInitExpr(Desig, ArrayExprs,
14637 E->getEqualOrColonLoc(),
14638 E->usesGNUSyntax(),
Init.get());
14643template<
typename Derived>
14647 llvm_unreachable(
"Unexpected DesignatedInitUpdateExpr in syntactic form of "
14652template<
typename Derived>
14656 llvm_unreachable(
"Unexpected NoInitExpr in syntactic form of initializer");
14660template<
typename Derived>
14663 llvm_unreachable(
"Unexpected ArrayInitLoopExpr outside of initializer");
14667template<
typename Derived>
14670 llvm_unreachable(
"Unexpected ArrayInitIndexExpr outside of initializer");
14674template<
typename Derived>
14682 QualType T = getDerived().TransformType(E->getType());
14686 if (!getDerived().AlwaysRebuild() &&
14690 return getDerived().RebuildImplicitValueInitExpr(
T);
14693template<
typename Derived>
14696 TypeSourceInfo *TInfo = getDerived().TransformType(E->getWrittenTypeInfo());
14700 ExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
14701 if (SubExpr.isInvalid())
14704 if (!getDerived().AlwaysRebuild() &&
14705 TInfo == E->getWrittenTypeInfo() &&
14706 SubExpr.get() == E->getSubExpr())
14709 return getDerived().RebuildVAArgExpr(E->getBuiltinLoc(), SubExpr.get(),
14710 TInfo, E->getRParenLoc());
14713template<
typename Derived>
14716 bool ArgumentChanged =
false;
14718 if (TransformExprs(E->getExprs(), E->getNumExprs(),
true,
Inits,
14722 return getDerived().RebuildParenListExpr(E->getLParenLoc(),
14724 E->getRParenLoc());
14732template<
typename Derived>
14735 Decl *LD = getDerived().TransformDecl(E->getLabel()->getLocation(),
14740 return getDerived().RebuildAddrLabelExpr(E->getAmpAmpLoc(), E->getLabelLoc(),
14744template<
typename Derived>
14749 = getDerived().TransformCompoundStmt(E->getSubStmt(),
true);
14750 if (SubStmt.isInvalid()) {
14755 unsigned OldDepth = E->getTemplateDepth();
14756 unsigned NewDepth = getDerived().TransformTemplateDepth(OldDepth);
14758 if (!getDerived().AlwaysRebuild() && OldDepth == NewDepth &&
14759 SubStmt.get() == E->getSubStmt()) {
14765 return getDerived().RebuildStmtExpr(E->getLParenLoc(), SubStmt.get(),
14766 E->getRParenLoc(), NewDepth);
14769template<
typename Derived>
14772 ExprResult Cond = getDerived().TransformExpr(E->getCond());
14773 if (Cond.isInvalid())
14776 ExprResult LHS = getDerived().TransformExpr(E->getLHS());
14777 if (LHS.isInvalid())
14780 ExprResult RHS = getDerived().TransformExpr(E->getRHS());
14781 if (RHS.isInvalid())
14784 if (!getDerived().AlwaysRebuild() &&
14785 Cond.get() == E->getCond() &&
14786 LHS.get() == E->getLHS() &&
14787 RHS.get() == E->getRHS())
14790 return getDerived().RebuildChooseExpr(E->getBuiltinLoc(),
14791 Cond.get(), LHS.get(), RHS.get(),
14792 E->getRParenLoc());
14795template<
typename Derived>
14801template<
typename Derived>
14804 switch (E->getOperator()) {
14808 case OO_Array_Delete:
14809 llvm_unreachable(
"new and delete operators cannot use CXXOperatorCallExpr");
14814 assert(E->getNumArgs() >= 1 &&
"Object call is missing arguments");
14827 if (FakeLParenLoc.isInvalid() && EndLoc.isValid())
14828 FakeLParenLoc = EndLoc;
14832 if (getDerived().TransformExprs(E->getArgs() + 1, E->getNumArgs() - 1,
true,
14836 if (E->getOperator() == OO_Subscript)
14837 return getDerived().RebuildCxxSubscriptExpr(
Object.get(), FakeLParenLoc,
14838 Args, E->getEndLoc());
14840 return getDerived().RebuildCallExpr(
Object.get(), FakeLParenLoc, Args,
14844#define OVERLOADED_OPERATOR(Name, Spelling, Token, Unary, Binary, MemberOnly) \
14848#define OVERLOADED_OPERATOR_MULTI(Name,Spelling,Unary,Binary,MemberOnly)
14849#include "clang/Basic/OperatorKinds.def"
14851 case OO_Conditional:
14852 llvm_unreachable(
"conditional operator is not actually overloadable");
14856 llvm_unreachable(
"not an overloaded operator?");
14860 if (E->getNumArgs() == 1 && E->getOperator() == OO_Amp)
14861 First = getDerived().TransformAddressOfOperand(E->getArg(0));
14863 First = getDerived().TransformExpr(E->getArg(0));
14864 if (
First.isInvalid())
14868 if (E->getNumArgs() == 2) {
14870 getDerived().TransformInitializer(E->getArg(1),
false);
14871 if (Second.isInvalid())
14877 getSema().CurFPFeatures =
14878 NewOverrides.applyOverrides(getSema().getLangOpts());
14879 getSema().FpPragmaStack.CurrentValue = NewOverrides;
14885 if (getDerived().TransformOverloadExprDecls(ULE, ULE->requiresADL(), R))
14888 return getDerived().RebuildCXXOperatorCallExpr(
14889 E->getOperator(), E->getOperatorLoc(),
Callee->getBeginLoc(),
14890 ULE->requiresADL(),
R.asUnresolvedSet(),
First.get(), Second.get());
14895 Callee = ICE->getSubExprAsWritten();
14897 ValueDecl *VD = cast_or_null<ValueDecl>(
14898 getDerived().TransformDecl(DR->getLocation(), DR));
14903 Functions.addDecl(VD);
14905 return getDerived().RebuildCXXOperatorCallExpr(
14906 E->getOperator(), E->getOperatorLoc(),
Callee->getBeginLoc(),
14907 false, Functions,
First.get(), Second.get());
14910template<
typename Derived>
14913 return getDerived().TransformCallExpr(E);
14916template <
typename Derived>
14919 getSema().CurContext != E->getParentContext();
14921 if (!getDerived().AlwaysRebuild() && !NeedRebuildFunc)
14924 return getDerived().RebuildSourceLocExpr(E->getIdentKind(), E->getType(),
14925 E->getBeginLoc(), E->getEndLoc(),
14926 getSema().CurContext);
14929template <
typename Derived>
14934template<
typename Derived>
14943 ExprResult EC = getDerived().TransformCallExpr(E->getConfig());
14944 if (EC.isInvalid())
14948 bool ArgChanged =
false;
14950 if (getDerived().TransformExprs(E->getArgs(), E->getNumArgs(),
true, Args,
14954 if (!getDerived().AlwaysRebuild() &&
14955 Callee.get() == E->getCallee() &&
14961 = ((
Expr *)
Callee.get())->getSourceRange().getBegin();
14962 return getDerived().RebuildCallExpr(
Callee.get(), FakeLParenLoc,
14964 E->getRParenLoc(), EC.get());
14967template<
typename Derived>
14983 return getDerived().RebuildCXXNamedCastExpr(
14990template<
typename Derived>
14999 if (Sub.isInvalid())
15002 return getDerived().RebuildBuiltinBitCastExpr(BCE->
getBeginLoc(), TSI,
15006template<
typename Derived>
15008TreeTransform<Derived>::TransformCXXStaticCastExpr(CXXStaticCastExpr *E) {
15009 return getDerived().TransformCXXNamedCastExpr(E);
15012template<
typename Derived>
15018template<
typename Derived>
15025template<
typename Derived>
15031template<
typename Derived>
15037template<
typename Derived>
15042 getDerived().TransformTypeWithDeducedTST(E->getTypeInfoAsWritten());
15047 = getDerived().TransformExpr(E->getSubExprAsWritten());
15048 if (SubExpr.isInvalid())
15051 if (!getDerived().AlwaysRebuild() &&
15052 Type == E->getTypeInfoAsWritten() &&
15053 SubExpr.get() == E->getSubExpr())
15056 return getDerived().RebuildCXXFunctionalCastExpr(
Type,
15060 E->isListInitialization());
15063template<
typename Derived>
15066 if (E->isTypeOperand()) {
15068 = getDerived().TransformType(E->getTypeOperandSourceInfo());
15072 if (!getDerived().AlwaysRebuild() &&
15073 TInfo == E->getTypeOperandSourceInfo())
15076 return getDerived().RebuildCXXTypeidExpr(E->getType(), E->getBeginLoc(),
15077 TInfo, E->getEndLoc());
15083 Expr *Op = E->getExprOperand();
15085 if (E->isGLValue()) {
15087 if (
auto *RD = OpType->getAsCXXRecordDecl()) {
15089 diag::err_incomplete_typeid))
15092 if (RD->isPolymorphic())
15100 ExprResult SubExpr = getDerived().TransformExpr(Op);
15101 if (SubExpr.isInvalid())
15104 if (!getDerived().AlwaysRebuild() &&
15105 SubExpr.get() == E->getExprOperand())
15108 return getDerived().RebuildCXXTypeidExpr(E->getType(), E->getBeginLoc(),
15109 SubExpr.get(), E->getEndLoc());
15112template<
typename Derived>
15115 if (E->isTypeOperand()) {
15117 = getDerived().TransformType(E->getTypeOperandSourceInfo());
15121 if (!getDerived().AlwaysRebuild() &&
15122 TInfo == E->getTypeOperandSourceInfo())
15125 return getDerived().RebuildCXXUuidofExpr(E->getType(), E->getBeginLoc(),
15126 TInfo, E->getEndLoc());
15132 ExprResult SubExpr = getDerived().TransformExpr(E->getExprOperand());
15133 if (SubExpr.isInvalid())
15136 if (!getDerived().AlwaysRebuild() &&
15137 SubExpr.get() == E->getExprOperand())
15140 return getDerived().RebuildCXXUuidofExpr(E->getType(), E->getBeginLoc(),
15141 SubExpr.get(), E->getEndLoc());
15144template<
typename Derived>
15150template<
typename Derived>
15157template<
typename Derived>
15173 auto &S = getSema();
15174 if (E->isCapturedByCopyInLambdaWithExplicitObjectParameter())
15175 return S.getCurrentThisType();
15176 if (S.getCurLambda())
15177 return getDerived().TransformType(E->getType());
15178 return S.getCurrentThisType();
15181 if (!getDerived().AlwaysRebuild() &&
T == E->getType() &&
15182 !E->isCapturedByCopyInLambdaWithExplicitObjectParameter()) {
15185 getSema().MarkThisReferenced(E);
15189 return getDerived().RebuildCXXThisExpr(E->getBeginLoc(),
T, E->isImplicit());
15192template<
typename Derived>
15195 ExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
15196 if (SubExpr.isInvalid())
15199 getSema().DiagnoseExceptionUse(E->getThrowLoc(),
false);
15201 if (!getDerived().AlwaysRebuild() &&
15202 SubExpr.get() == E->getSubExpr())
15205 return getDerived().RebuildCXXThrowExpr(E->getThrowLoc(), SubExpr.get(),
15206 E->isThrownVariableInScope());
15209template<
typename Derived>
15213 getDerived().TransformDecl(E->getBeginLoc(), E->getParam()));
15218 if (E->hasRewrittenInit()) {
15219 InitRes = getDerived().TransformExpr(E->getRewrittenExpr());
15220 if (InitRes.isInvalid())
15224 if (!getDerived().AlwaysRebuild() && Param == E->getParam() &&
15225 E->getUsedContext() == SemaRef.
CurContext &&
15226 InitRes.get() == E->getRewrittenExpr())
15229 return getDerived().RebuildCXXDefaultArgExpr(E->getUsedLocation(), Param,
15233template<
typename Derived>
15237 getDerived().TransformDecl(E->getBeginLoc(), E->getField()));
15241 if (!getDerived().AlwaysRebuild() && Field == E->getField() &&
15245 return getDerived().RebuildCXXDefaultInitExpr(E->getExprLoc(), Field);
15248template<
typename Derived>
15252 TypeSourceInfo *
T = getDerived().TransformType(E->getTypeSourceInfo());
15256 if (!getDerived().AlwaysRebuild() &&
15257 T == E->getTypeSourceInfo())
15260 return getDerived().RebuildCXXScalarValueInitExpr(
T,
15261 T->getTypeLoc().getEndLoc(),
15262 E->getRParenLoc());
15265template<
typename Derived>
15270 getDerived().TransformTypeWithDeducedTST(E->getAllocatedTypeSourceInfo());
15271 if (!AllocTypeInfo)
15275 std::optional<Expr *> ArraySize;
15276 if (E->isArray()) {
15278 if (std::optional<Expr *> OldArraySize = E->getArraySize()) {
15279 NewArraySize = getDerived().TransformExpr(*OldArraySize);
15280 if (NewArraySize.isInvalid())
15283 ArraySize = NewArraySize.get();
15287 bool ArgumentChanged =
false;
15289 if (getDerived().TransformExprs(E->getPlacementArgs(),
15290 E->getNumPlacementArgs(),
true,
15291 PlacementArgs, &ArgumentChanged))
15295 Expr *OldInit = E->getInitializer();
15298 NewInit = getDerived().TransformInitializer(OldInit,
true);
15299 if (NewInit.isInvalid())
15304 if (E->getOperatorNew()) {
15305 OperatorNew = cast_or_null<FunctionDecl>(
15306 getDerived().TransformDecl(E->getBeginLoc(), E->getOperatorNew()));
15312 if (E->getOperatorDelete()) {
15313 OperatorDelete = cast_or_null<FunctionDecl>(
15314 getDerived().TransformDecl(E->getBeginLoc(), E->getOperatorDelete()));
15315 if (!OperatorDelete)
15319 if (!getDerived().AlwaysRebuild() &&
15320 AllocTypeInfo == E->getAllocatedTypeSourceInfo() &&
15321 ArraySize == E->getArraySize() &&
15322 NewInit.get() == OldInit &&
15323 OperatorNew == E->getOperatorNew() &&
15324 OperatorDelete == E->getOperatorDelete() &&
15325 !ArgumentChanged) {
15330 if (OperatorDelete)
15333 if (E->isArray() && !E->getAllocatedType()->isDependentType()) {
15345 QualType AllocType = AllocTypeInfo->getType();
15356 = dyn_cast<ConstantArrayType>(ArrayT)) {
15360 AllocType = ConsArrayT->getElementType();
15362 = dyn_cast<DependentSizedArrayType>(ArrayT)) {
15363 if (DepArrayT->getSizeExpr()) {
15364 ArraySize = DepArrayT->getSizeExpr();
15365 AllocType = DepArrayT->getElementType();
15370 return getDerived().RebuildCXXNewExpr(
15371 E->getBeginLoc(), E->isGlobalNew(),
15372 E->getBeginLoc(), PlacementArgs,
15373 E->getBeginLoc(), E->getTypeIdParens(), AllocType,
15374 AllocTypeInfo, ArraySize, E->getDirectInitRange(), NewInit.get());
15377template<
typename Derived>
15386 if (E->getOperatorDelete()) {
15387 OperatorDelete = cast_or_null<FunctionDecl>(
15388 getDerived().TransformDecl(E->getBeginLoc(), E->getOperatorDelete()));
15389 if (!OperatorDelete)
15393 if (!getDerived().AlwaysRebuild() &&
15394 Operand.get() == E->getArgument() &&
15395 OperatorDelete == E->getOperatorDelete()) {
15398 if (OperatorDelete)
15401 if (!E->getArgument()->isTypeDependent()) {
15403 E->getDestroyedType());
15412 return getDerived().RebuildCXXDeleteExpr(
15413 E->getBeginLoc(), E->isGlobalDelete(), E->isArrayForm(),
Operand.get());
15416template<
typename Derived>
15421 if (
Base.isInvalid())
15425 bool MayBePseudoDestructor =
false;
15427 E->getOperatorLoc(),
15428 E->isArrow()? tok::arrow : tok::period,
15430 MayBePseudoDestructor);
15431 if (
Base.isInvalid())
15434 QualType ObjectType = ObjectTypePtr.get();
15436 if (QualifierLoc) {
15438 = getDerived().TransformNestedNameSpecifierLoc(QualifierLoc, ObjectType);
15443 SS.
Adopt(QualifierLoc);
15446 if (E->getDestroyedTypeInfo()) {
15447 TypeSourceInfo *DestroyedTypeInfo = getDerived().TransformTypeInObjectScope(
15448 E->getDestroyedTypeInfo(), ObjectType,
15450 if (!DestroyedTypeInfo)
15453 }
else if (!ObjectType.isNull() && ObjectType->isDependentType()) {
15457 E->getDestroyedTypeLoc());
15461 *E->getDestroyedTypeIdentifier(), E->getDestroyedTypeLoc(),
15462 nullptr, SS, ObjectTypePtr,
false);
15468 E->getDestroyedTypeLoc());
15472 if (E->getScopeTypeInfo()) {
15473 ScopeTypeInfo = getDerived().TransformTypeInObjectScope(
15474 E->getScopeTypeInfo(), ObjectType,
nullptr);
15475 if (!ScopeTypeInfo)
15479 return getDerived().RebuildCXXPseudoDestructorExpr(
Base.get(),
15480 E->getOperatorLoc(),
15484 E->getColonColonLoc(),
15489template <
typename Derived>
15494 bool AllEmptyPacks =
true;
15495 for (
auto *OldD : Old->
decls()) {
15511 if (
auto *UPD = dyn_cast<UsingPackDecl>(InstD))
15512 Decls = UPD->expansions();
15515 for (
auto *D : Decls) {
15516 if (
auto *UD = dyn_cast<UsingDecl>(D)) {
15517 for (
auto *SD : UD->shadows())
15524 AllEmptyPacks &= Decls.empty();
15533 if (AllEmptyPacks && !RequiresADL) {
15544 NamedDecl *FoundDecl = R.getRepresentativeDecl()->getUnderlyingDecl();
15545 getSema().FilterAcceptableTemplateNames(R,
15551 getSema().Diag(R.getNameLoc(),
15552 diag::err_template_kw_refers_to_non_template)
15556 diag::note_template_kw_refers_to_non_template)
15557 << R.getLookupName();
15565template <
typename Derived>
15571template <
typename Derived>
15574 bool IsAddressOfOperand) {
15579 if (TransformOverloadExprDecls(Old, Old->
requiresADL(), R))
15586 = getDerived().TransformNestedNameSpecifierLoc(Old->
getQualifierLoc());
15590 SS.
Adopt(QualifierLoc);
15594 CXXRecordDecl *NamingClass
15595 = cast_or_null<CXXRecordDecl>(getDerived().TransformDecl(
15598 if (!NamingClass) {
15603 R.setNamingClass(NamingClass);
15624 SS, TemplateKWLoc, R,
15631 return getDerived().RebuildDeclarationNameExpr(SS, R, Old->
requiresADL());
15634 return getDerived().RebuildTemplateIdExpr(SS, TemplateKWLoc, R,
15638template<
typename Derived>
15641 bool ArgChanged =
false;
15643 for (
unsigned I = 0, N = E->getNumArgs(); I != N; ++I) {
15645 TypeLoc FromTL = From->getTypeLoc();
15648 TLB.
reserve(FromTL.getFullDataSize());
15649 QualType To = getDerived().TransformType(TLB, FromTL);
15653 if (To == From->getType())
15654 Args.push_back(From);
15656 Args.push_back(TLB.getTypeSourceInfo(SemaRef.
Context, To));
15666 TypeLoc PatternTL = ExpansionTL.getPatternLoc();
15672 bool Expand =
true;
15673 bool RetainExpansion =
false;
15675 ExpansionTL.getTypePtr()->getNumExpansions();
15677 if (getDerived().TryExpandParameterPacks(
15678 ExpansionTL.getEllipsisLoc(), PatternTL.getSourceRange(),
15679 Unexpanded,
true, Expand,
15680 RetainExpansion, NumExpansions))
15690 TLB.
reserve(From->getTypeLoc().getFullDataSize());
15692 QualType To = getDerived().TransformType(TLB, PatternTL);
15696 To = getDerived().RebuildPackExpansionType(To,
15697 PatternTL.getSourceRange(),
15698 ExpansionTL.getEllipsisLoc(),
15706 Args.push_back(TLB.getTypeSourceInfo(SemaRef.
Context, To));
15712 for (
unsigned I = 0; I != *NumExpansions; ++I) {
15715 TLB.
reserve(PatternTL.getFullDataSize());
15716 QualType To = getDerived().TransformType(TLB, PatternTL);
15720 if (To->containsUnexpandedParameterPack()) {
15721 To = getDerived().RebuildPackExpansionType(To,
15722 PatternTL.getSourceRange(),
15723 ExpansionTL.getEllipsisLoc(),
15733 Args.push_back(TLB.getTypeSourceInfo(SemaRef.
Context, To));
15736 if (!RetainExpansion)
15741 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
15744 TLB.
reserve(From->getTypeLoc().getFullDataSize());
15746 QualType To = getDerived().TransformType(TLB, PatternTL);
15750 To = getDerived().RebuildPackExpansionType(To,
15751 PatternTL.getSourceRange(),
15752 ExpansionTL.getEllipsisLoc(),
15760 Args.push_back(TLB.getTypeSourceInfo(SemaRef.
Context, To));
15763 if (!getDerived().AlwaysRebuild() && !ArgChanged)
15766 return getDerived().RebuildTypeTrait(E->getTrait(), E->getBeginLoc(), Args,
15770template<
typename Derived>
15776 if (getDerived().TransformTemplateArguments(Old->getTemplateArgs(),
15777 Old->NumTemplateArgs, TransArgs))
15780 return getDerived().RebuildConceptSpecializationExpr(
15781 E->getNestedNameSpecifierLoc(), E->getTemplateKWLoc(),
15782 E->getConceptNameInfo(), E->getFoundDecl(), E->getConceptDecl(),
15786template<
typename Derived>
15800 getSema().Context, getSema().CurContext,
15801 E->getBody()->getBeginLoc());
15805 ExprResult TypeParamResult = getDerived().TransformRequiresTypeParams(
15806 E->getRequiresKWLoc(), E->getRBraceLoc(), E, Body,
15807 E->getLocalParameters(), TransParamTypes, TransParams, ExtParamInfos);
15811 Param->setDeclContext(Body);
15817 if (!TypeParamResult.isUnset())
15818 return TypeParamResult;
15821 if (getDerived().TransformRequiresExprRequirements(E->getRequirements(),
15826 if (
auto *ER = dyn_cast<concepts::ExprRequirement>(Req)) {
15827 if (ER->getReturnTypeRequirement().isTypeConstraint()) {
15828 ER->getReturnTypeRequirement()
15829 .getTypeConstraintTemplateParameterList()->getParam(0)
15830 ->setDeclContext(Body);
15835 return getDerived().RebuildRequiresExpr(
15836 E->getRequiresKWLoc(), Body, E->getLParenLoc(), TransParams,
15837 E->getRParenLoc(), TransReqs, E->getRBraceLoc());
15840template<
typename Derived>
15846 if (
auto *TypeReq = dyn_cast<concepts::TypeRequirement>(Req))
15847 TransReq =
getDerived().TransformTypeRequirement(TypeReq);
15848 else if (
auto *ExprReq = dyn_cast<concepts::ExprRequirement>(Req))
15849 TransReq =
getDerived().TransformExprRequirement(ExprReq);
15851 TransReq =
getDerived().TransformNestedRequirement(
15855 Transformed.push_back(TransReq);
15860template<
typename Derived>
15873 return getDerived().RebuildTypeRequirement(TransType);
15876template<
typename Derived>
15879 llvm::PointerUnion<Expr *, concepts::Requirement::SubstitutionDiagnostic *> TransExpr;
15885 TransExprRes =
SemaRef.CheckPlaceholderExpr(TransExprRes.
get());
15888 TransExpr = TransExprRes.
get();
15891 std::optional<concepts::ExprRequirement::ReturnTypeRequirement> TransRetReq;
15893 if (RetReq.isEmpty())
15894 TransRetReq.emplace();
15895 else if (RetReq.isSubstitutionFailure())
15896 TransRetReq.emplace(RetReq.getSubstitutionDiagnostic());
15897 else if (RetReq.isTypeConstraint()) {
15899 RetReq.getTypeConstraintTemplateParameterList();
15901 getDerived().TransformTemplateParameterList(OrigTPL);
15904 TransRetReq.emplace(TPL);
15906 assert(TransRetReq &&
"All code paths leading here must set TransRetReq");
15907 if (
Expr *E = dyn_cast<Expr *>(TransExpr))
15910 std::move(*TransRetReq));
15916template<
typename Derived>
15922 return getDerived().RebuildNestedRequirement(
15930 return getDerived().RebuildNestedRequirement(TransConstraint.
get());
15933template<
typename Derived>
15940 if (!getDerived().AlwaysRebuild() &&
15957template<
typename Derived>
15964 SubExpr = getDerived().TransformExpr(E->getQueriedExpression());
15965 if (SubExpr.isInvalid())
15968 if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getQueriedExpression())
15972 return getDerived().RebuildExpressionTrait(E->getTrait(), E->getBeginLoc(),
15973 SubExpr.get(), E->getEndLoc());
15976template <
typename Derived>
15981 DRE, AddrTaken, RecoveryTSI);
15994template <
typename Derived>
16001template <
typename Derived>
16017 getDerived().TransformDeclarationNameInfo(E->
getNameInfo());
16022 if (!getDerived().AlwaysRebuild() && QualifierLoc == E->
getQualifierLoc() &&
16028 return getDerived().RebuildDependentScopeDeclRefExpr(
16029 QualifierLoc, TemplateKWLoc, NameInfo,
nullptr,
16030 IsAddressOfOperand, RecoveryTSI);
16034 if (getDerived().TransformTemplateArguments(
16038 return getDerived().RebuildDependentScopeDeclRefExpr(
16039 QualifierLoc, TemplateKWLoc, NameInfo, &TransArgs, IsAddressOfOperand,
16043template<
typename Derived>
16049 if (getDerived().AllowSkippingCXXConstructExpr() &&
16050 ((E->getNumArgs() == 1 ||
16051 (E->getNumArgs() > 1 && getDerived().DropCallArgument(E->getArg(1)))) &&
16052 (!getDerived().DropCallArgument(E->getArg(0))) &&
16053 !E->isListInitialization()))
16059 QualType T = getDerived().TransformType(E->getType());
16064 getDerived().TransformDecl(E->getBeginLoc(), E->getConstructor()));
16068 bool ArgumentChanged =
false;
16073 E->isListInitialization());
16074 if (getDerived().TransformExprs(E->getArgs(), E->getNumArgs(),
true, Args,
16079 if (!getDerived().AlwaysRebuild() &&
16080 T == E->getType() &&
16082 !ArgumentChanged) {
16089 return getDerived().RebuildCXXConstructExpr(
16090 T, E->getBeginLoc(),
Constructor, E->isElidable(), Args,
16091 E->hadMultipleCandidates(), E->isListInitialization(),
16092 E->isStdInitListInitialization(), E->requiresZeroInitialization(),
16093 E->getConstructionKind(), E->getParenOrBraceRange());
16096template<
typename Derived>
16099 QualType T = getDerived().TransformType(E->getType());
16104 getDerived().TransformDecl(E->getBeginLoc(), E->getConstructor()));
16108 if (!getDerived().AlwaysRebuild() &&
16109 T == E->getType() &&
16117 return getDerived().RebuildCXXInheritedCtorInitExpr(
16119 E->constructsVBase(), E->inheritedFromVBase());
16126template<
typename Derived>
16129 if (
auto *Dtor = E->getTemporary()->getDestructor())
16132 return getDerived().TransformExpr(E->getSubExpr());
16140template<
typename Derived>
16146template<
typename Derived>
16151 getDerived().TransformTypeWithDeducedTST(E->getTypeSourceInfo());
16156 getDerived().TransformDecl(E->getBeginLoc(), E->getConstructor()));
16160 bool ArgumentChanged =
false;
16162 Args.reserve(E->getNumArgs());
16166 E->isListInitialization());
16167 if (TransformExprs(E->getArgs(), E->getNumArgs(),
true, Args,
16171 if (E->isListInitialization() && !E->isStdInitListInitialization()) {
16172 ExprResult Res = RebuildInitList(E->getBeginLoc(), Args, E->getEndLoc(),
16174 if (Res.isInvalid())
16176 Args = {Res.get()};
16180 if (!getDerived().AlwaysRebuild() &&
16181 T == E->getTypeSourceInfo() &&
16183 !ArgumentChanged) {
16190 return getDerived().RebuildCXXTemporaryObjectExpr(
16191 T, LParenLoc, Args, E->getEndLoc(), E->isListInitialization());
16194template<
typename Derived>
16199 typedef std::pair<ExprResult, QualType> InitCaptureInfoTy;
16200 struct TransformedInitCapture {
16202 SourceLocation EllipsisLoc;
16204 SmallVector<InitCaptureInfoTy, 4> Expansions;
16207 InitCaptures.resize(E->explicit_capture_end() - E->explicit_capture_begin());
16209 CEnd = E->capture_end();
16211 if (!E->isInitCapture(
C))
16214 TransformedInitCapture &
Result = InitCaptures[
C - E->capture_begin()];
16219 ExprResult NewExprInitResult = getDerived().TransformInitializer(
16222 if (NewExprInitResult.isInvalid()) {
16226 Expr *NewExprInit = NewExprInitResult.get();
16229 getSema().buildLambdaInitCaptureInitialization(
16230 C->getLocation(),
C->getCaptureKind() ==
LCK_ByRef,
16231 EllipsisLoc, NumExpansions, OldVD->getIdentifier(),
16235 Result.Expansions.push_back(
16236 InitCaptureInfoTy(NewExprInit, NewInitCaptureType));
16240 if (OldVD->isParameterPack()) {
16249 bool Expand =
true;
16250 bool RetainExpansion =
false;
16252 ExpansionTL.getTypePtr()->getNumExpansions();
16254 if (getDerived().TryExpandParameterPacks(
16255 ExpansionTL.getEllipsisLoc(), OldVD->getInit()->getSourceRange(),
16256 Unexpanded,
true, Expand,
16257 RetainExpansion, NumExpansions))
16259 assert(!RetainExpansion &&
"Should not need to retain expansion after a "
16260 "capture since it cannot be extended");
16262 for (
unsigned I = 0; I != *NumExpansions; ++I) {
16267 SubstInitCapture(ExpansionTL.getEllipsisLoc(), NumExpansions);
16268 Result.EllipsisLoc = ExpansionTL.getEllipsisLoc();
16307 if ((getSema().isUnevaluatedContext() ||
16308 getSema().isConstantEvaluatedContext()) &&
16309 !(dyn_cast_or_null<CXXRecordDecl>(DC->getParent()) &&
16311 (DC->isFileContext() || !DC->getParent()->isDependentContext()))
16316 E->getIntroducerRange(),
nullptr, DependencyKind,
16317 E->getCaptureDefault());
16318 getDerived().transformedLocalDecl(OldClass, {
Class});
16321 getSema().CreateLambdaCallOperator(E->getIntroducerRange(),
Class);
16324 getSema().buildLambdaScope(LSI, NewCallOperator, E->getIntroducerRange(),
16325 E->getCaptureDefault(), E->getCaptureDefaultLoc(),
16326 E->hasExplicitParameters(), E->isMutable());
16336 CEnd = E->capture_end();
16340 if (
C->isImplicit())
16344 if (
C->capturesThis()) {
16352 dyn_cast_if_present<CXXRecordDecl>(
16353 getSema().getFunctionLevelDeclContext()),
16355 getSema().CheckCXXThisCapture(
C->getLocation(),
C->isExplicit(),
16362 if (
C->capturesVLAType())
16366 if (E->isInitCapture(
C)) {
16367 TransformedInitCapture &NewC = InitCaptures[
C - E->capture_begin()];
16372 for (InitCaptureInfoTy &Info : NewC.Expansions) {
16374 QualType InitQualType = Info.second;
16375 if (
Init.isInvalid() || InitQualType.isNull()) {
16379 VarDecl *NewVD = getSema().createLambdaInitCaptureVarDecl(
16380 OldVD->getLocation(), InitQualType, NewC.EllipsisLoc,
16381 OldVD->getIdentifier(), OldVD->getInitStyle(),
Init.get(),
16382 getSema().CurContext);
16387 NewVDs.push_back(NewVD);
16388 getSema().addInitCapture(LSI, NewVD,
C->getCaptureKind() ==
LCK_ByRef);
16393 if (NewC.EllipsisLoc.isInvalid())
16394 LSI->ContainsUnexpandedParameterPack |=
16395 Init.get()->containsUnexpandedParameterPack();
16401 getDerived().transformedLocalDecl(OldVD, NewVDs);
16405 assert(
C->capturesVariable() &&
"unexpected kind of lambda capture");
16413 if (
C->isPackExpansion()) {
16415 bool ShouldExpand =
false;
16416 bool RetainExpansion =
false;
16418 if (getDerived().TryExpandParameterPacks(
16419 C->getEllipsisLoc(),
C->getLocation(), Unexpanded,
16420 true, ShouldExpand,
16421 RetainExpansion, NumExpansions)) {
16426 if (ShouldExpand) {
16431 for (
unsigned I = 0; I != *NumExpansions; ++I) {
16433 ValueDecl *CapturedVar = cast_if_present<ValueDecl>(
16434 getDerived().TransformDecl(
C->getLocation(), Pack));
16435 if (!CapturedVar) {
16441 getSema().tryCaptureVariable(CapturedVar,
C->getLocation(), Kind);
16449 EllipsisLoc =
C->getEllipsisLoc();
16453 auto *CapturedVar = cast_or_null<ValueDecl>(
16454 getDerived().TransformDecl(
C->getLocation(),
C->getCapturedVar()));
16455 if (!CapturedVar || CapturedVar->isInvalidDecl()) {
16462 if (
auto *VD = dyn_cast<VarDecl>(CapturedVar); VD && !
C->isPackExpansion())
16463 LSI->ContainsUnexpandedParameterPack |= VD->isParameterPack();
16466 getSema().tryCaptureVariable(CapturedVar,
C->getLocation(), Kind,
16469 getSema().finishLambdaExplicitCaptures(LSI);
16473 auto TPL = getDerived().TransformTemplateParameterList(
16474 E->getTemplateParameterList());
16475 LSI->GLTemplateParameterList = TPL;
16477 getSema().AddTemplateParametersToLambdaCallOperator(NewCallOperator,
Class,
16479 LSI->ContainsUnexpandedParameterPack |=
16480 TPL->containsUnexpandedParameterPack();
16485 E->getCallOperator()->getTypeSourceInfo()->getTypeLoc();
16487 getDerived().TransformType(NewCallOpTLBuilder, OldCallOpTypeLoc);
16488 if (NewCallOpType.isNull())
16490 LSI->ContainsUnexpandedParameterPack |=
16491 NewCallOpType->containsUnexpandedParameterPack();
16493 NewCallOpTLBuilder.getTypeSourceInfo(getSema().Context, NewCallOpType);
16498 assert(FPTL &&
"Not a FunctionProtoType?");
16502 ExprResult E = getDerived().TransformLambdaConstraint(
16503 const_cast<Expr *
>(TRC.ConstraintExpr));
16506 TRC.ConstraintExpr = E.get();
16509 LSI->BeforeCompoundStatement =
false;
16510 getSema().CompleteLambdaCallOperator(
16511 NewCallOperator, E->getCallOperator()->getLocation(),
16512 E->getCallOperator()->getInnerLocStart(), TRC, NewCallOpTSI,
16513 E->getCallOperator()->getConstexprKind(),
16514 E->getCallOperator()->getStorageClass(), FPTL.getParams(),
16515 E->hasExplicitResultType());
16517 getDerived().transformAttrs(E->getCallOperator(), NewCallOperator);
16518 getDerived().transformedLocalDecl(E->getCallOperator(), {NewCallOperator});
16524 std::optional<CXXRecordDecl::LambdaNumbering> Numbering;
16525 if (getDerived().ReplacingOriginal()) {
16526 Numbering = OldClass->getLambdaNumbering();
16529 getSema().handleLambdaNumbering(
Class, NewCallOperator, Numbering);
16534 getSema().PushExpressionEvaluationContextForFunction(
16536 E->getCallOperator());
16543 C.PointOfInstantiation = E->getBody()->getBeginLoc();
16544 getSema().pushCodeSynthesisContext(
C);
16548 : getDerived().TransformLambdaBody(E, E->getBody());
16550 getSema().popCodeSynthesisContext();
16554 FuncScopeCleanup.disable();
16556 if (Body.isInvalid()) {
16557 SavedContext.pop();
16558 getSema().ActOnLambdaError(E->getBeginLoc(),
nullptr,
16563 getSema().ActOnFinishFunctionBody(NewCallOperator, Body.get(),
16566 SavedContext.pop();
16601 DependencyKind = getDerived().ComputeLambdaDependency(LSI);
16602 Class->setLambdaDependencyKind(DependencyKind);
16604 return getDerived().RebuildLambdaExpr(E->getBeginLoc(),
16605 Body.get()->getEndLoc(), LSI);
16608template<
typename Derived>
16614template<
typename Derived>
16623 if (!
C->isImplicit())
16627 if (
C->capturesThis()) {
16628 getSema().CheckCXXThisCapture(
C->getLocation(),
C->isExplicit(),
16635 if (
C->capturesVLAType())
16638 assert(
C->capturesVariable() &&
"unexpected kind of lambda capture");
16642 VarDecl *CapturedVar = cast_or_null<VarDecl>(
16648 getSema().tryCaptureVariable(CapturedVar,
C->getLocation());
16654template<
typename Derived>
16663 bool ArgumentChanged =
false;
16675 if (!getDerived().AlwaysRebuild() &&
16681 return getDerived().RebuildCXXUnresolvedConstructExpr(
16685template <
typename Derived>
16689 TemplateName Name = getDerived().TransformConceptTemplateName(
16690 E->getTemplateName(), E->getNameLoc());
16695 if (getDerived().TransformTemplateArguments(
16696 E->template_arguments().data(), E->getNumTemplateArgs(), TransArgs))
16709 return getDerived().RebuildTemplateIdExpr(
16711 false, &TransArgs);
16714template<
typename Derived>
16723 if (!E->isImplicitAccess()) {
16724 OldBase = E->getBase();
16725 Base = getDerived().TransformExpr(OldBase);
16726 if (
Base.isInvalid())
16731 bool MayBePseudoDestructor =
false;
16733 E->getOperatorLoc(),
16734 E->isArrow()? tok::arrow : tok::period,
16736 MayBePseudoDestructor);
16737 if (
Base.isInvalid())
16740 ObjectType = ObjectTy.get();
16741 BaseType = ((
Expr*)
Base.get())->getType();
16744 BaseType = getDerived().TransformType(E->getBaseType());
16751 = getDerived().TransformFirstQualifierInScope(
16752 E->getFirstQualifierFoundInScope(),
16753 E->getQualifierLoc().getBeginLoc());
16756 if (E->getQualifier()) {
16758 = getDerived().TransformNestedNameSpecifierLoc(E->getQualifierLoc(),
16760 FirstQualifierInScope);
16772 = getDerived().TransformDeclarationNameInfo(E->getMemberNameInfo());
16773 if (!NameInfo.getName())
16776 if (!E->hasExplicitTemplateArgs()) {
16779 if (!getDerived().AlwaysRebuild() &&
16780 Base.get() == OldBase &&
16781 BaseType == E->getBaseType() &&
16782 QualifierLoc == E->getQualifierLoc() &&
16783 NameInfo.getName() == E->getMember() &&
16784 FirstQualifierInScope == E->getFirstQualifierFoundInScope())
16787 return getDerived().RebuildCXXDependentScopeMemberExpr(
Base.get(),
16790 E->getOperatorLoc(),
16793 FirstQualifierInScope,
16799 if (getDerived().TransformTemplateArguments(E->getTemplateArgs(),
16800 E->getNumTemplateArgs(),
16804 return getDerived().RebuildCXXDependentScopeMemberExpr(
Base.get(),
16807 E->getOperatorLoc(),
16810 FirstQualifierInScope,
16815template <
typename Derived>
16821 if (!Old->isImplicitAccess()) {
16822 Base = getDerived().TransformExpr(Old->getBase());
16823 if (
Base.isInvalid())
16826 getSema().PerformMemberExprBaseConversion(
Base.get(), Old->isArrow());
16827 if (
Base.isInvalid())
16829 BaseType =
Base.get()->getType();
16831 BaseType = getDerived().TransformType(Old->getBaseType());
16835 if (Old->getQualifierLoc()) {
16837 getDerived().TransformNestedNameSpecifierLoc(Old->getQualifierLoc());
16847 if (TransformOverloadExprDecls(Old,
false, R))
16851 if (Old->getNamingClass()) {
16853 getDerived().TransformDecl(Old->getMemberLoc(), Old->getNamingClass()));
16857 R.setNamingClass(NamingClass);
16861 if (Old->hasExplicitTemplateArgs()) {
16862 TransArgs.setLAngleLoc(Old->getLAngleLoc());
16863 TransArgs.setRAngleLoc(Old->getRAngleLoc());
16864 if (getDerived().TransformTemplateArguments(
16865 Old->getTemplateArgs(), Old->getNumTemplateArgs(), TransArgs))
16873 NamedDecl *FirstQualifierInScope =
nullptr;
16875 return getDerived().RebuildUnresolvedMemberExpr(
16876 Base.get(), BaseType, Old->getOperatorLoc(), Old->isArrow(), QualifierLoc,
16877 TemplateKWLoc, FirstQualifierInScope, R,
16878 (Old->hasExplicitTemplateArgs() ? &TransArgs :
nullptr));
16881template<
typename Derived>
16886 ExprResult SubExpr = getDerived().TransformExpr(E->getOperand());
16887 if (SubExpr.isInvalid())
16890 if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getOperand())
16893 return getDerived().RebuildCXXNoexceptExpr(E->getSourceRange(),SubExpr.get());
16896template<
typename Derived>
16899 ExprResult Pattern = getDerived().TransformExpr(E->getPattern());
16900 if (Pattern.isInvalid())
16903 if (!getDerived().AlwaysRebuild() && Pattern.get() == E->getPattern())
16906 return getDerived().RebuildPackExpansion(Pattern.get(), E->getEllipsisLoc(),
16907 E->getNumExpansions());
16910template <
typename Derived>
16915 if (!Arg.isPackExpansion()) {
16927 getSema().getTemplateArgumentPackExpansionPattern(ArgLoc, Ellipsis,
16928 OrigNumExpansions);
16940 if (!NumExpansions) {
16952template<
typename Derived>
16971 bool ShouldExpand =
false;
16972 bool RetainExpansion =
false;
16974 if (getDerived().TryExpandParameterPacks(
16976 true, ShouldExpand,
16977 RetainExpansion, NumExpansions))
16982 if (ShouldExpand) {
16984 if (
auto *TTPD = dyn_cast<TemplateTypeParmDecl>(Pack)) {
16985 ArgStorage = getSema().Context.getPackExpansionType(
16986 getSema().Context.getTypeDeclType(TTPD), std::nullopt);
16987 }
else if (
auto *TTPD = dyn_cast<TemplateTemplateParmDecl>(Pack)) {
16991 ExprResult DRE = getSema().BuildDeclRefExpr(
16992 VD, VD->getType().getNonLValueExprType(getSema().Context),
16995 if (DRE.isInvalid())
16998 new (getSema().Context)
17002 PackArgs = ArgStorage;
17007 if (!PackArgs.size()) {
17008 auto *Pack = cast_or_null<NamedDecl>(
17012 return getDerived().RebuildSizeOfPackExpr(
17019 getDerived().ComputeSizeOfPackExprWithoutSubstitution(PackArgs);
17031 TemporaryBase Rebase(*
this, E->
getPackLoc(), getBaseEntity());
17034 if (TransformTemplateArguments(PackLocIterator(*
this, PackArgs.begin()),
17035 PackLocIterator(*
this, PackArgs.end()),
17036 TransformedPackArgs,
true))
17043 bool PartialSubstitution =
false;
17044 for (
auto &Loc : TransformedPackArgs.arguments()) {
17045 Args.push_back(Loc.getArgument());
17046 if (Loc.getArgument().isPackExpansion())
17047 PartialSubstitution =
true;
17050 if (PartialSubstitution)
17051 return getDerived().RebuildSizeOfPackExpr(
17053 std::nullopt, Args);
17055 return getDerived().RebuildSizeOfPackExpr(
17057 static_cast<unsigned>(Args.size()),
17061template <
typename Derived>
17064 if (!E->isValueDependent())
17072 IndexExpr = getDerived().TransformExpr(E->getIndexExpr());
17073 if (IndexExpr.isInvalid())
17078 bool FullySubstituted =
true;
17079 if (!E->expandsToEmptyPack() && E->getExpressions().empty()) {
17080 Expr *Pattern = E->getPackIdExpression();
17082 getSema().collectUnexpandedParameterPacks(E->getPackIdExpression(),
17084 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
17088 bool ShouldExpand =
true;
17089 bool RetainExpansion =
false;
17091 NumExpansions = std::nullopt;
17092 if (getDerived().TryExpandParameterPacks(
17093 E->getEllipsisLoc(), Pattern->getSourceRange(), Unexpanded,
17094 true, ShouldExpand,
17095 RetainExpansion, NumExpansions))
17097 if (!ShouldExpand) {
17099 ExprResult Pack = getDerived().TransformExpr(Pattern);
17100 if (Pack.isInvalid())
17102 return getDerived().RebuildPackIndexingExpr(
17103 E->getEllipsisLoc(), E->getRSquareLoc(), Pack.get(), IndexExpr.get(),
17106 for (
unsigned I = 0; I != *NumExpansions; ++I) {
17109 if (
Out.isInvalid())
17111 if (
Out.get()->containsUnexpandedParameterPack()) {
17112 Out = getDerived().RebuildPackExpansion(
Out.get(), E->getEllipsisLoc(),
17113 OrigNumExpansions);
17114 if (
Out.isInvalid())
17116 FullySubstituted =
false;
17118 ExpandedExprs.push_back(
Out.get());
17122 if (RetainExpansion) {
17123 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
17126 if (
Out.isInvalid())
17129 Out = getDerived().RebuildPackExpansion(
Out.get(), E->getEllipsisLoc(),
17130 OrigNumExpansions);
17131 if (
Out.isInvalid())
17133 FullySubstituted =
false;
17134 ExpandedExprs.push_back(
Out.get());
17136 }
else if (!E->expandsToEmptyPack()) {
17137 if (getDerived().TransformExprs(E->getExpressions().data(),
17138 E->getExpressions().size(),
false,
17143 return getDerived().RebuildPackIndexingExpr(
17144 E->getEllipsisLoc(), E->getRSquareLoc(), E->getPackIdExpression(),
17145 IndexExpr.get(), ExpandedExprs, FullySubstituted);
17148template <
typename Derived>
17151 if (!getSema().ArgPackSubstIndex)
17157 return getDerived().RebuildSubstNonTypeTemplateParmExpr(
17158 E->getAssociatedDecl(), E->getParameterPack()->getPosition(),
17159 E->getParameterPack()->getType(), E->getParameterPackLocation(), Arg,
17163template <
typename Derived>
17180 ExprResult Replacement = getDerived().TransformExpr(OrigReplacement);
17181 if (Replacement.isInvalid())
17184 Decl *AssociatedDecl =
17185 getDerived().TransformDecl(E->getNameLoc(), E->getAssociatedDecl());
17186 if (!AssociatedDecl)
17189 QualType ParamType = TransformType(E->getParameterType());
17190 if (ParamType.isNull())
17193 if (Replacement.get() == OrigReplacement &&
17194 AssociatedDecl == E->getAssociatedDecl() &&
17195 ParamType == E->getParameterType())
17198 if (Replacement.get() != OrigReplacement ||
17199 ParamType != E->getParameterType()) {
17208 Param, ParamType, Replacement.get(), SugaredConverted,
17209 CanonicalConverted,
17211 if (Replacement.isInvalid())
17215 Replacement = E->getReplacement();
17218 return getDerived().RebuildSubstNonTypeTemplateParmExpr(
17219 AssociatedDecl, E->getIndex(), ParamType, E->getNameLoc(),
17221 E->getPackIndex(), E->getFinal());
17224template<
typename Derived>
17231template<
typename Derived>
17238template<
typename Derived>
17242 if (
Expr *OldCallee = E->getCallee()) {
17243 ExprResult CalleeResult = getDerived().TransformExpr(OldCallee);
17244 if (CalleeResult.isInvalid())
17249 Expr *Pattern = E->getPattern();
17252 getSema().collectUnexpandedParameterPacks(Pattern, Unexpanded);
17253 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
17257 bool Expand =
true;
17258 bool RetainExpansion =
false;
17260 NumExpansions = OrigNumExpansions;
17261 if (getDerived().TryExpandParameterPacks(
17262 E->getEllipsisLoc(), Pattern->getSourceRange(), Unexpanded,
17263 true, Expand, RetainExpansion,
17273 E->getLHS() ? getDerived().TransformExpr(E->getLHS()) :
ExprResult();
17274 if (LHS.isInvalid())
17278 E->getRHS() ? getDerived().TransformExpr(E->getRHS()) :
ExprResult();
17279 if (RHS.isInvalid())
17282 if (!getDerived().AlwaysRebuild() &&
17283 LHS.get() == E->getLHS() && RHS.get() == E->getRHS())
17286 return getDerived().RebuildCXXFoldExpr(
17287 Callee, E->getBeginLoc(), LHS.get(), E->getOperator(),
17288 E->getEllipsisLoc(), RHS.get(), E->getEndLoc(), NumExpansions);
17294 if (NumExpansions && SemaRef.
getLangOpts().BracketDepth < *NumExpansions) {
17295 SemaRef.
Diag(E->getEllipsisLoc(),
17296 clang::diag::err_fold_expression_limit_exceeded)
17297 << *NumExpansions << SemaRef.
getLangOpts().BracketDepth
17298 << E->getSourceRange();
17299 SemaRef.
Diag(E->getEllipsisLoc(), diag::note_bracket_depth);
17308 bool LeftFold = E->isLeftFold();
17312 if (!LeftFold && RetainExpansion) {
17313 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
17316 if (
Out.isInvalid())
17319 Result = getDerived().RebuildCXXFoldExpr(
17320 Callee, E->getBeginLoc(),
Out.get(), E->getOperator(),
17321 E->getEllipsisLoc(),
Result.get(), E->getEndLoc(), OrigNumExpansions);
17326 bool WarnedOnComparison =
false;
17327 for (
unsigned I = 0; I != *NumExpansions; ++I) {
17329 getSema(), LeftFold ? I : *NumExpansions - I - 1);
17331 if (
Out.isInvalid())
17334 if (
Out.get()->containsUnexpandedParameterPack()) {
17336 Result = getDerived().RebuildCXXFoldExpr(
17337 Callee, E->getBeginLoc(), LeftFold ?
Result.get() :
Out.get(),
17338 E->getOperator(), E->getEllipsisLoc(),
17339 LeftFold ?
Out.get() :
Result.get(), E->getEndLoc(),
17340 OrigNumExpansions);
17341 }
else if (
Result.isUsable()) {
17348 Result = getDerived().RebuildCXXOperatorCallExpr(
17350 E->getEllipsisLoc(),
Callee->getBeginLoc(),
Callee->requiresADL(),
17351 Functions, LHS, RHS);
17353 Result = getDerived().RebuildBinaryOperator(E->getEllipsisLoc(),
17354 E->getOperator(), LHS, RHS,
17356 if (!WarnedOnComparison &&
Result.isUsable()) {
17357 if (
auto *BO = dyn_cast<BinaryOperator>(
Result.get());
17358 BO && BO->isComparisonOp()) {
17359 WarnedOnComparison =
true;
17360 SemaRef.
Diag(BO->getBeginLoc(),
17361 diag::warn_comparison_in_fold_expression)
17362 << BO->getOpcodeStr();
17375 if (LeftFold && RetainExpansion) {
17376 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
17379 if (
Out.isInvalid())
17382 Result = getDerived().RebuildCXXFoldExpr(
17383 Callee, E->getBeginLoc(),
Result.get(), E->getOperator(),
17384 E->getEllipsisLoc(),
Out.get(), E->getEndLoc(), OrigNumExpansions);
17390 PE->setIsProducedByFoldExpansion();
17395 return getDerived().RebuildEmptyCXXFoldExpr(E->getEllipsisLoc(),
17400template <
typename Derived>
17406 QualType T = getDerived().TransformType(E->getType());
17408 bool ArgChanged =
false;
17410 if (getDerived().TransformExprs(InitExprs.data(), InitExprs.size(),
true,
17411 TransformedInits, &ArgChanged))
17414 if (!getDerived().AlwaysRebuild() && !ArgChanged &&
T == E->getType())
17417 return getDerived().RebuildCXXParenListInitExpr(
17418 TransformedInits,
T, E->getUserSpecifiedInitExprs().size(),
17419 E->getInitLoc(), E->getBeginLoc(), E->getEndLoc());
17422template<
typename Derived>
17429template<
typename Derived>
17435template<
typename Derived>
17441template<
typename Derived>
17444 ExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
17445 if (SubExpr.isInvalid())
17448 if (!getDerived().AlwaysRebuild() &&
17449 SubExpr.get() == E->getSubExpr())
17452 return getDerived().RebuildObjCBoxedExpr(E->getSourceRange(), SubExpr.get());
17455template<
typename Derived>
17460 bool ArgChanged =
false;
17461 if (getDerived().TransformExprs(E->getElements(), E->getNumElements(),
17462 false, Elements, &ArgChanged))
17465 if (!getDerived().AlwaysRebuild() && !ArgChanged)
17468 return getDerived().RebuildObjCArrayLiteral(E->getSourceRange(),
17473template<
typename Derived>
17479 bool ArgChanged =
false;
17480 for (
unsigned I = 0, N = E->getNumElements(); I != N; ++I) {
17483 if (OrigElement.isPackExpansion()) {
17486 getSema().collectUnexpandedParameterPacks(OrigElement.Key, Unexpanded);
17487 getSema().collectUnexpandedParameterPacks(OrigElement.Value, Unexpanded);
17488 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
17492 bool Expand =
true;
17493 bool RetainExpansion =
false;
17496 SourceRange PatternRange(OrigElement.Key->getBeginLoc(),
17497 OrigElement.Value->getEndLoc());
17498 if (getDerived().TryExpandParameterPacks(
17499 OrigElement.EllipsisLoc, PatternRange, Unexpanded,
17500 true, Expand, RetainExpansion,
17509 ExprResult Key = getDerived().TransformExpr(OrigElement.Key);
17510 if (Key.isInvalid())
17513 if (Key.get() != OrigElement.Key)
17517 if (
Value.isInvalid())
17524 Key.get(),
Value.get(), OrigElement.EllipsisLoc, NumExpansions
17526 Elements.push_back(Expansion);
17536 for (
unsigned I = 0; I != *NumExpansions; ++I) {
17538 ExprResult Key = getDerived().TransformExpr(OrigElement.Key);
17539 if (Key.isInvalid())
17543 if (
Value.isInvalid())
17553 if (Key.get()->containsUnexpandedParameterPack() ||
17554 Value.get()->containsUnexpandedParameterPack())
17555 Element.EllipsisLoc = OrigElement.EllipsisLoc;
17557 Elements.push_back(Element);
17567 ExprResult Key = getDerived().TransformExpr(OrigElement.Key);
17568 if (Key.isInvalid())
17571 if (Key.get() != OrigElement.Key)
17576 = getDerived().TransformExpr(OrigElement.Value);
17577 if (
Value.isInvalid())
17585 Elements.push_back(Element);
17588 if (!getDerived().AlwaysRebuild() && !ArgChanged)
17591 return getDerived().RebuildObjCDictionaryLiteral(E->getSourceRange(),
17595template<
typename Derived>
17599 = getDerived().TransformType(E->getEncodedTypeSourceInfo());
17600 if (!EncodedTypeInfo)
17603 if (!getDerived().AlwaysRebuild() &&
17604 EncodedTypeInfo == E->getEncodedTypeSourceInfo())
17607 return getDerived().RebuildObjCEncodeExpr(E->getAtLoc(),
17609 E->getRParenLoc());
17612template<
typename Derived>
17622template<
typename Derived>
17626 = getDerived().TransformType(E->getTypeInfoAsWritten());
17634 if (!getDerived().AlwaysRebuild() &&
17635 TSInfo == E->getTypeInfoAsWritten() &&
17636 Result.get() == E->getSubExpr())
17640 E->getLParenLoc(), E->getBridgeKind(), E->getBridgeKeywordLoc(), TSInfo,
17644template <
typename Derived>
17650template<
typename Derived>
17654 bool ArgChanged =
false;
17656 Args.reserve(E->getNumArgs());
17657 if (getDerived().TransformExprs(E->getArgs(), E->getNumArgs(),
false, Args,
17664 = getDerived().TransformType(E->getClassReceiverTypeInfo());
17665 if (!ReceiverTypeInfo)
17669 if (!getDerived().AlwaysRebuild() &&
17670 ReceiverTypeInfo == E->getClassReceiverTypeInfo() && !ArgChanged)
17675 E->getSelectorLocs(SelLocs);
17676 return getDerived().RebuildObjCMessageExpr(ReceiverTypeInfo,
17679 E->getMethodDecl(),
17686 if (!E->getMethodDecl())
17691 E->getSelectorLocs(SelLocs);
17692 return getDerived().RebuildObjCMessageExpr(E->getSuperLoc(),
17695 E->getReceiverType(),
17696 E->getMethodDecl(),
17704 "Only class and instance messages may be instantiated");
17706 = getDerived().TransformExpr(E->getInstanceReceiver());
17707 if (Receiver.isInvalid())
17711 if (!getDerived().AlwaysRebuild() &&
17712 Receiver.get() == E->getInstanceReceiver() && !ArgChanged)
17717 E->getSelectorLocs(SelLocs);
17718 return getDerived().RebuildObjCMessageExpr(Receiver.get(),
17721 E->getMethodDecl(),
17727template<
typename Derived>
17733template<
typename Derived>
17739template<
typename Derived>
17744 if (
Base.isInvalid())
17750 if (!getDerived().AlwaysRebuild() &&
17751 Base.get() == E->getBase())
17754 return getDerived().RebuildObjCIvarRefExpr(
Base.get(), E->getDecl(),
17756 E->isArrow(), E->isFreeIvar());
17759template<
typename Derived>
17764 if (!E->isObjectReceiver())
17769 if (
Base.isInvalid())
17775 if (!getDerived().AlwaysRebuild() &&
17776 Base.get() == E->getBase())
17779 if (E->isExplicitProperty())
17780 return getDerived().RebuildObjCPropertyRefExpr(
Base.get(),
17781 E->getExplicitProperty(),
17784 return getDerived().RebuildObjCPropertyRefExpr(
Base.get(),
17786 E->getImplicitPropertyGetter(),
17787 E->getImplicitPropertySetter(),
17791template<
typename Derived>
17796 if (
Base.isInvalid())
17800 ExprResult Key = getDerived().TransformExpr(E->getKeyExpr());
17801 if (Key.isInvalid())
17805 if (!getDerived().AlwaysRebuild() &&
17806 Key.get() == E->getKeyExpr() &&
Base.get() == E->getBaseExpr())
17809 return getDerived().RebuildObjCSubscriptRefExpr(E->getRBracket(),
17810 Base.get(), Key.get(),
17811 E->getAtIndexMethodDecl(),
17812 E->setAtIndexMethodDecl());
17815template<
typename Derived>
17820 if (
Base.isInvalid())
17824 if (!getDerived().AlwaysRebuild() &&
17825 Base.get() == E->getBase())
17828 return getDerived().RebuildObjCIsaExpr(
Base.get(), E->getIsaMemberLoc(),
17833template<
typename Derived>
17836 bool ArgumentChanged =
false;
17838 SubExprs.reserve(E->getNumSubExprs());
17839 if (getDerived().TransformExprs(E->getSubExprs(), E->getNumSubExprs(),
false,
17840 SubExprs, &ArgumentChanged))
17843 if (!getDerived().AlwaysRebuild() &&
17847 return getDerived().RebuildShuffleVectorExpr(E->getBuiltinLoc(),
17849 E->getRParenLoc());
17852template<
typename Derived>
17855 ExprResult SrcExpr = getDerived().TransformExpr(E->getSrcExpr());
17856 if (SrcExpr.isInvalid())
17863 if (!getDerived().AlwaysRebuild() &&
17864 Type == E->getTypeSourceInfo() &&
17865 SrcExpr.get() == E->getSrcExpr())
17868 return getDerived().RebuildConvertVectorExpr(E->getBuiltinLoc(),
17869 SrcExpr.get(),
Type,
17870 E->getRParenLoc());
17873template<
typename Derived>
17876 BlockDecl *oldBlock = E->getBlockDecl();
17882 blockScope->TheDecl->setBlockMissingReturnType(
17883 oldBlock->blockMissingReturnType());
17892 if (getDerived().TransformFunctionTypeParams(
17893 E->getCaretLocation(), oldBlock->parameters(),
nullptr,
17894 exprFunctionType->getExtParameterInfosOrNull(), paramTypes, ¶ms,
17896 getSema().ActOnBlockError(E->getCaretLocation(),
nullptr);
17901 getDerived().TransformType(exprFunctionType->getReturnType());
17903 auto epi = exprFunctionType->getExtProtoInfo();
17904 epi.ExtParameterInfos = extParamInfos.getPointerOrNull(paramTypes.size());
17907 getDerived().RebuildFunctionProtoType(exprResultType, paramTypes, epi);
17911 if (!params.empty())
17912 blockScope->TheDecl->setParams(params);
17914 if (!oldBlock->blockMissingReturnType()) {
17915 blockScope->HasImplicitReturnType =
false;
17916 blockScope->ReturnType = exprResultType;
17920 StmtResult body = getDerived().TransformStmt(E->getBody());
17921 if (body.isInvalid()) {
17922 getSema().ActOnBlockError(E->getCaretLocation(),
nullptr);
17930 for (
const auto &I : oldBlock->captures()) {
17931 VarDecl *oldCapture = I.getVariable();
17934 if (oldCapture->isParameterPack())
17938 cast<VarDecl>(getDerived().TransformDecl(E->getCaretLocation(),
17940 assert(blockScope->CaptureMap.count(newCapture));
17949template<
typename Derived>
17952 ExprResult SrcExpr = getDerived().TransformExpr(E->getSrcExpr());
17953 if (SrcExpr.isInvalid())
17956 QualType Type = getDerived().TransformType(E->getType());
17959 E->getRParenLoc());
17962template<
typename Derived>
17965 bool ArgumentChanged =
false;
17967 SubExprs.reserve(E->getNumSubExprs());
17968 if (getDerived().TransformExprs(E->getSubExprs(), E->getNumSubExprs(),
false,
17969 SubExprs, &ArgumentChanged))
17972 if (!getDerived().AlwaysRebuild() &&
17976 return getDerived().RebuildAtomicExpr(E->getBuiltinLoc(), SubExprs,
17977 E->getOp(), E->getRParenLoc());
17984template<
typename Derived>
17987 return SemaRef.BuildPointerType(PointeeType,
Star,
17991template<
typename Derived>
17994 return SemaRef.BuildBlockPointerType(PointeeType,
Star,
17998template<
typename Derived>
18001 bool WrittenAsLValue,
18003 return SemaRef.BuildReferenceType(ReferentType, WrittenAsLValue,
18007template <
typename Derived>
18011 return SemaRef.BuildMemberPointerType(PointeeType, SS, Cls, Sigil,
18015template<
typename Derived>
18022 return SemaRef.ObjC().BuildObjCTypeParamType(
18023 Decl, ProtocolLAngleLoc, Protocols, ProtocolLocs, ProtocolRAngleLoc,
18027template<
typename Derived>
18038 return SemaRef.ObjC().BuildObjCObjectType(
18039 BaseType, Loc, TypeArgsLAngleLoc, TypeArgs, TypeArgsRAngleLoc,
18040 ProtocolLAngleLoc, Protocols, ProtocolLocs, ProtocolRAngleLoc,
18045template<
typename Derived>
18049 return SemaRef.Context.getObjCObjectPointerType(PointeeType);
18052template <
typename Derived>
18055 Expr *SizeExpr,
unsigned IndexTypeQuals,
SourceRange BracketsRange) {
18056 if (SizeExpr || !Size)
18057 return SemaRef.BuildArrayType(ElementType, SizeMod, SizeExpr,
18058 IndexTypeQuals, BracketsRange,
18062 SemaRef.Context.UnsignedCharTy,
SemaRef.Context.UnsignedShortTy,
18064 SemaRef.Context.UnsignedLongLongTy,
SemaRef.Context.UnsignedInt128Ty
18067 for (
const auto &
T : Types)
18068 if (Size->getBitWidth() ==
SemaRef.Context.getIntWidth(
T)) {
18078 return SemaRef.BuildArrayType(ElementType, SizeMod, ArraySize,
18079 IndexTypeQuals, BracketsRange,
18083template <
typename Derived>
18086 Expr *SizeExpr,
unsigned IndexTypeQuals,
SourceRange BracketsRange) {
18087 return getDerived().RebuildArrayType(ElementType, SizeMod, &Size, SizeExpr,
18088 IndexTypeQuals, BracketsRange);
18091template <
typename Derived>
18095 return getDerived().RebuildArrayType(ElementType, SizeMod,
nullptr,
nullptr,
18096 IndexTypeQuals, BracketsRange);
18099template <
typename Derived>
18102 unsigned IndexTypeQuals,
SourceRange BracketsRange) {
18103 return getDerived().RebuildArrayType(ElementType, SizeMod,
nullptr,
18105 IndexTypeQuals, BracketsRange);
18108template <
typename Derived>
18111 unsigned IndexTypeQuals,
SourceRange BracketsRange) {
18112 return getDerived().RebuildArrayType(ElementType, SizeMod,
nullptr,
18114 IndexTypeQuals, BracketsRange);
18117template <
typename Derived>
18120 return SemaRef.BuildAddressSpaceAttr(PointeeType, AddrSpaceExpr,
18124template <
typename Derived>
18126 unsigned NumElements,
18129 return SemaRef.Context.getVectorType(ElementType, NumElements, VecKind);
18132template <
typename Derived>
18136 return SemaRef.BuildVectorType(ElementType, SizeExpr, AttributeLoc);
18139template<
typename Derived>
18141 unsigned NumElements,
18143 llvm::APInt numElements(
SemaRef.Context.getIntWidth(
SemaRef.Context.IntTy),
18144 NumElements,
true);
18148 return SemaRef.BuildExtVectorType(ElementType, VectorSize, AttributeLoc);
18151template<
typename Derived>
18156 return SemaRef.BuildExtVectorType(ElementType, SizeExpr, AttributeLoc);
18159template <
typename Derived>
18161 QualType ElementType,
unsigned NumRows,
unsigned NumColumns) {
18162 return SemaRef.Context.getConstantMatrixType(ElementType, NumRows,
18166template <
typename Derived>
18170 return SemaRef.BuildMatrixType(ElementType, RowExpr, ColumnExpr,
18174template <
typename Derived>
18178 return SemaRef.BuildFunctionType(
T, ParamTypes,
18184template<
typename Derived>
18186 return SemaRef.Context.getFunctionNoProtoType(
T);
18189template <
typename Derived>
18193 assert(D &&
"no decl found");
18197 if (
auto *UPD = dyn_cast<UsingPackDecl>(D)) {
18201 if (UPD->expansions().empty()) {
18202 getSema().Diag(NameLoc, diag::err_using_pack_expansion_empty)
18203 << UPD->isCXXClassMember() << UPD;
18212 for (
auto *E : UPD->expansions()) {
18219 else if (
T.isNull())
18222 assert(
getSema().Context.hasSameType(ThisT,
T) &&
18223 "mismatched resolved types in using pack expansion");
18225 return T.isNull() ? FallbackT :
T;
18227 if (
auto *Using = dyn_cast<UsingDecl>(D)) {
18228 assert(Using->hasTypename() &&
18229 "UnresolvedUsingTypenameDecl transformed to non-typename using");
18232 assert(++Using->shadow_begin() == Using->shadow_end());
18237 return SemaRef.Context.getUsingType(
Keyword, Qualifier, Shadow);
18240 "UnresolvedUsingTypenameDecl transformed to non-using decl");
18241 return SemaRef.Context.getUnresolvedUsingType(
18245template <
typename Derived>
18248 return SemaRef.BuildTypeofExprType(E, Kind);
18251template<
typename Derived>
18254 return SemaRef.Context.getTypeOfType(Underlying, Kind);
18257template <
typename Derived>
18259 return SemaRef.BuildDecltypeType(E);
18262template <
typename Derived>
18267 return SemaRef.BuildPackIndexingType(Pattern, IndexExpr, Loc, EllipsisLoc,
18268 FullySubstituted, Expansions);
18271template<
typename Derived>
18273 UnaryTransformType::UTTKind UKind,
18275 return SemaRef.BuildUnaryTransformType(BaseType, UKind, Loc);
18278template <
typename Derived>
18282 return SemaRef.CheckTemplateIdType(
18287template<
typename Derived>
18290 return SemaRef.BuildAtomicType(ValueType, KWLoc);
18293template<
typename Derived>
18297 return isReadPipe ?
SemaRef.BuildReadPipeType(ValueType, KWLoc)
18298 :
SemaRef.BuildWritePipeType(ValueType, KWLoc);
18301template <
typename Derived>
18305 llvm::APInt NumBitsAP(
SemaRef.Context.getIntWidth(
SemaRef.Context.IntTy),
18309 return SemaRef.BuildBitIntType(IsUnsigned, Bits, Loc);
18312template <
typename Derived>
18315 return SemaRef.BuildBitIntType(IsUnsigned, NumBitsExpr, Loc);
18318template <
typename Derived>
18326template <
typename Derived>
18333 getSema().ActOnTemplateName(
nullptr, SS, TemplateKWLoc,
18336 AllowInjectedClassName);
18340template<
typename Derived>
18347 bool AllowInjectedClassName) {
18350 SourceLocation SymbolLocations[3] = { NameLoc, NameLoc, NameLoc };
18355 false,
Template, AllowInjectedClassName);
18359template <
typename Derived>
18364 bool isPostIncDec = Second && (Op == OO_PlusPlus || Op == OO_MinusMinus);
18369 return SemaRef.PseudoObject().checkAssignment(
nullptr, OpLoc,
18370 Opc,
First, Second);
18385 if (Op == OO_Subscript) {
18386 if (!
First->getType()->isOverloadableType() &&
18388 return getSema().CreateBuiltinArraySubscriptExpr(
First, CalleeLoc, Second,
18390 }
else if (Op == OO_Arrow) {
18393 if (
First->getType()->isDependentType())
18396 return SemaRef.BuildOverloadedArrowExpr(
nullptr,
First, OpLoc);
18397 }
else if (Second ==
nullptr || isPostIncDec) {
18398 if (!
First->getType()->isOverloadableType() ||
18399 (Op == OO_Amp &&
getSema().isQualifiedMemberAccess(
First))) {
18406 return getSema().CreateBuiltinUnaryOp(OpLoc, Opc,
First);
18410 !
First->getType()->isOverloadableType() &&
18416 =
SemaRef.CreateBuiltinBinOp(OpLoc, Opc,
First, Second);
18425 if (!Second || isPostIncDec) {
18428 return SemaRef.CreateOverloadedUnaryOp(OpLoc, Opc, Functions,
First,
18435 First, Second, RequiresADL);
18442template<
typename Derived>
18452 QualType CanonicalBaseType =
Base->getType().getCanonicalType();
18453 if (
Base->isTypeDependent() || Destroyed.getIdentifier() ||
18458 ->getAsCanonical<RecordType>())) {
18460 return SemaRef.BuildPseudoDestructorExpr(
18461 Base, OperatorLoc, isArrow ? tok::arrow : tok::period, SS, ScopeType,
18462 CCLoc, TildeLoc, Destroyed);
18474 if (!
isa<TagType>(ScopeType->getType().getCanonicalType())) {
18475 getSema().Diag(ScopeType->getTypeLoc().getBeginLoc(),
18476 diag::err_expected_class_or_namespace)
18477 << ScopeType->getType() <<
getSema().getLangOpts().CPlusPlus;
18481 SS.
Make(
SemaRef.Context, ScopeType->getTypeLoc(), CCLoc);
18485 return getSema().BuildMemberReferenceExpr(
18486 Base,
Base->getType(), OperatorLoc, isArrow, SS, TemplateKWLoc,
18492template<
typename Derived>
18500 for (
unsigned I = 0; I < NumParams; ++I) {
18501 if (I != ContextParamPos) {
18507 Params.push_back(std::make_pair(StringRef(), QualType()));
18510 getSema().ActOnCapturedRegionStart(Loc,
nullptr,
18518 if (Body.isInvalid()) {
18519 getSema().ActOnCapturedRegionError();
18523 return getSema().ActOnCapturedRegionEnd(Body.get());
18526template <
typename Derived>
18532 llvm_unreachable(
"SYCL kernel call statement cannot appear in dependent "
18536template <
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 '...
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)
AddrLabelExpr - The GNU address of label extension, representing &&label.
Represents the index of the current element of an array being initialized by an ArrayInitLoopExpr.
Represents a loop initializing the elements of an array.
Wrapper for source info for array parameter types.
This class represents BOTH the OpenMP Array Section and OpenACC 'subarray', with a boolean differenti...
ArraySubscriptExpr - [C99 6.5.2.1] Array Subscripting.
Wrapper for source info for arrays.
void setLBracketLoc(SourceLocation Loc)
An Embarcadero array type trait, as used in the implementation of __array_rank and __array_extent.
SourceLocation getEndLoc() const LLVM_READONLY
ArrayTypeTrait getTrait() const
Expr * getDimensionExpression() const
TypeSourceInfo * getQueriedTypeSourceInfo() const
SourceLocation getBeginLoc() const LLVM_READONLY
Represents an array type, per C99 6.7.5.2 - Array Declarators.
AsTypeExpr - Clang builtin function __builtin_astype [OpenCL 6.2.4.2] This AST node provides support ...
AtomicExpr - Variadic atomic builtins: __atomic_exchange, __atomic_fetch_*, __atomic_load,...
void setKWLoc(SourceLocation Loc)
Attr - This represents one attribute.
Represents an attribute applied to a statement.
SourceLocation getAttrLoc() const
ArrayRef< const Attr * > getAttrs() const
Type source information for an attributed type.
void setAttr(const Attr *A)
Type source information for an btf_tag attributed type.
BinaryConditionalOperator - The GNU extension to the conditional operator which allows the middle ope...
A builtin binary operation expression such as "x + y" or "x <= y".
static OverloadedOperatorKind getOverloadedOperator(Opcode Opc)
Retrieve the overloaded operator kind that corresponds to the given binary opcode.
static bool isAssignmentOp(Opcode Opc)
static Opcode getOverloadedOpcode(OverloadedOperatorKind OO)
Retrieve the binary opcode that corresponds to the given overloaded operator.
A fixed int type of a specified bitwidth.
Represents a block literal declaration, which is like an unnamed FunctionDecl.
void setIsVariadic(bool value)
BlockExpr - Adaptor class for mixing a BlockDecl with expressions.
Wrapper for source info for block pointers.
BreakStmt - This represents a break.
Represents a C++2a __builtin_bit_cast(T, v) expression.
SourceLocation getEndLoc() const LLVM_READONLY
SourceLocation getBeginLoc() const LLVM_READONLY
CStyleCastExpr - An explicit cast in C (C99 6.5.4) or a C-style cast in C++ (C++ [expr....
Represents a call to a CUDA kernel function.
A C++ addrspace_cast expression (currently only enabled for OpenCL).
Represents binding an expression to a temporary.
A boolean literal, per ([C++ lex.bool] Boolean literals).
CXXCatchStmt - This represents a C++ catch block.
A C++ const_cast expression (C++ [expr.const.cast]).
Represents a call to a C++ constructor.
SourceRange getParenOrBraceRange() const
Expr * getArg(unsigned Arg)
Return the specified argument.
bool isStdInitListInitialization() const
Whether this constructor call was written as list-initialization, but was interpreted as forming a st...
SourceLocation getEndLoc() const LLVM_READONLY
SourceLocation getBeginLoc() const LLVM_READONLY
bool isListInitialization() const
Whether this constructor call was written as list-initialization.
unsigned getNumArgs() const
Return the number of arguments to the constructor call.
Represents a C++ constructor within a class.
A default argument (C++ [dcl.fct.default]).
static CXXDefaultArgExpr * Create(const ASTContext &C, SourceLocation Loc, ParmVarDecl *Param, Expr *RewrittenExpr, DeclContext *UsedContext)
A use of a default initializer in a constructor or in aggregate initialization.
Represents a delete expression for memory deallocation and destructor calls, e.g.
Represents a C++ member access expression where the actual member referenced could not be resolved be...
Represents a C++ destructor within a class.
A C++ dynamic_cast expression (C++ [expr.dynamic.cast]).
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 '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.
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 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 BuildCXXDefaultInitExpr(SourceLocation Loc, FieldDecl *Field)
ExprResult BuildLambdaExpr(SourceLocation StartLoc, SourceLocation EndLoc)
Complete a lambda-expression having processed and attached the lambda body.
@ BFRK_Rebuild
Instantiation or recovery rebuild of a for-range statement.
void ActOnCaseStmtBody(Stmt *CaseStmt, Stmt *SubStmt)
ActOnCaseStmtBody - This installs a statement as the body of a case.
ExprResult ActOnBlockStmtExpr(SourceLocation CaretLoc, Stmt *Body, Scope *CurScope)
ActOnBlockStmtExpr - This is called when the body of a block statement literal was successfully compl...
ExprResult BuildArrayTypeTrait(ArrayTypeTrait ATT, SourceLocation KWLoc, TypeSourceInfo *TSInfo, Expr *DimExpr, SourceLocation RParen)
void MarkMemberReferenced(MemberExpr *E)
Perform reference-marking and odr-use handling for a MemberExpr.
ExprResult BuildCXXNamedCast(SourceLocation OpLoc, tok::TokenKind Kind, TypeSourceInfo *Ty, Expr *E, SourceRange AngleBrackets, SourceRange Parens)
void MarkFunctionReferenced(SourceLocation Loc, FunctionDecl *Func, bool MightBeOdrUse=true)
Mark a function referenced, and check whether it is odr-used (C++ [basic.def.odr]p2,...
ExprResult CreateRecoveryExpr(SourceLocation Begin, SourceLocation End, ArrayRef< Expr * > SubExprs, QualType T=QualType())
Attempts to produce a RecoveryExpr after some AST node cannot be created.
ExprResult ActOnGCCAsmStmtString(Expr *Stm, bool ForAsmLabel)
StmtResult ActOnIfStmt(SourceLocation IfLoc, IfStatementKind StatementKind, SourceLocation LParenLoc, Stmt *InitStmt, ConditionResult Cond, SourceLocation RParenLoc, Stmt *ThenVal, SourceLocation ElseLoc, Stmt *ElseVal)
void ActOnBlockStart(SourceLocation CaretLoc, Scope *CurScope)
ActOnBlockStart - This callback is invoked when a block literal is started.
ExprResult ActOnArraySubscriptExpr(Scope *S, Expr *Base, SourceLocation LLoc, MultiExprArg ArgExprs, SourceLocation RLoc)
ExprResult BuildAtomicExpr(SourceRange CallRange, SourceRange ExprRange, SourceLocation RParenLoc, MultiExprArg Args, AtomicExpr::AtomicOp Op, AtomicArgumentOrder ArgOrder=AtomicArgumentOrder::API)
ExprResult ActOnCallExpr(Scope *S, Expr *Fn, SourceLocation LParenLoc, MultiExprArg ArgExprs, SourceLocation RParenLoc, Expr *ExecConfig=nullptr)
ActOnCallExpr - Handle a call to Fn with the specified array of arguments.
OpaquePtr< TemplateName > TemplateTy
static QualType GetTypeFromParser(ParsedType Ty, TypeSourceInfo **TInfo=nullptr)
static ConditionResult ConditionError()
StmtResult ActOnCompoundStmt(SourceLocation L, SourceLocation R, ArrayRef< Stmt * > Elts, bool isStmtExpr)
SemaPseudoObject & PseudoObject()
StmtResult ActOnCXXTryBlock(SourceLocation TryLoc, Stmt *TryBlock, ArrayRef< Stmt * > Handlers)
ActOnCXXTryBlock - Takes a try compound-statement and a number of handlers and creates a try statemen...
OpaquePtr< DeclGroupRef > DeclGroupPtrTy
StmtResult ActOnDefaultStmt(SourceLocation DefaultLoc, SourceLocation ColonLoc, Stmt *SubStmt, Scope *CurScope)
ExprResult HandleExprEvaluationContextForTypeof(Expr *E)
StmtResult ActOnCaseStmt(SourceLocation CaseLoc, ExprResult LHS, SourceLocation DotDotDotLoc, ExprResult RHS, SourceLocation ColonLoc)
TypeSourceInfo * CheckPackExpansion(TypeSourceInfo *Pattern, SourceLocation EllipsisLoc, UnsignedOrNone NumExpansions)
Construct a pack expansion type from the pattern of the pack expansion.
StmtResult FinishCXXForRangeStmt(Stmt *ForRange, Stmt *Body)
FinishCXXForRangeStmt - Attach the body to a C++0x for-range statement.
ExprResult ActOnFinishFullExpr(Expr *Expr, bool DiscardedValue)
ExprResult CreateBuiltinMatrixSubscriptExpr(Expr *Base, Expr *RowIdx, Expr *ColumnIdx, SourceLocation RBLoc)
StmtResult ActOnGCCAsmStmt(SourceLocation AsmLoc, bool IsSimple, bool IsVolatile, unsigned NumOutputs, unsigned NumInputs, IdentifierInfo **Names, MultiExprArg Constraints, MultiExprArg Exprs, Expr *AsmString, MultiExprArg Clobbers, unsigned NumLabels, SourceLocation RParenLoc)
ShuffleVectorExpr - clang-specific builtin-in function __builtin_shufflevector.
Represents an expression that computes the length of a parameter pack.
SourceLocation getPackLoc() const
Determine the location of the parameter pack.
bool isPartiallySubstituted() const
Determine whether this represents a partially-substituted sizeof... expression, such as is produced f...
static SizeOfPackExpr * Create(ASTContext &Context, SourceLocation OperatorLoc, NamedDecl *Pack, SourceLocation PackLoc, SourceLocation RParenLoc, UnsignedOrNone Length=std::nullopt, ArrayRef< TemplateArgument > PartialArgs={})
ArrayRef< TemplateArgument > getPartialArguments() const
Get.
SourceLocation getOperatorLoc() const
Determine the location of the 'sizeof' keyword.
SourceLocation getRParenLoc() const
Determine the location of the right parenthesis.
NamedDecl * getPack() const
Retrieve the parameter pack.
Represents a function call to one of __builtin_LINE(), __builtin_COLUMN(), __builtin_FUNCTION(),...
static bool MayBeDependent(SourceLocIdentKind Kind)
Encodes a location in the source.
bool isValid() const
Return true if this is a valid SourceLocation object.
A trivial tuple used to represent a source range.
SourceLocation getEnd() const
SourceLocation getBegin() const
StmtExpr - This is the GNU Statement Expression extension: ({int X=4; X;}).
Stmt - This represents one statement.
SourceLocation getEndLoc() const LLVM_READONLY
StmtClass getStmtClass() const
SourceRange getSourceRange() const LLVM_READONLY
SourceLocation tokens are not useful in isolation - they are low level value objects created/interpre...
StringLiteral - This represents a string literal expression, e.g.
Wrapper for substituted template type parameters.
Represents a reference to a non-type template parameter that has been substituted with a template arg...
Represents a reference to a non-type template parameter pack that has been substituted with a non-tem...
A structure for storing an already-substituted template template parameter pack.
A structure for storing the information associated with a substituted template template parameter.
Wrapper for substituted template type parameters.
SwitchStmt - This represents a 'switch' stmt.
Represents the declaration of a struct/union/class/enum.
SourceLocation getNameLoc() const
SourceLocation getElaboratedKeywordLoc() const
NestedNameSpecifierLoc getQualifierLoc() const
void setQualifierLoc(NestedNameSpecifierLoc QualifierLoc)
void setNameLoc(SourceLocation Loc)
void setElaboratedKeywordLoc(SourceLocation Loc)
A convenient class for passing around template argument information.
void setLAngleLoc(SourceLocation Loc)
void setRAngleLoc(SourceLocation Loc)
void addArgument(const TemplateArgumentLoc &Loc)
const TemplateArgumentLoc * operator->() const
pointer(TemplateArgumentLoc Arg)
Simple iterator that traverses the template arguments in a container that provides a getArgLoc() memb...
TemplateArgumentLoc operator*() const
TemplateArgumentLocContainerIterator operator++(int)
friend bool operator!=(const TemplateArgumentLocContainerIterator &X, const TemplateArgumentLocContainerIterator &Y)
TemplateArgumentLocContainerIterator()
TemplateArgumentLoc value_type
TemplateArgumentLocContainerIterator(ArgLocContainer &Container, unsigned Index)
friend bool operator==(const TemplateArgumentLocContainerIterator &X, const TemplateArgumentLocContainerIterator &Y)
TemplateArgumentLocContainerIterator & operator++()
std::input_iterator_tag iterator_category
TemplateArgumentLoc reference
pointer operator->() const
const TemplateArgumentLoc * operator->() const
pointer(TemplateArgumentLoc Arg)
Iterator adaptor that invents template argument location information for each of the template argumen...
TemplateArgumentLocInventIterator & operator++()
pointer operator->() const
std::iterator_traits< InputIterator >::difference_type difference_type
reference operator*() const
TemplateArgumentLocInventIterator operator++(int)
friend bool operator==(const TemplateArgumentLocInventIterator &X, const TemplateArgumentLocInventIterator &Y)
TemplateArgumentLocInventIterator(TreeTransform< Derived > &Self, InputIterator Iter)
friend bool operator!=(const TemplateArgumentLocInventIterator &X, const TemplateArgumentLocInventIterator &Y)
std::input_iterator_tag iterator_category
TemplateArgumentLoc reference
TemplateArgumentLoc value_type
Location wrapper for a TemplateArgument.
const TemplateArgument & getArgument() const
SourceLocation getTemplateNameLoc() const
SourceLocation getTemplateKWLoc() const
TypeSourceInfo * getTypeSourceInfo() const
Expr * getSourceExpression() const
NestedNameSpecifierLoc getTemplateQualifierLoc() const
Represents a template argument.
Expr * getAsExpr() const
Retrieve the template argument as an expression.
const TemplateArgument * pack_iterator
Iterator that traverses the elements of a template argument pack.
QualType getNonTypeTemplateArgumentType() const
If this is a non-type template argument, get its type.
QualType getAsType() const
Retrieve the type for a type template argument.
llvm::APSInt getAsIntegral() const
Retrieve the template argument as an integral value.
TemplateName getAsTemplate() const
Retrieve the template name for a template name argument.
bool containsUnexpandedParameterPack() const
Whether this template argument contains an unexpanded parameter pack.
ValueDecl * getAsDecl() const
Retrieve the declaration for a declaration non-type template argument.
@ Declaration
The template argument is a declaration that was provided for a pointer, reference,...
@ Template
The template argument is a template name that was provided for a template template parameter.
@ StructuralValue
The template argument is a non-type template argument that can't be represented by the special-case D...
@ Pack
The template argument is actually a parameter pack.
@ TemplateExpansion
The template argument is a pack expansion of a template name that was provided for a template templat...
@ NullPtr
The template argument is a null pointer or null pointer to member that was provided for a non-type te...
@ Type
The template argument is a type.
@ Null
Represents an empty template argument, e.g., one that has not been deduced.
@ Integral
The template argument is an integral value stored in an llvm::APSInt that was provided for an integra...
@ Expression
The template argument is an expression, and we've not resolved it to one of the other forms yet,...
ArgKind getKind() const
Return the kind of stored template argument.
bool isPackExpansion() const
Determine whether this template argument is a pack expansion.
const APValue & getAsStructuralValue() const
Get the value of a StructuralValue.
The base class of all kinds of template declarations (e.g., class, function, etc.).
Represents a C++ template name within the type system.
TemplateDecl * getAsTemplateDecl(bool IgnoreDeduced=false) const
Retrieve the underlying template declaration that this template name refers to, if known.
DeducedTemplateStorage * getAsDeducedTemplateName() const
Retrieve the deduced template info, if any.
bool isNull() const
Determine whether this template name is NULL.
DependentTemplateName * getAsDependentTemplateName() const
Retrieve the underlying dependent template name structure, if any.
QualifiedTemplateName * getAsQualifiedTemplateName() const
Retrieve the underlying qualified template name structure, if any.
NestedNameSpecifier getQualifier() const
SubstTemplateTemplateParmPackStorage * getAsSubstTemplateTemplateParmPack() const
Retrieve the substituted template template parameter pack, if known.
SubstTemplateTemplateParmStorage * getAsSubstTemplateTemplateParm() const
Retrieve the substituted template template parameter, if known.
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.
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