13#ifndef LLVM_CLANG_LIB_SEMA_TREETRANSFORM_H
14#define LLVM_CLANG_LIB_SEMA_TREETRANSFORM_H
49#include "llvm/ADT/ArrayRef.h"
50#include "llvm/Support/ErrorHandling.h"
54using namespace llvm::omp;
121template<
typename Derived>
126 class ForgetPartiallySubstitutedPackRAII {
134 ForgetPartiallySubstitutedPackRAII(Derived &
Self)
135 :
Self(
Self), ResetPackSubstIndex(
Self.getSema(), std::nullopt) {
136 Old =
Self.ForgetPartiallySubstitutedPack();
139 ~ForgetPartiallySubstitutedPackRAII() {
140 Self.RememberPartiallySubstitutedPack(Old);
142 ForgetPartiallySubstitutedPackRAII(
143 const ForgetPartiallySubstitutedPackRAII &) =
delete;
144 ForgetPartiallySubstitutedPackRAII &
145 operator=(
const ForgetPartiallySubstitutedPackRAII &) =
delete;
161 Derived &
getDerived() {
return static_cast<Derived&
>(*this); }
165 return static_cast<const Derived&
>(*this);
233 if (Location.isValid())
234 Self.getDerived().setBase(Location, Entity);
238 Self.getDerived().setBase(OldLocation, OldEntity);
313 bool FailOnPackProducingTemplates,
314 bool &ShouldExpand,
bool &RetainExpansion,
316 ShouldExpand =
false;
344 struct ForgetSubstitutionRAII {
350 Old =
Self.ForgetSubstitution();
353 ~ForgetSubstitutionRAII() {
Self.RememberSubstitution(std::move(Old)); }
453 const X##Attr *Transform##X##Attr(const X##Attr *R) { return R; }
454#include "clang/Basic/AttrList.inc"
464 const X##Attr *TransformStmt##X##Attr(const Stmt *, const Stmt *, \
465 const X##Attr *A) { \
466 return getDerived().Transform##X##Attr(A); \
468#include "clang/Basic/AttrList.inc"
514 bool *ArgChanged =
nullptr);
523 llvm::DenseMap<Decl *, Decl *>::iterator Known
526 return Known->second;
554 assert(
New.size() == 1 &&
555 "must override transformedLocalDecl if performing pack expansion");
593 NamedDecl *FirstQualifierInScope =
nullptr);
638 NamedDecl *FirstQualifierInScope =
nullptr,
639 bool AllowInjectedClassName =
false);
651 bool Uneval =
false);
678 bool Uneval =
false) {
697 template<
typename InputIterator>
701 bool Uneval =
false);
703 template <
typename InputIterator>
707 bool Uneval =
false);
728 return SemaRef.Context.getTrivialTypeSourceInfo(
T,
732#define ABSTRACT_TYPELOC(CLASS, PARENT)
733#define TYPELOC(CLASS, PARENT) \
734 QualType Transform##CLASS##Type(TypeLocBuilder &TLB, CLASS##TypeLoc T);
735#include "clang/AST/TypeLocNodes.def"
739 bool SuppressObjCLifetime);
743 bool SuppressObjCLifetime);
745 template<
typename Fn>
763 bool AllowInjectedClassName);
791 return getDerived().TransformFunctionTypeParams(
792 Loc, Params, ParamTypes, ParamInfos, PTypes, PVars, PInfos,
nullptr);
810 KWLoc, Params,
nullptr,
811 nullptr, PTypes, &TransParams, PInfos))
825 bool ExpectParameterPack);
852 bool IsAddressOfOperand,
860 bool IsAddressOfOperand);
868#define STMT(Node, Parent) \
869 LLVM_ATTRIBUTE_NOINLINE \
870 StmtResult Transform##Node(Node *S);
871#define VALUESTMT(Node, Parent) \
872 LLVM_ATTRIBUTE_NOINLINE \
873 StmtResult Transform##Node(Node *S, StmtDiscardKind SDK);
874#define EXPR(Node, Parent) \
875 LLVM_ATTRIBUTE_NOINLINE \
876 ExprResult Transform##Node(Node *E);
877#define ABSTRACT_STMT(Stmt)
878#include "clang/AST/StmtNodes.inc"
880#define GEN_CLANG_CLAUSE_CLASS
881#define CLAUSE_CLASS(Enum, Str, Class) \
882 LLVM_ATTRIBUTE_NOINLINE \
883 OMPClause *Transform##Class(Class *S);
884#include "llvm/Frontend/OpenMP/OMP.inc"
962 const llvm::APInt *Size,
Expr *SizeExpr,
963 unsigned IndexTypeQuals,
SourceRange BracketsRange);
972 const llvm::APInt &Size,
Expr *SizeExpr,
973 unsigned IndexTypeQuals,
983 unsigned IndexTypeQuals,
993 unsigned IndexTypeQuals,
1004 unsigned IndexTypeQuals,
1042 unsigned NumColumns);
1059 Expr *AddrSpaceExpr,
1083 return SemaRef.Context.getUsingType(
Keyword, Qualifier, D, UnderlyingType);
1096 return SemaRef.Context.getMacroQualifiedType(
T, MacroII);
1106 return SemaRef.Context.getCanonicalTagType(Tag);
1123 UnaryTransformType::UTTKind UKind,
1135 bool FullySubstituted,
1149 TypeConstraintConcept,
1150 TypeConstraintArgs);
1157 return SemaRef.Context.getDeducedTemplateSpecializationType(
1176 return SemaRef.BuildParenType(InnerType);
1189 bool DeducedTSTContext) {
1191 SS.
Adopt(QualifierLoc);
1195 if (!
SemaRef.computeDeclContext(SS))
1203 return SemaRef.CheckTypenameType(
Keyword, KeywordLoc, QualifierLoc,
1204 *Id, IdLoc, DeducedTSTContext);
1217 if (
SemaRef.RequireCompleteDeclContext(SS, DC))
1222 switch (
Result.getResultKind()) {
1233 llvm_unreachable(
"Tag lookup cannot find non-tags");
1245 switch (
Result.getResultKind()) {
1251 SemaRef.Diag(IdLoc, diag::err_tag_reference_non_tag)
1252 << SomeDecl << NTK << Kind;
1257 SemaRef.Diag(IdLoc, diag::err_not_tag_in_scope)
1263 if (!
SemaRef.isAcceptableTagRedeclaration(Tag, Kind,
false,
1265 SemaRef.Diag(KeywordLoc, diag::err_use_with_wrong_tag) << Id;
1266 SemaRef.Diag(Tag->getLocation(), diag::note_previous_use);
1322 bool AllowInjectedClassName);
1335 bool AllowInjectedClassName);
1341 bool AllowInjectedClassName);
1351 Decl *AssociatedDecl,
unsigned Index,
1354 ArgPack, AssociatedDecl, Index, Final);
1408 return SemaRef.ActOnLabelStmt(IdentLoc, L, ColonLoc, SubStmt);
1418 if (
SemaRef.CheckRebuiltStmtAttributes(Attrs))
1420 return SemaRef.BuildAttributedStmt(AttrLoc, Attrs, SubStmt);
1432 Then, ElseLoc, Else);
1486 Inc, RParenLoc, Body);
1531 bool IsVolatile,
unsigned NumOutputs,
1538 NumInputs, Names, Constraints, Exprs,
1539 AsmString, Clobbers, NumLabels, RParenLoc);
1548 StringRef AsmString,
1549 unsigned NumOutputs,
unsigned NumInputs,
1555 NumOutputs, NumInputs,
1556 Constraints, Clobbers, Exprs, EndLoc);
1585 CoawaitLoc, Operand, OpCoawaitLookup);
1589 Suspend.
get(),
true);
1690 Kind, DirName, CancelRegion, Clauses, AStmt, StartLoc, EndLoc);
1702 Kind, DirName, Clauses, AStmt, StartLoc, EndLoc);
1716 NameModifier,
Condition, StartLoc, LParenLoc, NameModifierLoc, ColonLoc,
1742 Modifier, NumThreads, StartLoc, LParenLoc, ModifierLoc, EndLoc);
1803 First, Count, StartLoc, LParenLoc, FirstLoc, CountLoc, EndLoc);
1839 Kind, KindKwLoc, VCKind, VCLoc, StartLoc, LParenLoc, EndLoc);
1852 Kind, KindKwLoc, StartLoc, LParenLoc, EndLoc);
1859 ImpexTypeArg, StartLoc, LParenLoc, EndLoc);
1872 M1, M2, Kind, ChunkSize, StartLoc, LParenLoc, M1Loc, M2Loc, KindLoc,
1934 VarList, LPKind, LPKindLoc, ColonLoc, StartLoc, LParenLoc, EndLoc);
1962 VarList, {Modifier, OriginalSharingModifier}, StartLoc, LParenLoc,
1963 ModifierLoc, ColonLoc, EndLoc, ReductionIdScopeSpec, ReductionId,
1964 UnresolvedReductions);
1978 VarList, StartLoc, LParenLoc, ColonLoc, EndLoc, ReductionIdScopeSpec,
1979 ReductionId, UnresolvedReductions);
1994 VarList, StartLoc, LParenLoc, ColonLoc, EndLoc, ReductionIdScopeSpec,
1995 ReductionId, UnresolvedReductions);
2008 VarList, Step, StartLoc, LParenLoc, Modifier, ModifierLoc, ColonLoc,
2009 StepModifierLoc, EndLoc);
2022 VarList, Alignment, StartLoc, LParenLoc, ColonLoc, EndLoc);
2082 Data, DepModifier, VarList, StartLoc, LParenLoc, EndLoc);
2095 Modifier,
Device, StartLoc, LParenLoc, ModifierLoc, EndLoc);
2110 IteratorModifier, MapTypeModifiers, MapTypeModifiersLoc,
2111 MapperIdScopeSpec, MapperId, MapType, IsMapTypeImplicit, MapLoc,
2112 ColonLoc, VarList, Locs,
2113 false, UnresolvedMappers);
2130 Allocate, Alignment, FirstModifier, FirstModifierLoc, SecondModifier,
2131 SecondModifierLoc, VarList, StartLoc, LParenLoc, ColonLoc, EndLoc);
2179 Modifier,
Device, StartLoc, LParenLoc, ModifierLoc, EndLoc);
2192 Modifier, NumTasks, StartLoc, LParenLoc, ModifierLoc, EndLoc);
2227 Kind, ChunkSize, StartLoc, LParenLoc, KindLoc, CommaLoc, EndLoc);
2242 MotionModifiers, MotionModifiersLoc, IteratorModifier,
2243 MapperIdScopeSpec, MapperId, ColonLoc, VarList, Locs,
2259 MotionModifiers, MotionModifiersLoc, IteratorModifier,
2260 MapperIdScopeSpec, MapperId, ColonLoc, VarList, Locs,
2273 VarList, Locs, FallbackModifier, FallbackModifierLoc);
2315 M, Kind, StartLoc, LParenLoc, MLoc, KindLoc, EndLoc);
2362 StartLoc, LParenLoc, EndLoc,
Data);
2375 StartLoc, LParenLoc, ColonLoc, EndLoc, Modifier, Locators);
2387 Modifier, Kind, StartLoc, LParenLoc, ModifierKwLoc, KindKwLoc, EndLoc);
2400 InteropVar, InteropInfo, StartLoc, LParenLoc, VarLoc, EndLoc);
2411 LParenLoc, VarLoc, EndLoc);
2423 InteropVar, StartLoc, LParenLoc, VarLoc, EndLoc);
2494 M1, M2, Size, StartLoc, LParenLoc, M1Loc, M2Loc, EndLoc);
2575 DepType, DepLoc, ColonLoc, VarList, StartLoc, LParenLoc, EndLoc);
2623 ForLoc, Element, Collection, RParenLoc);
2641 StartLoc, IdLoc, Id);
2678 if (
DeclStmt *RangeStmt = dyn_cast<DeclStmt>(Range)) {
2679 if (RangeStmt->isSingleDecl()) {
2680 if (
VarDecl *RangeVar = dyn_cast<VarDecl>(RangeStmt->getSingleDecl())) {
2681 if (RangeVar->isInvalidDecl())
2684 Expr *RangeExpr = RangeVar->getInit();
2691 diag::err_objc_for_range_init_stmt)
2692 <<
Init->getSourceRange();
2695 ForLoc, LoopVar, RangeExpr, RParenLoc);
2702 ForLoc, CoawaitLoc,
Init, ColonLoc, Range, Begin, End,
Cond, Inc,
2716 QualifierLoc, NameInfo, Nested);
2778 SS.
Adopt(QualifierLoc);
2900 if (IsOMPArraySection)
2902 Base, LBracketLoc, LowerBound, ColonLocFirst, ColonLocSecond, Length,
2903 Stride, RBracketLoc);
2905 assert(Stride ==
nullptr && !ColonLocSecond.
isValid() &&
2906 "Stride/second colon not allowed for OpenACC");
2909 Base, LBracketLoc, LowerBound, ColonLocFirst, Length, RBracketLoc);
2921 Base, LParenLoc, RParenLoc, Dims, BracketsRanges);
2933 nullptr, IteratorKwLoc, LLoc, RLoc,
Data);
2943 Expr *ExecConfig =
nullptr) {
2945 nullptr, Callee, LParenLoc, Args, RParenLoc, ExecConfig);
2952 nullptr, Callee, LParenLoc, Args, RParenLoc);
2970 if (!
Member->getDeclName()) {
2974 assert(
Member->getType()->isRecordType() &&
2975 "unnamed member not of record type?");
2988 if (!isArrow &&
Base->isPRValue()) {
3003 SS.
Adopt(QualifierLoc);
3006 if (
Base->containsErrors())
3011 if (isArrow && !BaseType->isPointerType())
3020 if (
getSema().isUnevaluatedContext() &&
Base->isImplicitCXXThis() &&
3025 ->getAsCXXRecordDecl()) {
3029 if (!ThisClass->Equals(
Class) && !ThisClass->isDerivedFrom(
Class))
3037 FirstQualifierInScope,
3038 R, ExplicitTemplateArgs,
3048 bool ForFoldExpression =
false) {
3126 return SemaRef.BuildInitList(LBraceLoc,
Inits, RBraceLoc);
3139 =
SemaRef.ActOnDesignatedInitializer(Desig, EqualOrColonLoc, GNUSyntax,
3179 unsigned NumUserSpecifiedExprs,
3184 InitLoc, LParenLoc, RParenLoc);
3214 return SemaRef.ActOnChooseExpr(BuiltinLoc,
3226 Expr *ControllingExpr,
3231 ControllingExpr, Types, Exprs);
3246 ControllingType, Types, Exprs);
3279 case Stmt::CXXStaticCastExprClass:
3280 return getDerived().RebuildCXXStaticCastExpr(OpLoc, LAngleLoc, TInfo,
3281 RAngleLoc, LParenLoc,
3282 SubExpr, RParenLoc);
3284 case Stmt::CXXDynamicCastExprClass:
3285 return getDerived().RebuildCXXDynamicCastExpr(OpLoc, LAngleLoc, TInfo,
3286 RAngleLoc, LParenLoc,
3287 SubExpr, RParenLoc);
3289 case Stmt::CXXReinterpretCastExprClass:
3290 return getDerived().RebuildCXXReinterpretCastExpr(OpLoc, LAngleLoc, TInfo,
3291 RAngleLoc, LParenLoc,
3295 case Stmt::CXXConstCastExprClass:
3296 return getDerived().RebuildCXXConstCastExpr(OpLoc, LAngleLoc, TInfo,
3297 RAngleLoc, LParenLoc,
3298 SubExpr, RParenLoc);
3300 case Stmt::CXXAddrspaceCastExprClass:
3301 return getDerived().RebuildCXXAddrspaceCastExpr(
3302 OpLoc, LAngleLoc, TInfo, RAngleLoc, LParenLoc, SubExpr, RParenLoc);
3305 llvm_unreachable(
"Invalid C++ named cast");
3383 OpLoc, tok::kw_addrspace_cast, TInfo, SubExpr,
3395 bool ListInitialization) {
3399 if (
auto *PLE = dyn_cast<ParenListExpr>(Sub))
3401 TInfo, LParenLoc,
MultiExprArg(PLE->getExprs(), PLE->getNumExprs()),
3402 RParenLoc, ListInitialization);
3404 if (
auto *PLE = dyn_cast<CXXParenListInitExpr>(Sub))
3406 TInfo, LParenLoc, PLE->getInitExprs(), RParenLoc, ListInitialization);
3410 ListInitialization);
3474 if (
getSema().CheckCXXThisType(ThisLoc, ThisType))
3484 bool IsThrownVariableInScope) {
3494 Expr *RewrittenExpr) {
3496 RewrittenExpr,
getSema().CurContext);
3530 std::optional<Expr *> ArraySize,
3549 bool IsGlobalDelete,
3600 bool IsAddressOfOperand,
3603 SS.
Adopt(QualifierLoc);
3605 if (TemplateArgs || TemplateKWLoc.
isValid())
3607 SS, TemplateKWLoc, NameInfo, TemplateArgs, IsAddressOfOperand);
3610 SS, NameInfo, IsAddressOfOperand, RecoveryTSI);
3632 bool IsElidable,
MultiExprArg Args,
bool HadMultipleCandidates,
3633 bool ListInitialization,
bool StdInitListInitialization,
3640 FoundCtor =
Constructor->getInheritedConstructor().getConstructor();
3643 if (
getSema().CompleteConstructorCall(FoundCtor,
T, Args, Loc,
3650 HadMultipleCandidates,
3652 StdInitListInitialization,
3653 RequiresZeroInit, ConstructKind,
3661 bool ConstructsVBase,
3662 bool InheritedFromVBase) {
3664 Loc,
T,
Constructor, ConstructsVBase, InheritedFromVBase);
3675 bool ListInitialization) {
3677 TSInfo, LParenOrBraceLoc, Args, RParenOrBraceLoc, ListInitialization);
3688 bool ListInitialization) {
3690 RParenLoc, ListInitialization);
3707 SS.
Adopt(QualifierLoc);
3709 return SemaRef.BuildMemberReferenceExpr(BaseE, BaseType,
3710 OperatorLoc, IsArrow,
3712 FirstQualifierInScope,
3714 TemplateArgs,
nullptr);
3730 SS.
Adopt(QualifierLoc);
3732 return SemaRef.BuildMemberReferenceExpr(BaseE, BaseType,
3733 OperatorLoc, IsArrow,
3735 FirstQualifierInScope,
3736 R, TemplateArgs,
nullptr);
3744 return SemaRef.BuildCXXNoexceptExpr(Range.getBegin(), Arg, Range.getEnd());
3757 RParenLoc, Length, PartialArgs);
3762 Expr *PackIdExpression,
Expr *IndexExpr,
3764 bool FullySubstituted =
false) {
3766 IndexExpr, RSquareLoc, ExpandedExprs,
3792 NamedConcept, TALI);
3810 LocalParameters, RParenLoc, Requirements,
3817 return SemaRef.BuildTypeRequirement(SubstDiag);
3821 return SemaRef.BuildTypeRequirement(
T);
3829 return SemaRef.BuildExprRequirement(SubstDiag, IsSimple, NoexceptLoc,
3836 return SemaRef.BuildExprRequirement(E, IsSimple, NoexceptLoc,
3843 return SemaRef.BuildNestedRequirement(InvalidConstraintEntity,
3848 return SemaRef.BuildNestedRequirement(Constraint);
3864 Expr **Elements,
unsigned NumElements) {
3874 RB,
Base, Key, getterMethod, setterMethod);
3893 return SemaRef.ObjC().BuildObjCEncodeExpression(AtLoc, EncodeTypeInfo,
3905 return SemaRef.ObjC().BuildClassMessage(
3906 ReceiverTypeInfo, ReceiverTypeInfo->
getType(),
3919 return SemaRef.ObjC().BuildInstanceMessage(Receiver, Receiver->
getType(),
3922 SelectorLocs, RBracLoc, Args);
3934 return Method->isInstanceMethod()
3935 ?
SemaRef.ObjC().BuildInstanceMessage(
3936 nullptr, SuperType, SuperLoc, Sel,
Method, LBracLoc,
3937 SelectorLocs, RBracLoc, Args)
3938 :
SemaRef.ObjC().BuildClassMessage(
nullptr, SuperType, SuperLoc,
3940 SelectorLocs, RBracLoc, Args);
3949 bool IsArrow,
bool IsFreeIvar) {
3958 if (IsFreeIvar &&
Result.isUsable())
3995 PropertyLoc,
Base));
4024 =
SemaRef.Context.Idents.get(
"__builtin_shufflevector");
4027 assert(!Lookup.
empty() &&
"No __builtin_shufflevector?");
4035 Callee =
SemaRef.ImpCastExprToType(Callee, CalleePtrTy,
4036 CK_BuiltinFnToFnPtr).get();
4052 return SemaRef.ConvertVectorExpr(SrcExpr, DstTInfo, BuiltinLoc, RParenLoc);
4067 EllipsisLoc, NumExpansions);
4091 llvm_unreachable(
"Pack expansion pattern has no parameter packs");
4127 EllipsisLoc, RHS, RParenLoc,
4136 Init->containsUnexpandedParameterPack();
4137 else if (PVD->hasUninstantiatedDefaultArg())
4139 PVD->getUninstantiatedDefaultArg()
4140 ->containsUnexpandedParameterPack();
4294 Exprs.push_back(DevNumExpr);
4295 llvm::append_range(Exprs, QueueIdExprs);
4332 AssociatedDecl, NTTP, Loc, Arg, PackIndex, Final);
4356 ObjectType, FirstQualifierInScope);
4362 QualType TransformDependentNameType(TypeLocBuilder &TLB,
4363 DependentNameTypeLoc TL,
4364 bool DeducibleTSTContext,
4365 QualType ObjectType = QualType(),
4366 NamedDecl *UnqualLookup =
nullptr);
4369 TransformOpenACCClauseList(OpenACCDirectiveKind DirKind,
4374 OpenACCDirectiveKind DirKind,
4375 const OpenACCClause *OldClause);
4378template <
typename Derived>
4388#define STMT(Node, Parent) \
4389 case Stmt::Node##Class: return getDerived().Transform##Node(cast<Node>(S));
4390#define VALUESTMT(Node, Parent) \
4391 case Stmt::Node##Class: \
4392 return getDerived().Transform##Node(cast<Node>(S), SDK);
4393#define ABSTRACT_STMT(Node)
4394#define EXPR(Node, Parent)
4395#include "clang/AST/StmtNodes.inc"
4398#define STMT(Node, Parent)
4399#define ABSTRACT_STMT(Stmt)
4400#define EXPR(Node, Parent) case Stmt::Node##Class:
4401#include "clang/AST/StmtNodes.inc"
4406 E =
getSema().ActOnStmtExprResult(E);
4414template<
typename Derived>
4422#define GEN_CLANG_CLAUSE_CLASS
4423#define CLAUSE_CLASS(Enum, Str, Class) \
4425 return getDerived().Transform##Class(cast<Class>(S));
4426#include "llvm/Frontend/OpenMP/OMP.inc"
4433template<
typename Derived>
4440#define STMT(Node, Parent) case Stmt::Node##Class: break;
4441#define ABSTRACT_STMT(Stmt)
4442#define EXPR(Node, Parent) \
4443 case Stmt::Node##Class: return getDerived().Transform##Node(cast<Node>(E));
4444#include "clang/AST/StmtNodes.inc"
4450template<
typename Derived>
4458 if (
auto *FE = dyn_cast<FullExpr>(
Init))
4459 Init = FE->getSubExpr();
4461 if (
auto *AIL = dyn_cast<ArrayInitLoopExpr>(
Init)) {
4467 Init = MTE->getSubExpr();
4470 Init = Binder->getSubExpr();
4473 Init = ICE->getSubExprAsWritten();
4476 dyn_cast<CXXStdInitializerListExpr>(
Init))
4513 getSema().currentEvaluationContext().InLifetimeExtendingContext =
4514 getSema().parentEvaluationContext().InLifetimeExtendingContext;
4515 getSema().currentEvaluationContext().RebuildDefaultArgOrDefaultInit =
4516 getSema().parentEvaluationContext().RebuildDefaultArgOrDefaultInit;
4518 bool ArgChanged =
false;
4520 true, NewArgs, &ArgChanged))
4530 if (
Parens.isInvalid()) {
4533 assert(NewArgs.empty() &&
4534 "no parens or braces but have direct init with arguments?");
4541template<
typename Derived>
4547 for (
unsigned I = 0; I != NumInputs; ++I) {
4557 Expr *Pattern = Expansion->getPattern();
4560 getSema().collectUnexpandedParameterPacks(Pattern, Unexpanded);
4561 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
4566 bool RetainExpansion =
false;
4567 UnsignedOrNone OrigNumExpansions = Expansion->getNumExpansions();
4571 Unexpanded,
true, Expand,
4572 RetainExpansion, NumExpansions))
4585 Expansion->getEllipsisLoc(),
4587 if (Out.isInvalid())
4592 Outputs.push_back(Out.get());
4598 if (ArgChanged) *ArgChanged =
true;
4602 for (
unsigned I = 0; I != *NumExpansions; ++I) {
4605 if (Out.isInvalid())
4608 if (Out.get()->containsUnexpandedParameterPack()) {
4610 Out.get(), Expansion->getEllipsisLoc(), OrigNumExpansions);
4611 if (Out.isInvalid())
4615 Outputs.push_back(Out.get());
4620 if (RetainExpansion) {
4621 ForgetPartiallySubstitutedPackRAII Forget(
getDerived());
4624 if (Out.isInvalid())
4628 Out.get(), Expansion->getEllipsisLoc(), OrigNumExpansions);
4629 if (Out.isInvalid())
4632 Outputs.push_back(Out.get());
4639 IsCall ?
getDerived().TransformInitializer(Inputs[I],
false)
4644 if (
Result.get() != Inputs[I] && ArgChanged)
4647 Outputs.push_back(
Result.get());
4653template <
typename Derived>
4664 VarDecl *ConditionVar = cast_or_null<VarDecl>(
4670 return getSema().ActOnConditionVariable(ConditionVar, Loc, Kind);
4679 return getSema().ActOnCondition(
nullptr, Loc, CondExpr.
get(), Kind,
4686template <
typename Derived>
4694 Qualifier = Qualifier.getAsNamespaceAndPrefix().Prefix)
4706 llvm_unreachable(
"unexpected null nested name specifier");
4737 QualifierLoc =
getDerived().TransformNestedNameSpecifierLoc(
4738 QualifierLoc, ObjectType, FirstQualifierInScope);
4742 FirstQualifierInScope =
nullptr;
4744 SS.
Adopt(QualifierLoc);
4748 if (
SemaRef.BuildCXXNestedNameSpecifier(
nullptr, IdInfo,
4750 FirstQualifierInScope,
false))
4758 T = TransformTypeInObjectScope(TLB, TL, ObjectType,
4759 FirstQualifierInScope);
4765 if (
T->isDependentType() ||
T->isRecordType() ||
4766 (
SemaRef.getLangOpts().CPlusPlus11 &&
T->isEnumeralType())) {
4767 if (
T->isEnumeralType())
4769 diag::warn_cxx98_compat_enum_nested_name_spec);
4776 if (!TTL || !TTL.
getDecl()->isInvalidDecl()) {
4800template<
typename Derived>
4820 TemplateDecl *NewTemplate = cast_or_null<TemplateDecl>(
4827 SemaRef.Context.DeclarationNames.getCXXDeductionGuideName(NewTemplate));
4837 NewTInfo =
getDerived().TransformType(OldTInfo);
4840 NewCanTy =
SemaRef.Context.getCanonicalType(NewTInfo->
getType());
4848 NewCanTy =
SemaRef.Context.getCanonicalType(NewT);
4861 llvm_unreachable(
"Unknown name kind.");
4864template <
typename Derived>
4868 QualType ObjectType,
bool AllowInjectedClassName) {
4870 return getDerived().RebuildTemplateName(SS, TemplateKWLoc, *II, NameLoc,
4871 ObjectType, AllowInjectedClassName);
4873 NameLoc, ObjectType,
4874 AllowInjectedClassName);
4877template <
typename Derived>
4881 NamedDecl *FirstQualifierInScope,
bool AllowInjectedClassName) {
4883 TemplateName UnderlyingName = QTN->getUnderlyingTemplate();
4886 QualifierLoc =
getDerived().TransformNestedNameSpecifierLoc(
4887 QualifierLoc, ObjectType, FirstQualifierInScope);
4894 UnderlyingQualifier, TemplateKWLoc, UnderlyingName, NameLoc, ObjectType,
4895 FirstQualifierInScope, AllowInjectedClassName);
4896 if (NewUnderlyingName.
isNull())
4898 assert(!UnderlyingQualifier &&
"unexpected qualifier");
4902 NewUnderlyingName == UnderlyingName)
4905 SS.
Adopt(QualifierLoc);
4906 return getDerived().RebuildTemplateName(SS, QTN->hasTemplateKeyword(),
4912 QualifierLoc =
getDerived().TransformNestedNameSpecifierLoc(
4913 QualifierLoc, ObjectType, FirstQualifierInScope);
4927 SS.
Adopt(QualifierLoc);
4928 return getDerived().RebuildTemplateName(SS, TemplateKWLoc, DTN->getName(),
4929 NameLoc, ObjectType,
4930 AllowInjectedClassName);
4935 assert(!QualifierLoc &&
"Unexpected qualified SubstTemplateTemplateParm");
4942 ReplacementQualifierLoc = Builder.getWithLocInContext(
SemaRef.Context);
4946 ReplacementQualifierLoc, TemplateKWLoc, ReplacementName, NameLoc,
4947 ObjectType, FirstQualifierInScope, AllowInjectedClassName);
4950 Decl *AssociatedDecl =
4951 getDerived().TransformDecl(NameLoc, S->getAssociatedDecl());
4953 AssociatedDecl == S->getAssociatedDecl())
4955 return SemaRef.Context.getSubstTemplateTemplateParm(
4956 NewName, AssociatedDecl, S->getIndex(), S->getPackIndex(),
4961 "DeducedTemplateName should not escape partial ordering");
4965 assert(!QualifierLoc &&
"Unexpected qualifier");
4972 assert(!QualifierLoc &&
4973 "Unexpected qualified SubstTemplateTemplateParmPack");
4975 SubstPack->getArgumentPack(), SubstPack->getAssociatedDecl(),
4976 SubstPack->getIndex(), SubstPack->getFinal());
4980 llvm_unreachable(
"overloaded function decl survived to here");
4983template <
typename Derived>
4988 QualifierLoc, TemplateKeywordLoc, Name, NameLoc);
4994template<
typename Derived>
4998 Output =
getSema().getTrivialTemplateArgumentLoc(
5002template <
typename Derived>
5010 llvm_unreachable(
"Unexpected TemplateArgument");
5033 if (NewT ==
T && D == NewD)
5050 llvm_unreachable(
"unexpected template argument kind");
5082 llvm_unreachable(
"Caller should expand pack expansions");
5098 E =
SemaRef.ActOnConstantExpression(E);
5113template<
typename Derived,
typename InputIterator>
5121 typedef typename std::iterator_traits<InputIterator>::difference_type
5136 : Self(Self), Iter(Iter) { }
5151 Self.InventTemplateArgumentLoc(*Iter,
Result);
5159 return X.Iter == Y.Iter;
5164 return X.Iter != Y.Iter;
5168template<
typename Derived>
5169template<
typename InputIterator>
5189 PackLocIterator(*
this, In.getArgument().pack_begin()),
5190 PackLocIterator(*
this, In.getArgument().pack_end()), *PackOutput,
5197 if (In.getArgument().isPackExpansion()) {
5209 std::optional<ForgetSubstitutionRAII> ForgetSubst;
5219 if (Out.getArgument().containsUnexpandedParameterPack()) {
5222 if (Out.getArgument().isNull())
5232 ForgetPartiallySubstitutedPackRAII Forget(
getDerived());
5240 if (Out.getArgument().isNull())
5259template <
typename Derived>
5260template <
typename InputIterator>
5269 return !Arg.isDependent() && Arg.isConceptOrConceptTemplateParameter();
5281 PackLocIterator(*
this, In.getArgument().pack_begin()),
5282 PackLocIterator(*
this, In.getArgument().pack_end()), Outputs,
5288 if (!isNonDependentConceptArgument(In.getArgument())) {
5303template <
typename Derived>
5314 Pattern =
getSema().getTemplateArgumentPackExpansionPattern(
5317 getSema().collectUnexpandedParameterPacks(Pattern, Unexpanded);
5318 if (IsLateExpansionAttempt) {
5323 return P.first.dyn_cast<
const SubstBuiltinTemplatePackType *>();
5325 if (!SawPackTypes) {
5330 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
5338 Info.
Ellipsis, Pattern.getSourceRange(), Unexpanded,
5344 if (ComputeInfo(In,
false, Info, Pattern))
5356 std::optional<Sema::ArgPackSubstIndexRAII> SubstIndex(
5357 std::in_place,
getSema(), std::nullopt);
5363 if (Out.getArgument().isNull())
5400 ForgetSubstitutionRAII ForgetSubst(
getDerived());
5401 if (ComputeInfo(Out,
true, Info, OutPattern))
5414template<
typename Derived>
5432template <
typename Derived>
5452template<
typename Derived>
5455 switch (
T.getTypeLocClass()) {
5456#define ABSTRACT_TYPELOC(CLASS, PARENT)
5457#define TYPELOC(CLASS, PARENT) \
5458 case TypeLoc::CLASS: \
5459 return getDerived().Transform##CLASS##Type(TLB, \
5460 T.castAs<CLASS##TypeLoc>());
5461#include "clang/AST/TypeLocNodes.def"
5464 llvm_unreachable(
"unhandled type loc!");
5467template<
typename Derived>
5480template <
typename Derived>
5518template<
typename Derived>
5523 TypeLoc UnqualTL =
T.getUnqualifiedLoc();
5524 auto SuppressObjCLifetime =
5525 T.getType().getLocalQualifiers().hasObjCLifetime();
5527 Result = getDerived().TransformTemplateTypeParmType(TLB, TTP,
5528 SuppressObjCLifetime);
5529 }
else if (
auto STTP = UnqualTL.
getAs<SubstTemplateTypeParmPackTypeLoc>()) {
5530 Result = getDerived().TransformSubstTemplateTypeParmPackType(
5531 TLB, STTP, SuppressObjCLifetime);
5533 Result = getDerived().TransformType(TLB, UnqualTL);
5552template <
typename Derived>
5562 SemaRef.Diag(Loc, diag::err_address_space_mismatch_templ_inst)
5569 if (
T.getPointerAuth().isPresent()) {
5570 SemaRef.Diag(Loc, diag::err_ptrauth_qualifier_redundant) << TL.
getType();
5573 if (!
T->isDependentType()) {
5574 if (!
T->isSignableType(
SemaRef.getASTContext())) {
5575 SemaRef.Diag(Loc, diag::err_ptrauth_qualifier_invalid_target) <<
T;
5583 if (
T->isFunctionType()) {
5584 T =
SemaRef.getASTContext().getAddrSpaceQualType(
T,
5594 if (
T->isReferenceType()) {
5604 if (!
T->isObjCLifetimeType() && !
T->isDependentType())
5606 else if (
T.getObjCLifetime()) {
5610 const AutoType *AutoTy;
5611 if ((AutoTy = dyn_cast<AutoType>(
T)) && AutoTy->isDeduced()) {
5613 QualType Deduced = AutoTy->getDeducedType();
5618 T =
SemaRef.Context.getAutoType(Deduced, AutoTy->getKeyword(),
5621 AutoTy->getTypeConstraintConcept(),
5622 AutoTy->getTypeConstraintArguments());
5627 SemaRef.Diag(Loc, diag::err_attr_objc_ownership_redundant) <<
T;
5633 return SemaRef.BuildQualifiedType(
T, Loc, Quals);
5636template <
typename Derived>
5637QualType TreeTransform<Derived>::TransformTypeInObjectScope(
5640 assert(!getDerived().AlreadyTransformed(TL.
getType()));
5643 case TypeLoc::TemplateSpecialization:
5644 return getDerived().TransformTemplateSpecializationType(
5646 FirstQualifierInScope,
true);
5647 case TypeLoc::DependentName:
5648 return getDerived().TransformDependentNameType(
5650 ObjectType, FirstQualifierInScope);
5654 return getDerived().TransformType(TLB, TL);
5658template <
class TyLoc>
static inline
5660 TyLoc NewT = TLB.
push<TyLoc>(
T.getType());
5661 NewT.setNameLoc(
T.getNameLoc());
5665template<
typename Derived>
5666QualType TreeTransform<Derived>::TransformBuiltinType(TypeLocBuilder &TLB,
5668 BuiltinTypeLoc NewT = TLB.push<BuiltinTypeLoc>(T.getType());
5669 NewT.setBuiltinLoc(T.getBuiltinLoc());
5670 if (T.needsExtraLocalData())
5671 NewT.getWrittenBuiltinSpecs() = T.getWrittenBuiltinSpecs();
5675template<
typename Derived>
5682template <
typename Derived>
5686 return getDerived().
TransformType(TLB, TL.getOriginalLoc());
5689template<
typename Derived>
5692 QualType OriginalType = getDerived().TransformType(TLB, TL.getOriginalLoc());
5693 if (OriginalType.isNull())
5697 if (getDerived().AlwaysRebuild() ||
5698 OriginalType != TL.getOriginalLoc().getType())
5705template <
typename Derived>
5709 QualType OriginalType = getDerived().TransformType(TLB, TL.getElementLoc());
5710 if (OriginalType.isNull())
5714 if (getDerived().AlwaysRebuild() ||
5715 OriginalType != TL.getElementLoc().getType())
5722template<
typename Derived>
5726 = getDerived().TransformType(TLB, TL.getPointeeLoc());
5727 if (PointeeType.isNull())
5731 if (PointeeType->getAs<ObjCObjectType>()) {
5743 if (getDerived().AlwaysRebuild() ||
5744 PointeeType != TL.getPointeeLoc().getType()) {
5745 Result = getDerived().RebuildPointerType(PointeeType, TL.getSigilLoc());
5752 TLB.TypeWasModifiedSafely(
Result->getPointeeType());
5759template<
typename Derived>
5764 = getDerived().TransformType(TLB, TL.getPointeeLoc());
5765 if (PointeeType.isNull())
5769 if (getDerived().AlwaysRebuild() ||
5770 PointeeType != TL.getPointeeLoc().getType()) {
5771 Result = getDerived().RebuildBlockPointerType(PointeeType,
5786template<
typename Derived>
5794 if (PointeeType.
isNull())
5799 PointeeType !=
T->getPointeeTypeAsWritten()) {
5801 T->isSpelledAsLValue(),
5823template<
typename Derived>
5827 return TransformReferenceType(TLB, TL);
5830template<
typename Derived>
5832TreeTransform<Derived>::TransformRValueReferenceType(TypeLocBuilder &TLB,
5833 RValueReferenceTypeLoc TL) {
5834 return TransformReferenceType(TLB, TL);
5837template<
typename Derived>
5841 QualType PointeeType = getDerived().TransformType(TLB, TL.getPointeeLoc());
5842 if (PointeeType.isNull())
5849 getDerived().TransformNestedNameSpecifierLoc(OldQualifierLoc);
5850 if (!NewQualifierLoc)
5853 CXXRecordDecl *OldCls =
T->getMostRecentCXXRecordDecl(), *NewCls =
nullptr;
5855 NewCls = cast_or_null<CXXRecordDecl>(
5856 getDerived().TransformDecl(TL.getStarLoc(), OldCls));
5862 if (getDerived().AlwaysRebuild() || PointeeType !=
T->getPointeeType() ||
5863 NewQualifierLoc.getNestedNameSpecifier() !=
5864 OldQualifierLoc.getNestedNameSpecifier() ||
5867 SS.
Adopt(NewQualifierLoc);
5868 Result = getDerived().RebuildMemberPointerType(PointeeType, SS, NewCls,
5877 if (MPT && PointeeType != MPT->getPointeeType()) {
5884 NewTL.setQualifierLoc(NewQualifierLoc);
5889template<
typename Derived>
5894 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
5895 if (ElementType.isNull())
5899 Expr *OldSize = TL.getSizeExpr();
5901 OldSize =
const_cast<Expr*
>(
T->getSizeExpr());
5902 Expr *NewSize =
nullptr;
5906 NewSize = getDerived().TransformExpr(OldSize).template getAs<Expr>();
5911 if (getDerived().AlwaysRebuild() ||
5912 ElementType !=
T->getElementType() ||
5913 (
T->getSizeExpr() && NewSize != OldSize)) {
5914 Result = getDerived().RebuildConstantArrayType(ElementType,
5915 T->getSizeModifier(),
5916 T->getSize(), NewSize,
5917 T->getIndexTypeCVRQualifiers(),
5918 TL.getBracketsRange());
5929 NewTL.setRBracketLoc(TL.getRBracketLoc());
5930 NewTL.setSizeExpr(NewSize);
5935template<
typename Derived>
5940 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
5941 if (ElementType.isNull())
5945 if (getDerived().AlwaysRebuild() ||
5946 ElementType !=
T->getElementType()) {
5947 Result = getDerived().RebuildIncompleteArrayType(ElementType,
5948 T->getSizeModifier(),
5949 T->getIndexTypeCVRQualifiers(),
5950 TL.getBracketsRange());
5957 NewTL.setRBracketLoc(TL.getRBracketLoc());
5958 NewTL.setSizeExpr(
nullptr);
5963template<
typename Derived>
5968 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
5969 if (ElementType.isNull())
5976 SizeResult = getDerived().TransformExpr(
T->getSizeExpr());
5978 if (SizeResult.isInvalid())
5982 if (SizeResult.isInvalid())
5988 if (getDerived().AlwaysRebuild() ||
5989 ElementType !=
T->getElementType() ||
5990 Size !=
T->getSizeExpr()) {
5991 Result = getDerived().RebuildVariableArrayType(ElementType,
5992 T->getSizeModifier(),
5994 T->getIndexTypeCVRQualifiers(),
5995 TL.getBracketsRange());
6004 NewTL.setRBracketLoc(TL.getRBracketLoc());
6005 NewTL.setSizeExpr(Size);
6010template<
typename Derived>
6015 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
6016 if (ElementType.isNull())
6024 SemaRef.
ExprEvalContexts.back().InConditionallyConstantEvaluateContext =
true;
6027 Expr *origSize = TL.getSizeExpr();
6028 if (!origSize) origSize =
T->getSizeExpr();
6031 = getDerived().TransformExpr(origSize);
6033 if (sizeResult.isInvalid())
6036 Expr *size = sizeResult.get();
6039 if (getDerived().AlwaysRebuild() ||
6040 ElementType !=
T->getElementType() ||
6042 Result = getDerived().RebuildDependentSizedArrayType(ElementType,
6043 T->getSizeModifier(),
6045 T->getIndexTypeCVRQualifiers(),
6046 TL.getBracketsRange());
6055 NewTL.setRBracketLoc(TL.getRBracketLoc());
6056 NewTL.setSizeExpr(size);
6061template <
typename Derived>
6065 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
6066 if (ElementType.isNull())
6074 if (
Size.isInvalid())
6078 if (getDerived().AlwaysRebuild() || ElementType !=
T->getElementType() ||
6079 Size.get() !=
T->getSizeExpr()) {
6080 Result = getDerived().RebuildDependentVectorType(
6081 ElementType,
Size.get(),
T->getAttributeLoc(),
T->getVectorKind());
6099template<
typename Derived>
6106 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
6107 if (ElementType.isNull())
6116 if (
Size.isInvalid())
6120 if (getDerived().AlwaysRebuild() ||
6121 ElementType !=
T->getElementType() ||
6122 Size.get() !=
T->getSizeExpr()) {
6123 Result = getDerived().RebuildDependentSizedExtVectorType(ElementType,
6125 T->getAttributeLoc());
6143template <
typename Derived>
6148 QualType ElementType = getDerived().TransformType(
T->getElementType());
6149 if (ElementType.isNull())
6153 if (getDerived().AlwaysRebuild() || ElementType !=
T->getElementType()) {
6154 Result = getDerived().RebuildConstantMatrixType(
6155 ElementType,
T->getNumRows(),
T->getNumColumns());
6162 NewTL.setAttrOperandParensRange(TL.getAttrOperandParensRange());
6163 NewTL.setAttrRowOperand(TL.getAttrRowOperand());
6164 NewTL.setAttrColumnOperand(TL.getAttrColumnOperand());
6169template <
typename Derived>
6174 QualType ElementType = getDerived().TransformType(
T->getElementType());
6175 if (ElementType.isNull()) {
6183 Expr *origRows = TL.getAttrRowOperand();
6185 origRows =
T->getRowExpr();
6186 Expr *origColumns = TL.getAttrColumnOperand();
6188 origColumns =
T->getColumnExpr();
6190 ExprResult rowResult = getDerived().TransformExpr(origRows);
6192 if (rowResult.isInvalid())
6195 ExprResult columnResult = getDerived().TransformExpr(origColumns);
6197 if (columnResult.isInvalid())
6200 Expr *rows = rowResult.get();
6201 Expr *columns = columnResult.get();
6204 if (getDerived().AlwaysRebuild() || ElementType !=
T->getElementType() ||
6205 rows != origRows || columns != origColumns) {
6206 Result = getDerived().RebuildDependentSizedMatrixType(
6207 ElementType, rows, columns,
T->getAttributeLoc());
6217 NewTL.setAttrOperandParensRange(TL.getAttrOperandParensRange());
6218 NewTL.setAttrRowOperand(rows);
6219 NewTL.setAttrColumnOperand(columns);
6223template <
typename Derived>
6229 getDerived().TransformType(TLB, TL.getPointeeTypeLoc());
6231 if (pointeeType.isNull())
6238 ExprResult AddrSpace = getDerived().TransformExpr(
T->getAddrSpaceExpr());
6240 if (AddrSpace.isInvalid())
6244 if (getDerived().AlwaysRebuild() || pointeeType !=
T->getPointeeType() ||
6245 AddrSpace.get() !=
T->getAddrSpaceExpr()) {
6246 Result = getDerived().RebuildDependentAddressSpaceType(
6247 pointeeType, AddrSpace.get(),
T->getAttributeLoc());
6258 NewTL.setAttrExprOperand(TL.getAttrExprOperand());
6259 NewTL.setAttrNameLoc(TL.getAttrNameLoc());
6262 TLB.TypeWasModifiedSafely(
Result);
6268template <
typename Derived>
6272 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
6273 if (ElementType.isNull())
6277 if (getDerived().AlwaysRebuild() ||
6278 ElementType !=
T->getElementType()) {
6279 Result = getDerived().RebuildVectorType(ElementType,
T->getNumElements(),
6280 T->getVectorKind());
6291template<
typename Derived>
6295 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
6296 if (ElementType.isNull())
6300 if (getDerived().AlwaysRebuild() ||
6301 ElementType !=
T->getElementType()) {
6302 Result = getDerived().RebuildExtVectorType(ElementType,
6303 T->getNumElements(),
6315template <
typename Derived>
6318 bool ExpectParameterPack) {
6353 if (NewTSI == OldTSI && indexAdjustment == 0)
6363 getDerived().transformedLocalDecl(OldParm, {newParm});
6367template <
typename Derived>
6375 unsigned *LastParamTransformed) {
6376 int indexAdjustment = 0;
6378 unsigned NumParams = Params.size();
6379 for (
unsigned i = 0; i != NumParams; ++i) {
6380 if (LastParamTransformed)
6381 *LastParamTransformed = i;
6383 assert(OldParm->getFunctionScopeIndex() == i);
6387 if (OldParm->isParameterPack()) {
6392 TypeLoc TL = OldParm->getTypeSourceInfo()->getTypeLoc();
6395 SemaRef.collectUnexpandedParameterPacks(Pattern, Unexpanded);
6398 bool ShouldExpand =
false;
6399 bool RetainExpansion =
false;
6401 if (Unexpanded.size() > 0) {
6402 OrigNumExpansions = ExpansionTL.
getTypePtr()->getNumExpansions();
6403 NumExpansions = OrigNumExpansions;
6407 ShouldExpand, RetainExpansion, NumExpansions)) {
6412 const AutoType *AT =
6413 Pattern.getType().getTypePtr()->getContainedAutoType();
6414 assert((AT && (!AT->isDeduced() || AT->getDeducedType().isNull())) &&
6415 "Could not find parameter packs or undeduced auto type!");
6422 getDerived().ExpandingFunctionParameterPack(OldParm);
6423 for (
unsigned I = 0; I != *NumExpansions; ++I) {
6426 =
getDerived().TransformFunctionTypeParam(OldParm,
6434 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6435 OutParamTypes.push_back(NewParm->
getType());
6437 PVars->push_back(NewParm);
6442 if (RetainExpansion) {
6443 ForgetPartiallySubstitutedPackRAII Forget(
getDerived());
6445 =
getDerived().TransformFunctionTypeParam(OldParm,
6453 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6454 OutParamTypes.push_back(NewParm->
getType());
6456 PVars->push_back(NewParm);
6472 NewParm =
getDerived().TransformFunctionTypeParam(OldParm,
6477 "Parameter pack no longer a parameter pack after "
6480 NewParm =
getDerived().TransformFunctionTypeParam(
6481 OldParm, indexAdjustment, std::nullopt,
6489 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6490 OutParamTypes.push_back(NewParm->
getType());
6492 PVars->push_back(NewParm);
6500 bool IsPackExpansion =
false;
6503 if (
const PackExpansionType *Expansion
6504 = dyn_cast<PackExpansionType>(OldType)) {
6506 QualType Pattern = Expansion->getPattern();
6508 getSema().collectUnexpandedParameterPacks(Pattern, Unexpanded);
6511 bool ShouldExpand =
false;
6512 bool RetainExpansion =
false;
6516 RetainExpansion, NumExpansions)) {
6523 for (
unsigned I = 0; I != *NumExpansions; ++I) {
6530 NewType =
getSema().getASTContext().getPackExpansionType(
6531 NewType, std::nullopt);
6538 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6539 OutParamTypes.push_back(NewType);
6541 PVars->push_back(
nullptr);
6550 if (RetainExpansion) {
6551 ForgetPartiallySubstitutedPackRAII Forget(
getDerived());
6557 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6558 OutParamTypes.push_back(NewType);
6560 PVars->push_back(
nullptr);
6565 OldType = Expansion->getPattern();
6566 IsPackExpansion =
true;
6568 NewType =
getDerived().TransformType(OldType);
6570 NewType =
getDerived().TransformType(OldType);
6576 if (IsPackExpansion)
6577 NewType =
getSema().Context.getPackExpansionType(NewType,
6581 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6582 OutParamTypes.push_back(NewType);
6584 PVars->push_back(
nullptr);
6589 for (
unsigned i = 0, e = PVars->size(); i != e; ++i)
6591 assert(parm->getFunctionScopeIndex() == i);
6598template<
typename Derived>
6603 return getDerived().TransformFunctionProtoType(
6607 ExceptionStorage, Changed);
6611template<
typename Derived>
template<
typename Fn>
6630 if (
T->hasTrailingReturn()) {
6634 T->getExtParameterInfosOrNull(),
6635 ParamTypes, &ParamDecls, ExtParamInfos))
6645 auto *RD = dyn_cast<CXXRecordDecl>(
SemaRef.getCurLexicalContext());
6647 SemaRef, !ThisContext && RD ? RD : ThisContext, ThisTypeQuals);
6662 T->getExtParameterInfosOrNull(),
6663 ParamTypes, &ParamDecls, ExtParamInfos))
6669 bool EPIChanged =
false;
6674 if (
auto NewExtParamInfos =
6690 std::optional<FunctionEffectSet> NewFX;
6702 std::optional<FunctionEffectMode> Mode =
6722 "FunctionEffectMode::None shouldn't be possible here");
6725 if (!
SemaRef.diagnoseConflictingFunctionEffect(*NewFX, NewEC,
6728 NewFX->insert(NewEC, Errs);
6729 assert(Errs.empty());
6739 Result =
getDerived().RebuildFunctionProtoType(ResultType, ParamTypes, EPI);
6750 for (
unsigned i = 0, e = NewTL.
getNumParams(); i != e; ++i)
6756template<
typename Derived>
6779 getSema().ActOnNoexceptSpec(NoexceptExpr.
get(), EST);
6794 if (
const PackExpansionType *PackExpansion =
6795 T->getAs<PackExpansionType>()) {
6800 SemaRef.collectUnexpandedParameterPacks(PackExpansion->getPattern(),
6802 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
6807 bool Expand =
false;
6808 bool RetainExpansion =
false;
6809 UnsignedOrNone NumExpansions = PackExpansion->getNumExpansions();
6814 true, Expand, RetainExpansion,
6827 U =
SemaRef.Context.getPackExpansionType(
U, NumExpansions);
6828 Exceptions.push_back(
U);
6834 for (
unsigned ArgIdx = 0; ArgIdx != *NumExpansions; ++ArgIdx) {
6838 if (
U.isNull() ||
SemaRef.CheckSpecifiedExceptionType(
U, Loc))
6841 Exceptions.push_back(
U);
6845 if (
U.isNull() ||
SemaRef.CheckSpecifiedExceptionType(
U, Loc))
6850 Exceptions.push_back(
U);
6860template<
typename Derived>
6870 if (getDerived().AlwaysRebuild() || ResultType !=
T->getReturnType())
6871 Result = getDerived().RebuildFunctionNoProtoType(ResultType);
6882template <
typename Derived>
6883QualType TreeTransform<Derived>::TransformUnresolvedUsingType(
6884 TypeLocBuilder &TLB, UnresolvedUsingTypeLoc TL) {
6886 const UnresolvedUsingType *T = TL.getTypePtr();
6887 bool Changed =
false;
6889 NestedNameSpecifierLoc QualifierLoc = TL.getQualifierLoc();
6890 if (NestedNameSpecifierLoc OldQualifierLoc = QualifierLoc) {
6891 QualifierLoc = getDerived().TransformNestedNameSpecifierLoc(QualifierLoc);
6894 Changed |= QualifierLoc != OldQualifierLoc;
6897 auto *D = getDerived().TransformDecl(TL.getNameLoc(),
T->getDecl());
6903 if (getDerived().AlwaysRebuild() || Changed) {
6904 Result = getDerived().RebuildUnresolvedUsingType(
6905 T->getKeyword(), QualifierLoc.getNestedNameSpecifier(), TL.getNameLoc(),
6913 QualifierLoc, TL.getNameLoc());
6916 QualifierLoc, TL.getNameLoc());
6920template <
typename Derived>
6928 QualifierLoc = getDerived().TransformNestedNameSpecifierLoc(QualifierLoc);
6931 Changed |= QualifierLoc != OldQualifierLoc;
6934 auto *D = cast_or_null<UsingShadowDecl>(
6935 getDerived().TransformDecl(TL.getNameLoc(),
T->getDecl()));
6940 QualType UnderlyingType = getDerived().TransformType(
T->desugar());
6941 if (UnderlyingType.isNull())
6943 Changed |= UnderlyingType !=
T->desugar();
6946 if (getDerived().AlwaysRebuild() || Changed) {
6947 Result = getDerived().RebuildUsingType(
6948 T->getKeyword(), QualifierLoc.getNestedNameSpecifier(), D,
6958template<
typename Derived>
6966 QualifierLoc = getDerived().TransformNestedNameSpecifierLoc(QualifierLoc);
6969 Changed |= QualifierLoc != OldQualifierLoc;
6972 auto *
Typedef = cast_or_null<TypedefNameDecl>(
6973 getDerived().TransformDecl(TL.getNameLoc(),
T->getDecl()));
6981 if (getDerived().AlwaysRebuild() || Changed) {
6982 Result = getDerived().RebuildTypedefType(
6983 T->getKeyword(), QualifierLoc.getNestedNameSpecifier(),
Typedef);
6989 QualifierLoc, TL.getNameLoc());
6993template<
typename Derived>
7001 ExprResult E = getDerived().TransformExpr(TL.getUnderlyingExpr());
7011 if (getDerived().AlwaysRebuild() || E.get() != TL.getUnderlyingExpr()) {
7013 getDerived().RebuildTypeOfExprType(E.get(), TL.getTypeofLoc(), Kind);
7020 NewTL.setLParenLoc(TL.getLParenLoc());
7021 NewTL.setRParenLoc(TL.getRParenLoc());
7026template<
typename Derived>
7030 TypeSourceInfo* New_Under_TI = getDerived().TransformType(Old_Under_TI);
7036 if (getDerived().AlwaysRebuild() || New_Under_TI != Old_Under_TI) {
7037 Result = getDerived().RebuildTypeOfType(New_Under_TI->getType(), Kind);
7044 NewTL.setLParenLoc(TL.getLParenLoc());
7045 NewTL.setRParenLoc(TL.getRParenLoc());
7046 NewTL.setUnmodifiedTInfo(New_Under_TI);
7051template<
typename Derived>
7054 const DecltypeType *
T = TL.getTypePtr();
7061 ExprResult E = getDerived().TransformExpr(
T->getUnderlyingExpr());
7065 E = getSema().ActOnDecltypeExpression(E.get());
7070 if (getDerived().AlwaysRebuild() ||
7071 E.get() !=
T->getUnderlyingExpr()) {
7072 Result = getDerived().RebuildDecltypeType(E.get(), TL.getDecltypeLoc());
7080 NewTL.setRParenLoc(TL.getRParenLoc());
7084template <
typename Derived>
7094 IndexExpr = getDerived().TransformExpr(TL.getIndexExpr());
7095 if (IndexExpr.isInvalid())
7098 QualType Pattern = TL.getPattern();
7100 const PackIndexingType *PIT = TL.
getTypePtr();
7104 bool NotYetExpanded = Types.empty();
7105 bool FullySubstituted =
true;
7107 if (Types.empty() && !PIT->expandsToEmptyPack())
7111 if (!
T->containsUnexpandedParameterPack()) {
7112 QualType Transformed = getDerived().TransformType(
T);
7113 if (Transformed.isNull())
7115 SubtitutedTypes.push_back(Transformed);
7120 getSema().collectUnexpandedParameterPacks(
T, Unexpanded);
7121 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
7124 bool ShouldExpand =
true;
7125 bool RetainExpansion =
false;
7127 if (getDerived().TryExpandParameterPacks(
7130 RetainExpansion, NumExpansions))
7132 if (!ShouldExpand) {
7138 QualType Pack = getDerived().TransformType(TLB, TI->getTypeLoc());
7141 if (NotYetExpanded) {
7142 FullySubstituted =
false;
7143 QualType Out = getDerived().RebuildPackIndexingType(
7153 SubtitutedTypes.push_back(Pack);
7156 for (
unsigned I = 0; I != *NumExpansions; ++I) {
7161 SubtitutedTypes.push_back(Out);
7162 FullySubstituted &= !
Out->containsUnexpandedParameterPack();
7166 if (RetainExpansion) {
7167 FullySubstituted =
false;
7168 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
7172 SubtitutedTypes.push_back(Out);
7180 QualType Result = getDerived().TransformType(TLB, TL.getPatternLoc());
7182 QualType Out = getDerived().RebuildPackIndexingType(
7184 FullySubstituted, SubtitutedTypes);
7193template<
typename Derived>
7199 if (
Result->isDependentType()) {
7200 const UnaryTransformType *
T = TL.getTypePtr();
7202 NewBaseTSI = getDerived().TransformType(TL.getUnderlyingTInfo());
7205 QualType NewBase = NewBaseTSI->getType();
7207 Result = getDerived().RebuildUnaryTransformType(NewBase,
7216 NewTL.setParensRange(TL.getParensRange());
7217 NewTL.setUnderlyingTInfo(NewBaseTSI);
7221template<
typename Derived>
7224 const DeducedTemplateSpecializationType *
T = TL.getTypePtr();
7229 TL.getTemplateNameLoc());
7233 QualType OldDeduced =
T->getDeducedType();
7235 if (!OldDeduced.isNull()) {
7236 NewDeduced = getDerived().TransformType(OldDeduced);
7237 if (NewDeduced.isNull())
7241 QualType Result = getDerived().RebuildDeducedTemplateSpecializationType(
7248 NewTL.setTemplateNameLoc(TL.getTemplateNameLoc());
7249 NewTL.setQualifierLoc(QualifierLoc);
7253template <
typename Derived>
7260 QualifierLoc =
getDerived().TransformNestedNameSpecifierLoc(QualifierLoc);
7265 auto *TD = cast_or_null<TagDecl>(
7272 TD !=
T->getDecl()) {
7273 if (
T->isCanonicalUnqualified())
7290template <
typename Derived>
7296template <
typename Derived>
7297QualType TreeTransform<Derived>::TransformRecordType(TypeLocBuilder &TLB,
7299 return getDerived().TransformTagType(TLB, TL);
7302template<
typename Derived>
7309template<
typename Derived>
7313 return getDerived().TransformTemplateTypeParmType(
7318template <
typename Derived>
7324template<
typename Derived>
7325QualType TreeTransform<Derived>::TransformSubstTemplateTypeParmType(
7326 TypeLocBuilder &TLB,
7327 SubstTemplateTypeParmTypeLoc TL) {
7328 const SubstTemplateTypeParmType *T = TL.getTypePtr();
7331 getDerived().TransformDecl(TL.getNameLoc(), T->getAssociatedDecl());
7336 TemporaryBase Rebase(*
this, TL.getNameLoc(), DeclarationName());
7337 QualType Replacement = getDerived().TransformType(T->getReplacementType());
7338 if (Replacement.isNull())
7342 Replacement, NewReplaced, T->getIndex(), T->getPackIndex(),
7346 SubstTemplateTypeParmTypeLoc NewTL
7347 = TLB.push<SubstTemplateTypeParmTypeLoc>(Result);
7348 NewTL.setNameLoc(TL.getNameLoc());
7352template <
typename Derived>
7358template<
typename Derived>
7362 return getDerived().TransformSubstTemplateTypeParmPackType(
7366template <
typename Derived>
7372template<
typename Derived>
7373QualType TreeTransform<Derived>::TransformAtomicType(TypeLocBuilder &TLB,
7375 QualType ValueType = getDerived().TransformType(TLB, TL.getValueLoc());
7376 if (ValueType.isNull())
7379 QualType Result = TL.getType();
7380 if (getDerived().AlwaysRebuild() ||
7381 ValueType != TL.getValueLoc().getType()) {
7382 Result = getDerived().RebuildAtomicType(ValueType, TL.getKWLoc());
7383 if (Result.isNull())
7389 NewTL.setLParenLoc(TL.getLParenLoc());
7390 NewTL.setRParenLoc(TL.getRParenLoc());
7395template <
typename Derived>
7398 QualType ValueType = getDerived().TransformType(TLB, TL.getValueLoc());
7399 if (ValueType.isNull())
7403 if (getDerived().AlwaysRebuild() || ValueType != TL.getValueLoc().getType()) {
7406 Result = getDerived().RebuildPipeType(ValueType, TL.getKWLoc(), isReadPipe);
7417template <
typename Derived>
7423 if (getDerived().AlwaysRebuild()) {
7424 Result = getDerived().RebuildBitIntType(EIT->isUnsigned(),
7425 EIT->getNumBits(), TL.getNameLoc());
7435template <
typename Derived>
7442 ExprResult BitsExpr = getDerived().TransformExpr(EIT->getNumBitsExpr());
7445 if (BitsExpr.isInvalid())
7450 if (getDerived().AlwaysRebuild() || BitsExpr.get() != EIT->getNumBitsExpr()) {
7451 Result = getDerived().RebuildDependentBitIntType(
7452 EIT->isUnsigned(), BitsExpr.get(), TL.getNameLoc());
7468template <
typename Derived>
7471 llvm_unreachable(
"This type does not need to be transformed.");
7479 template<
typename ArgLocContainer>
7481 ArgLocContainer *Container;
7506 : Container(&Container), Index(Index) { }
7520 return Container->getArgLoc(Index);
7524 return pointer(Container->getArgLoc(Index));
7529 return X.Container == Y.Container &&
X.Index == Y.Index;
7538template<
typename Derived>
7539QualType TreeTransform<Derived>::TransformAutoType(TypeLocBuilder &TLB,
7541 const AutoType *T = TL.getTypePtr();
7542 QualType OldDeduced = T->getDeducedType();
7543 QualType NewDeduced;
7544 if (!OldDeduced.isNull()) {
7545 NewDeduced = getDerived().TransformType(OldDeduced);
7546 if (NewDeduced.isNull())
7553 if (
T->isConstrained()) {
7554 assert(TL.getConceptReference());
7555 NewCD = cast_or_null<ConceptDecl>(getDerived().TransformDecl(
7556 TL.getConceptNameLoc(),
T->getTypeConstraintConcept()));
7558 NewTemplateArgs.setLAngleLoc(TL.getLAngleLoc());
7559 NewTemplateArgs.setRAngleLoc(TL.getRAngleLoc());
7561 if (getDerived().TransformTemplateArguments(
7562 ArgIterator(TL, 0), ArgIterator(TL, TL.getNumArgs()),
7566 if (TL.getNestedNameSpecifierLoc()) {
7568 = getDerived().TransformNestedNameSpecifierLoc(
7569 TL.getNestedNameSpecifierLoc());
7570 if (!NewNestedNameSpec)
7576 if (getDerived().AlwaysRebuild() || NewDeduced != OldDeduced ||
7577 T->isDependentType() ||
T->isConstrained()) {
7580 NewArgList.reserve(NewTemplateArgs.size());
7581 for (
const auto &ArgLoc : NewTemplateArgs.arguments())
7582 NewArgList.push_back(ArgLoc.getArgument());
7583 Result = getDerived().RebuildAutoType(NewDeduced,
T->getKeyword(), NewCD,
7591 NewTL.setRParenLoc(TL.getRParenLoc());
7592 NewTL.setConceptReference(
nullptr);
7594 if (
T->isConstrained()) {
7596 TL.getTypePtr()->getTypeConstraintConcept()->getDeclName(),
7597 TL.getConceptNameLoc(),
7598 TL.getTypePtr()->getTypeConstraintConcept()->getDeclName());
7600 SemaRef.
Context, NewNestedNameSpec, TL.getTemplateKWLoc(), DNI,
7601 TL.getFoundDecl(), TL.getTypePtr()->getTypeConstraintConcept(),
7603 NewTL.setConceptReference(CR);
7609template <
typename Derived>
7612 return getDerived().TransformTemplateSpecializationType(
7617template <
typename Derived>
7620 NamedDecl *FirstQualifierInScope,
bool AllowInjectedClassName) {
7621 const TemplateSpecializationType *
T = TL.
getTypePtr();
7627 AllowInjectedClassName);
7636 if (getDerived().TransformTemplateArguments(ArgIterator(TL, 0),
7645 QualType Result = getDerived().RebuildTemplateSpecializationType(
7658template <
typename Derived>
7662 QualType modifiedType = getDerived().TransformType(TLB, TL.getModifiedLoc());
7663 if (modifiedType.isNull())
7667 const Attr *oldAttr = TL.getAttr();
7668 const Attr *newAttr = oldAttr ? getDerived().TransformAttr(oldAttr) :
nullptr;
7669 if (oldAttr && !newAttr)
7675 if (getDerived().AlwaysRebuild() ||
7676 modifiedType != oldType->getModifiedType()) {
7689 QualType equivalentType = modifiedType;
7690 if (TL.getModifiedLoc().getType() != TL.getEquivalentTypeLoc().getType()) {
7692 AuxiliaryTLB.
reserve(TL.getFullDataSize());
7694 getDerived().TransformType(AuxiliaryTLB, TL.getEquivalentTypeLoc());
7695 if (equivalentType.isNull())
7701 if (
auto nullability = oldType->getImmediateNullability()) {
7702 if (!modifiedType->canHaveNullability()) {
7703 SemaRef.
Diag((TL.getAttr() ? TL.getAttr()->getLocation()
7704 : TL.getModifiedLoc().getBeginLoc()),
7705 diag::err_nullability_nonpointer)
7722template <
typename Derived>
7726 QualType InnerTy = getDerived().TransformType(TLB, TL.getInnerLoc());
7727 if (InnerTy.isNull())
7730 Expr *OldCount = TL.getCountExpr();
7731 Expr *NewCount =
nullptr;
7733 ExprResult CountResult = getDerived().TransformExpr(OldCount);
7734 if (CountResult.isInvalid())
7736 NewCount = CountResult.get();
7740 if (getDerived().AlwaysRebuild() || InnerTy != OldTy->desugar() ||
7741 OldCount != NewCount) {
7744 InnerTy, NewCount, OldTy->isCountInBytes(), OldTy->isOrNull());
7751template <
typename Derived>
7755 llvm_unreachable(
"Unexpected TreeTransform for BTFTagAttributedType");
7758template <
typename Derived>
7762 const HLSLAttributedResourceType *oldType = TL.getTypePtr();
7764 QualType WrappedTy = getDerived().TransformType(TLB, TL.getWrappedLoc());
7765 if (WrappedTy.isNull())
7769 QualType OldContainedTy = oldType->getContainedType();
7771 if (!OldContainedTy.isNull()) {
7772 TypeSourceInfo *oldContainedTSI = TL.getContainedTypeSourceInfo();
7773 if (!oldContainedTSI)
7774 oldContainedTSI = getSema().getASTContext().getTrivialTypeSourceInfo(
7776 ContainedTSI = getDerived().TransformType(oldContainedTSI);
7779 ContainedTy = ContainedTSI->getType();
7783 if (getDerived().AlwaysRebuild() || WrappedTy != oldType->getWrappedType() ||
7784 ContainedTy != oldType->getContainedType()) {
7786 WrappedTy, ContainedTy, oldType->getAttrs());
7792 NewTL.setContainedTypeSourceInfo(ContainedTSI);
7796template <
typename Derived>
7800 return TL.getType();
7803template<
typename Derived>
7807 QualType Inner = getDerived().TransformType(TLB, TL.getInnerLoc());
7812 if (getDerived().AlwaysRebuild() ||
7813 Inner != TL.getInnerLoc().getType()) {
7814 Result = getDerived().RebuildParenType(Inner);
7821 NewTL.setRParenLoc(TL.getRParenLoc());
7825template <
typename Derived>
7829 QualType Inner = getDerived().TransformType(TLB, TL.getInnerLoc());
7834 if (getDerived().AlwaysRebuild() || Inner != TL.getInnerLoc().getType()) {
7836 getDerived().RebuildMacroQualifiedType(Inner, TL.getMacroIdentifier());
7846template<
typename Derived>
7847QualType TreeTransform<Derived>::TransformDependentNameType(
7849 return TransformDependentNameType(TLB, TL,
false);
7852template <
typename Derived>
7853QualType TreeTransform<Derived>::TransformDependentNameType(
7856 const DependentNameType *
T = TL.getTypePtr();
7860 QualifierLoc = getDerived().TransformNestedNameSpecifierLoc(
7861 QualifierLoc, ObjectType, UnqualLookup);
7865 assert((ObjectType.isNull() && !UnqualLookup) &&
7866 "must be transformed by TransformNestedNameSpecifierLoc");
7870 = getDerived().RebuildDependentNameType(
T->getKeyword(),
7871 TL.getElaboratedKeywordLoc(),
7882 NewTL.setQualifierLoc(QualifierLoc);
7883 NewTL.setNameLoc(TL.getNameLoc());
7887 NewTL.setTemplateNameLoc(TL.getNameLoc());
7888 NewTL.setQualifierLoc(QualifierLoc);
7891 QualifierLoc, TL.getNameLoc());
7894 NewTL.
set(TL.getElaboratedKeywordLoc(), QualifierLoc, TL.getNameLoc());
7898 NewTL.setQualifierLoc(QualifierLoc);
7899 NewTL.setNameLoc(TL.getNameLoc());
7904template<
typename Derived>
7908 = getDerived().TransformType(TLB, TL.getPatternLoc());
7909 if (Pattern.isNull())
7913 if (getDerived().AlwaysRebuild() ||
7914 Pattern != TL.getPatternLoc().getType()) {
7915 Result = getDerived().RebuildPackExpansionType(Pattern,
7916 TL.getPatternLoc().getSourceRange(),
7917 TL.getEllipsisLoc(),
7918 TL.getTypePtr()->getNumExpansions());
7928template<
typename Derived>
7933 TLB.pushFullCopy(TL);
7934 return TL.getType();
7937template<
typename Derived>
7941 const ObjCTypeParamType *
T = TL.getTypePtr();
7943 getDerived().TransformDecl(
T->getDecl()->getLocation(),
T->getDecl()));
7948 if (getDerived().AlwaysRebuild() ||
7949 OTP !=
T->getDecl()) {
7950 Result = getDerived().RebuildObjCTypeParamType(
7951 OTP, TL.getProtocolLAngleLoc(),
7952 llvm::ArrayRef(TL.getTypePtr()->qual_begin(), TL.getNumProtocols()),
7953 TL.getProtocolLocs(), TL.getProtocolRAngleLoc());
7959 if (TL.getNumProtocols()) {
7960 NewTL.setProtocolLAngleLoc(TL.getProtocolLAngleLoc());
7961 for (
unsigned i = 0, n = TL.getNumProtocols(); i != n; ++i)
7962 NewTL.setProtocolLoc(i, TL.getProtocolLoc(i));
7963 NewTL.setProtocolRAngleLoc(TL.getProtocolRAngleLoc());
7968template<
typename Derived>
7973 QualType BaseType = getDerived().TransformType(TLB, TL.getBaseLoc());
7974 if (BaseType.isNull())
7977 bool AnyChanged = BaseType != TL.getBaseLoc().getType();
7981 for (
unsigned i = 0, n = TL.getNumTypeArgs(); i != n; ++i) {
7983 TypeLoc TypeArgLoc = TypeArgInfo->getTypeLoc();
7984 QualType TypeArg = TypeArgInfo->getType();
7989 const auto *PackExpansion = PackExpansionLoc.getType()
7990 ->castAs<PackExpansionType>();
7994 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
7998 TypeLoc PatternLoc = PackExpansionLoc.getPatternLoc();
7999 bool Expand =
false;
8000 bool RetainExpansion =
false;
8001 UnsignedOrNone NumExpansions = PackExpansion->getNumExpansions();
8002 if (getDerived().TryExpandParameterPacks(
8003 PackExpansionLoc.getEllipsisLoc(), PatternLoc.getSourceRange(),
8004 Unexpanded,
true, Expand,
8005 RetainExpansion, NumExpansions))
8015 TypeArgBuilder.
reserve(PatternLoc.getFullDataSize());
8016 QualType NewPatternType = getDerived().TransformType(TypeArgBuilder,
8018 if (NewPatternType.isNull())
8022 NewPatternType, NumExpansions);
8024 NewExpansionLoc.
setEllipsisLoc(PackExpansionLoc.getEllipsisLoc());
8025 NewTypeArgInfos.push_back(
8026 TypeArgBuilder.getTypeSourceInfo(SemaRef.
Context, NewExpansionType));
8032 for (
unsigned ArgIdx = 0; ArgIdx != *NumExpansions; ++ArgIdx) {
8036 TypeArgBuilder.
reserve(PatternLoc.getFullDataSize());
8038 QualType NewTypeArg = getDerived().TransformType(TypeArgBuilder,
8040 if (NewTypeArg.isNull())
8043 NewTypeArgInfos.push_back(
8044 TypeArgBuilder.getTypeSourceInfo(SemaRef.
Context, NewTypeArg));
8051 TypeArgBuilder.
reserve(TypeArgLoc.getFullDataSize());
8053 getDerived().TransformType(TypeArgBuilder, TypeArgLoc);
8054 if (NewTypeArg.isNull())
8058 if (NewTypeArg == TypeArg) {
8059 NewTypeArgInfos.push_back(TypeArgInfo);
8063 NewTypeArgInfos.push_back(
8064 TypeArgBuilder.getTypeSourceInfo(SemaRef.
Context, NewTypeArg));
8069 if (getDerived().AlwaysRebuild() || AnyChanged) {
8071 Result = getDerived().RebuildObjCObjectType(
8072 BaseType, TL.getBeginLoc(), TL.getTypeArgsLAngleLoc(), NewTypeArgInfos,
8073 TL.getTypeArgsRAngleLoc(), TL.getProtocolLAngleLoc(),
8074 llvm::ArrayRef(TL.getTypePtr()->qual_begin(), TL.getNumProtocols()),
8075 TL.getProtocolLocs(), TL.getProtocolRAngleLoc());
8083 NewT.setTypeArgsLAngleLoc(TL.getTypeArgsLAngleLoc());
8084 for (
unsigned i = 0, n = TL.getNumTypeArgs(); i != n; ++i)
8085 NewT.setTypeArgTInfo(i, NewTypeArgInfos[i]);
8086 NewT.setTypeArgsRAngleLoc(TL.getTypeArgsRAngleLoc());
8087 NewT.setProtocolLAngleLoc(TL.getProtocolLAngleLoc());
8088 for (
unsigned i = 0, n = TL.getNumProtocols(); i != n; ++i)
8089 NewT.setProtocolLoc(i, TL.getProtocolLoc(i));
8090 NewT.setProtocolRAngleLoc(TL.getProtocolRAngleLoc());
8094template<
typename Derived>
8098 QualType PointeeType = getDerived().TransformType(TLB, TL.getPointeeLoc());
8099 if (PointeeType.isNull())
8103 if (getDerived().AlwaysRebuild() ||
8104 PointeeType != TL.getPointeeLoc().getType()) {
8105 Result = getDerived().RebuildObjCObjectPointerType(PointeeType,
8119template<
typename Derived>
8125template<
typename Derived>
8128 return getDerived().TransformCompoundStmt(S,
false);
8131template<
typename Derived>
8138 getSema().resetFPOptions(
8141 bool SubStmtInvalid =
false;
8142 bool SubStmtChanged =
false;
8144 for (
auto *B : S->
body()) {
8146 B, IsStmtExpr && B == S->
body_back() ? StmtDiscardKind::StmtExprResult
8147 : StmtDiscardKind::Discarded);
8149 if (
Result.isInvalid()) {
8156 SubStmtInvalid =
true;
8160 SubStmtChanged = SubStmtChanged || Result.get() != B;
8161 Statements.push_back(Result.getAs<Stmt>());
8167 if (!getDerived().AlwaysRebuild() &&
8171 return getDerived().RebuildCompoundStmt(S->
getLBracLoc(),
8177template<
typename Derived>
8186 LHS = getDerived().TransformExpr(S->getLHS());
8188 if (LHS.isInvalid())
8192 RHS = getDerived().TransformExpr(S->getRHS());
8194 if (RHS.isInvalid())
8201 StmtResult Case = getDerived().RebuildCaseStmt(S->getCaseLoc(),
8203 S->getEllipsisLoc(),
8206 if (Case.isInvalid())
8211 getDerived().TransformStmt(S->getSubStmt());
8212 if (SubStmt.isInvalid())
8216 return getDerived().RebuildCaseStmtBody(Case.get(), SubStmt.get());
8219template <
typename Derived>
8223 getDerived().TransformStmt(S->getSubStmt());
8224 if (SubStmt.isInvalid())
8228 return getDerived().RebuildDefaultStmt(S->getDefaultLoc(), S->getColonLoc(),
8232template<
typename Derived>
8235 StmtResult SubStmt = getDerived().TransformStmt(S->getSubStmt(), SDK);
8236 if (SubStmt.isInvalid())
8239 Decl *LD = getDerived().TransformDecl(S->getDecl()->getLocation(),
8247 if (LD == S->getDecl())
8248 S->getDecl()->setStmt(
nullptr);
8251 return getDerived().RebuildLabelStmt(S->getIdentLoc(),
8256template <
typename Derived>
8265 return getDerived().Transform##X##Attr(cast<X##Attr>(R));
8266#include "clang/Basic/AttrList.inc"
8271template <
typename Derived>
8282 return getDerived().TransformStmt##X##Attr(OrigS, InstS, cast<X##Attr>(R));
8283#include "clang/Basic/AttrList.inc"
8288template <
typename Derived>
8291 StmtDiscardKind SDK) {
8296 bool AttrsChanged =
false;
8300 for (
const auto *I : S->
getAttrs()) {
8302 getDerived().TransformStmtAttr(S->
getSubStmt(), SubStmt.
get(), I);
8303 AttrsChanged |= (I != R);
8316 return getDerived().RebuildAttributedStmt(S->
getAttrLoc(), Attrs,
8320template<
typename Derived>
8325 if (
Init.isInvalid())
8329 if (!S->isConsteval()) {
8331 Cond = getDerived().TransformCondition(
8332 S->getIfLoc(), S->getConditionVariable(), S->getCond(),
8335 if (
Cond.isInvalid())
8340 std::optional<bool> ConstexprConditionValue;
8341 if (S->isConstexpr())
8342 ConstexprConditionValue =
Cond.getKnownValue();
8346 if (!ConstexprConditionValue || *ConstexprConditionValue) {
8350 S->isNonNegatedConsteval());
8352 Then = getDerived().TransformStmt(S->getThen());
8353 if (Then.isInvalid())
8359 Then =
new (getSema().Context)
8360 CompoundStmt(S->getThen()->getBeginLoc(), S->getThen()->getEndLoc());
8365 if (!ConstexprConditionValue || !*ConstexprConditionValue) {
8369 S->isNegatedConsteval());
8371 Else = getDerived().TransformStmt(S->getElse());
8372 if (Else.isInvalid())
8374 }
else if (S->getElse() && ConstexprConditionValue &&
8375 *ConstexprConditionValue) {
8379 Else =
new (getSema().Context)
8380 CompoundStmt(S->getElse()->getBeginLoc(), S->getElse()->getEndLoc());
8383 if (!getDerived().AlwaysRebuild() &&
8384 Init.get() == S->getInit() &&
8385 Cond.get() == std::make_pair(S->getConditionVariable(), S->getCond()) &&
8386 Then.get() == S->getThen() &&
8387 Else.get() == S->getElse())
8390 return getDerived().RebuildIfStmt(
8391 S->getIfLoc(), S->getStatementKind(), S->getLParenLoc(),
Cond,
8392 S->getRParenLoc(),
Init.get(), Then.get(), S->getElseLoc(), Else.get());
8395template<
typename Derived>
8400 if (
Init.isInvalid())
8405 S->getSwitchLoc(), S->getConditionVariable(), S->getCond(),
8407 if (
Cond.isInvalid())
8412 getDerived().RebuildSwitchStmtStart(S->getSwitchLoc(), S->getLParenLoc(),
8413 Init.get(),
Cond, S->getRParenLoc());
8418 StmtResult Body = getDerived().TransformStmt(S->getBody());
8419 if (Body.isInvalid())
8423 return getDerived().RebuildSwitchStmtBody(S->getSwitchLoc(),
Switch.get(),
8427template<
typename Derived>
8432 S->getWhileLoc(), S->getConditionVariable(), S->getCond(),
8434 if (
Cond.isInvalid())
8443 StmtResult Body = getDerived().TransformStmt(S->getBody());
8444 if (Body.isInvalid())
8447 if (!getDerived().AlwaysRebuild() &&
8448 Cond.get() == std::make_pair(S->getConditionVariable(), S->getCond()) &&
8449 Body.get() == S->getBody())
8452 return getDerived().RebuildWhileStmt(S->getWhileLoc(), S->getLParenLoc(),
8453 Cond, S->getRParenLoc(), Body.get());
8456template<
typename Derived>
8465 StmtResult Body = getDerived().TransformStmt(S->getBody());
8466 if (Body.isInvalid())
8471 if (
Cond.isInvalid())
8474 if (!getDerived().AlwaysRebuild() &&
8475 Cond.get() == S->getCond() &&
8476 Body.get() == S->getBody())
8479 return getDerived().RebuildDoStmt(S->getDoLoc(), Body.get(), S->getWhileLoc(),
8480 S->getWhileLoc(),
Cond.get(),
8484template<
typename Derived>
8487 if (getSema().getLangOpts().OpenMP)
8488 getSema().OpenMP().startOpenMPLoop();
8492 if (
Init.isInvalid())
8497 if (getSema().getLangOpts().OpenMP &&
Init.isUsable())
8498 getSema().OpenMP().ActOnOpenMPLoopInitialization(S->getForLoc(),
8503 S->getForLoc(), S->getConditionVariable(), S->getCond(),
8505 if (
Cond.isInvalid())
8510 if (
Inc.isInvalid())
8514 if (S->getInc() && !FullInc.get())
8521 S->getBeginLoc(), S->getInit(),
Init.get(), S->getCond(),
8522 Cond.get().second, S->getInc(),
Inc.get());
8525 StmtResult Body = getDerived().TransformStmt(S->getBody());
8526 if (Body.isInvalid())
8531 if (!getDerived().AlwaysRebuild() &&
8532 Init.get() == S->getInit() &&
8533 Cond.get() == std::make_pair(S->getConditionVariable(), S->getCond()) &&
8534 Inc.get() == S->getInc() &&
8535 Body.get() == S->getBody())
8538 return getDerived().RebuildForStmt(S->getForLoc(), S->getLParenLoc(),
8540 S->getRParenLoc(), Body.get());
8543template<
typename Derived>
8546 Decl *LD = getDerived().TransformDecl(S->getLabel()->getLocation(),
8552 return getDerived().RebuildGotoStmt(S->getGotoLoc(), S->getLabelLoc(),
8556template<
typename Derived>
8564 if (!getDerived().AlwaysRebuild() &&
8565 Target.get() == S->getTarget())
8568 return getDerived().RebuildIndirectGotoStmt(S->getGotoLoc(), S->getStarLoc(),
8572template<
typename Derived>
8575 if (!S->hasLabelTarget())
8578 Decl *LD = getDerived().TransformDecl(S->getLabelDecl()->getLocation(),
8587template<
typename Derived>
8590 if (!S->hasLabelTarget())
8593 Decl *LD = getDerived().TransformDecl(S->getLabelDecl()->getLocation(),
8602template <
typename Derived>
8610template<
typename Derived>
8620 return getDerived().RebuildReturnStmt(S->getReturnLoc(),
Result.get());
8623template<
typename Derived>
8626 bool DeclChanged =
false;
8629 for (
auto *D : S->decls()) {
8630 Decl *Transformed = getDerived().TransformDefinition(D->getLocation(), D);
8634 if (Transformed != D)
8638 if (
auto *TD = dyn_cast<TypeDecl>(Transformed)) {
8639 if (
auto *TN = dyn_cast<TypedefNameDecl>(TD)) {
8640 LSI->ContainsUnexpandedParameterPack |=
8641 TN->getUnderlyingType()->containsUnexpandedParameterPack();
8643 LSI->ContainsUnexpandedParameterPack |=
8646 .getTypeDeclType(TD)
8647 ->containsUnexpandedParameterPack();
8650 if (
auto *VD = dyn_cast<VarDecl>(Transformed))
8651 LSI->ContainsUnexpandedParameterPack |=
8652 VD->getType()->containsUnexpandedParameterPack();
8655 Decls.push_back(Transformed);
8658 if (!getDerived().AlwaysRebuild() && !DeclChanged)
8661 return getDerived().RebuildDeclStmt(Decls, S->getBeginLoc(), S->getEndLoc());
8664template<
typename Derived>
8674 bool ExprsChanged =
false;
8676 auto RebuildString = [&](
Expr *E) {
8681 ExprsChanged =
true;
8688 for (
unsigned I = 0, E = S->getNumOutputs(); I != E; ++I) {
8689 Names.push_back(S->getOutputIdentifier(I));
8695 Constraints.push_back(
Result.get());
8698 Expr *OutputExpr = S->getOutputExpr(I);
8699 Result = getDerived().TransformExpr(OutputExpr);
8703 ExprsChanged |=
Result.get() != OutputExpr;
8705 Exprs.push_back(
Result.get());
8709 for (
unsigned I = 0, E = S->getNumInputs(); I != E; ++I) {
8710 Names.push_back(S->getInputIdentifier(I));
8716 Constraints.push_back(
Result.get());
8719 Expr *InputExpr = S->getInputExpr(I);
8720 Result = getDerived().TransformExpr(InputExpr);
8724 ExprsChanged |=
Result.get() != InputExpr;
8726 Exprs.push_back(
Result.get());
8730 for (
unsigned I = 0, E = S->getNumLabels(); I != E; ++I) {
8731 Names.push_back(S->getLabelIdentifier(I));
8736 ExprsChanged |=
Result.get() != S->getLabelExpr(I);
8737 Exprs.push_back(
Result.get());
8741 for (
unsigned I = 0, E = S->getNumClobbers(); I != E; ++I) {
8745 Clobbers.push_back(
Result.get());
8748 ExprResult AsmString = RebuildString(S->getAsmStringExpr());
8749 if (AsmString.isInvalid())
8752 if (!getDerived().AlwaysRebuild() && !ExprsChanged)
8755 return getDerived().RebuildGCCAsmStmt(S->getAsmLoc(), S->isSimple(),
8756 S->isVolatile(), S->getNumOutputs(),
8757 S->getNumInputs(), Names.data(),
8758 Constraints, Exprs, AsmString.get(),
8759 Clobbers, S->getNumLabels(),
8763template<
typename Derived>
8768 bool HadError =
false, HadChange =
false;
8772 TransformedExprs.reserve(SrcExprs.size());
8773 for (
unsigned i = 0, e = SrcExprs.size(); i != e; ++i) {
8775 if (!
Result.isUsable()) {
8778 HadChange |= (
Result.get() != SrcExprs[i]);
8779 TransformedExprs.push_back(
Result.get());
8784 if (!HadChange && !getDerived().AlwaysRebuild())
8787 return getDerived().RebuildMSAsmStmt(S->getAsmLoc(), S->getLBraceLoc(),
8788 AsmToks, S->getAsmString(),
8789 S->getNumOutputs(), S->getNumInputs(),
8790 S->getAllConstraints(), S->getClobbers(),
8791 TransformedExprs, S->getEndLoc());
8795template<
typename Derived>
8800 assert(FD && ScopeInfo && !ScopeInfo->CoroutinePromise &&
8801 ScopeInfo->NeedsCoroutineSuspends &&
8802 ScopeInfo->CoroutineSuspends.first ==
nullptr &&
8803 ScopeInfo->CoroutineSuspends.second ==
nullptr &&
8804 "expected clean scope info");
8808 ScopeInfo->setNeedsCoroutineSuspends(
false);
8821 getDerived().transformedLocalDecl(S->getPromiseDecl(), {Promise});
8822 ScopeInfo->CoroutinePromise = Promise;
8827 StmtResult InitSuspend = getDerived().TransformStmt(S->getInitSuspendStmt());
8828 if (InitSuspend.isInvalid())
8831 getDerived().TransformStmt(S->getFinalSuspendStmt());
8832 if (FinalSuspend.isInvalid() ||
8835 ScopeInfo->setCoroutineSuspends(InitSuspend.get(), FinalSuspend.get());
8838 StmtResult BodyRes = getDerived().TransformStmt(S->getBody());
8839 if (BodyRes.isInvalid())
8843 if (Builder.isInvalid())
8846 Expr *ReturnObject = S->getReturnValueInit();
8847 assert(ReturnObject &&
"the return object is expected to be valid");
8848 ExprResult Res = getDerived().TransformInitializer(ReturnObject,
8850 if (Res.isInvalid())
8852 Builder.ReturnValue = Res.get();
8857 if (S->hasDependentPromiseType()) {
8860 if (!Promise->getType()->isDependentType()) {
8861 assert(!S->getFallthroughHandler() && !S->getExceptionHandler() &&
8862 !S->getReturnStmtOnAllocFailure() && !S->getDeallocate() &&
8863 "these nodes should not have been built yet");
8864 if (!Builder.buildDependentStatements())
8868 if (
auto *OnFallthrough = S->getFallthroughHandler()) {
8869 StmtResult Res = getDerived().TransformStmt(OnFallthrough);
8870 if (Res.isInvalid())
8872 Builder.OnFallthrough = Res.get();
8875 if (
auto *OnException = S->getExceptionHandler()) {
8876 StmtResult Res = getDerived().TransformStmt(OnException);
8877 if (Res.isInvalid())
8879 Builder.OnException = Res.get();
8882 if (
auto *OnAllocFailure = S->getReturnStmtOnAllocFailure()) {
8883 StmtResult Res = getDerived().TransformStmt(OnAllocFailure);
8884 if (Res.isInvalid())
8886 Builder.ReturnStmtOnAllocFailure = Res.get();
8890 assert(S->getAllocate() && S->getDeallocate() &&
8891 "allocation and deallocation calls must already be built");
8892 ExprResult AllocRes = getDerived().TransformExpr(S->getAllocate());
8893 if (AllocRes.isInvalid())
8895 Builder.Allocate = AllocRes.get();
8897 ExprResult DeallocRes = getDerived().TransformExpr(S->getDeallocate());
8898 if (DeallocRes.isInvalid())
8900 Builder.Deallocate = DeallocRes.get();
8902 if (
auto *ResultDecl = S->getResultDecl()) {
8903 StmtResult Res = getDerived().TransformStmt(ResultDecl);
8904 if (Res.isInvalid())
8906 Builder.ResultDecl = Res.get();
8911 if (Res.isInvalid())
8913 Builder.ReturnStmt = Res.get();
8917 return getDerived().RebuildCoroutineBodyStmt(Builder);
8920template<
typename Derived>
8930 return getDerived().RebuildCoreturnStmt(S->getKeywordLoc(),
Result.get(),
8934template <
typename Derived>
8947 ExprResult Lookup = getSema().BuildOperatorCoawaitLookupExpr(
8948 getSema().getCurScope(), E->getKeywordLoc());
8952 return getDerived().RebuildCoawaitExpr(
8953 E->getKeywordLoc(),
Operand.get(),
8957template <
typename Derived>
8960 ExprResult OperandResult = getDerived().TransformInitializer(E->getOperand(),
8962 if (OperandResult.isInvalid())
8966 E->getOperatorCoawaitLookup());
8973 return getDerived().RebuildDependentCoawaitExpr(
8974 E->getKeywordLoc(), OperandResult.get(),
8978template<
typename Derived>
8988 return getDerived().RebuildCoyieldExpr(E->getKeywordLoc(),
Result.get());
8993template<
typename Derived>
8997 StmtResult TryBody = getDerived().TransformStmt(S->getTryBody());
8998 if (TryBody.isInvalid())
9002 bool AnyCatchChanged =
false;
9004 for (
unsigned I = 0, N = S->getNumCatchStmts(); I != N; ++I) {
9005 StmtResult Catch = getDerived().TransformStmt(S->getCatchStmt(I));
9006 if (Catch.isInvalid())
9008 if (Catch.get() != S->getCatchStmt(I))
9009 AnyCatchChanged =
true;
9010 CatchStmts.push_back(Catch.get());
9015 if (S->getFinallyStmt()) {
9016 Finally = getDerived().TransformStmt(S->getFinallyStmt());
9017 if (Finally.isInvalid())
9022 if (!getDerived().AlwaysRebuild() &&
9023 TryBody.get() == S->getTryBody() &&
9025 Finally.get() == S->getFinallyStmt())
9029 return getDerived().RebuildObjCAtTryStmt(S->getAtTryLoc(), TryBody.get(),
9030 CatchStmts, Finally.get());
9033template<
typename Derived>
9038 if (
VarDecl *FromVar = S->getCatchParamDecl()) {
9040 if (FromVar->getTypeSourceInfo()) {
9041 TSInfo = getDerived().TransformType(FromVar->getTypeSourceInfo());
9048 T = TSInfo->getType();
9050 T = getDerived().TransformType(FromVar->getType());
9055 Var = getDerived().RebuildObjCExceptionDecl(FromVar, TSInfo,
T);
9060 StmtResult Body = getDerived().TransformStmt(S->getCatchBody());
9061 if (Body.isInvalid())
9064 return getDerived().RebuildObjCAtCatchStmt(S->getAtCatchLoc(),
9069template<
typename Derived>
9073 StmtResult Body = getDerived().TransformStmt(S->getFinallyBody());
9074 if (Body.isInvalid())
9078 if (!getDerived().AlwaysRebuild() &&
9079 Body.get() == S->getFinallyBody())
9083 return getDerived().RebuildObjCAtFinallyStmt(S->getAtFinallyLoc(),
9087template<
typename Derived>
9091 if (S->getThrowExpr()) {
9092 Operand = getDerived().TransformExpr(S->getThrowExpr());
9097 if (!getDerived().AlwaysRebuild() &&
9098 Operand.get() == S->getThrowExpr())
9101 return getDerived().RebuildObjCAtThrowStmt(S->getThrowLoc(),
Operand.get());
9104template<
typename Derived>
9113 getDerived().RebuildObjCAtSynchronizedOperand(S->getAtSynchronizedLoc(),
9119 StmtResult Body = getDerived().TransformStmt(S->getSynchBody());
9120 if (Body.isInvalid())
9124 if (!getDerived().AlwaysRebuild() &&
9125 Object.get() == S->getSynchExpr() &&
9126 Body.get() == S->getSynchBody())
9130 return getDerived().RebuildObjCAtSynchronizedStmt(S->getAtSynchronizedLoc(),
9131 Object.get(), Body.get());
9134template<
typename Derived>
9139 StmtResult Body = getDerived().TransformStmt(S->getSubStmt());
9140 if (Body.isInvalid())
9144 if (!getDerived().AlwaysRebuild() &&
9145 Body.get() == S->getSubStmt())
9149 return getDerived().RebuildObjCAutoreleasePoolStmt(
9150 S->getAtLoc(), Body.get());
9153template<
typename Derived>
9158 StmtResult Element = getDerived().TransformStmt(
9159 S->getElement(), StmtDiscardKind::NotDiscarded);
9160 if (Element.isInvalid())
9164 ExprResult Collection = getDerived().TransformExpr(S->getCollection());
9165 if (Collection.isInvalid())
9169 StmtResult Body = getDerived().TransformStmt(S->getBody());
9170 if (Body.isInvalid())
9174 if (!getDerived().AlwaysRebuild() &&
9175 Element.get() == S->getElement() &&
9176 Collection.get() == S->getCollection() &&
9177 Body.get() == S->getBody())
9181 return getDerived().RebuildObjCForCollectionStmt(S->getForLoc(),
9188template <
typename Derived>
9192 if (
VarDecl *ExceptionDecl = S->getExceptionDecl()) {
9194 getDerived().TransformType(ExceptionDecl->getTypeSourceInfo());
9198 Var = getDerived().RebuildExceptionDecl(
9199 ExceptionDecl,
T, ExceptionDecl->getInnerLocStart(),
9200 ExceptionDecl->getLocation(), ExceptionDecl->getIdentifier());
9201 if (!Var || Var->isInvalidDecl())
9206 StmtResult Handler = getDerived().TransformStmt(S->getHandlerBlock());
9207 if (Handler.isInvalid())
9210 if (!getDerived().AlwaysRebuild() && !Var &&
9211 Handler.get() == S->getHandlerBlock())
9214 return getDerived().RebuildCXXCatchStmt(S->getCatchLoc(), Var, Handler.get());
9217template <
typename Derived>
9220 StmtResult TryBlock = getDerived().TransformCompoundStmt(S->getTryBlock());
9221 if (TryBlock.isInvalid())
9225 bool HandlerChanged =
false;
9227 for (
unsigned I = 0, N = S->getNumHandlers(); I != N; ++I) {
9228 StmtResult Handler = getDerived().TransformCXXCatchStmt(S->getHandler(I));
9229 if (Handler.isInvalid())
9232 HandlerChanged = HandlerChanged || Handler.get() != S->getHandler(I);
9233 Handlers.push_back(Handler.getAs<
Stmt>());
9236 getSema().DiagnoseExceptionUse(S->getTryLoc(),
true);
9238 if (!getDerived().AlwaysRebuild() && TryBlock.get() == S->getTryBlock() &&
9242 return getDerived().RebuildCXXTryStmt(S->getTryLoc(), TryBlock.get(),
9246template<
typename Derived>
9257 auto &LastRecord = getSema().currentEvaluationContext();
9258 LastRecord.InLifetimeExtendingContext =
true;
9259 LastRecord.RebuildDefaultArgOrDefaultInit =
true;
9262 S->getInit() ? getDerived().TransformStmt(S->getInit()) :
StmtResult();
9263 if (
Init.isInvalid())
9267 if (
Range.isInvalid())
9272 getSema().ExprEvalContexts.back().ForRangeLifetimeExtendTemps.empty());
9273 auto ForRangeLifetimeExtendTemps =
9274 getSema().ExprEvalContexts.back().ForRangeLifetimeExtendTemps;
9276 StmtResult Begin = getDerived().TransformStmt(S->getBeginStmt());
9277 if (Begin.isInvalid())
9279 StmtResult End = getDerived().TransformStmt(S->getEndStmt());
9280 if (End.isInvalid())
9284 if (
Cond.isInvalid())
9288 if (
Cond.isInvalid())
9294 if (
Inc.isInvalid())
9299 StmtResult LoopVar = getDerived().TransformStmt(S->getLoopVarStmt());
9300 if (LoopVar.isInvalid())
9304 if (getDerived().AlwaysRebuild() ||
9305 Init.get() != S->getInit() ||
9306 Range.get() != S->getRangeStmt() ||
9307 Begin.get() != S->getBeginStmt() ||
9308 End.get() != S->getEndStmt() ||
9309 Cond.get() != S->getCond() ||
9310 Inc.get() != S->getInc() ||
9311 LoopVar.get() != S->getLoopVarStmt()) {
9312 NewStmt = getDerived().RebuildCXXForRangeStmt(
9313 S->getForLoc(), S->getCoawaitLoc(),
Init.get(), S->getColonLoc(),
9314 Range.get(), Begin.get(), End.get(),
Cond.get(),
Inc.get(),
9315 LoopVar.get(), S->getRParenLoc(), ForRangeLifetimeExtendTemps);
9316 if (NewStmt.isInvalid() && LoopVar.get() != S->getLoopVarStmt()) {
9318 getSema().ActOnInitializerError(
9329 StmtResult Body = getDerived().TransformStmt(S->getBody());
9330 if (Body.isInvalid())
9337 if (Body.get() != S->getBody() && NewStmt.get() == S) {
9338 NewStmt = getDerived().RebuildCXXForRangeStmt(
9339 S->getForLoc(), S->getCoawaitLoc(),
Init.get(), S->getColonLoc(),
9340 Range.get(), Begin.get(), End.get(),
Cond.get(),
Inc.get(),
9341 LoopVar.get(), S->getRParenLoc(), ForRangeLifetimeExtendTemps);
9342 if (NewStmt.isInvalid())
9346 if (NewStmt.get() == S)
9349 return FinishCXXForRangeStmt(NewStmt.get(), Body.get());
9352template<
typename Derived>
9358 if (S->getQualifierLoc()) {
9360 = getDerived().TransformNestedNameSpecifierLoc(S->getQualifierLoc());
9367 if (NameInfo.getName()) {
9368 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
9369 if (!NameInfo.getName())
9374 if (!getDerived().AlwaysRebuild() &&
9375 QualifierLoc == S->getQualifierLoc() &&
9376 NameInfo.getName() == S->getNameInfo().getName())
9381 SS.
Adopt(QualifierLoc);
9383 switch (getSema().CheckMicrosoftIfExistsSymbol(
nullptr, SS, NameInfo)) {
9385 if (S->isIfExists())
9388 return new (getSema().Context)
NullStmt(S->getKeywordLoc());
9391 if (S->isIfNotExists())
9394 return new (getSema().Context)
NullStmt(S->getKeywordLoc());
9405 StmtResult SubStmt = getDerived().TransformCompoundStmt(S->getSubStmt());
9406 if (SubStmt.isInvalid())
9414 return getDerived().RebuildMSDependentExistsStmt(S->getKeywordLoc(),
9421template<
typename Derived>
9425 if (E->getQualifierLoc()) {
9427 = getDerived().TransformNestedNameSpecifierLoc(E->getQualifierLoc());
9433 getDerived().TransformDecl(E->getMemberLoc(), E->getPropertyDecl()));
9438 if (
Base.isInvalid())
9444 QualifierLoc, E->getMemberLoc());
9447template <
typename Derived>
9451 if (BaseRes.isInvalid())
9453 auto IdxRes = getDerived().TransformExpr(E->getIdx());
9454 if (IdxRes.isInvalid())
9457 if (!getDerived().AlwaysRebuild() &&
9458 BaseRes.get() == E->getBase() &&
9459 IdxRes.get() == E->getIdx())
9462 return getDerived().RebuildArraySubscriptExpr(
9463 BaseRes.get(),
SourceLocation(), IdxRes.get(), E->getRBracketLoc());
9466template <
typename Derived>
9468 StmtResult TryBlock = getDerived().TransformCompoundStmt(S->getTryBlock());
9469 if (TryBlock.isInvalid())
9472 StmtResult Handler = getDerived().TransformSEHHandler(S->getHandler());
9473 if (Handler.isInvalid())
9476 if (!getDerived().AlwaysRebuild() && TryBlock.get() == S->getTryBlock() &&
9477 Handler.get() == S->getHandler())
9480 return getDerived().RebuildSEHTryStmt(S->getIsCXXTry(), S->getTryLoc(),
9481 TryBlock.get(), Handler.get());
9484template <
typename Derived>
9487 if (
Block.isInvalid())
9490 return getDerived().RebuildSEHFinallyStmt(S->getFinallyLoc(),
Block.get());
9493template <
typename Derived>
9495 ExprResult FilterExpr = getDerived().TransformExpr(S->getFilterExpr());
9496 if (FilterExpr.isInvalid())
9500 if (
Block.isInvalid())
9503 return getDerived().RebuildSEHExceptStmt(S->getExceptLoc(), FilterExpr.get(),
9507template <
typename Derived>
9515template<
typename Derived>
9525template <
typename Derived>
9527TreeTransform<Derived>::TransformOMPCanonicalLoop(OMPCanonicalLoop *L) {
9531 return getDerived().TransformStmt(L->getLoopStmt());
9534template <
typename Derived>
9541 TClauses.reserve(Clauses.size());
9545 getDerived().getSema().OpenMP().StartOpenMPClause((*I)->getClauseKind());
9547 getDerived().getSema().OpenMP().EndOpenMPClause();
9549 TClauses.push_back(Clause);
9551 TClauses.push_back(
nullptr);
9555 if (D->hasAssociatedStmt() && D->getAssociatedStmt()) {
9556 getDerived().getSema().OpenMP().ActOnOpenMPRegionStart(
9557 D->getDirectiveKind(),
9563 if (D->getDirectiveKind() == OMPD_atomic ||
9564 D->getDirectiveKind() == OMPD_critical ||
9565 D->getDirectiveKind() == OMPD_section ||
9566 D->getDirectiveKind() == OMPD_master)
9567 CS = D->getAssociatedStmt();
9569 CS = D->getRawStmt();
9572 getSema().getLangOpts().OpenMPIRBuilder)
9576 getDerived().getSema().OpenMP().ActOnOpenMPRegionEnd(Body, TClauses);
9581 if (TClauses.size() != Clauses.size()) {
9587 if (D->getDirectiveKind() == OMPD_critical) {
9589 DirName =
getDerived().TransformDeclarationNameInfo(DirName);
9592 if (D->getDirectiveKind() == OMPD_cancellation_point) {
9594 }
else if (D->getDirectiveKind() == OMPD_cancel) {
9598 return getDerived().RebuildOMPExecutableDirective(
9599 D->getDirectiveKind(), DirName, CancelRegion, TClauses,
9600 AssociatedStmt.
get(), D->getBeginLoc(), D->getEndLoc());
9608template <
typename Derived>
9615 TClauses.reserve(Clauses.size());
9618 getDerived().getSema().OpenMP().StartOpenMPClause(
C->getClauseKind());
9620 getDerived().getSema().OpenMP().EndOpenMPClause();
9622 TClauses.push_back(Clause);
9624 TClauses.push_back(
nullptr);
9628 if (D->hasAssociatedStmt() && D->getAssociatedStmt()) {
9629 getDerived().getSema().OpenMP().ActOnOpenMPRegionStart(
9630 D->getDirectiveKind(),
9635 assert(D->getDirectiveKind() == OMPD_assume &&
9636 "Unexpected informational directive");
9637 Stmt *CS = D->getAssociatedStmt();
9641 getDerived().getSema().OpenMP().ActOnOpenMPRegionEnd(Body, TClauses);
9645 if (TClauses.size() != Clauses.size())
9650 return getDerived().RebuildOMPInformationalDirective(
9651 D->getDirectiveKind(), DirName, TClauses, AssociatedStmt.
get(),
9652 D->getBeginLoc(), D->getEndLoc());
9655template <
typename Derived>
9660 SemaRef.
Diag(D->getBeginLoc(), diag::err_omp_instantiation_not_supported)
9661 << getOpenMPDirectiveName(D->getDirectiveKind(), OMPVersion);
9665template <
typename Derived>
9667TreeTransform<Derived>::TransformOMPParallelDirective(OMPParallelDirective *D) {
9668 DeclarationNameInfo DirName;
9669 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9670 OMPD_parallel, DirName,
nullptr, D->getBeginLoc());
9671 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9672 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9676template <
typename Derived>
9680 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9681 OMPD_simd, DirName,
nullptr, D->getBeginLoc());
9682 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9683 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9687template <
typename Derived>
9691 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9692 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
9693 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9694 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9698template <
typename Derived>
9702 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9703 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
9704 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9705 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9709template <
typename Derived>
9713 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9714 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
9715 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9716 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9720template <
typename Derived>
9724 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9725 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
9726 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9727 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9731template <
typename Derived>
9733 OMPInterchangeDirective *D) {
9735 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9736 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
9737 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9738 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9742template <
typename Derived>
9746 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9747 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
9748 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9749 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9753template <
typename Derived>
9757 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9758 OMPD_for, DirName,
nullptr, D->getBeginLoc());
9759 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9760 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9764template <
typename Derived>
9768 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9769 OMPD_for_simd, DirName,
nullptr, D->getBeginLoc());
9770 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9771 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9775template <
typename Derived>
9779 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9780 OMPD_sections, DirName,
nullptr, D->getBeginLoc());
9781 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9782 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9786template <
typename Derived>
9790 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9791 OMPD_section, DirName,
nullptr, D->getBeginLoc());
9792 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9793 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9797template <
typename Derived>
9801 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9802 OMPD_scope, DirName,
nullptr, D->getBeginLoc());
9803 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9804 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9808template <
typename Derived>
9812 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9813 OMPD_single, DirName,
nullptr, D->getBeginLoc());
9814 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9815 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9819template <
typename Derived>
9823 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9824 OMPD_master, DirName,
nullptr, D->getBeginLoc());
9825 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9826 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9830template <
typename Derived>
9834 OMPD_critical, D->getDirectiveName(),
nullptr, D->getBeginLoc());
9835 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9836 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9840template <
typename Derived>
9842 OMPParallelForDirective *D) {
9844 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9845 OMPD_parallel_for, DirName,
nullptr, D->getBeginLoc());
9846 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9847 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9851template <
typename Derived>
9853 OMPParallelForSimdDirective *D) {
9855 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9856 OMPD_parallel_for_simd, DirName,
nullptr, D->getBeginLoc());
9857 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9858 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9862template <
typename Derived>
9864 OMPParallelMasterDirective *D) {
9866 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9867 OMPD_parallel_master, DirName,
nullptr, D->getBeginLoc());
9868 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9869 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9873template <
typename Derived>
9875 OMPParallelMaskedDirective *D) {
9877 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9878 OMPD_parallel_masked, DirName,
nullptr, D->getBeginLoc());
9879 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9880 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9884template <
typename Derived>
9886 OMPParallelSectionsDirective *D) {
9888 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9889 OMPD_parallel_sections, DirName,
nullptr, D->getBeginLoc());
9890 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9891 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9895template <
typename Derived>
9899 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9900 OMPD_task, DirName,
nullptr, D->getBeginLoc());
9901 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9902 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9906template <
typename Derived>
9908 OMPTaskyieldDirective *D) {
9910 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9911 OMPD_taskyield, DirName,
nullptr, D->getBeginLoc());
9912 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9913 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9917template <
typename Derived>
9921 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9922 OMPD_barrier, DirName,
nullptr, D->getBeginLoc());
9923 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9924 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9928template <
typename Derived>
9932 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9933 OMPD_taskwait, DirName,
nullptr, D->getBeginLoc());
9934 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9935 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9939template <
typename Derived>
9943 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9944 OMPD_assume, DirName,
nullptr, D->getBeginLoc());
9945 StmtResult Res = getDerived().TransformOMPInformationalDirective(D);
9946 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9950template <
typename Derived>
9954 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9955 OMPD_error, DirName,
nullptr, D->getBeginLoc());
9956 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9957 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9961template <
typename Derived>
9963 OMPTaskgroupDirective *D) {
9965 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9966 OMPD_taskgroup, DirName,
nullptr, D->getBeginLoc());
9967 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9968 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9972template <
typename Derived>
9976 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9977 OMPD_flush, DirName,
nullptr, D->getBeginLoc());
9978 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9979 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9983template <
typename Derived>
9987 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9988 OMPD_depobj, DirName,
nullptr, D->getBeginLoc());
9989 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9990 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9994template <
typename Derived>
9998 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9999 OMPD_scan, DirName,
nullptr, D->getBeginLoc());
10000 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10001 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10005template <
typename Derived>
10009 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10010 OMPD_ordered, DirName,
nullptr, D->getBeginLoc());
10011 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10012 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10016template <
typename Derived>
10020 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10021 OMPD_atomic, DirName,
nullptr, D->getBeginLoc());
10022 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10023 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10027template <
typename Derived>
10031 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10032 OMPD_target, DirName,
nullptr, D->getBeginLoc());
10033 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10034 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10038template <
typename Derived>
10040 OMPTargetDataDirective *D) {
10042 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10043 OMPD_target_data, DirName,
nullptr, D->getBeginLoc());
10044 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10045 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10049template <
typename Derived>
10051 OMPTargetEnterDataDirective *D) {
10053 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10054 OMPD_target_enter_data, DirName,
nullptr, D->getBeginLoc());
10055 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10056 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10060template <
typename Derived>
10062 OMPTargetExitDataDirective *D) {
10064 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10065 OMPD_target_exit_data, DirName,
nullptr, D->getBeginLoc());
10066 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10067 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10071template <
typename Derived>
10073 OMPTargetParallelDirective *D) {
10075 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10076 OMPD_target_parallel, DirName,
nullptr, D->getBeginLoc());
10077 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10078 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10082template <
typename Derived>
10084 OMPTargetParallelForDirective *D) {
10086 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10087 OMPD_target_parallel_for, DirName,
nullptr, D->getBeginLoc());
10088 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10089 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10093template <
typename Derived>
10095 OMPTargetUpdateDirective *D) {
10097 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10098 OMPD_target_update, DirName,
nullptr, D->getBeginLoc());
10099 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10100 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10104template <
typename Derived>
10108 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10109 OMPD_teams, DirName,
nullptr, D->getBeginLoc());
10110 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10111 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10115template <
typename Derived>
10117 OMPCancellationPointDirective *D) {
10119 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10120 OMPD_cancellation_point, DirName,
nullptr, D->getBeginLoc());
10121 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10122 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10126template <
typename Derived>
10130 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10131 OMPD_cancel, DirName,
nullptr, D->getBeginLoc());
10132 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10133 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10137template <
typename Derived>
10141 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10142 OMPD_taskloop, DirName,
nullptr, D->getBeginLoc());
10143 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10144 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10148template <
typename Derived>
10150 OMPTaskLoopSimdDirective *D) {
10152 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10153 OMPD_taskloop_simd, DirName,
nullptr, D->getBeginLoc());
10154 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10155 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10159template <
typename Derived>
10161 OMPMasterTaskLoopDirective *D) {
10163 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10164 OMPD_master_taskloop, DirName,
nullptr, D->getBeginLoc());
10165 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10166 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10170template <
typename Derived>
10172 OMPMaskedTaskLoopDirective *D) {
10174 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10175 OMPD_masked_taskloop, DirName,
nullptr, D->getBeginLoc());
10176 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10177 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10181template <
typename Derived>
10183 OMPMasterTaskLoopSimdDirective *D) {
10185 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10186 OMPD_master_taskloop_simd, DirName,
nullptr, D->getBeginLoc());
10187 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10188 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10192template <
typename Derived>
10194 OMPMaskedTaskLoopSimdDirective *D) {
10196 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10197 OMPD_masked_taskloop_simd, DirName,
nullptr, D->getBeginLoc());
10198 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10199 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10203template <
typename Derived>
10205 OMPParallelMasterTaskLoopDirective *D) {
10207 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10208 OMPD_parallel_master_taskloop, DirName,
nullptr, D->getBeginLoc());
10209 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10210 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10214template <
typename Derived>
10216 OMPParallelMaskedTaskLoopDirective *D) {
10218 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10219 OMPD_parallel_masked_taskloop, DirName,
nullptr, D->getBeginLoc());
10220 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10221 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10225template <
typename Derived>
10228 OMPParallelMasterTaskLoopSimdDirective *D) {
10230 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10231 OMPD_parallel_master_taskloop_simd, DirName,
nullptr, D->getBeginLoc());
10232 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10233 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10237template <
typename Derived>
10240 OMPParallelMaskedTaskLoopSimdDirective *D) {
10242 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10243 OMPD_parallel_masked_taskloop_simd, DirName,
nullptr, D->getBeginLoc());
10244 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10245 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10249template <
typename Derived>
10251 OMPDistributeDirective *D) {
10253 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10254 OMPD_distribute, DirName,
nullptr, D->getBeginLoc());
10255 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10256 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10260template <
typename Derived>
10262 OMPDistributeParallelForDirective *D) {
10264 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10265 OMPD_distribute_parallel_for, DirName,
nullptr, D->getBeginLoc());
10266 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10267 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10271template <
typename Derived>
10274 OMPDistributeParallelForSimdDirective *D) {
10276 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10277 OMPD_distribute_parallel_for_simd, DirName,
nullptr, D->getBeginLoc());
10278 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10279 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10283template <
typename Derived>
10285 OMPDistributeSimdDirective *D) {
10287 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10288 OMPD_distribute_simd, DirName,
nullptr, D->getBeginLoc());
10289 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10290 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10294template <
typename Derived>
10296 OMPTargetParallelForSimdDirective *D) {
10298 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10299 OMPD_target_parallel_for_simd, DirName,
nullptr, D->getBeginLoc());
10300 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10301 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10305template <
typename Derived>
10307 OMPTargetSimdDirective *D) {
10309 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10310 OMPD_target_simd, DirName,
nullptr, D->getBeginLoc());
10311 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10312 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10316template <
typename Derived>
10318 OMPTeamsDistributeDirective *D) {
10320 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10321 OMPD_teams_distribute, DirName,
nullptr, D->getBeginLoc());
10322 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10323 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10327template <
typename Derived>
10329 OMPTeamsDistributeSimdDirective *D) {
10331 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10332 OMPD_teams_distribute_simd, DirName,
nullptr, D->getBeginLoc());
10333 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10334 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10338template <
typename Derived>
10340 OMPTeamsDistributeParallelForSimdDirective *D) {
10342 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10343 OMPD_teams_distribute_parallel_for_simd, DirName,
nullptr,
10345 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10346 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10350template <
typename Derived>
10352 OMPTeamsDistributeParallelForDirective *D) {
10354 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10355 OMPD_teams_distribute_parallel_for, DirName,
nullptr, D->getBeginLoc());
10356 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10357 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10361template <
typename Derived>
10363 OMPTargetTeamsDirective *D) {
10365 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10366 OMPD_target_teams, DirName,
nullptr, D->getBeginLoc());
10367 auto Res = getDerived().TransformOMPExecutableDirective(D);
10368 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10372template <
typename Derived>
10374 OMPTargetTeamsDistributeDirective *D) {
10376 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10377 OMPD_target_teams_distribute, DirName,
nullptr, D->getBeginLoc());
10378 auto Res = getDerived().TransformOMPExecutableDirective(D);
10379 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10383template <
typename Derived>
10386 OMPTargetTeamsDistributeParallelForDirective *D) {
10388 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10389 OMPD_target_teams_distribute_parallel_for, DirName,
nullptr,
10391 auto Res = getDerived().TransformOMPExecutableDirective(D);
10392 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10396template <
typename Derived>
10399 OMPTargetTeamsDistributeParallelForSimdDirective *D) {
10401 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10402 OMPD_target_teams_distribute_parallel_for_simd, DirName,
nullptr,
10404 auto Res = getDerived().TransformOMPExecutableDirective(D);
10405 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10409template <
typename Derived>
10412 OMPTargetTeamsDistributeSimdDirective *D) {
10414 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10415 OMPD_target_teams_distribute_simd, DirName,
nullptr, D->getBeginLoc());
10416 auto Res = getDerived().TransformOMPExecutableDirective(D);
10417 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10421template <
typename Derived>
10425 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10426 OMPD_interop, DirName,
nullptr, D->getBeginLoc());
10427 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10428 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10432template <
typename Derived>
10436 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10437 OMPD_dispatch, DirName,
nullptr, D->getBeginLoc());
10438 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10439 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10443template <
typename Derived>
10447 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10448 OMPD_masked, DirName,
nullptr, D->getBeginLoc());
10449 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10450 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10454template <
typename Derived>
10456 OMPGenericLoopDirective *D) {
10458 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10459 OMPD_loop, DirName,
nullptr, D->getBeginLoc());
10460 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10461 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10465template <
typename Derived>
10467 OMPTeamsGenericLoopDirective *D) {
10469 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10470 OMPD_teams_loop, DirName,
nullptr, D->getBeginLoc());
10471 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10472 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10476template <
typename Derived>
10478 OMPTargetTeamsGenericLoopDirective *D) {
10480 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10481 OMPD_target_teams_loop, DirName,
nullptr, D->getBeginLoc());
10482 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10483 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10487template <
typename Derived>
10489 OMPParallelGenericLoopDirective *D) {
10491 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10492 OMPD_parallel_loop, DirName,
nullptr, D->getBeginLoc());
10493 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10494 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10498template <
typename Derived>
10501 OMPTargetParallelGenericLoopDirective *D) {
10503 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10504 OMPD_target_parallel_loop, DirName,
nullptr, D->getBeginLoc());
10505 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10506 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10513template <
typename Derived>
10516 if (
Cond.isInvalid())
10518 return getDerived().RebuildOMPIfClause(
10519 C->getNameModifier(),
Cond.get(),
C->getBeginLoc(),
C->getLParenLoc(),
10520 C->getNameModifierLoc(),
C->getColonLoc(),
C->getEndLoc());
10523template <
typename Derived>
10526 if (
Cond.isInvalid())
10528 return getDerived().RebuildOMPFinalClause(
Cond.get(),
C->getBeginLoc(),
10529 C->getLParenLoc(),
C->getEndLoc());
10532template <
typename Derived>
10535 ExprResult NumThreads = getDerived().TransformExpr(
C->getNumThreads());
10536 if (NumThreads.isInvalid())
10538 return getDerived().RebuildOMPNumThreadsClause(
10539 C->getModifier(), NumThreads.get(),
C->getBeginLoc(),
C->getLParenLoc(),
10540 C->getModifierLoc(),
C->getEndLoc());
10543template <
typename Derived>
10546 ExprResult E = getDerived().TransformExpr(
C->getSafelen());
10549 return getDerived().RebuildOMPSafelenClause(
10550 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10553template <
typename Derived>
10556 ExprResult E = getDerived().TransformExpr(
C->getAllocator());
10559 return getDerived().RebuildOMPAllocatorClause(
10560 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10563template <
typename Derived>
10566 ExprResult E = getDerived().TransformExpr(
C->getSimdlen());
10569 return getDerived().RebuildOMPSimdlenClause(
10570 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10573template <
typename Derived>
10576 TransformedSizes.reserve(
C->getNumSizes());
10578 for (
Expr *E :
C->getSizesRefs()) {
10580 TransformedSizes.push_back(
nullptr);
10589 TransformedSizes.push_back(
T.get());
10592 if (!Changed && !getDerived().AlwaysRebuild())
10594 return RebuildOMPSizesClause(TransformedSizes,
C->getBeginLoc(),
10595 C->getLParenLoc(),
C->getEndLoc());
10598template <
typename Derived>
10602 TransformedArgs.reserve(
C->getNumLoops());
10604 for (
Expr *E :
C->getArgsRefs()) {
10606 TransformedArgs.push_back(
nullptr);
10615 TransformedArgs.push_back(
T.get());
10618 if (!Changed && !getDerived().AlwaysRebuild())
10620 return RebuildOMPPermutationClause(TransformedArgs,
C->getBeginLoc(),
10621 C->getLParenLoc(),
C->getEndLoc());
10624template <
typename Derived>
10626 if (!getDerived().AlwaysRebuild())
10628 return RebuildOMPFullClause(
C->getBeginLoc(),
C->getEndLoc());
10631template <
typename Derived>
10634 ExprResult T = getDerived().TransformExpr(
C->getFactor());
10637 Expr *Factor =
T.get();
10638 bool Changed = Factor !=
C->getFactor();
10640 if (!Changed && !getDerived().AlwaysRebuild())
10642 return RebuildOMPPartialClause(Factor,
C->getBeginLoc(),
C->getLParenLoc(),
10646template <
typename Derived>
10649 ExprResult F = getDerived().TransformExpr(
C->getFirst());
10653 ExprResult Cn = getDerived().TransformExpr(
C->getCount());
10654 if (Cn.isInvalid())
10658 Expr *Count = Cn.get();
10660 bool Changed = (
First !=
C->getFirst()) || (Count !=
C->getCount());
10663 if (!Changed && !getDerived().AlwaysRebuild())
10666 return RebuildOMPLoopRangeClause(
First, Count,
C->getBeginLoc(),
10667 C->getLParenLoc(),
C->getFirstLoc(),
10668 C->getCountLoc(),
C->getEndLoc());
10671template <
typename Derived>
10674 ExprResult E = getDerived().TransformExpr(
C->getNumForLoops());
10677 return getDerived().RebuildOMPCollapseClause(
10678 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10681template <
typename Derived>
10685 C->getDefaultKind(),
C->getDefaultKindKwLoc(),
C->getDefaultVC(),
10686 C->getDefaultVCLoc(),
C->getBeginLoc(),
C->getLParenLoc(),
10690template <
typename Derived>
10697template <
typename Derived>
10700 Expr *Impex =
C->getImpexType();
10701 ExprResult TransformedImpex = getDerived().TransformExpr(Impex);
10703 if (TransformedImpex.isInvalid())
10706 return getDerived().RebuildOMPTransparentClause(
10707 TransformedImpex.get(),
C->getBeginLoc(),
C->getLParenLoc(),
10711template <
typename Derived>
10715 C->getProcBindKind(),
C->getProcBindKindKwLoc(),
C->getBeginLoc(),
10716 C->getLParenLoc(),
C->getEndLoc());
10719template <
typename Derived>
10722 ExprResult E = getDerived().TransformExpr(
C->getChunkSize());
10725 return getDerived().RebuildOMPScheduleClause(
10726 C->getFirstScheduleModifier(),
C->getSecondScheduleModifier(),
10727 C->getScheduleKind(), E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
10728 C->getFirstScheduleModifierLoc(),
C->getSecondScheduleModifierLoc(),
10729 C->getScheduleKindLoc(),
C->getCommaLoc(),
C->getEndLoc());
10732template <
typename Derived>
10736 if (
auto *
Num =
C->getNumForLoops()) {
10737 E = getDerived().TransformExpr(
Num);
10741 return getDerived().RebuildOMPOrderedClause(
C->getBeginLoc(),
C->getEndLoc(),
10742 C->getLParenLoc(), E.get());
10745template <
typename Derived>
10749 if (
Expr *Evt =
C->getEventHandler()) {
10750 E = getDerived().TransformExpr(Evt);
10754 return getDerived().RebuildOMPDetachClause(E.get(),
C->getBeginLoc(),
10755 C->getLParenLoc(),
C->getEndLoc());
10758template <
typename Derived>
10764 if (
Cond.isInvalid())
10767 return getDerived().RebuildOMPNowaitClause(
Cond.get(),
C->getBeginLoc(),
10768 C->getLParenLoc(),
C->getEndLoc());
10771template <
typename Derived>
10778template <
typename Derived>
10785template <
typename Derived>
10791template <
typename Derived>
10797template <
typename Derived>
10804template <
typename Derived>
10811template <
typename Derived>
10818template <
typename Derived>
10824template <
typename Derived>
10830template <
typename Derived>
10832 ExprResult E = getDerived().TransformExpr(
C->getExpr());
10835 return getDerived().RebuildOMPHoldsClause(E.get(),
C->getBeginLoc(),
10836 C->getLParenLoc(),
C->getEndLoc());
10839template <
typename Derived>
10845template <
typename Derived>
10850template <
typename Derived>
10852 OMPNoOpenMPRoutinesClause *
C) {
10855template <
typename Derived>
10857 OMPNoOpenMPConstructsClause *
C) {
10860template <
typename Derived>
10862 OMPNoParallelismClause *
C) {
10866template <
typename Derived>
10873template <
typename Derived>
10880template <
typename Derived>
10887template <
typename Derived>
10894template <
typename Derived>
10901template <
typename Derived>
10907template <
typename Derived>
10914template <
typename Derived>
10920template <
typename Derived>
10927template <
typename Derived>
10929 ExprResult IVR = getDerived().TransformExpr(
C->getInteropVar());
10930 if (IVR.isInvalid())
10934 InteropInfo.PreferTypes.reserve(
C->varlist_size() - 1);
10935 for (
Expr *E : llvm::drop_begin(
C->varlist())) {
10937 if (ER.isInvalid())
10939 InteropInfo.PreferTypes.push_back(ER.get());
10941 return getDerived().RebuildOMPInitClause(IVR.get(), InteropInfo,
10942 C->getBeginLoc(),
C->getLParenLoc(),
10943 C->getVarLoc(),
C->getEndLoc());
10946template <
typename Derived>
10948 ExprResult ER = getDerived().TransformExpr(
C->getInteropVar());
10949 if (ER.isInvalid())
10951 return getDerived().RebuildOMPUseClause(ER.get(),
C->getBeginLoc(),
10952 C->getLParenLoc(),
C->getVarLoc(),
10956template <
typename Derived>
10960 if (
Expr *IV =
C->getInteropVar()) {
10961 ER = getDerived().TransformExpr(IV);
10962 if (ER.isInvalid())
10965 return getDerived().RebuildOMPDestroyClause(ER.get(),
C->getBeginLoc(),
10966 C->getLParenLoc(),
C->getVarLoc(),
10970template <
typename Derived>
10974 if (
Cond.isInvalid())
10976 return getDerived().RebuildOMPNovariantsClause(
10977 Cond.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10980template <
typename Derived>
10984 if (
Cond.isInvalid())
10986 return getDerived().RebuildOMPNocontextClause(
10987 Cond.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10990template <
typename Derived>
10993 ExprResult ThreadID = getDerived().TransformExpr(
C->getThreadID());
10994 if (ThreadID.isInvalid())
10996 return getDerived().RebuildOMPFilterClause(ThreadID.get(),
C->getBeginLoc(),
10997 C->getLParenLoc(),
C->getEndLoc());
11000template <
typename Derived>
11002 ExprResult E = getDerived().TransformExpr(
C->getAlignment());
11005 return getDerived().RebuildOMPAlignClause(E.get(),
C->getBeginLoc(),
11006 C->getLParenLoc(),
C->getEndLoc());
11009template <
typename Derived>
11011 OMPUnifiedAddressClause *
C) {
11012 llvm_unreachable(
"unified_address clause cannot appear in dependent context");
11015template <
typename Derived>
11017 OMPUnifiedSharedMemoryClause *
C) {
11019 "unified_shared_memory clause cannot appear in dependent context");
11022template <
typename Derived>
11024 OMPReverseOffloadClause *
C) {
11025 llvm_unreachable(
"reverse_offload clause cannot appear in dependent context");
11028template <
typename Derived>
11030 OMPDynamicAllocatorsClause *
C) {
11032 "dynamic_allocators clause cannot appear in dependent context");
11035template <
typename Derived>
11037 OMPAtomicDefaultMemOrderClause *
C) {
11039 "atomic_default_mem_order clause cannot appear in dependent context");
11042template <
typename Derived>
11045 llvm_unreachable(
"self_maps clause cannot appear in dependent context");
11048template <
typename Derived>
11051 C->getBeginLoc(),
C->getLParenLoc(),
11055template <
typename Derived>
11059 C->getSeverityKind(),
C->getSeverityKindKwLoc(),
C->getBeginLoc(),
11060 C->getLParenLoc(),
C->getEndLoc());
11063template <
typename Derived>
11066 ExprResult E = getDerived().TransformExpr(
C->getMessageString());
11069 return getDerived().RebuildOMPMessageClause(
11070 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11073template <
typename Derived>
11077 Vars.reserve(
C->varlist_size());
11078 for (
auto *
VE :
C->varlist()) {
11080 if (EVar.isInvalid())
11082 Vars.push_back(EVar.get());
11084 return getDerived().RebuildOMPPrivateClause(
11085 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11088template <
typename Derived>
11090 OMPFirstprivateClause *
C) {
11092 Vars.reserve(
C->varlist_size());
11093 for (
auto *
VE :
C->varlist()) {
11095 if (EVar.isInvalid())
11097 Vars.push_back(EVar.get());
11099 return getDerived().RebuildOMPFirstprivateClause(
11100 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11103template <
typename Derived>
11107 Vars.reserve(
C->varlist_size());
11108 for (
auto *
VE :
C->varlist()) {
11110 if (EVar.isInvalid())
11112 Vars.push_back(EVar.get());
11114 return getDerived().RebuildOMPLastprivateClause(
11115 Vars,
C->getKind(),
C->getKindLoc(),
C->getColonLoc(),
C->getBeginLoc(),
11116 C->getLParenLoc(),
C->getEndLoc());
11119template <
typename Derived>
11123 Vars.reserve(
C->varlist_size());
11124 for (
auto *
VE :
C->varlist()) {
11126 if (EVar.isInvalid())
11128 Vars.push_back(EVar.get());
11130 return getDerived().RebuildOMPSharedClause(Vars,
C->getBeginLoc(),
11131 C->getLParenLoc(),
C->getEndLoc());
11134template <
typename Derived>
11138 Vars.reserve(
C->varlist_size());
11139 for (
auto *
VE :
C->varlist()) {
11141 if (EVar.isInvalid())
11143 Vars.push_back(EVar.get());
11146 ReductionIdScopeSpec.
Adopt(
C->getQualifierLoc());
11149 if (NameInfo.getName()) {
11150 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
11151 if (!NameInfo.getName())
11157 for (
auto *E :
C->reduction_ops()) {
11162 for (
auto *D : ULE->decls()) {
11165 Decls.addDecl(InstD, InstD->getAccess());
11169 ReductionIdScopeSpec.getWithLocInContext(SemaRef.
Context), NameInfo,
11170 true, Decls.begin(), Decls.end(),
11173 UnresolvedReductions.push_back(
nullptr);
11175 return getDerived().RebuildOMPReductionClause(
11176 Vars,
C->getModifier(),
C->getOriginalSharingModifier(),
C->getBeginLoc(),
11177 C->getLParenLoc(),
C->getModifierLoc(),
C->getColonLoc(),
C->getEndLoc(),
11178 ReductionIdScopeSpec, NameInfo, UnresolvedReductions);
11181template <
typename Derived>
11183 OMPTaskReductionClause *
C) {
11185 Vars.reserve(
C->varlist_size());
11186 for (
auto *
VE :
C->varlist()) {
11188 if (EVar.isInvalid())
11190 Vars.push_back(EVar.get());
11193 ReductionIdScopeSpec.
Adopt(
C->getQualifierLoc());
11196 if (NameInfo.getName()) {
11197 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
11198 if (!NameInfo.getName())
11204 for (
auto *E :
C->reduction_ops()) {
11209 for (
auto *D : ULE->decls()) {
11212 Decls.addDecl(InstD, InstD->getAccess());
11216 ReductionIdScopeSpec.getWithLocInContext(SemaRef.
Context), NameInfo,
11217 true, Decls.begin(), Decls.end(),
11220 UnresolvedReductions.push_back(
nullptr);
11222 return getDerived().RebuildOMPTaskReductionClause(
11223 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getColonLoc(),
11224 C->getEndLoc(), ReductionIdScopeSpec, NameInfo, UnresolvedReductions);
11227template <
typename Derived>
11231 Vars.reserve(
C->varlist_size());
11232 for (
auto *
VE :
C->varlist()) {
11234 if (EVar.isInvalid())
11236 Vars.push_back(EVar.get());
11239 ReductionIdScopeSpec.
Adopt(
C->getQualifierLoc());
11242 if (NameInfo.getName()) {
11243 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
11244 if (!NameInfo.getName())
11250 for (
auto *E :
C->reduction_ops()) {
11255 for (
auto *D : ULE->decls()) {
11258 Decls.addDecl(InstD, InstD->getAccess());
11262 ReductionIdScopeSpec.getWithLocInContext(SemaRef.
Context), NameInfo,
11263 true, Decls.begin(), Decls.end(),
11266 UnresolvedReductions.push_back(
nullptr);
11268 return getDerived().RebuildOMPInReductionClause(
11269 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getColonLoc(),
11270 C->getEndLoc(), ReductionIdScopeSpec, NameInfo, UnresolvedReductions);
11273template <
typename Derived>
11277 Vars.reserve(
C->varlist_size());
11278 for (
auto *
VE :
C->varlist()) {
11280 if (EVar.isInvalid())
11282 Vars.push_back(EVar.get());
11284 ExprResult Step = getDerived().TransformExpr(
C->getStep());
11285 if (Step.isInvalid())
11287 return getDerived().RebuildOMPLinearClause(
11288 Vars, Step.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getModifier(),
11289 C->getModifierLoc(),
C->getColonLoc(),
C->getStepModifierLoc(),
11293template <
typename Derived>
11297 Vars.reserve(
C->varlist_size());
11298 for (
auto *
VE :
C->varlist()) {
11300 if (EVar.isInvalid())
11302 Vars.push_back(EVar.get());
11304 ExprResult Alignment = getDerived().TransformExpr(
C->getAlignment());
11305 if (Alignment.isInvalid())
11307 return getDerived().RebuildOMPAlignedClause(
11308 Vars, Alignment.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11309 C->getColonLoc(),
C->getEndLoc());
11312template <
typename Derived>
11316 Vars.reserve(
C->varlist_size());
11317 for (
auto *
VE :
C->varlist()) {
11319 if (EVar.isInvalid())
11321 Vars.push_back(EVar.get());
11323 return getDerived().RebuildOMPCopyinClause(Vars,
C->getBeginLoc(),
11324 C->getLParenLoc(),
C->getEndLoc());
11327template <
typename Derived>
11331 Vars.reserve(
C->varlist_size());
11332 for (
auto *
VE :
C->varlist()) {
11334 if (EVar.isInvalid())
11336 Vars.push_back(EVar.get());
11338 return getDerived().RebuildOMPCopyprivateClause(
11339 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11342template <
typename Derived>
11345 Vars.reserve(
C->varlist_size());
11346 for (
auto *
VE :
C->varlist()) {
11348 if (EVar.isInvalid())
11350 Vars.push_back(EVar.get());
11352 return getDerived().RebuildOMPFlushClause(Vars,
C->getBeginLoc(),
11353 C->getLParenLoc(),
C->getEndLoc());
11356template <
typename Derived>
11359 ExprResult E = getDerived().TransformExpr(
C->getDepobj());
11362 return getDerived().RebuildOMPDepobjClause(E.get(),
C->getBeginLoc(),
11363 C->getLParenLoc(),
C->getEndLoc());
11366template <
typename Derived>
11370 Expr *DepModifier =
C->getModifier();
11372 ExprResult DepModRes = getDerived().TransformExpr(DepModifier);
11373 if (DepModRes.isInvalid())
11375 DepModifier = DepModRes.get();
11377 Vars.reserve(
C->varlist_size());
11378 for (
auto *
VE :
C->varlist()) {
11380 if (EVar.isInvalid())
11382 Vars.push_back(EVar.get());
11384 return getDerived().RebuildOMPDependClause(
11385 {
C->getDependencyKind(),
C->getDependencyLoc(),
C->getColonLoc(),
11386 C->getOmpAllMemoryLoc()},
11387 DepModifier, Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11390template <
typename Derived>
11393 ExprResult E = getDerived().TransformExpr(
C->getDevice());
11396 return getDerived().RebuildOMPDeviceClause(
11397 C->getModifier(), E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11398 C->getModifierLoc(),
C->getEndLoc());
11401template <
typename Derived,
class T>
11408 Vars.reserve(
C->varlist_size());
11409 for (
auto *
VE :
C->varlist()) {
11413 Vars.push_back(EVar.
get());
11417 if (
C->getMapperQualifierLoc()) {
11418 QualifierLoc = TT.
getDerived().TransformNestedNameSpecifierLoc(
11419 C->getMapperQualifierLoc());
11423 MapperIdScopeSpec.
Adopt(QualifierLoc);
11424 MapperIdInfo =
C->getMapperIdInfo();
11425 if (MapperIdInfo.
getName()) {
11426 MapperIdInfo = TT.
getDerived().TransformDeclarationNameInfo(MapperIdInfo);
11432 for (
auto *E :
C->mapperlists()) {
11437 for (
auto *D : ULE->decls()) {
11440 Decls.addDecl(InstD, InstD->
getAccess());
11445 MapperIdInfo,
true, Decls.begin(), Decls.end(),
11448 UnresolvedMappers.push_back(
nullptr);
11454template <
typename Derived>
11456 OMPVarListLocTy Locs(
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11458 Expr *IteratorModifier =
C->getIteratorModifier();
11459 if (IteratorModifier) {
11460 ExprResult MapModRes = getDerived().TransformExpr(IteratorModifier);
11461 if (MapModRes.isInvalid())
11463 IteratorModifier = MapModRes.
get();
11469 *
this,
C, Vars, MapperIdScopeSpec, MapperIdInfo, UnresolvedMappers))
11471 return getDerived().RebuildOMPMapClause(
11472 IteratorModifier,
C->getMapTypeModifiers(),
C->getMapTypeModifiersLoc(),
11473 MapperIdScopeSpec, MapperIdInfo,
C->getMapType(),
C->isImplicitMapType(),
11474 C->getMapLoc(),
C->getColonLoc(), Vars, Locs, UnresolvedMappers);
11477template <
typename Derived>
11480 Expr *Allocator =
C->getAllocator();
11482 ExprResult AllocatorRes = getDerived().TransformExpr(Allocator);
11483 if (AllocatorRes.isInvalid())
11485 Allocator = AllocatorRes.get();
11487 Expr *Alignment =
C->getAlignment();
11489 ExprResult AlignmentRes = getDerived().TransformExpr(Alignment);
11490 if (AlignmentRes.isInvalid())
11492 Alignment = AlignmentRes.get();
11495 Vars.reserve(
C->varlist_size());
11496 for (
auto *
VE :
C->varlist()) {
11498 if (EVar.isInvalid())
11500 Vars.push_back(EVar.get());
11502 return getDerived().RebuildOMPAllocateClause(
11503 Allocator, Alignment,
C->getFirstAllocateModifier(),
11504 C->getFirstAllocateModifierLoc(),
C->getSecondAllocateModifier(),
11505 C->getSecondAllocateModifierLoc(), Vars,
C->getBeginLoc(),
11506 C->getLParenLoc(),
C->getColonLoc(),
C->getEndLoc());
11509template <
typename Derived>
11513 Vars.reserve(
C->varlist_size());
11514 for (
auto *
VE :
C->varlist()) {
11516 if (EVar.isInvalid())
11518 Vars.push_back(EVar.get());
11520 return getDerived().RebuildOMPNumTeamsClause(
11521 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11524template <
typename Derived>
11528 Vars.reserve(
C->varlist_size());
11529 for (
auto *
VE :
C->varlist()) {
11531 if (EVar.isInvalid())
11533 Vars.push_back(EVar.get());
11535 return getDerived().RebuildOMPThreadLimitClause(
11536 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11539template <
typename Derived>
11542 ExprResult E = getDerived().TransformExpr(
C->getPriority());
11545 return getDerived().RebuildOMPPriorityClause(
11546 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11549template <
typename Derived>
11552 ExprResult E = getDerived().TransformExpr(
C->getGrainsize());
11555 return getDerived().RebuildOMPGrainsizeClause(
11556 C->getModifier(), E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11557 C->getModifierLoc(),
C->getEndLoc());
11560template <
typename Derived>
11563 ExprResult E = getDerived().TransformExpr(
C->getNumTasks());
11566 return getDerived().RebuildOMPNumTasksClause(
11567 C->getModifier(), E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11568 C->getModifierLoc(),
C->getEndLoc());
11571template <
typename Derived>
11573 ExprResult E = getDerived().TransformExpr(
C->getHint());
11576 return getDerived().RebuildOMPHintClause(E.get(),
C->getBeginLoc(),
11577 C->getLParenLoc(),
C->getEndLoc());
11580template <
typename Derived>
11582 OMPDistScheduleClause *
C) {
11583 ExprResult E = getDerived().TransformExpr(
C->getChunkSize());
11586 return getDerived().RebuildOMPDistScheduleClause(
11587 C->getDistScheduleKind(), E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11588 C->getDistScheduleKindLoc(),
C->getCommaLoc(),
C->getEndLoc());
11591template <
typename Derived>
11597 C->getDefaultmapKind(),
11600 C->getDefaultmapModifierLoc(),
11601 C->getDefaultmapKindLoc(),
11605template <
typename Derived>
11609 Expr *IteratorModifier =
C->getIteratorModifier();
11610 if (IteratorModifier) {
11611 ExprResult MapModRes = getDerived().TransformExpr(IteratorModifier);
11612 if (MapModRes.isInvalid())
11614 IteratorModifier = MapModRes.get();
11620 *
this,
C, Vars, MapperIdScopeSpec, MapperIdInfo, UnresolvedMappers))
11622 return getDerived().RebuildOMPToClause(
11623 C->getMotionModifiers(),
C->getMotionModifiersLoc(), IteratorModifier,
11624 MapperIdScopeSpec, MapperIdInfo,
C->getColonLoc(), Vars, Locs,
11625 UnresolvedMappers);
11628template <
typename Derived>
11632 Expr *IteratorModifier =
C->getIteratorModifier();
11633 if (IteratorModifier) {
11634 ExprResult MapModRes = getDerived().TransformExpr(IteratorModifier);
11635 if (MapModRes.isInvalid())
11637 IteratorModifier = MapModRes.get();
11643 *
this,
C, Vars, MapperIdScopeSpec, MapperIdInfo, UnresolvedMappers))
11645 return getDerived().RebuildOMPFromClause(
11646 C->getMotionModifiers(),
C->getMotionModifiersLoc(), IteratorModifier,
11647 MapperIdScopeSpec, MapperIdInfo,
C->getColonLoc(), Vars, Locs,
11648 UnresolvedMappers);
11651template <
typename Derived>
11653 OMPUseDevicePtrClause *
C) {
11655 Vars.reserve(
C->varlist_size());
11656 for (
auto *
VE :
C->varlist()) {
11658 if (EVar.isInvalid())
11660 Vars.push_back(EVar.get());
11663 return getDerived().RebuildOMPUseDevicePtrClause(
11664 Vars, Locs,
C->getFallbackModifier(),
C->getFallbackModifierLoc());
11667template <
typename Derived>
11669 OMPUseDeviceAddrClause *
C) {
11671 Vars.reserve(
C->varlist_size());
11672 for (
auto *
VE :
C->varlist()) {
11674 if (EVar.isInvalid())
11676 Vars.push_back(EVar.get());
11679 return getDerived().RebuildOMPUseDeviceAddrClause(Vars, Locs);
11682template <
typename Derived>
11686 Vars.reserve(
C->varlist_size());
11687 for (
auto *
VE :
C->varlist()) {
11689 if (EVar.isInvalid())
11691 Vars.push_back(EVar.get());
11694 return getDerived().RebuildOMPIsDevicePtrClause(Vars, Locs);
11697template <
typename Derived>
11699 OMPHasDeviceAddrClause *
C) {
11701 Vars.reserve(
C->varlist_size());
11702 for (
auto *
VE :
C->varlist()) {
11704 if (EVar.isInvalid())
11706 Vars.push_back(EVar.get());
11709 return getDerived().RebuildOMPHasDeviceAddrClause(Vars, Locs);
11712template <
typename Derived>
11716 Vars.reserve(
C->varlist_size());
11717 for (
auto *
VE :
C->varlist()) {
11719 if (EVar.isInvalid())
11721 Vars.push_back(EVar.get());
11723 return getDerived().RebuildOMPNontemporalClause(
11724 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11727template <
typename Derived>
11731 Vars.reserve(
C->varlist_size());
11732 for (
auto *
VE :
C->varlist()) {
11734 if (EVar.isInvalid())
11736 Vars.push_back(EVar.get());
11738 return getDerived().RebuildOMPInclusiveClause(
11739 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11742template <
typename Derived>
11746 Vars.reserve(
C->varlist_size());
11747 for (
auto *
VE :
C->varlist()) {
11749 if (EVar.isInvalid())
11751 Vars.push_back(EVar.get());
11753 return getDerived().RebuildOMPExclusiveClause(
11754 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11757template <
typename Derived>
11759 OMPUsesAllocatorsClause *
C) {
11761 Data.reserve(
C->getNumberOfAllocators());
11762 for (
unsigned I = 0, E =
C->getNumberOfAllocators(); I < E; ++I) {
11763 OMPUsesAllocatorsClause::Data D =
C->getAllocatorData(I);
11765 if (Allocator.isInvalid())
11769 AllocatorTraits = getDerived().TransformExpr(AT);
11770 if (AllocatorTraits.isInvalid())
11774 NewD.Allocator = Allocator.get();
11775 NewD.AllocatorTraits = AllocatorTraits.get();
11779 return getDerived().RebuildOMPUsesAllocatorsClause(
11780 Data,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11783template <
typename Derived>
11787 Locators.reserve(
C->varlist_size());
11789 if (
Expr *Modifier =
C->getModifier()) {
11790 ModifierRes = getDerived().TransformExpr(Modifier);
11791 if (ModifierRes.isInvalid())
11794 for (
Expr *E :
C->varlist()) {
11795 ExprResult Locator = getDerived().TransformExpr(E);
11796 if (Locator.isInvalid())
11798 Locators.push_back(Locator.get());
11800 return getDerived().RebuildOMPAffinityClause(
11801 C->getBeginLoc(),
C->getLParenLoc(),
C->getColonLoc(),
C->getEndLoc(),
11802 ModifierRes.get(), Locators);
11805template <
typename Derived>
11808 C->getKind(),
C->getKindKwLoc(),
C->getBeginLoc(),
C->getLParenLoc(),
11809 C->getEndLoc(),
C->getModifier(),
C->getModifierKwLoc());
11812template <
typename Derived>
11815 C->getBindKind(),
C->getBindKindLoc(),
C->getBeginLoc(),
11816 C->getLParenLoc(),
C->getEndLoc());
11819template <
typename Derived>
11821 OMPXDynCGroupMemClause *
C) {
11823 if (
Size.isInvalid())
11825 return getDerived().RebuildOMPXDynCGroupMemClause(
11826 Size.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11829template <
typename Derived>
11831 OMPDynGroupprivateClause *
C) {
11833 if (
Size.isInvalid())
11835 return getDerived().RebuildOMPDynGroupprivateClause(
11836 C->getDynGroupprivateModifier(),
C->getDynGroupprivateFallbackModifier(),
11837 Size.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11838 C->getDynGroupprivateModifierLoc(),
11839 C->getDynGroupprivateFallbackModifierLoc(),
C->getEndLoc());
11842template <
typename Derived>
11846 Vars.reserve(
C->varlist_size());
11847 for (
auto *
VE :
C->varlist()) {
11849 if (EVar.isInvalid())
11851 Vars.push_back(EVar.get());
11853 return getDerived().RebuildOMPDoacrossClause(
11854 C->getDependenceType(),
C->getDependenceLoc(),
C->getColonLoc(), Vars,
11855 C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11858template <
typename Derived>
11862 for (
auto *A :
C->getAttrs())
11863 NewAttrs.push_back(getDerived().TransformAttr(A));
11864 return getDerived().RebuildOMPXAttributeClause(
11865 NewAttrs,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11868template <
typename Derived>
11877template <
typename Derived>
11878class OpenACCClauseTransform final
11880 TreeTransform<Derived> &Self;
11881 ArrayRef<const OpenACCClause *> ExistingClauses;
11882 SemaOpenACC::OpenACCParsedClause &ParsedClause;
11883 OpenACCClause *NewClause =
nullptr;
11886 ExprResult Res = Self.TransformExpr(VarRef);
11888 if (!Res.isUsable())
11891 Res = Self.getSema().OpenACC().ActOnVar(ParsedClause.getDirectiveKind(),
11892 ParsedClause.getClauseKind(),
11898 llvm::SmallVector<Expr *> VisitVarList(ArrayRef<Expr *> VarList) {
11899 llvm::SmallVector<Expr *> InstantiatedVarList;
11900 for (Expr *CurVar : VarList) {
11903 if (VarRef.isUsable())
11904 InstantiatedVarList.push_back(VarRef.get());
11907 return InstantiatedVarList;
11911 OpenACCClauseTransform(TreeTransform<Derived> &Self,
11912 ArrayRef<const OpenACCClause *> ExistingClauses,
11913 SemaOpenACC::OpenACCParsedClause &PC)
11914 : Self(Self), ExistingClauses(ExistingClauses), ParsedClause(PC) {}
11916 OpenACCClause *CreatedClause()
const {
return NewClause; }
11918#define VISIT_CLAUSE(CLAUSE_NAME) \
11919 void Visit##CLAUSE_NAME##Clause(const OpenACC##CLAUSE_NAME##Clause &Clause);
11920#include "clang/Basic/OpenACCClauses.def"
11923template <
typename Derived>
11924void OpenACCClauseTransform<Derived>::VisitDefaultClause(
11926 ParsedClause.setDefaultDetails(
C.getDefaultClauseKind());
11929 Self.getSema().getASTContext(), ParsedClause.getDefaultClauseKind(),
11930 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
11931 ParsedClause.getEndLoc());
11934template <
typename Derived>
11935void OpenACCClauseTransform<Derived>::VisitIfClause(
const OpenACCIfClause &
C) {
11937 assert(
Cond &&
"If constructed with invalid Condition");
11941 if (Res.isInvalid() || !Res.get().second)
11944 ParsedClause.setConditionDetails(Res.get().second);
11947 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
11948 ParsedClause.getLParenLoc(), ParsedClause.getConditionExpr(),
11949 ParsedClause.getEndLoc());
11952template <
typename Derived>
11953void OpenACCClauseTransform<Derived>::VisitSelfClause(
11959 for (
Expr *CurVar :
C.getVarList()) {
11962 if (!Res.isUsable())
11965 Res =
Self.getSema().OpenACC().ActOnVar(ParsedClause.getDirectiveKind(),
11966 ParsedClause.getClauseKind(),
11969 if (Res.isUsable())
11970 InstantiatedVarList.push_back(Res.get());
11973 ParsedClause.setVarListDetails(InstantiatedVarList,
11977 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
11978 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
11979 ParsedClause.getEndLoc());
11982 if (
C.hasConditionExpr()) {
11985 Self.TransformCondition(
Cond->getExprLoc(),
nullptr,
Cond,
11988 if (Res.isInvalid() || !Res.get().second)
11991 ParsedClause.setConditionDetails(Res.get().second);
11995 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
11996 ParsedClause.getLParenLoc(), ParsedClause.getConditionExpr(),
11997 ParsedClause.getEndLoc());
12001template <
typename Derived>
12002void OpenACCClauseTransform<Derived>::VisitNumGangsClause(
12006 for (
Expr *CurIntExpr :
C.getIntExprs()) {
12009 if (!Res.isUsable())
12014 C.getBeginLoc(), Res.get());
12015 if (!Res.isUsable())
12018 InstantiatedIntExprs.push_back(Res.get());
12021 ParsedClause.setIntExprDetails(InstantiatedIntExprs);
12023 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12024 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs(),
12025 ParsedClause.getEndLoc());
12028template <
typename Derived>
12029void OpenACCClauseTransform<Derived>::VisitPrivateClause(
12034 for (
const auto [RefExpr, InitRecipe] :
12035 llvm::zip(
C.getVarList(),
C.getInitRecipes())) {
12038 if (VarRef.isUsable()) {
12039 InstantiatedVarList.push_back(VarRef.get());
12043 if (InitRecipe.isSet())
12044 InitRecipes.push_back(InitRecipe);
12046 InitRecipes.push_back(
12047 Self.getSema().OpenACC().CreatePrivateInitRecipe(VarRef.get()));
12050 ParsedClause.setVarListDetails(InstantiatedVarList,
12054 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12055 ParsedClause.getLParenLoc(), ParsedClause.getVarList(), InitRecipes,
12056 ParsedClause.getEndLoc());
12059template <
typename Derived>
12060void OpenACCClauseTransform<Derived>::VisitHostClause(
12062 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12066 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12067 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12068 ParsedClause.getEndLoc());
12071template <
typename Derived>
12072void OpenACCClauseTransform<Derived>::VisitDeviceClause(
12074 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12078 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12079 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12080 ParsedClause.getEndLoc());
12083template <
typename Derived>
12084void OpenACCClauseTransform<Derived>::VisitFirstPrivateClause(
12089 for (
const auto [RefExpr, InitRecipe] :
12090 llvm::zip(
C.getVarList(),
C.getInitRecipes())) {
12093 if (VarRef.isUsable()) {
12094 InstantiatedVarList.push_back(VarRef.get());
12098 if (InitRecipe.isSet())
12099 InitRecipes.push_back(InitRecipe);
12101 InitRecipes.push_back(
12102 Self.getSema().OpenACC().CreateFirstPrivateInitRecipe(
12106 ParsedClause.setVarListDetails(InstantiatedVarList,
12110 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12111 ParsedClause.getLParenLoc(), ParsedClause.getVarList(), InitRecipes,
12112 ParsedClause.getEndLoc());
12115template <
typename Derived>
12116void OpenACCClauseTransform<Derived>::VisitNoCreateClause(
12118 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12122 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12123 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12124 ParsedClause.getEndLoc());
12127template <
typename Derived>
12128void OpenACCClauseTransform<Derived>::VisitPresentClause(
12130 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12134 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12135 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12136 ParsedClause.getEndLoc());
12139template <
typename Derived>
12140void OpenACCClauseTransform<Derived>::VisitCopyClause(
12142 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12143 C.getModifierList());
12146 Self.getSema().getASTContext(), ParsedClause.getClauseKind(),
12147 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12148 ParsedClause.getModifierList(), ParsedClause.getVarList(),
12149 ParsedClause.getEndLoc());
12152template <
typename Derived>
12153void OpenACCClauseTransform<Derived>::VisitLinkClause(
12155 llvm_unreachable(
"link clause not valid unless a decl transform");
12158template <
typename Derived>
12159void OpenACCClauseTransform<Derived>::VisitDeviceResidentClause(
12161 llvm_unreachable(
"device_resident clause not valid unless a decl transform");
12163template <
typename Derived>
12164void OpenACCClauseTransform<Derived>::VisitNoHostClause(
12166 llvm_unreachable(
"nohost clause not valid unless a decl transform");
12168template <
typename Derived>
12169void OpenACCClauseTransform<Derived>::VisitBindClause(
12171 llvm_unreachable(
"bind clause not valid unless a decl transform");
12174template <
typename Derived>
12175void OpenACCClauseTransform<Derived>::VisitCopyInClause(
12177 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12178 C.getModifierList());
12181 Self.getSema().getASTContext(), ParsedClause.getClauseKind(),
12182 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12183 ParsedClause.getModifierList(), ParsedClause.getVarList(),
12184 ParsedClause.getEndLoc());
12187template <
typename Derived>
12188void OpenACCClauseTransform<Derived>::VisitCopyOutClause(
12190 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12191 C.getModifierList());
12194 Self.getSema().getASTContext(), ParsedClause.getClauseKind(),
12195 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12196 ParsedClause.getModifierList(), ParsedClause.getVarList(),
12197 ParsedClause.getEndLoc());
12200template <
typename Derived>
12201void OpenACCClauseTransform<Derived>::VisitCreateClause(
12203 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12204 C.getModifierList());
12207 Self.getSema().getASTContext(), ParsedClause.getClauseKind(),
12208 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12209 ParsedClause.getModifierList(), ParsedClause.getVarList(),
12210 ParsedClause.getEndLoc());
12212template <
typename Derived>
12213void OpenACCClauseTransform<Derived>::VisitAttachClause(
12218 llvm::erase_if(VarList, [&](
Expr *E) {
12219 return Self.getSema().OpenACC().CheckVarIsPointerType(
12225 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12226 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12227 ParsedClause.getEndLoc());
12230template <
typename Derived>
12231void OpenACCClauseTransform<Derived>::VisitDetachClause(
12236 llvm::erase_if(VarList, [&](
Expr *E) {
12237 return Self.getSema().OpenACC().CheckVarIsPointerType(
12243 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12244 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12245 ParsedClause.getEndLoc());
12248template <
typename Derived>
12249void OpenACCClauseTransform<Derived>::VisitDeleteClause(
12251 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12254 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12255 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12256 ParsedClause.getEndLoc());
12259template <
typename Derived>
12260void OpenACCClauseTransform<Derived>::VisitUseDeviceClause(
12262 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12265 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12266 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12267 ParsedClause.getEndLoc());
12270template <
typename Derived>
12271void OpenACCClauseTransform<Derived>::VisitDevicePtrClause(
12276 llvm::erase_if(VarList, [&](
Expr *E) {
12277 return Self.getSema().OpenACC().CheckVarIsPointerType(
12283 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12284 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12285 ParsedClause.getEndLoc());
12288template <
typename Derived>
12289void OpenACCClauseTransform<Derived>::VisitNumWorkersClause(
12291 Expr *IntExpr =
const_cast<Expr *
>(
C.getIntExpr());
12292 assert(IntExpr &&
"num_workers clause constructed with invalid int expr");
12295 if (!Res.isUsable())
12300 C.getBeginLoc(), Res.get());
12301 if (!Res.isUsable())
12304 ParsedClause.setIntExprDetails(Res.get());
12306 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12307 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs()[0],
12308 ParsedClause.getEndLoc());
12311template <
typename Derived>
12312void OpenACCClauseTransform<Derived>::VisitDeviceNumClause (
12314 Expr *IntExpr =
const_cast<Expr *
>(
C.getIntExpr());
12315 assert(IntExpr &&
"device_num clause constructed with invalid int expr");
12318 if (!Res.isUsable())
12323 C.getBeginLoc(), Res.get());
12324 if (!Res.isUsable())
12327 ParsedClause.setIntExprDetails(Res.get());
12329 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12330 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs()[0],
12331 ParsedClause.getEndLoc());
12334template <
typename Derived>
12335void OpenACCClauseTransform<Derived>::VisitDefaultAsyncClause(
12337 Expr *IntExpr =
const_cast<Expr *
>(
C.getIntExpr());
12338 assert(IntExpr &&
"default_async clause constructed with invalid int expr");
12341 if (!Res.isUsable())
12346 C.getBeginLoc(), Res.get());
12347 if (!Res.isUsable())
12350 ParsedClause.setIntExprDetails(Res.get());
12352 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12353 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs()[0],
12354 ParsedClause.getEndLoc());
12357template <
typename Derived>
12358void OpenACCClauseTransform<Derived>::VisitVectorLengthClause(
12360 Expr *IntExpr =
const_cast<Expr *
>(
C.getIntExpr());
12361 assert(IntExpr &&
"vector_length clause constructed with invalid int expr");
12364 if (!Res.isUsable())
12369 C.getBeginLoc(), Res.get());
12370 if (!Res.isUsable())
12373 ParsedClause.setIntExprDetails(Res.get());
12375 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12376 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs()[0],
12377 ParsedClause.getEndLoc());
12380template <
typename Derived>
12381void OpenACCClauseTransform<Derived>::VisitAsyncClause(
12383 if (
C.hasIntExpr()) {
12385 if (!Res.isUsable())
12390 C.getBeginLoc(), Res.get());
12391 if (!Res.isUsable())
12393 ParsedClause.setIntExprDetails(Res.get());
12397 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12398 ParsedClause.getLParenLoc(),
12399 ParsedClause.getNumIntExprs() != 0 ? ParsedClause.getIntExprs()[0]
12401 ParsedClause.getEndLoc());
12404template <
typename Derived>
12405void OpenACCClauseTransform<Derived>::VisitWorkerClause(
12407 if (
C.hasIntExpr()) {
12412 if (!Res.isUsable())
12417 C.getBeginLoc(), Res.get());
12418 if (!Res.isUsable())
12420 ParsedClause.setIntExprDetails(Res.get());
12424 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12425 ParsedClause.getLParenLoc(),
12426 ParsedClause.getNumIntExprs() != 0 ? ParsedClause.getIntExprs()[0]
12428 ParsedClause.getEndLoc());
12431template <
typename Derived>
12432void OpenACCClauseTransform<Derived>::VisitVectorClause(
12434 if (
C.hasIntExpr()) {
12439 if (!Res.isUsable())
12444 C.getBeginLoc(), Res.get());
12445 if (!Res.isUsable())
12447 ParsedClause.setIntExprDetails(Res.get());
12451 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12452 ParsedClause.getLParenLoc(),
12453 ParsedClause.getNumIntExprs() != 0 ? ParsedClause.getIntExprs()[0]
12455 ParsedClause.getEndLoc());
12458template <
typename Derived>
12459void OpenACCClauseTransform<Derived>::VisitWaitClause(
12461 if (
C.hasExprs()) {
12462 Expr *DevNumExpr =
nullptr;
12466 if (
C.getDevNumExpr()) {
12468 if (!Res.isUsable())
12472 C.getBeginLoc(), Res.get());
12473 if (!Res.isUsable())
12476 DevNumExpr = Res.get();
12480 for (
Expr *CurQueueIdExpr :
C.getQueueIdExprs()) {
12482 if (!Res.isUsable())
12486 C.getBeginLoc(), Res.get());
12487 if (!Res.isUsable())
12490 InstantiatedQueueIdExprs.push_back(Res.get());
12493 ParsedClause.setWaitDetails(DevNumExpr,
C.getQueuesLoc(),
12494 std::move(InstantiatedQueueIdExprs));
12498 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12499 ParsedClause.getLParenLoc(), ParsedClause.getDevNumExpr(),
12500 ParsedClause.getQueuesLoc(), ParsedClause.getQueueIdExprs(),
12501 ParsedClause.getEndLoc());
12504template <
typename Derived>
12505void OpenACCClauseTransform<Derived>::VisitDeviceTypeClause(
12509 Self.getSema().getASTContext(),
C.getClauseKind(),
12510 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12511 C.getArchitectures(), ParsedClause.getEndLoc());
12514template <
typename Derived>
12515void OpenACCClauseTransform<Derived>::VisitAutoClause(
12519 ParsedClause.getBeginLoc(),
12520 ParsedClause.getEndLoc());
12523template <
typename Derived>
12524void OpenACCClauseTransform<Derived>::VisitIndependentClause(
12527 ParsedClause.getBeginLoc(),
12528 ParsedClause.getEndLoc());
12531template <
typename Derived>
12532void OpenACCClauseTransform<Derived>::VisitSeqClause(
12535 ParsedClause.getBeginLoc(),
12536 ParsedClause.getEndLoc());
12538template <
typename Derived>
12539void OpenACCClauseTransform<Derived>::VisitFinalizeClause(
12542 ParsedClause.getBeginLoc(),
12543 ParsedClause.getEndLoc());
12546template <
typename Derived>
12547void OpenACCClauseTransform<Derived>::VisitIfPresentClause(
12550 ParsedClause.getBeginLoc(),
12551 ParsedClause.getEndLoc());
12554template <
typename Derived>
12555void OpenACCClauseTransform<Derived>::VisitReductionClause(
12561 for (
const auto [Var, OrigRecipe] :
12562 llvm::zip(TransformedVars,
C.getRecipes())) {
12564 ParsedClause.getDirectiveKind(),
C.getReductionOp(), Var);
12565 if (Res.isUsable()) {
12566 ValidVars.push_back(Res.get());
12568 if (OrigRecipe.isSet())
12569 Recipes.emplace_back(OrigRecipe.AllocaDecl, OrigRecipe.CombinerRecipes);
12571 Recipes.push_back(
Self.getSema().OpenACC().CreateReductionInitRecipe(
12572 C.getReductionOp(), Res.get()));
12576 NewClause =
Self.getSema().OpenACC().CheckReductionClause(
12577 ExistingClauses, ParsedClause.getDirectiveKind(),
12578 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12579 C.getReductionOp(), ValidVars, Recipes, ParsedClause.getEndLoc());
12582template <
typename Derived>
12583void OpenACCClauseTransform<Derived>::VisitCollapseClause(
12585 Expr *LoopCount =
const_cast<Expr *
>(
C.getLoopCount());
12586 assert(LoopCount &&
"collapse clause constructed with invalid loop count");
12590 NewLoopCount =
Self.getSema().OpenACC().ActOnIntExpr(
12592 NewLoopCount.get()->getBeginLoc(), NewLoopCount.get());
12595 Self.getSema().OpenACC().CheckCollapseLoopCount(NewLoopCount.get());
12597 ParsedClause.setCollapseDetails(
C.hasForce(), NewLoopCount.get());
12599 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12600 ParsedClause.getLParenLoc(), ParsedClause.isForce(),
12601 ParsedClause.getLoopCount(), ParsedClause.getEndLoc());
12604template <
typename Derived>
12605void OpenACCClauseTransform<Derived>::VisitTileClause(
12610 for (
Expr *E :
C.getSizeExprs()) {
12613 if (!NewSizeExpr.isUsable())
12616 NewSizeExpr =
Self.getSema().OpenACC().ActOnIntExpr(
12618 NewSizeExpr.get()->getBeginLoc(), NewSizeExpr.get());
12620 NewSizeExpr =
Self.getSema().OpenACC().CheckTileSizeExpr(NewSizeExpr.get());
12622 if (!NewSizeExpr.isUsable())
12624 TransformedExprs.push_back(NewSizeExpr.get());
12627 ParsedClause.setIntExprDetails(TransformedExprs);
12629 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12630 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs(),
12631 ParsedClause.getEndLoc());
12633template <
typename Derived>
12634void OpenACCClauseTransform<Derived>::VisitGangClause(
12639 for (
unsigned I = 0; I <
C.getNumExprs(); ++I) {
12641 if (!ER.isUsable())
12644 ER =
Self.getSema().OpenACC().CheckGangExpr(ExistingClauses,
12645 ParsedClause.getDirectiveKind(),
12646 C.getExpr(I).first, ER.get());
12647 if (!ER.isUsable())
12649 TransformedGangKinds.push_back(
C.getExpr(I).first);
12650 TransformedIntExprs.push_back(ER.get());
12653 NewClause =
Self.getSema().OpenACC().CheckGangClause(
12654 ParsedClause.getDirectiveKind(), ExistingClauses,
12655 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12656 TransformedGangKinds, TransformedIntExprs, ParsedClause.getEndLoc());
12659template <
typename Derived>
12660OpenACCClause *TreeTransform<Derived>::TransformOpenACCClause(
12665 DirKind, OldClause->getClauseKind(), OldClause->getBeginLoc());
12666 ParsedClause.setEndLoc(OldClause->getEndLoc());
12668 if (
const auto *WithParms = dyn_cast<OpenACCClauseWithParams>(OldClause))
12669 ParsedClause.setLParenLoc(WithParms->getLParenLoc());
12671 OpenACCClauseTransform<Derived> Transform{*
this, ExistingClauses,
12673 Transform.Visit(OldClause);
12675 return Transform.CreatedClause();
12678template <
typename Derived>
12680TreeTransform<Derived>::TransformOpenACCClauseList(
12683 for (
const auto *Clause : OldClauses) {
12684 if (
OpenACCClause *TransformedClause = getDerived().TransformOpenACCClause(
12685 TransformedClauses, DirKind, Clause))
12686 TransformedClauses.push_back(TransformedClause);
12688 return TransformedClauses;
12691template <
typename Derived>
12694 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12697 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12700 if (getSema().OpenACC().ActOnStartStmtDirective(
12701 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12706 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
12707 C->clauses(), TransformedClauses);
12708 StmtResult StrBlock = getDerived().TransformStmt(
C->getStructuredBlock());
12709 StrBlock = getSema().OpenACC().ActOnAssociatedStmt(
12710 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses, StrBlock);
12712 return getDerived().RebuildOpenACCComputeConstruct(
12713 C->getDirectiveKind(),
C->getBeginLoc(),
C->getDirectiveLoc(),
12714 C->getEndLoc(), TransformedClauses, StrBlock);
12717template <
typename Derived>
12721 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12724 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12727 if (getSema().OpenACC().ActOnStartStmtDirective(
12728 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12733 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
12734 C->clauses(), TransformedClauses);
12736 Loop = getSema().OpenACC().ActOnAssociatedStmt(
12737 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses,
Loop);
12739 return getDerived().RebuildOpenACCLoopConstruct(
12740 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12741 TransformedClauses,
Loop);
12744template <
typename Derived>
12746 OpenACCCombinedConstruct *
C) {
12747 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12750 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12753 if (getSema().OpenACC().ActOnStartStmtDirective(
12754 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12759 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
12760 C->clauses(), TransformedClauses);
12762 Loop = getSema().OpenACC().ActOnAssociatedStmt(
12763 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses,
Loop);
12765 return getDerived().RebuildOpenACCCombinedConstruct(
12766 C->getDirectiveKind(),
C->getBeginLoc(),
C->getDirectiveLoc(),
12767 C->getEndLoc(), TransformedClauses,
Loop);
12770template <
typename Derived>
12773 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12776 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12778 if (getSema().OpenACC().ActOnStartStmtDirective(
12779 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12783 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
12784 C->clauses(), TransformedClauses);
12785 StmtResult StrBlock = getDerived().TransformStmt(
C->getStructuredBlock());
12786 StrBlock = getSema().OpenACC().ActOnAssociatedStmt(
12787 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses, StrBlock);
12789 return getDerived().RebuildOpenACCDataConstruct(
12790 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12791 TransformedClauses, StrBlock);
12794template <
typename Derived>
12796 OpenACCEnterDataConstruct *
C) {
12797 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12800 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12802 if (getSema().OpenACC().ActOnStartStmtDirective(
12803 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12806 return getDerived().RebuildOpenACCEnterDataConstruct(
12807 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12808 TransformedClauses);
12811template <
typename Derived>
12813 OpenACCExitDataConstruct *
C) {
12814 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12817 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12819 if (getSema().OpenACC().ActOnStartStmtDirective(
12820 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12823 return getDerived().RebuildOpenACCExitDataConstruct(
12824 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12825 TransformedClauses);
12828template <
typename Derived>
12830 OpenACCHostDataConstruct *
C) {
12831 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12834 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12836 if (getSema().OpenACC().ActOnStartStmtDirective(
12837 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12841 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
12842 C->clauses(), TransformedClauses);
12843 StmtResult StrBlock = getDerived().TransformStmt(
C->getStructuredBlock());
12844 StrBlock = getSema().OpenACC().ActOnAssociatedStmt(
12845 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses, StrBlock);
12847 return getDerived().RebuildOpenACCHostDataConstruct(
12848 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12849 TransformedClauses, StrBlock);
12852template <
typename Derived>
12855 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12858 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12860 if (getSema().OpenACC().ActOnStartStmtDirective(
12861 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12864 return getDerived().RebuildOpenACCInitConstruct(
12865 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12866 TransformedClauses);
12869template <
typename Derived>
12871 OpenACCShutdownConstruct *
C) {
12872 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12875 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12877 if (getSema().OpenACC().ActOnStartStmtDirective(
12878 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12881 return getDerived().RebuildOpenACCShutdownConstruct(
12882 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12883 TransformedClauses);
12885template <
typename Derived>
12888 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12891 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12893 if (getSema().OpenACC().ActOnStartStmtDirective(
12894 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12897 return getDerived().RebuildOpenACCSetConstruct(
12898 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12899 TransformedClauses);
12902template <
typename Derived>
12904 OpenACCUpdateConstruct *
C) {
12905 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12908 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12910 if (getSema().OpenACC().ActOnStartStmtDirective(
12911 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12914 return getDerived().RebuildOpenACCUpdateConstruct(
12915 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12916 TransformedClauses);
12919template <
typename Derived>
12922 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12925 if (
C->hasDevNumExpr()) {
12926 DevNumExpr = getDerived().TransformExpr(
C->getDevNumExpr());
12928 if (DevNumExpr.isUsable())
12929 DevNumExpr = getSema().OpenACC().ActOnIntExpr(
12931 C->getBeginLoc(), DevNumExpr.get());
12936 for (
Expr *QE :
C->getQueueIdExprs()) {
12937 assert(QE &&
"Null queue id expr?");
12938 ExprResult NewEQ = getDerived().TransformExpr(QE);
12940 if (!NewEQ.isUsable())
12944 C->getBeginLoc(), NewEQ.get());
12945 if (NewEQ.isUsable())
12946 QueueIdExprs.push_back(NewEQ.get());
12950 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12953 if (getSema().OpenACC().ActOnStartStmtDirective(
12954 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12957 return getDerived().RebuildOpenACCWaitConstruct(
12958 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getLParenLoc(),
12959 DevNumExpr.isUsable() ? DevNumExpr.get() :
nullptr,
C->getQueuesLoc(),
12960 QueueIdExprs,
C->getRParenLoc(),
C->getEndLoc(), TransformedClauses);
12962template <
typename Derived>
12964 OpenACCCacheConstruct *
C) {
12965 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12968 for (
Expr *Var :
C->getVarList()) {
12969 assert(Var &&
"Null var listexpr?");
12971 ExprResult NewVar = getDerived().TransformExpr(Var);
12973 if (!NewVar.isUsable())
12976 NewVar = getSema().OpenACC().ActOnVar(
12978 if (!NewVar.isUsable())
12981 TransformedVarList.push_back(NewVar.get());
12984 if (getSema().OpenACC().ActOnStartStmtDirective(
C->getDirectiveKind(),
12985 C->getBeginLoc(), {}))
12988 return getDerived().RebuildOpenACCCacheConstruct(
12989 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getLParenLoc(),
12990 C->getReadOnlyLoc(), TransformedVarList,
C->getRParenLoc(),
12994template <
typename Derived>
12996 OpenACCAtomicConstruct *
C) {
12997 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13000 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
13003 if (getSema().OpenACC().ActOnStartStmtDirective(
C->getDirectiveKind(),
13004 C->getBeginLoc(), {}))
13009 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(), {}, {});
13011 StmtResult AssocStmt = getDerived().TransformStmt(
C->getAssociatedStmt());
13012 AssocStmt = getSema().OpenACC().ActOnAssociatedStmt(
13013 C->getBeginLoc(),
C->getDirectiveKind(),
C->getAtomicKind(), {},
13016 return getDerived().RebuildOpenACCAtomicConstruct(
13017 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getAtomicKind(),
13018 C->getEndLoc(), TransformedClauses, AssocStmt);
13021template <
typename Derived>
13024 if (getDerived().AlwaysRebuild())
13033template<
typename Derived>
13036 return TransformExpr(E->getSubExpr());
13039template <
typename Derived>
13042 if (!E->isTypeDependent())
13045 TypeSourceInfo *NewT = getDerived().TransformType(E->getTypeSourceInfo());
13050 if (!getDerived().AlwaysRebuild() && E->getTypeSourceInfo() == NewT)
13053 return getDerived().RebuildSYCLUniqueStableNameExpr(
13054 E->getLocation(), E->getLParenLocation(), E->getRParenLocation(), NewT);
13057template<
typename Derived>
13060 if (!E->isTypeDependent())
13064 E->getIdentKind());
13067template<
typename Derived>
13071 if (E->getQualifierLoc()) {
13073 = getDerived().TransformNestedNameSpecifierLoc(E->getQualifierLoc());
13079 = cast_or_null<ValueDecl>(getDerived().TransformDecl(E->getLocation(),
13081 if (!ND || ND->isInvalidDecl())
13085 if (E->getFoundDecl() != E->getDecl()) {
13086 Found = cast_or_null<NamedDecl>(
13087 getDerived().TransformDecl(E->getLocation(), E->getFoundDecl()));
13093 if (NameInfo.getName()) {
13094 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
13095 if (!NameInfo.getName())
13099 if (!getDerived().AlwaysRebuild() &&
13100 !E->isCapturedByCopyInLambdaWithExplicitObjectParameter() &&
13101 QualifierLoc == E->getQualifierLoc() && ND == E->getDecl() &&
13102 Found == E->getFoundDecl() &&
13103 NameInfo.getName() == E->getDecl()->getDeclName() &&
13104 !E->hasExplicitTemplateArgs()) {
13114 if (E->hasExplicitTemplateArgs()) {
13115 TemplateArgs = &TransArgs;
13116 TransArgs.setLAngleLoc(E->getLAngleLoc());
13117 TransArgs.setRAngleLoc(E->getRAngleLoc());
13118 if (getDerived().TransformTemplateArguments(E->getTemplateArgs(),
13119 E->getNumTemplateArgs(),
13124 return getDerived().RebuildDeclRefExpr(QualifierLoc, ND, NameInfo,
13125 Found, TemplateArgs);
13128template<
typename Derived>
13134template <
typename Derived>
13140template<
typename Derived>
13146template<
typename Derived>
13152template<
typename Derived>
13158template<
typename Derived>
13164template<
typename Derived>
13167 return getDerived().TransformCallExpr(E);
13170template<
typename Derived>
13175 if (E->isExprPredicate())
13176 ControllingExpr = getDerived().TransformExpr(E->getControllingExpr());
13178 ControllingType = getDerived().TransformType(E->getControllingType());
13180 if (ControllingExpr.isInvalid() && !ControllingType)
13191 AssocTypes.push_back(AssocType);
13193 AssocTypes.push_back(
nullptr);
13197 getDerived().TransformExpr(Assoc.getAssociationExpr());
13198 if (AssocExpr.isInvalid())
13200 AssocExprs.push_back(AssocExpr.get());
13203 if (!ControllingType)
13204 return getDerived().RebuildGenericSelectionExpr(E->getGenericLoc(),
13205 E->getDefaultLoc(),
13207 ControllingExpr.get(),
13210 return getDerived().RebuildGenericSelectionExpr(
13211 E->getGenericLoc(), E->getDefaultLoc(), E->getRParenLoc(),
13212 ControllingType, AssocTypes, AssocExprs);
13215template<
typename Derived>
13218 ExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
13219 if (SubExpr.isInvalid())
13222 if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getSubExpr())
13225 return getDerived().RebuildParenExpr(SubExpr.get(), E->getLParen(),
13232template<
typename Derived>
13236 return getDerived().TransformDependentScopeDeclRefExpr(
13237 DRE,
true,
nullptr);
13239 return getDerived().TransformUnresolvedLookupExpr(
13245template<
typename Derived>
13250 SubExpr = TransformAddressOfOperand(E->
getSubExpr());
13256 if (!getDerived().AlwaysRebuild() && SubExpr.
get() == E->
getSubExpr())
13264template<
typename Derived>
13266TreeTransform<Derived>::TransformOffsetOfExpr(OffsetOfExpr *E) {
13268 TypeSourceInfo *Type = getDerived().TransformType(E->getTypeSourceInfo());
13278 bool ExprChanged =
false;
13279 typedef Sema::OffsetOfComponent Component;
13281 for (
unsigned I = 0, N = E->getNumComponents(); I != N; ++I) {
13282 const OffsetOfNode &ON = E->getComponent(I);
13284 Comp.isBrackets =
true;
13285 Comp.LocStart = ON.getSourceRange().getBegin();
13286 Comp.LocEnd = ON.getSourceRange().getEnd();
13287 switch (ON.getKind()) {
13289 Expr *FromIndex = E->getIndexExpr(ON.getArrayExprIndex());
13290 ExprResult Index = getDerived().TransformExpr(FromIndex);
13291 if (Index.isInvalid())
13294 ExprChanged = ExprChanged || Index.get() != FromIndex;
13295 Comp.isBrackets =
true;
13296 Comp.U.E = Index.get();
13302 Comp.isBrackets =
false;
13303 Comp.U.IdentInfo = ON.getFieldName();
13304 if (!
Comp.U.IdentInfo)
13314 Components.push_back(Comp);
13318 if (!getDerived().AlwaysRebuild() &&
13319 Type == E->getTypeSourceInfo() &&
13324 return getDerived().RebuildOffsetOfExpr(E->getOperatorLoc(),
Type,
13325 Components, E->getRParenLoc());
13328template<
typename Derived>
13331 assert((!E->getSourceExpr() || getDerived().AlreadyTransformed(E->getType())) &&
13332 "opaque value expression requires transformation");
13336template <
typename Derived>
13340 for (
Expr *
C : E->subExpressions()) {
13342 if (NewC.isInvalid())
13348 if (!getDerived().AlwaysRebuild() && !Changed)
13350 return getDerived().RebuildRecoveryExpr(E->getBeginLoc(), E->getEndLoc(),
13354template<
typename Derived>
13364 ExprResult result = getDerived().TransformExpr(newSyntacticForm);
13365 if (result.isInvalid())
return ExprError();
13370 if (result.get()->hasPlaceholderType(BuiltinType::PseudoObject))
13376template<
typename Derived>
13380 if (E->isArgumentType()) {
13387 if (!getDerived().AlwaysRebuild() && OldT == NewT)
13390 return getDerived().RebuildUnaryExprOrTypeTrait(NewT, E->getOperatorLoc(),
13392 E->getSourceRange());
13406 auto *PE = dyn_cast<ParenExpr>(E->getArgumentExpr());
13408 PE ? dyn_cast<DependentScopeDeclRefExpr>(PE->getSubExpr()) :
nullptr)
13409 SubExpr = getDerived().TransformParenDependentScopeDeclRefExpr(
13410 PE, DRE,
false, &RecoveryTSI);
13412 SubExpr = getDerived().TransformExpr(E->getArgumentExpr());
13415 return getDerived().RebuildUnaryExprOrTypeTrait(
13416 RecoveryTSI, E->getOperatorLoc(), E->getKind(), E->getSourceRange());
13417 }
else if (SubExpr.isInvalid())
13420 if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getArgumentExpr())
13423 return getDerived().RebuildUnaryExprOrTypeTrait(SubExpr.get(),
13424 E->getOperatorLoc(),
13426 E->getSourceRange());
13429template<
typename Derived>
13432 ExprResult LHS = getDerived().TransformExpr(E->getLHS());
13433 if (LHS.isInvalid())
13436 ExprResult RHS = getDerived().TransformExpr(E->getRHS());
13437 if (RHS.isInvalid())
13441 if (!getDerived().AlwaysRebuild() &&
13442 LHS.get() == E->getLHS() &&
13443 RHS.get() == E->getRHS())
13446 return getDerived().RebuildArraySubscriptExpr(
13448 E->getLHS()->getBeginLoc(), RHS.get(), E->getRBracketLoc());
13451template <
typename Derived>
13455 if (
Base.isInvalid())
13458 ExprResult RowIdx = getDerived().TransformExpr(E->getRowIdx());
13459 if (RowIdx.isInvalid())
13462 if (!getDerived().AlwaysRebuild() &&
Base.get() == E->getBase() &&
13463 RowIdx.get() == E->getRowIdx())
13466 return getDerived().RebuildMatrixSingleSubscriptExpr(
Base.get(), RowIdx.get(),
13467 E->getRBracketLoc());
13470template <
typename Derived>
13474 if (
Base.isInvalid())
13477 ExprResult RowIdx = getDerived().TransformExpr(E->getRowIdx());
13478 if (RowIdx.isInvalid())
13481 ExprResult ColumnIdx = getDerived().TransformExpr(E->getColumnIdx());
13482 if (ColumnIdx.isInvalid())
13485 if (!getDerived().AlwaysRebuild() &&
Base.get() == E->getBase() &&
13486 RowIdx.get() == E->getRowIdx() && ColumnIdx.get() == E->getColumnIdx())
13489 return getDerived().RebuildMatrixSubscriptExpr(
13490 Base.get(), RowIdx.get(), ColumnIdx.get(), E->getRBracketLoc());
13493template <
typename Derived>
13497 if (
Base.isInvalid())
13501 if (E->getLowerBound()) {
13502 LowerBound = getDerived().TransformExpr(E->getLowerBound());
13503 if (LowerBound.isInvalid())
13508 if (E->getLength()) {
13509 Length = getDerived().TransformExpr(E->getLength());
13510 if (Length.isInvalid())
13515 if (E->isOMPArraySection()) {
13516 if (
Expr *Str = E->getStride()) {
13517 Stride = getDerived().TransformExpr(Str);
13518 if (Stride.isInvalid())
13523 if (!getDerived().AlwaysRebuild() &&
Base.get() == E->getBase() &&
13524 LowerBound.get() == E->getLowerBound() &&
13525 Length.get() == E->getLength() &&
13526 (E->isOpenACCArraySection() || Stride.get() == E->getStride()))
13529 return getDerived().RebuildArraySectionExpr(
13530 E->isOMPArraySection(),
Base.get(), E->getBase()->getEndLoc(),
13531 LowerBound.get(), E->getColonLocFirst(),
13532 E->isOMPArraySection() ? E->getColonLocSecond() :
SourceLocation{},
13533 Length.get(), Stride.get(), E->getRBracketLoc());
13536template <
typename Derived>
13540 if (
Base.isInvalid())
13544 bool ErrorFound =
false;
13545 for (
Expr *
Dim : E->getDimensions()) {
13547 if (DimRes.isInvalid()) {
13551 Dims.push_back(DimRes.get());
13556 return getDerived().RebuildOMPArrayShapingExpr(
Base.get(), E->getLParenLoc(),
13557 E->getRParenLoc(), Dims,
13558 E->getBracketsRanges());
13561template <
typename Derived>
13564 unsigned NumIterators = E->numOfIterators();
13567 bool ErrorFound =
false;
13568 bool NeedToRebuild = getDerived().AlwaysRebuild();
13569 for (
unsigned I = 0; I < NumIterators; ++I) {
13571 Data[I].DeclIdent = D->getIdentifier();
13572 Data[I].DeclIdentLoc = D->getLocation();
13573 if (D->getLocation() == D->getBeginLoc()) {
13575 "Implicit type must be int.");
13577 TypeSourceInfo *TSI = getDerived().TransformType(D->getTypeSourceInfo());
13585 ErrorFound = ErrorFound ||
13586 !(!D->getTypeSourceInfo() || (
Data[I].
Type.getAsOpaquePtr() &&
13587 !
Data[I].Type.get().isNull())) ||
13588 Begin.isInvalid() || End.isInvalid() || Step.isInvalid();
13591 Data[I].Range.Begin = Begin.get();
13592 Data[I].Range.End = End.get();
13593 Data[I].Range.Step = Step.get();
13594 Data[I].AssignLoc = E->getAssignLoc(I);
13595 Data[I].ColonLoc = E->getColonLoc(I);
13596 Data[I].SecColonLoc = E->getSecondColonLoc(I);
13599 (D->getTypeSourceInfo() &&
Data[I].
Type.get().getTypePtrOrNull() !=
13600 D->getType().getTypePtrOrNull()) ||
13606 if (!NeedToRebuild)
13609 ExprResult Res = getDerived().RebuildOMPIteratorExpr(
13610 E->getIteratorKwLoc(), E->getLParenLoc(), E->getRParenLoc(),
Data);
13611 if (!Res.isUsable())
13614 for (
unsigned I = 0; I < NumIterators; ++I)
13615 getDerived().transformedLocalDecl(E->getIteratorDecl(I),
13616 IE->getIteratorDecl(I));
13620template<
typename Derived>
13629 bool ArgChanged =
false;
13631 if (getDerived().TransformExprs(E->getArgs(), E->getNumArgs(),
true, Args,
13635 if (!getDerived().AlwaysRebuild() &&
13636 Callee.get() == E->getCallee() &&
13642 = ((
Expr *)
Callee.get())->getSourceRange().getBegin();
13645 if (E->hasStoredFPFeatures()) {
13647 getSema().CurFPFeatures =
13649 getSema().FpPragmaStack.CurrentValue = NewOverrides;
13652 return getDerived().RebuildCallExpr(
Callee.get(), FakeLParenLoc,
13654 E->getRParenLoc());
13657template<
typename Derived>
13661 if (
Base.isInvalid())
13665 if (E->hasQualifier()) {
13667 = getDerived().TransformNestedNameSpecifierLoc(E->getQualifierLoc());
13675 = cast_or_null<ValueDecl>(getDerived().TransformDecl(E->getMemberLoc(),
13676 E->getMemberDecl()));
13680 NamedDecl *FoundDecl = E->getFoundDecl();
13681 if (FoundDecl == E->getMemberDecl()) {
13684 FoundDecl = cast_or_null<NamedDecl>(
13685 getDerived().TransformDecl(E->getMemberLoc(), FoundDecl));
13690 if (!getDerived().AlwaysRebuild() &&
13691 Base.get() == E->getBase() &&
13692 QualifierLoc == E->getQualifierLoc() &&
13693 Member == E->getMemberDecl() &&
13694 FoundDecl == E->getFoundDecl() &&
13695 !E->hasExplicitTemplateArgs()) {
13700 getSema().OpenMP().isOpenMPRebuildMemberExpr(
13710 if (E->hasExplicitTemplateArgs()) {
13711 TransArgs.setLAngleLoc(E->getLAngleLoc());
13712 TransArgs.setRAngleLoc(E->getRAngleLoc());
13713 if (getDerived().TransformTemplateArguments(E->getTemplateArgs(),
13714 E->getNumTemplateArgs(),
13727 NamedDecl *FirstQualifierInScope =
nullptr;
13729 if (MemberNameInfo.getName()) {
13730 MemberNameInfo = getDerived().TransformDeclarationNameInfo(MemberNameInfo);
13731 if (!MemberNameInfo.getName())
13735 return getDerived().RebuildMemberExpr(
Base.get(), FakeOperatorLoc,
13742 (E->hasExplicitTemplateArgs()
13743 ? &TransArgs :
nullptr),
13744 FirstQualifierInScope);
13747template<
typename Derived>
13750 ExprResult LHS = getDerived().TransformExpr(E->getLHS());
13751 if (LHS.isInvalid())
13755 getDerived().TransformInitializer(E->getRHS(),
false);
13756 if (RHS.isInvalid())
13759 if (!getDerived().AlwaysRebuild() &&
13760 LHS.get() == E->getLHS() &&
13761 RHS.get() == E->getRHS())
13764 if (E->isCompoundAssignmentOp())
13766 return getDerived().RebuildBinaryOperator(
13767 E->getOperatorLoc(), E->getOpcode(), LHS.get(), RHS.get());
13770 getSema().CurFPFeatures =
13771 NewOverrides.applyOverrides(getSema().getLangOpts());
13772 getSema().FpPragmaStack.CurrentValue = NewOverrides;
13773 return getDerived().RebuildBinaryOperator(E->getOperatorLoc(), E->getOpcode(),
13774 LHS.get(), RHS.get());
13777template <
typename Derived>
13782 ExprResult LHS = getDerived().TransformExpr(
const_cast<Expr*
>(Decomp.LHS));
13783 if (LHS.isInvalid())
13786 ExprResult RHS = getDerived().TransformExpr(
const_cast<Expr*
>(Decomp.RHS));
13787 if (RHS.isInvalid())
13793 bool ChangedAnyLookups =
false;
13794 Expr *PossibleBinOps[] = {E->getSemanticForm(),
13795 const_cast<Expr *
>(Decomp.InnerBinOp)};
13796 for (
Expr *PossibleBinOp : PossibleBinOps) {
13797 auto *Op = dyn_cast<CXXOperatorCallExpr>(PossibleBinOp->IgnoreImplicit());
13800 auto *
Callee = dyn_cast<DeclRefExpr>(Op->getCallee()->IgnoreImplicit());
13806 NamedDecl *
Found = cast_or_null<NamedDecl>(getDerived().TransformDecl(
13807 E->getOperatorLoc(),
Callee->getFoundDecl()));
13811 ChangedAnyLookups =
true;
13812 UnqualLookups.addDecl(
Found);
13815 if (!getDerived().AlwaysRebuild() && !ChangedAnyLookups &&
13816 LHS.get() == Decomp.LHS && RHS.get() == Decomp.RHS) {
13822 const Expr *StopAt[] = {Decomp.LHS, Decomp.RHS};
13827 return getDerived().RebuildCXXRewrittenBinaryOperator(
13828 E->getOperatorLoc(), Decomp.Opcode, UnqualLookups, LHS.get(), RHS.get());
13831template<
typename Derived>
13837 getSema().CurFPFeatures =
13838 NewOverrides.applyOverrides(getSema().getLangOpts());
13839 getSema().FpPragmaStack.CurrentValue = NewOverrides;
13840 return getDerived().TransformBinaryOperator(E);
13843template<
typename Derived>
13849 ExprResult commonExpr = getDerived().TransformExpr(e->getCommon());
13850 if (commonExpr.isInvalid())
13853 ExprResult rhs = getDerived().TransformExpr(e->getFalseExpr());
13854 if (rhs.isInvalid())
13857 if (!getDerived().AlwaysRebuild() &&
13858 commonExpr.get() == e->getCommon() &&
13859 rhs.get() == e->getFalseExpr())
13862 return getDerived().RebuildConditionalOperator(commonExpr.get(),
13863 e->getQuestionLoc(),
13869template<
typename Derived>
13873 if (
Cond.isInvalid())
13876 ExprResult LHS = getDerived().TransformExpr(E->getLHS());
13877 if (LHS.isInvalid())
13880 ExprResult RHS = getDerived().TransformExpr(E->getRHS());
13881 if (RHS.isInvalid())
13884 if (!getDerived().AlwaysRebuild() &&
13885 Cond.get() == E->getCond() &&
13886 LHS.get() == E->getLHS() &&
13887 RHS.get() == E->getRHS())
13890 return getDerived().RebuildConditionalOperator(
Cond.get(),
13891 E->getQuestionLoc(),
13897template<
typename Derived>
13902 return getDerived().
TransformExpr(E->getSubExprAsWritten());
13905template<
typename Derived>
13913 = getDerived().TransformExpr(E->getSubExprAsWritten());
13914 if (SubExpr.isInvalid())
13917 if (!getDerived().AlwaysRebuild() &&
13918 Type == E->getTypeInfoAsWritten() &&
13919 SubExpr.get() == E->getSubExpr())
13922 return getDerived().RebuildCStyleCastExpr(E->getLParenLoc(),
13928template<
typename Derived>
13936 ExprResult Init = getDerived().TransformExpr(E->getInitializer());
13937 if (
Init.isInvalid())
13940 if (!getDerived().AlwaysRebuild() &&
13942 Init.get() == E->getInitializer())
13949 return getDerived().RebuildCompoundLiteralExpr(
13950 E->getLParenLoc(), NewT,
13951 E->getInitializer()->getEndLoc(),
Init.get());
13954template<
typename Derived>
13958 if (
Base.isInvalid())
13961 if (!getDerived().AlwaysRebuild() &&
13962 Base.get() == E->getBase())
13968 return getDerived().RebuildExtVectorElementExpr(
13969 Base.get(), FakeOperatorLoc, E->isArrow(), E->getAccessorLoc(),
13973template<
typename Derived>
13979 bool InitChanged =
false;
13985 if (getDerived().TransformExprs(E->getInits(), E->getNumInits(),
false,
13986 Inits, &InitChanged))
13989 if (!getDerived().AlwaysRebuild() && !InitChanged) {
13996 return getDerived().RebuildInitList(E->getLBraceLoc(),
Inits,
13997 E->getRBraceLoc());
14000template<
typename Derived>
14007 if (
Init.isInvalid())
14012 bool ExprChanged =
false;
14014 if (D.isFieldDesignator()) {
14015 if (D.getFieldDecl()) {
14017 getDerived().TransformDecl(D.getFieldLoc(), D.getFieldDecl()));
14018 if (Field != D.getFieldDecl())
14021 ExprChanged =
true;
14022 if (
Field->isAnonymousStructOrUnion())
14028 ExprChanged =
true;
14031 D.getFieldName(), D.getDotLoc(), D.getFieldLoc()));
14035 if (D.isArrayDesignator()) {
14036 ExprResult Index = getDerived().TransformExpr(E->getArrayIndex(D));
14037 if (Index.isInvalid())
14040 Desig.AddDesignator(
14043 ExprChanged = ExprChanged || Index.get() != E->getArrayIndex(D);
14044 ArrayExprs.push_back(Index.get());
14048 assert(D.isArrayRangeDesignator() &&
"New kind of designator?");
14050 = getDerived().TransformExpr(E->getArrayRangeStart(D));
14051 if (Start.isInvalid())
14054 ExprResult End = getDerived().TransformExpr(E->getArrayRangeEnd(D));
14055 if (End.isInvalid())
14059 Start.get(), End.get(), D.getLBracketLoc(), D.getEllipsisLoc()));
14061 ExprChanged = ExprChanged || Start.get() != E->getArrayRangeStart(D) ||
14062 End.get() != E->getArrayRangeEnd(D);
14064 ArrayExprs.push_back(Start.get());
14065 ArrayExprs.push_back(End.get());
14068 if (!getDerived().AlwaysRebuild() &&
14069 Init.get() == E->getInit() &&
14073 return getDerived().RebuildDesignatedInitExpr(Desig, ArrayExprs,
14074 E->getEqualOrColonLoc(),
14075 E->usesGNUSyntax(),
Init.get());
14080template<
typename Derived>
14084 llvm_unreachable(
"Unexpected DesignatedInitUpdateExpr in syntactic form of "
14089template<
typename Derived>
14093 llvm_unreachable(
"Unexpected NoInitExpr in syntactic form of initializer");
14097template<
typename Derived>
14100 llvm_unreachable(
"Unexpected ArrayInitLoopExpr outside of initializer");
14104template<
typename Derived>
14107 llvm_unreachable(
"Unexpected ArrayInitIndexExpr outside of initializer");
14111template<
typename Derived>
14119 QualType T = getDerived().TransformType(E->getType());
14123 if (!getDerived().AlwaysRebuild() &&
14127 return getDerived().RebuildImplicitValueInitExpr(
T);
14130template<
typename Derived>
14133 TypeSourceInfo *TInfo = getDerived().TransformType(E->getWrittenTypeInfo());
14137 ExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
14138 if (SubExpr.isInvalid())
14141 if (!getDerived().AlwaysRebuild() &&
14142 TInfo == E->getWrittenTypeInfo() &&
14143 SubExpr.get() == E->getSubExpr())
14146 return getDerived().RebuildVAArgExpr(E->getBuiltinLoc(), SubExpr.get(),
14147 TInfo, E->getRParenLoc());
14150template<
typename Derived>
14153 bool ArgumentChanged =
false;
14155 if (TransformExprs(E->getExprs(), E->getNumExprs(),
true,
Inits,
14159 return getDerived().RebuildParenListExpr(E->getLParenLoc(),
14161 E->getRParenLoc());
14169template<
typename Derived>
14172 Decl *LD = getDerived().TransformDecl(E->getLabel()->getLocation(),
14177 return getDerived().RebuildAddrLabelExpr(E->getAmpAmpLoc(), E->getLabelLoc(),
14181template<
typename Derived>
14186 = getDerived().TransformCompoundStmt(E->getSubStmt(),
true);
14187 if (SubStmt.isInvalid()) {
14192 unsigned OldDepth = E->getTemplateDepth();
14193 unsigned NewDepth = getDerived().TransformTemplateDepth(OldDepth);
14195 if (!getDerived().AlwaysRebuild() && OldDepth == NewDepth &&
14196 SubStmt.get() == E->getSubStmt()) {
14202 return getDerived().RebuildStmtExpr(E->getLParenLoc(), SubStmt.get(),
14203 E->getRParenLoc(), NewDepth);
14206template<
typename Derived>
14210 if (
Cond.isInvalid())
14213 ExprResult LHS = getDerived().TransformExpr(E->getLHS());
14214 if (LHS.isInvalid())
14217 ExprResult RHS = getDerived().TransformExpr(E->getRHS());
14218 if (RHS.isInvalid())
14221 if (!getDerived().AlwaysRebuild() &&
14222 Cond.get() == E->getCond() &&
14223 LHS.get() == E->getLHS() &&
14224 RHS.get() == E->getRHS())
14227 return getDerived().RebuildChooseExpr(E->getBuiltinLoc(),
14228 Cond.get(), LHS.get(), RHS.get(),
14229 E->getRParenLoc());
14232template<
typename Derived>
14238template<
typename Derived>
14241 switch (E->getOperator()) {
14245 case OO_Array_Delete:
14246 llvm_unreachable(
"new and delete operators cannot use CXXOperatorCallExpr");
14251 assert(E->getNumArgs() >= 1 &&
"Object call is missing arguments");
14264 if (FakeLParenLoc.isInvalid() && EndLoc.isValid())
14265 FakeLParenLoc = EndLoc;
14269 if (getDerived().TransformExprs(E->getArgs() + 1, E->getNumArgs() - 1,
true,
14273 if (E->getOperator() == OO_Subscript)
14274 return getDerived().RebuildCxxSubscriptExpr(
Object.get(), FakeLParenLoc,
14275 Args, E->getEndLoc());
14277 return getDerived().RebuildCallExpr(
Object.get(), FakeLParenLoc, Args,
14281#define OVERLOADED_OPERATOR(Name, Spelling, Token, Unary, Binary, MemberOnly) \
14285#define OVERLOADED_OPERATOR_MULTI(Name,Spelling,Unary,Binary,MemberOnly)
14286#include "clang/Basic/OperatorKinds.def"
14288 case OO_Conditional:
14289 llvm_unreachable(
"conditional operator is not actually overloadable");
14293 llvm_unreachable(
"not an overloaded operator?");
14297 if (E->getNumArgs() == 1 && E->getOperator() == OO_Amp)
14298 First = getDerived().TransformAddressOfOperand(E->getArg(0));
14300 First = getDerived().TransformExpr(E->getArg(0));
14301 if (
First.isInvalid())
14305 if (E->getNumArgs() == 2) {
14307 getDerived().TransformInitializer(E->getArg(1),
false);
14308 if (Second.isInvalid())
14314 getSema().CurFPFeatures =
14315 NewOverrides.applyOverrides(getSema().getLangOpts());
14316 getSema().FpPragmaStack.CurrentValue = NewOverrides;
14320 LookupResult R(SemaRef, ULE->getName(), ULE->getNameLoc(),
14322 if (getDerived().TransformOverloadExprDecls(ULE, ULE->requiresADL(), R))
14325 return getDerived().RebuildCXXOperatorCallExpr(
14326 E->getOperator(), E->getOperatorLoc(),
Callee->getBeginLoc(),
14327 ULE->requiresADL(), R.asUnresolvedSet(),
First.get(), Second.get());
14332 Callee = ICE->getSubExprAsWritten();
14334 ValueDecl *VD = cast_or_null<ValueDecl>(
14335 getDerived().TransformDecl(DR->getLocation(), DR));
14340 Functions.addDecl(VD);
14342 return getDerived().RebuildCXXOperatorCallExpr(
14343 E->getOperator(), E->getOperatorLoc(),
Callee->getBeginLoc(),
14344 false, Functions,
First.get(), Second.get());
14347template<
typename Derived>
14350 return getDerived().TransformCallExpr(E);
14353template <
typename Derived>
14356 getSema().CurContext != E->getParentContext();
14358 if (!getDerived().AlwaysRebuild() && !NeedRebuildFunc)
14361 return getDerived().RebuildSourceLocExpr(E->getIdentKind(), E->getType(),
14362 E->getBeginLoc(), E->getEndLoc(),
14363 getSema().CurContext);
14366template <
typename Derived>
14371template<
typename Derived>
14380 ExprResult EC = getDerived().TransformCallExpr(E->getConfig());
14381 if (EC.isInvalid())
14385 bool ArgChanged =
false;
14387 if (getDerived().TransformExprs(E->getArgs(), E->getNumArgs(),
true, Args,
14391 if (!getDerived().AlwaysRebuild() &&
14392 Callee.get() == E->getCallee() &&
14398 = ((
Expr *)
Callee.get())->getSourceRange().getBegin();
14399 return getDerived().RebuildCallExpr(
Callee.get(), FakeLParenLoc,
14401 E->getRParenLoc(), EC.get());
14404template<
typename Derived>
14420 return getDerived().RebuildCXXNamedCastExpr(
14427template<
typename Derived>
14436 if (Sub.isInvalid())
14439 return getDerived().RebuildBuiltinBitCastExpr(BCE->
getBeginLoc(), TSI,
14443template<
typename Derived>
14445TreeTransform<Derived>::TransformCXXStaticCastExpr(CXXStaticCastExpr *E) {
14446 return getDerived().TransformCXXNamedCastExpr(E);
14449template<
typename Derived>
14455template<
typename Derived>
14462template<
typename Derived>
14468template<
typename Derived>
14474template<
typename Derived>
14479 getDerived().TransformTypeWithDeducedTST(E->getTypeInfoAsWritten());
14484 = getDerived().TransformExpr(E->getSubExprAsWritten());
14485 if (SubExpr.isInvalid())
14488 if (!getDerived().AlwaysRebuild() &&
14489 Type == E->getTypeInfoAsWritten() &&
14490 SubExpr.get() == E->getSubExpr())
14493 return getDerived().RebuildCXXFunctionalCastExpr(
Type,
14497 E->isListInitialization());
14500template<
typename Derived>
14503 if (E->isTypeOperand()) {
14505 = getDerived().TransformType(E->getTypeOperandSourceInfo());
14509 if (!getDerived().AlwaysRebuild() &&
14510 TInfo == E->getTypeOperandSourceInfo())
14513 return getDerived().RebuildCXXTypeidExpr(E->getType(), E->getBeginLoc(),
14514 TInfo, E->getEndLoc());
14520 Expr *Op = E->getExprOperand();
14522 if (E->isGLValue())
14523 if (
auto *RD = Op->getType()->getAsCXXRecordDecl();
14524 RD && RD->isPolymorphic())
14530 ExprResult SubExpr = getDerived().TransformExpr(Op);
14531 if (SubExpr.isInvalid())
14534 if (!getDerived().AlwaysRebuild() &&
14535 SubExpr.get() == E->getExprOperand())
14538 return getDerived().RebuildCXXTypeidExpr(E->getType(), E->getBeginLoc(),
14539 SubExpr.get(), E->getEndLoc());
14542template<
typename Derived>
14545 if (E->isTypeOperand()) {
14547 = getDerived().TransformType(E->getTypeOperandSourceInfo());
14551 if (!getDerived().AlwaysRebuild() &&
14552 TInfo == E->getTypeOperandSourceInfo())
14555 return getDerived().RebuildCXXUuidofExpr(E->getType(), E->getBeginLoc(),
14556 TInfo, E->getEndLoc());
14562 ExprResult SubExpr = getDerived().TransformExpr(E->getExprOperand());
14563 if (SubExpr.isInvalid())
14566 if (!getDerived().AlwaysRebuild() &&
14567 SubExpr.get() == E->getExprOperand())
14570 return getDerived().RebuildCXXUuidofExpr(E->getType(), E->getBeginLoc(),
14571 SubExpr.get(), E->getEndLoc());
14574template<
typename Derived>
14580template<
typename Derived>
14587template<
typename Derived>
14603 auto &S = getSema();
14604 if (E->isCapturedByCopyInLambdaWithExplicitObjectParameter())
14605 return S.getCurrentThisType();
14606 if (S.getCurLambda())
14607 return getDerived().TransformType(E->getType());
14608 return S.getCurrentThisType();
14611 if (!getDerived().AlwaysRebuild() &&
T == E->getType() &&
14612 !E->isCapturedByCopyInLambdaWithExplicitObjectParameter()) {
14615 getSema().MarkThisReferenced(E);
14619 return getDerived().RebuildCXXThisExpr(E->getBeginLoc(),
T, E->isImplicit());
14622template<
typename Derived>
14625 ExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
14626 if (SubExpr.isInvalid())
14629 getSema().DiagnoseExceptionUse(E->getThrowLoc(),
false);
14631 if (!getDerived().AlwaysRebuild() &&
14632 SubExpr.get() == E->getSubExpr())
14635 return getDerived().RebuildCXXThrowExpr(E->getThrowLoc(), SubExpr.get(),
14636 E->isThrownVariableInScope());
14639template<
typename Derived>
14643 getDerived().TransformDecl(E->getBeginLoc(), E->getParam()));
14648 if (E->hasRewrittenInit()) {
14649 InitRes = getDerived().TransformExpr(E->getRewrittenExpr());
14650 if (InitRes.isInvalid())
14654 if (!getDerived().AlwaysRebuild() && Param == E->getParam() &&
14655 E->getUsedContext() == SemaRef.
CurContext &&
14656 InitRes.get() == E->getRewrittenExpr())
14659 return getDerived().RebuildCXXDefaultArgExpr(E->getUsedLocation(), Param,
14663template<
typename Derived>
14667 getDerived().TransformDecl(E->getBeginLoc(), E->getField()));
14671 if (!getDerived().AlwaysRebuild() && Field == E->getField() &&
14675 return getDerived().RebuildCXXDefaultInitExpr(E->getExprLoc(), Field);
14678template<
typename Derived>
14682 TypeSourceInfo *
T = getDerived().TransformType(E->getTypeSourceInfo());
14686 if (!getDerived().AlwaysRebuild() &&
14687 T == E->getTypeSourceInfo())
14690 return getDerived().RebuildCXXScalarValueInitExpr(
T,
14691 T->getTypeLoc().getEndLoc(),
14692 E->getRParenLoc());
14695template<
typename Derived>
14700 getDerived().TransformTypeWithDeducedTST(E->getAllocatedTypeSourceInfo());
14701 if (!AllocTypeInfo)
14705 std::optional<Expr *> ArraySize;
14706 if (E->isArray()) {
14708 if (std::optional<Expr *> OldArraySize = E->getArraySize()) {
14709 NewArraySize = getDerived().TransformExpr(*OldArraySize);
14710 if (NewArraySize.isInvalid())
14713 ArraySize = NewArraySize.get();
14717 bool ArgumentChanged =
false;
14719 if (getDerived().TransformExprs(E->getPlacementArgs(),
14720 E->getNumPlacementArgs(),
true,
14721 PlacementArgs, &ArgumentChanged))
14725 Expr *OldInit = E->getInitializer();
14728 NewInit = getDerived().TransformInitializer(OldInit,
true);
14729 if (NewInit.isInvalid())
14734 if (E->getOperatorNew()) {
14735 OperatorNew = cast_or_null<FunctionDecl>(
14736 getDerived().TransformDecl(E->getBeginLoc(), E->getOperatorNew()));
14742 if (E->getOperatorDelete()) {
14743 OperatorDelete = cast_or_null<FunctionDecl>(
14744 getDerived().TransformDecl(E->getBeginLoc(), E->getOperatorDelete()));
14745 if (!OperatorDelete)
14749 if (!getDerived().AlwaysRebuild() &&
14750 AllocTypeInfo == E->getAllocatedTypeSourceInfo() &&
14751 ArraySize == E->getArraySize() &&
14752 NewInit.get() == OldInit &&
14753 OperatorNew == E->getOperatorNew() &&
14754 OperatorDelete == E->getOperatorDelete() &&
14755 !ArgumentChanged) {
14760 if (OperatorDelete)
14763 if (E->isArray() && !E->getAllocatedType()->isDependentType()) {
14775 QualType AllocType = AllocTypeInfo->getType();
14786 = dyn_cast<ConstantArrayType>(ArrayT)) {
14790 AllocType = ConsArrayT->getElementType();
14792 = dyn_cast<DependentSizedArrayType>(ArrayT)) {
14793 if (DepArrayT->getSizeExpr()) {
14794 ArraySize = DepArrayT->getSizeExpr();
14795 AllocType = DepArrayT->getElementType();
14800 return getDerived().RebuildCXXNewExpr(
14801 E->getBeginLoc(), E->isGlobalNew(),
14802 E->getBeginLoc(), PlacementArgs,
14803 E->getBeginLoc(), E->getTypeIdParens(), AllocType,
14804 AllocTypeInfo, ArraySize, E->getDirectInitRange(), NewInit.get());
14807template<
typename Derived>
14816 if (E->getOperatorDelete()) {
14817 OperatorDelete = cast_or_null<FunctionDecl>(
14818 getDerived().TransformDecl(E->getBeginLoc(), E->getOperatorDelete()));
14819 if (!OperatorDelete)
14823 if (!getDerived().AlwaysRebuild() &&
14824 Operand.get() == E->getArgument() &&
14825 OperatorDelete == E->getOperatorDelete()) {
14828 if (OperatorDelete)
14831 if (!E->getArgument()->isTypeDependent()) {
14833 E->getDestroyedType());
14834 if (
auto *
Record = Destroyed->getAsCXXRecordDecl())
14842 return getDerived().RebuildCXXDeleteExpr(
14843 E->getBeginLoc(), E->isGlobalDelete(), E->isArrayForm(),
Operand.get());
14846template<
typename Derived>
14851 if (
Base.isInvalid())
14855 bool MayBePseudoDestructor =
false;
14857 E->getOperatorLoc(),
14858 E->isArrow()? tok::arrow : tok::period,
14860 MayBePseudoDestructor);
14861 if (
Base.isInvalid())
14864 QualType ObjectType = ObjectTypePtr.get();
14866 if (QualifierLoc) {
14868 = getDerived().TransformNestedNameSpecifierLoc(QualifierLoc, ObjectType);
14873 SS.
Adopt(QualifierLoc);
14876 if (E->getDestroyedTypeInfo()) {
14877 TypeSourceInfo *DestroyedTypeInfo = getDerived().TransformTypeInObjectScope(
14878 E->getDestroyedTypeInfo(), ObjectType,
14880 if (!DestroyedTypeInfo)
14882 Destroyed = DestroyedTypeInfo;
14883 }
else if (!ObjectType.isNull() && ObjectType->isDependentType()) {
14887 E->getDestroyedTypeLoc());
14891 *E->getDestroyedTypeIdentifier(), E->getDestroyedTypeLoc(),
14892 nullptr, SS, ObjectTypePtr,
false);
14898 E->getDestroyedTypeLoc());
14902 if (E->getScopeTypeInfo()) {
14903 ScopeTypeInfo = getDerived().TransformTypeInObjectScope(
14904 E->getScopeTypeInfo(), ObjectType,
nullptr);
14905 if (!ScopeTypeInfo)
14909 return getDerived().RebuildCXXPseudoDestructorExpr(
Base.get(),
14910 E->getOperatorLoc(),
14914 E->getColonColonLoc(),
14919template <
typename Derived>
14924 bool AllEmptyPacks =
true;
14925 for (
auto *OldD : Old->
decls()) {
14941 if (
auto *UPD = dyn_cast<UsingPackDecl>(InstD))
14942 Decls = UPD->expansions();
14945 for (
auto *D : Decls) {
14946 if (
auto *UD = dyn_cast<UsingDecl>(D)) {
14947 for (
auto *SD : UD->shadows())
14954 AllEmptyPacks &= Decls.empty();
14963 if (AllEmptyPacks && !RequiresADL) {
14975 getSema().FilterAcceptableTemplateNames(R,
14982 diag::err_template_kw_refers_to_non_template)
14986 diag::note_template_kw_refers_to_non_template)
14995template <
typename Derived>
15001template <
typename Derived>
15004 bool IsAddressOfOperand) {
15009 if (TransformOverloadExprDecls(Old, Old->
requiresADL(), R))
15016 = getDerived().TransformNestedNameSpecifierLoc(Old->
getQualifierLoc());
15020 SS.
Adopt(QualifierLoc);
15024 CXXRecordDecl *NamingClass
15025 = cast_or_null<CXXRecordDecl>(getDerived().TransformDecl(
15028 if (!NamingClass) {
15033 R.setNamingClass(NamingClass);
15054 SS, TemplateKWLoc, R,
15061 return getDerived().RebuildDeclarationNameExpr(SS, R, Old->
requiresADL());
15064 return getDerived().RebuildTemplateIdExpr(SS, TemplateKWLoc, R,
15068template<
typename Derived>
15071 bool ArgChanged =
false;
15073 for (
unsigned I = 0, N = E->getNumArgs(); I != N; ++I) {
15075 TypeLoc FromTL = From->getTypeLoc();
15078 TLB.
reserve(FromTL.getFullDataSize());
15079 QualType To = getDerived().TransformType(TLB, FromTL);
15083 if (To == From->getType())
15084 Args.push_back(From);
15086 Args.push_back(TLB.getTypeSourceInfo(SemaRef.
Context, To));
15096 TypeLoc PatternTL = ExpansionTL.getPatternLoc();
15102 bool Expand =
true;
15103 bool RetainExpansion =
false;
15105 ExpansionTL.getTypePtr()->getNumExpansions();
15107 if (getDerived().TryExpandParameterPacks(
15108 ExpansionTL.getEllipsisLoc(), PatternTL.getSourceRange(),
15109 Unexpanded,
true, Expand,
15110 RetainExpansion, NumExpansions))
15120 TLB.
reserve(From->getTypeLoc().getFullDataSize());
15122 QualType To = getDerived().TransformType(TLB, PatternTL);
15126 To = getDerived().RebuildPackExpansionType(To,
15127 PatternTL.getSourceRange(),
15128 ExpansionTL.getEllipsisLoc(),
15136 Args.push_back(TLB.getTypeSourceInfo(SemaRef.
Context, To));
15142 for (
unsigned I = 0; I != *NumExpansions; ++I) {
15145 TLB.
reserve(PatternTL.getFullDataSize());
15146 QualType To = getDerived().TransformType(TLB, PatternTL);
15150 if (To->containsUnexpandedParameterPack()) {
15151 To = getDerived().RebuildPackExpansionType(To,
15152 PatternTL.getSourceRange(),
15153 ExpansionTL.getEllipsisLoc(),
15163 Args.push_back(TLB.getTypeSourceInfo(SemaRef.
Context, To));
15166 if (!RetainExpansion)
15171 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
15174 TLB.
reserve(From->getTypeLoc().getFullDataSize());
15176 QualType To = getDerived().TransformType(TLB, PatternTL);
15180 To = getDerived().RebuildPackExpansionType(To,
15181 PatternTL.getSourceRange(),
15182 ExpansionTL.getEllipsisLoc(),
15190 Args.push_back(TLB.getTypeSourceInfo(SemaRef.
Context, To));
15193 if (!getDerived().AlwaysRebuild() && !ArgChanged)
15196 return getDerived().RebuildTypeTrait(E->getTrait(), E->getBeginLoc(), Args,
15200template<
typename Derived>
15206 if (getDerived().TransformTemplateArguments(Old->getTemplateArgs(),
15207 Old->NumTemplateArgs, TransArgs))
15210 return getDerived().RebuildConceptSpecializationExpr(
15211 E->getNestedNameSpecifierLoc(), E->getTemplateKWLoc(),
15212 E->getConceptNameInfo(), E->getFoundDecl(), E->getNamedConcept(),
15216template<
typename Derived>
15230 getSema().Context, getSema().CurContext,
15231 E->getBody()->getBeginLoc());
15235 ExprResult TypeParamResult = getDerived().TransformRequiresTypeParams(
15236 E->getRequiresKWLoc(), E->getRBraceLoc(), E, Body,
15237 E->getLocalParameters(), TransParamTypes, TransParams, ExtParamInfos);
15241 Param->setDeclContext(Body);
15247 if (!TypeParamResult.isUnset())
15248 return TypeParamResult;
15251 if (getDerived().TransformRequiresExprRequirements(E->getRequirements(),
15256 if (
auto *ER = dyn_cast<concepts::ExprRequirement>(Req)) {
15257 if (ER->getReturnTypeRequirement().isTypeConstraint()) {
15258 ER->getReturnTypeRequirement()
15259 .getTypeConstraintTemplateParameterList()->getParam(0)
15260 ->setDeclContext(Body);
15265 return getDerived().RebuildRequiresExpr(
15266 E->getRequiresKWLoc(), Body, E->getLParenLoc(), TransParams,
15267 E->getRParenLoc(), TransReqs, E->getRBraceLoc());
15270template<
typename Derived>
15276 if (
auto *TypeReq = dyn_cast<concepts::TypeRequirement>(Req))
15277 TransReq =
getDerived().TransformTypeRequirement(TypeReq);
15278 else if (
auto *ExprReq = dyn_cast<concepts::ExprRequirement>(Req))
15279 TransReq =
getDerived().TransformExprRequirement(ExprReq);
15281 TransReq =
getDerived().TransformNestedRequirement(
15285 Transformed.push_back(TransReq);
15290template<
typename Derived>
15303 return getDerived().RebuildTypeRequirement(TransType);
15306template<
typename Derived>
15309 llvm::PointerUnion<Expr *, concepts::Requirement::SubstitutionDiagnostic *> TransExpr;
15315 TransExprRes =
SemaRef.CheckPlaceholderExpr(TransExprRes.
get());
15318 TransExpr = TransExprRes.
get();
15321 std::optional<concepts::ExprRequirement::ReturnTypeRequirement> TransRetReq;
15323 if (RetReq.isEmpty())
15324 TransRetReq.emplace();
15325 else if (RetReq.isSubstitutionFailure())
15326 TransRetReq.emplace(RetReq.getSubstitutionDiagnostic());
15327 else if (RetReq.isTypeConstraint()) {
15329 RetReq.getTypeConstraintTemplateParameterList();
15331 getDerived().TransformTemplateParameterList(OrigTPL);
15334 TransRetReq.emplace(TPL);
15336 assert(TransRetReq &&
"All code paths leading here must set TransRetReq");
15337 if (
Expr *E = dyn_cast<Expr *>(TransExpr))
15340 std::move(*TransRetReq));
15346template<
typename Derived>
15352 return getDerived().RebuildNestedRequirement(
15360 return getDerived().RebuildNestedRequirement(TransConstraint.
get());
15363template<
typename Derived>
15370 if (!getDerived().AlwaysRebuild() &&
15387template<
typename Derived>
15394 SubExpr = getDerived().TransformExpr(E->getQueriedExpression());
15395 if (SubExpr.isInvalid())
15398 if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getQueriedExpression())
15402 return getDerived().RebuildExpressionTrait(E->getTrait(), E->getBeginLoc(),
15403 SubExpr.get(), E->getEndLoc());
15406template <
typename Derived>
15411 DRE, AddrTaken, RecoveryTSI);
15424template <
typename Derived>
15431template <
typename Derived>
15447 getDerived().TransformDeclarationNameInfo(E->
getNameInfo());
15452 if (!getDerived().AlwaysRebuild() && QualifierLoc == E->
getQualifierLoc() &&
15458 return getDerived().RebuildDependentScopeDeclRefExpr(
15459 QualifierLoc, TemplateKWLoc, NameInfo,
nullptr,
15460 IsAddressOfOperand, RecoveryTSI);
15464 if (getDerived().TransformTemplateArguments(
15468 return getDerived().RebuildDependentScopeDeclRefExpr(
15469 QualifierLoc, TemplateKWLoc, NameInfo, &TransArgs, IsAddressOfOperand,
15473template<
typename Derived>
15479 if (getDerived().AllowSkippingCXXConstructExpr() &&
15480 ((E->getNumArgs() == 1 ||
15481 (E->getNumArgs() > 1 && getDerived().DropCallArgument(E->getArg(1)))) &&
15482 (!getDerived().DropCallArgument(E->getArg(0))) &&
15483 !E->isListInitialization()))
15489 QualType T = getDerived().TransformType(E->getType());
15494 getDerived().TransformDecl(E->getBeginLoc(), E->getConstructor()));
15498 bool ArgumentChanged =
false;
15503 E->isListInitialization());
15504 if (getDerived().TransformExprs(E->getArgs(), E->getNumArgs(),
true, Args,
15509 if (!getDerived().AlwaysRebuild() &&
15510 T == E->getType() &&
15512 !ArgumentChanged) {
15519 return getDerived().RebuildCXXConstructExpr(
15520 T, E->getBeginLoc(),
Constructor, E->isElidable(), Args,
15521 E->hadMultipleCandidates(), E->isListInitialization(),
15522 E->isStdInitListInitialization(), E->requiresZeroInitialization(),
15523 E->getConstructionKind(), E->getParenOrBraceRange());
15526template<
typename Derived>
15529 QualType T = getDerived().TransformType(E->getType());
15534 getDerived().TransformDecl(E->getBeginLoc(), E->getConstructor()));
15538 if (!getDerived().AlwaysRebuild() &&
15539 T == E->getType() &&
15547 return getDerived().RebuildCXXInheritedCtorInitExpr(
15549 E->constructsVBase(), E->inheritedFromVBase());
15556template<
typename Derived>
15559 if (
auto *Dtor = E->getTemporary()->getDestructor())
15562 return getDerived().TransformExpr(E->getSubExpr());
15570template<
typename Derived>
15576template<
typename Derived>
15581 getDerived().TransformTypeWithDeducedTST(E->getTypeSourceInfo());
15586 getDerived().TransformDecl(E->getBeginLoc(), E->getConstructor()));
15590 bool ArgumentChanged =
false;
15592 Args.reserve(E->getNumArgs());
15596 E->isListInitialization());
15597 if (TransformExprs(E->getArgs(), E->getNumArgs(),
true, Args,
15601 if (E->isListInitialization() && !E->isStdInitListInitialization()) {
15602 ExprResult Res = RebuildInitList(E->getBeginLoc(), Args, E->getEndLoc());
15603 if (Res.isInvalid())
15605 Args = {Res.get()};
15609 if (!getDerived().AlwaysRebuild() &&
15610 T == E->getTypeSourceInfo() &&
15612 !ArgumentChanged) {
15619 return getDerived().RebuildCXXTemporaryObjectExpr(
15620 T, LParenLoc, Args, E->getEndLoc(), E->isListInitialization());
15623template<
typename Derived>
15628 typedef std::pair<ExprResult, QualType> InitCaptureInfoTy;
15629 struct TransformedInitCapture {
15631 SourceLocation EllipsisLoc;
15633 SmallVector<InitCaptureInfoTy, 4> Expansions;
15636 InitCaptures.resize(E->explicit_capture_end() - E->explicit_capture_begin());
15638 CEnd = E->capture_end();
15640 if (!E->isInitCapture(
C))
15643 TransformedInitCapture &
Result = InitCaptures[
C - E->capture_begin()];
15648 ExprResult NewExprInitResult = getDerived().TransformInitializer(
15651 if (NewExprInitResult.isInvalid()) {
15655 Expr *NewExprInit = NewExprInitResult.get();
15658 getSema().buildLambdaInitCaptureInitialization(
15659 C->getLocation(),
C->getCaptureKind() ==
LCK_ByRef,
15660 EllipsisLoc, NumExpansions, OldVD->getIdentifier(),
15664 Result.Expansions.push_back(
15665 InitCaptureInfoTy(NewExprInit, NewInitCaptureType));
15669 if (OldVD->isParameterPack()) {
15678 bool Expand =
true;
15679 bool RetainExpansion =
false;
15681 ExpansionTL.getTypePtr()->getNumExpansions();
15683 if (getDerived().TryExpandParameterPacks(
15684 ExpansionTL.getEllipsisLoc(), OldVD->getInit()->getSourceRange(),
15685 Unexpanded,
true, Expand,
15686 RetainExpansion, NumExpansions))
15688 assert(!RetainExpansion &&
"Should not need to retain expansion after a "
15689 "capture since it cannot be extended");
15691 for (
unsigned I = 0; I != *NumExpansions; ++I) {
15696 SubstInitCapture(ExpansionTL.getEllipsisLoc(), NumExpansions);
15697 Result.EllipsisLoc = ExpansionTL.getEllipsisLoc();
15734 while (DC->isRequiresExprBody())
15736 if ((getSema().isUnevaluatedContext() ||
15737 getSema().isConstantEvaluatedContext()) &&
15738 !(dyn_cast_or_null<CXXRecordDecl>(DC->getParent()) &&
15740 (DC->isFileContext() || !DC->getParent()->isDependentContext()))
15745 E->getIntroducerRange(),
nullptr, DependencyKind,
15746 E->getCaptureDefault());
15747 getDerived().transformedLocalDecl(OldClass, {
Class});
15750 getSema().CreateLambdaCallOperator(E->getIntroducerRange(),
Class);
15753 getSema().buildLambdaScope(LSI, NewCallOperator, E->getIntroducerRange(),
15754 E->getCaptureDefault(), E->getCaptureDefaultLoc(),
15755 E->hasExplicitParameters(), E->isMutable());
15765 CEnd = E->capture_end();
15769 if (
C->isImplicit())
15773 if (
C->capturesThis()) {
15781 dyn_cast_if_present<CXXRecordDecl>(
15782 getSema().getFunctionLevelDeclContext()),
15784 getSema().CheckCXXThisCapture(
C->getLocation(),
C->isExplicit(),
15791 if (
C->capturesVLAType())
15795 if (E->isInitCapture(
C)) {
15796 TransformedInitCapture &NewC = InitCaptures[
C - E->capture_begin()];
15801 for (InitCaptureInfoTy &Info : NewC.Expansions) {
15803 QualType InitQualType = Info.second;
15804 if (
Init.isInvalid() || InitQualType.isNull()) {
15808 VarDecl *NewVD = getSema().createLambdaInitCaptureVarDecl(
15809 OldVD->getLocation(), InitQualType, NewC.EllipsisLoc,
15810 OldVD->getIdentifier(), OldVD->getInitStyle(),
Init.get(),
15811 getSema().CurContext);
15816 NewVDs.push_back(NewVD);
15817 getSema().addInitCapture(LSI, NewVD,
C->getCaptureKind() ==
LCK_ByRef);
15822 if (NewC.EllipsisLoc.isInvalid())
15823 LSI->ContainsUnexpandedParameterPack |=
15824 Init.get()->containsUnexpandedParameterPack();
15830 getDerived().transformedLocalDecl(OldVD, NewVDs);
15834 assert(
C->capturesVariable() &&
"unexpected kind of lambda capture");
15842 if (
C->isPackExpansion()) {
15844 bool ShouldExpand =
false;
15845 bool RetainExpansion =
false;
15847 if (getDerived().TryExpandParameterPacks(
15848 C->getEllipsisLoc(),
C->getLocation(), Unexpanded,
15849 true, ShouldExpand,
15850 RetainExpansion, NumExpansions)) {
15855 if (ShouldExpand) {
15860 for (
unsigned I = 0; I != *NumExpansions; ++I) {
15862 ValueDecl *CapturedVar = cast_if_present<ValueDecl>(
15863 getDerived().TransformDecl(
C->getLocation(), Pack));
15864 if (!CapturedVar) {
15870 getSema().tryCaptureVariable(CapturedVar,
C->getLocation(), Kind);
15878 EllipsisLoc =
C->getEllipsisLoc();
15882 auto *CapturedVar = cast_or_null<ValueDecl>(
15883 getDerived().TransformDecl(
C->getLocation(),
C->getCapturedVar()));
15884 if (!CapturedVar || CapturedVar->isInvalidDecl()) {
15891 if (
auto *VD = dyn_cast<VarDecl>(CapturedVar); VD && !
C->isPackExpansion())
15892 LSI->ContainsUnexpandedParameterPack |= VD->isParameterPack();
15895 getSema().tryCaptureVariable(CapturedVar,
C->getLocation(), Kind,
15898 getSema().finishLambdaExplicitCaptures(LSI);
15902 auto TPL = getDerived().TransformTemplateParameterList(
15903 E->getTemplateParameterList());
15904 LSI->GLTemplateParameterList = TPL;
15906 getSema().AddTemplateParametersToLambdaCallOperator(NewCallOperator,
Class,
15908 LSI->ContainsUnexpandedParameterPack |=
15909 TPL->containsUnexpandedParameterPack();
15914 E->getCallOperator()->getTypeSourceInfo()->getTypeLoc();
15916 getDerived().TransformType(NewCallOpTLBuilder, OldCallOpTypeLoc);
15917 if (NewCallOpType.isNull())
15919 LSI->ContainsUnexpandedParameterPack |=
15920 NewCallOpType->containsUnexpandedParameterPack();
15922 NewCallOpTLBuilder.getTypeSourceInfo(getSema().Context, NewCallOpType);
15927 assert(FPTL &&
"Not a FunctionProtoType?");
15930 if (!TRC.ArgPackSubstIndex)
15933 getSema().CompleteLambdaCallOperator(
15934 NewCallOperator, E->getCallOperator()->getLocation(),
15935 E->getCallOperator()->getInnerLocStart(), TRC, NewCallOpTSI,
15936 E->getCallOperator()->getConstexprKind(),
15937 E->getCallOperator()->getStorageClass(), FPTL.getParams(),
15938 E->hasExplicitResultType());
15940 getDerived().transformAttrs(E->getCallOperator(), NewCallOperator);
15941 getDerived().transformedLocalDecl(E->getCallOperator(), {NewCallOperator});
15947 std::optional<CXXRecordDecl::LambdaNumbering> Numbering;
15948 if (getDerived().ReplacingOriginal()) {
15949 Numbering = OldClass->getLambdaNumbering();
15952 getSema().handleLambdaNumbering(
Class, NewCallOperator, Numbering);
15957 getSema().PushExpressionEvaluationContextForFunction(
15959 E->getCallOperator());
15966 C.PointOfInstantiation = E->getBody()->getBeginLoc();
15967 getSema().pushCodeSynthesisContext(
C);
15971 : getDerived().TransformLambdaBody(E, E->getBody());
15973 getSema().popCodeSynthesisContext();
15977 FuncScopeCleanup.disable();
15979 if (Body.isInvalid()) {
15980 SavedContext.pop();
15981 getSema().ActOnLambdaError(E->getBeginLoc(),
nullptr,
15986 getSema().ActOnFinishFunctionBody(NewCallOperator, Body.get(),
15989 SavedContext.pop();
16024 DependencyKind = getDerived().ComputeLambdaDependency(LSI);
16025 Class->setLambdaDependencyKind(DependencyKind);
16027 return getDerived().RebuildLambdaExpr(E->getBeginLoc(),
16028 Body.get()->getEndLoc(), LSI);
16031template<
typename Derived>
16037template<
typename Derived>
16046 if (!
C->isImplicit())
16050 if (
C->capturesThis()) {
16051 getSema().CheckCXXThisCapture(
C->getLocation(),
C->isExplicit(),
16058 if (
C->capturesVLAType())
16061 assert(
C->capturesVariable() &&
"unexpected kind of lambda capture");
16065 VarDecl *CapturedVar = cast_or_null<VarDecl>(
16071 getSema().tryCaptureVariable(CapturedVar,
C->getLocation());
16077template<
typename Derived>
16086 bool ArgumentChanged =
false;
16098 if (!getDerived().AlwaysRebuild() &&
16104 return getDerived().RebuildCXXUnresolvedConstructExpr(
16108template<
typename Derived>
16117 if (!E->isImplicitAccess()) {
16118 OldBase = E->getBase();
16119 Base = getDerived().TransformExpr(OldBase);
16120 if (
Base.isInvalid())
16125 bool MayBePseudoDestructor =
false;
16127 E->getOperatorLoc(),
16128 E->isArrow()? tok::arrow : tok::period,
16130 MayBePseudoDestructor);
16131 if (
Base.isInvalid())
16134 ObjectType = ObjectTy.get();
16135 BaseType = ((
Expr*)
Base.get())->getType();
16138 BaseType = getDerived().TransformType(E->getBaseType());
16145 = getDerived().TransformFirstQualifierInScope(
16146 E->getFirstQualifierFoundInScope(),
16147 E->getQualifierLoc().getBeginLoc());
16150 if (E->getQualifier()) {
16152 = getDerived().TransformNestedNameSpecifierLoc(E->getQualifierLoc(),
16154 FirstQualifierInScope);
16166 = getDerived().TransformDeclarationNameInfo(E->getMemberNameInfo());
16167 if (!NameInfo.getName())
16170 if (!E->hasExplicitTemplateArgs()) {
16173 if (!getDerived().AlwaysRebuild() &&
16174 Base.get() == OldBase &&
16175 BaseType == E->getBaseType() &&
16176 QualifierLoc == E->getQualifierLoc() &&
16177 NameInfo.getName() == E->getMember() &&
16178 FirstQualifierInScope == E->getFirstQualifierFoundInScope())
16181 return getDerived().RebuildCXXDependentScopeMemberExpr(
Base.get(),
16184 E->getOperatorLoc(),
16187 FirstQualifierInScope,
16193 if (getDerived().TransformTemplateArguments(E->getTemplateArgs(),
16194 E->getNumTemplateArgs(),
16198 return getDerived().RebuildCXXDependentScopeMemberExpr(
Base.get(),
16201 E->getOperatorLoc(),
16204 FirstQualifierInScope,
16209template <
typename Derived>
16215 if (!Old->isImplicitAccess()) {
16216 Base = getDerived().TransformExpr(Old->getBase());
16217 if (
Base.isInvalid())
16220 getSema().PerformMemberExprBaseConversion(
Base.get(), Old->isArrow());
16221 if (
Base.isInvalid())
16223 BaseType =
Base.get()->getType();
16225 BaseType = getDerived().TransformType(Old->getBaseType());
16229 if (Old->getQualifierLoc()) {
16231 getDerived().TransformNestedNameSpecifierLoc(Old->getQualifierLoc());
16241 if (TransformOverloadExprDecls(Old,
false, R))
16245 if (Old->getNamingClass()) {
16247 getDerived().TransformDecl(Old->getMemberLoc(), Old->getNamingClass()));
16251 R.setNamingClass(NamingClass);
16255 if (Old->hasExplicitTemplateArgs()) {
16256 TransArgs.setLAngleLoc(Old->getLAngleLoc());
16257 TransArgs.setRAngleLoc(Old->getRAngleLoc());
16258 if (getDerived().TransformTemplateArguments(
16259 Old->getTemplateArgs(), Old->getNumTemplateArgs(), TransArgs))
16267 NamedDecl *FirstQualifierInScope =
nullptr;
16269 return getDerived().RebuildUnresolvedMemberExpr(
16270 Base.get(), BaseType, Old->getOperatorLoc(), Old->isArrow(), QualifierLoc,
16271 TemplateKWLoc, FirstQualifierInScope, R,
16272 (Old->hasExplicitTemplateArgs() ? &TransArgs :
nullptr));
16275template<
typename Derived>
16280 ExprResult SubExpr = getDerived().TransformExpr(E->getOperand());
16281 if (SubExpr.isInvalid())
16284 if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getOperand())
16287 return getDerived().RebuildCXXNoexceptExpr(E->getSourceRange(),SubExpr.get());
16290template<
typename Derived>
16293 ExprResult Pattern = getDerived().TransformExpr(E->getPattern());
16294 if (Pattern.isInvalid())
16297 if (!getDerived().AlwaysRebuild() && Pattern.get() == E->getPattern())
16300 return getDerived().RebuildPackExpansion(Pattern.get(), E->getEllipsisLoc(),
16301 E->getNumExpansions());
16304template <
typename Derived>
16309 if (!Arg.isPackExpansion()) {
16321 getSema().getTemplateArgumentPackExpansionPattern(ArgLoc, Ellipsis,
16322 OrigNumExpansions);
16334 if (!NumExpansions) {
16346template<
typename Derived>
16365 bool ShouldExpand =
false;
16366 bool RetainExpansion =
false;
16367 UnsignedOrNone NumExpansions = std::nullopt;
16368 if (getDerived().TryExpandParameterPacks(
16370 true, ShouldExpand,
16371 RetainExpansion, NumExpansions))
16376 if (ShouldExpand) {
16378 if (
auto *TTPD = dyn_cast<TemplateTypeParmDecl>(Pack)) {
16379 ArgStorage = getSema().Context.getPackExpansionType(
16380 getSema().Context.getTypeDeclType(TTPD), std::nullopt);
16381 }
else if (
auto *TTPD = dyn_cast<TemplateTemplateParmDecl>(Pack)) {
16385 ExprResult DRE = getSema().BuildDeclRefExpr(
16386 VD, VD->getType().getNonLValueExprType(getSema().Context),
16389 if (DRE.isInvalid())
16392 new (getSema().Context)
16396 PackArgs = ArgStorage;
16401 if (!PackArgs.size()) {
16402 auto *Pack = cast_or_null<NamedDecl>(
16406 return getDerived().RebuildSizeOfPackExpr(
16413 getDerived().ComputeSizeOfPackExprWithoutSubstitution(PackArgs);
16425 TemporaryBase Rebase(*
this, E->
getPackLoc(), getBaseEntity());
16428 if (TransformTemplateArguments(PackLocIterator(*
this, PackArgs.begin()),
16429 PackLocIterator(*
this, PackArgs.end()),
16430 TransformedPackArgs,
true))
16437 bool PartialSubstitution =
false;
16438 for (
auto &Loc : TransformedPackArgs.arguments()) {
16439 Args.push_back(Loc.getArgument());
16440 if (Loc.getArgument().isPackExpansion())
16441 PartialSubstitution =
true;
16444 if (PartialSubstitution)
16445 return getDerived().RebuildSizeOfPackExpr(
16447 std::nullopt, Args);
16449 return getDerived().RebuildSizeOfPackExpr(
16451 static_cast<unsigned>(Args.size()),
16455template <
typename Derived>
16458 if (!E->isValueDependent())
16466 IndexExpr = getDerived().TransformExpr(E->getIndexExpr());
16467 if (IndexExpr.isInvalid())
16472 bool FullySubstituted =
true;
16473 if (!E->expandsToEmptyPack() && E->getExpressions().empty()) {
16474 Expr *Pattern = E->getPackIdExpression();
16476 getSema().collectUnexpandedParameterPacks(E->getPackIdExpression(),
16478 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
16482 bool ShouldExpand =
true;
16483 bool RetainExpansion =
false;
16485 NumExpansions = std::nullopt;
16486 if (getDerived().TryExpandParameterPacks(
16487 E->getEllipsisLoc(), Pattern->getSourceRange(), Unexpanded,
16488 true, ShouldExpand,
16489 RetainExpansion, NumExpansions))
16491 if (!ShouldExpand) {
16493 ExprResult Pack = getDerived().TransformExpr(Pattern);
16494 if (Pack.isInvalid())
16496 return getDerived().RebuildPackIndexingExpr(
16497 E->getEllipsisLoc(), E->getRSquareLoc(), Pack.get(), IndexExpr.get(),
16500 for (
unsigned I = 0; I != *NumExpansions; ++I) {
16503 if (
Out.isInvalid())
16505 if (
Out.get()->containsUnexpandedParameterPack()) {
16506 Out = getDerived().RebuildPackExpansion(
Out.get(), E->getEllipsisLoc(),
16507 OrigNumExpansions);
16508 if (
Out.isInvalid())
16510 FullySubstituted =
false;
16512 ExpandedExprs.push_back(
Out.get());
16516 if (RetainExpansion) {
16517 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
16520 if (
Out.isInvalid())
16523 Out = getDerived().RebuildPackExpansion(
Out.get(), E->getEllipsisLoc(),
16524 OrigNumExpansions);
16525 if (
Out.isInvalid())
16527 FullySubstituted =
false;
16528 ExpandedExprs.push_back(
Out.get());
16530 }
else if (!E->expandsToEmptyPack()) {
16531 if (getDerived().TransformExprs(E->getExpressions().data(),
16532 E->getExpressions().size(),
false,
16537 return getDerived().RebuildPackIndexingExpr(
16538 E->getEllipsisLoc(), E->getRSquareLoc(), E->getPackIdExpression(),
16539 IndexExpr.get(), ExpandedExprs, FullySubstituted);
16542template <
typename Derived>
16545 if (!getSema().ArgPackSubstIndex)
16551 return getDerived().RebuildSubstNonTypeTemplateParmExpr(
16552 E->getAssociatedDecl(), E->getParameterPack(),
16553 E->getParameterPackLocation(), Arg, SemaRef.
getPackIndex(Pack),
16557template <
typename Derived>
16561 ExprResult Replacement = getDerived().TransformExpr(OrigReplacement);
16562 if (Replacement.isInvalid())
16565 Decl *AssociatedDecl =
16566 getDerived().TransformDecl(E->getNameLoc(), E->getAssociatedDecl());
16567 if (!AssociatedDecl)
16570 if (Replacement.get() == OrigReplacement &&
16571 AssociatedDecl == E->getAssociatedDecl())
16574 auto getParamAndType = [E](
Decl *AssociatedDecl)
16575 -> std::tuple<NonTypeTemplateParmDecl *, QualType> {
16576 auto [PDecl, Arg] =
16580 return {Param, Param->getType()};
16582 Arg = Arg.getPackAsArray()[*PackIndex];
16583 return {Param, Arg.getNonTypeTemplateArgumentType()};
16589 if (
auto [Param, ParamType] = getParamAndType(AssociatedDecl);
16591 ParamType, std::get<1>(getParamAndType(E->getAssociatedDecl()))) ||
16592 Replacement.get() != OrigReplacement) {
16599 Param, ParamType, Replacement.get(), SugaredConverted,
16600 CanonicalConverted,
16602 if (Replacement.isInvalid())
16606 Replacement = E->getReplacement();
16609 return getDerived().RebuildSubstNonTypeTemplateParmExpr(
16610 AssociatedDecl, E->getParameter(), E->getNameLoc(),
16612 E->getPackIndex(), E->getFinal());
16615template<
typename Derived>
16622template<
typename Derived>
16629template<
typename Derived>
16633 if (
Expr *OldCallee = E->getCallee()) {
16634 ExprResult CalleeResult = getDerived().TransformExpr(OldCallee);
16635 if (CalleeResult.isInvalid())
16640 Expr *Pattern = E->getPattern();
16643 getSema().collectUnexpandedParameterPacks(Pattern, Unexpanded);
16644 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
16648 bool Expand =
true;
16649 bool RetainExpansion =
false;
16651 NumExpansions = OrigNumExpansions;
16652 if (getDerived().TryExpandParameterPacks(
16653 E->getEllipsisLoc(), Pattern->getSourceRange(), Unexpanded,
16654 true, Expand, RetainExpansion,
16664 E->getLHS() ? getDerived().TransformExpr(E->getLHS()) :
ExprResult();
16665 if (LHS.isInvalid())
16669 E->getRHS() ? getDerived().TransformExpr(E->getRHS()) :
ExprResult();
16670 if (RHS.isInvalid())
16673 if (!getDerived().AlwaysRebuild() &&
16674 LHS.get() == E->getLHS() && RHS.get() == E->getRHS())
16677 return getDerived().RebuildCXXFoldExpr(
16678 Callee, E->getBeginLoc(), LHS.get(), E->getOperator(),
16679 E->getEllipsisLoc(), RHS.get(), E->getEndLoc(), NumExpansions);
16685 if (NumExpansions && SemaRef.
getLangOpts().BracketDepth < *NumExpansions) {
16686 SemaRef.
Diag(E->getEllipsisLoc(),
16687 clang::diag::err_fold_expression_limit_exceeded)
16688 << *NumExpansions << SemaRef.
getLangOpts().BracketDepth
16689 << E->getSourceRange();
16690 SemaRef.
Diag(E->getEllipsisLoc(), diag::note_bracket_depth);
16699 bool LeftFold = E->isLeftFold();
16703 if (!LeftFold && RetainExpansion) {
16704 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
16707 if (
Out.isInvalid())
16710 Result = getDerived().RebuildCXXFoldExpr(
16711 Callee, E->getBeginLoc(),
Out.get(), E->getOperator(),
16712 E->getEllipsisLoc(),
Result.get(), E->getEndLoc(), OrigNumExpansions);
16717 bool WarnedOnComparison =
false;
16718 for (
unsigned I = 0; I != *NumExpansions; ++I) {
16720 getSema(), LeftFold ? I : *NumExpansions - I - 1);
16722 if (
Out.isInvalid())
16725 if (
Out.get()->containsUnexpandedParameterPack()) {
16727 Result = getDerived().RebuildCXXFoldExpr(
16728 Callee, E->getBeginLoc(), LeftFold ?
Result.get() :
Out.get(),
16729 E->getOperator(), E->getEllipsisLoc(),
16730 LeftFold ?
Out.get() :
Result.get(), E->getEndLoc(),
16731 OrigNumExpansions);
16732 }
else if (
Result.isUsable()) {
16739 Result = getDerived().RebuildCXXOperatorCallExpr(
16741 E->getEllipsisLoc(),
Callee->getBeginLoc(),
Callee->requiresADL(),
16742 Functions, LHS, RHS);
16744 Result = getDerived().RebuildBinaryOperator(E->getEllipsisLoc(),
16745 E->getOperator(), LHS, RHS,
16747 if (!WarnedOnComparison &&
Result.isUsable()) {
16748 if (
auto *BO = dyn_cast<BinaryOperator>(
Result.get());
16749 BO && BO->isComparisonOp()) {
16750 WarnedOnComparison =
true;
16751 SemaRef.
Diag(BO->getBeginLoc(),
16752 diag::warn_comparison_in_fold_expression)
16753 << BO->getOpcodeStr();
16766 if (LeftFold && RetainExpansion) {
16767 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
16770 if (
Out.isInvalid())
16773 Result = getDerived().RebuildCXXFoldExpr(
16774 Callee, E->getBeginLoc(),
Result.get(), E->getOperator(),
16775 E->getEllipsisLoc(),
Out.get(), E->getEndLoc(), OrigNumExpansions);
16781 PE->setIsProducedByFoldExpansion();
16786 return getDerived().RebuildEmptyCXXFoldExpr(E->getEllipsisLoc(),
16791template <
typename Derived>
16797 QualType T = getDerived().TransformType(E->getType());
16799 bool ArgChanged =
false;
16801 if (getDerived().TransformExprs(InitExprs.data(), InitExprs.size(),
true,
16802 TransformedInits, &ArgChanged))
16805 if (!getDerived().AlwaysRebuild() && !ArgChanged &&
T == E->getType())
16808 return getDerived().RebuildCXXParenListInitExpr(
16809 TransformedInits,
T, E->getUserSpecifiedInitExprs().size(),
16810 E->getInitLoc(), E->getBeginLoc(), E->getEndLoc());
16813template<
typename Derived>
16820template<
typename Derived>
16826template<
typename Derived>
16832template<
typename Derived>
16835 ExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
16836 if (SubExpr.isInvalid())
16839 if (!getDerived().AlwaysRebuild() &&
16840 SubExpr.get() == E->getSubExpr())
16843 return getDerived().RebuildObjCBoxedExpr(E->getSourceRange(), SubExpr.get());
16846template<
typename Derived>
16851 bool ArgChanged =
false;
16852 if (getDerived().TransformExprs(E->getElements(), E->getNumElements(),
16853 false, Elements, &ArgChanged))
16856 if (!getDerived().AlwaysRebuild() && !ArgChanged)
16859 return getDerived().RebuildObjCArrayLiteral(E->getSourceRange(),
16864template<
typename Derived>
16870 bool ArgChanged =
false;
16871 for (
unsigned I = 0, N = E->getNumElements(); I != N; ++I) {
16874 if (OrigElement.isPackExpansion()) {
16877 getSema().collectUnexpandedParameterPacks(OrigElement.Key, Unexpanded);
16878 getSema().collectUnexpandedParameterPacks(OrigElement.Value, Unexpanded);
16879 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
16883 bool Expand =
true;
16884 bool RetainExpansion =
false;
16887 SourceRange PatternRange(OrigElement.Key->getBeginLoc(),
16888 OrigElement.Value->getEndLoc());
16889 if (getDerived().TryExpandParameterPacks(
16890 OrigElement.EllipsisLoc, PatternRange, Unexpanded,
16891 true, Expand, RetainExpansion,
16900 ExprResult Key = getDerived().TransformExpr(OrigElement.Key);
16901 if (Key.isInvalid())
16904 if (Key.get() != OrigElement.Key)
16908 if (
Value.isInvalid())
16915 Key.get(),
Value.get(), OrigElement.EllipsisLoc, NumExpansions
16917 Elements.push_back(Expansion);
16927 for (
unsigned I = 0; I != *NumExpansions; ++I) {
16929 ExprResult Key = getDerived().TransformExpr(OrigElement.Key);
16930 if (Key.isInvalid())
16934 if (
Value.isInvalid())
16944 if (Key.get()->containsUnexpandedParameterPack() ||
16945 Value.get()->containsUnexpandedParameterPack())
16946 Element.EllipsisLoc = OrigElement.EllipsisLoc;
16948 Elements.push_back(Element);
16958 ExprResult Key = getDerived().TransformExpr(OrigElement.Key);
16959 if (Key.isInvalid())
16962 if (Key.get() != OrigElement.Key)
16967 = getDerived().TransformExpr(OrigElement.Value);
16968 if (
Value.isInvalid())
16976 Elements.push_back(Element);
16979 if (!getDerived().AlwaysRebuild() && !ArgChanged)
16982 return getDerived().RebuildObjCDictionaryLiteral(E->getSourceRange(),
16986template<
typename Derived>
16990 = getDerived().TransformType(E->getEncodedTypeSourceInfo());
16991 if (!EncodedTypeInfo)
16994 if (!getDerived().AlwaysRebuild() &&
16995 EncodedTypeInfo == E->getEncodedTypeSourceInfo())
16998 return getDerived().RebuildObjCEncodeExpr(E->getAtLoc(),
17000 E->getRParenLoc());
17003template<
typename Derived>
17013template<
typename Derived>
17017 = getDerived().TransformType(E->getTypeInfoAsWritten());
17025 if (!getDerived().AlwaysRebuild() &&
17026 TSInfo == E->getTypeInfoAsWritten() &&
17027 Result.get() == E->getSubExpr())
17031 E->getLParenLoc(), E->getBridgeKind(), E->getBridgeKeywordLoc(), TSInfo,
17035template <
typename Derived>
17041template<
typename Derived>
17045 bool ArgChanged =
false;
17047 Args.reserve(E->getNumArgs());
17048 if (getDerived().TransformExprs(E->getArgs(), E->getNumArgs(),
false, Args,
17055 = getDerived().TransformType(E->getClassReceiverTypeInfo());
17056 if (!ReceiverTypeInfo)
17060 if (!getDerived().AlwaysRebuild() &&
17061 ReceiverTypeInfo == E->getClassReceiverTypeInfo() && !ArgChanged)
17066 E->getSelectorLocs(SelLocs);
17067 return getDerived().RebuildObjCMessageExpr(ReceiverTypeInfo,
17070 E->getMethodDecl(),
17077 if (!E->getMethodDecl())
17082 E->getSelectorLocs(SelLocs);
17083 return getDerived().RebuildObjCMessageExpr(E->getSuperLoc(),
17086 E->getReceiverType(),
17087 E->getMethodDecl(),
17095 "Only class and instance messages may be instantiated");
17097 = getDerived().TransformExpr(E->getInstanceReceiver());
17098 if (Receiver.isInvalid())
17102 if (!getDerived().AlwaysRebuild() &&
17103 Receiver.get() == E->getInstanceReceiver() && !ArgChanged)
17108 E->getSelectorLocs(SelLocs);
17109 return getDerived().RebuildObjCMessageExpr(Receiver.get(),
17112 E->getMethodDecl(),
17118template<
typename Derived>
17124template<
typename Derived>
17130template<
typename Derived>
17135 if (
Base.isInvalid())
17141 if (!getDerived().AlwaysRebuild() &&
17142 Base.get() == E->getBase())
17145 return getDerived().RebuildObjCIvarRefExpr(
Base.get(), E->getDecl(),
17147 E->isArrow(), E->isFreeIvar());
17150template<
typename Derived>
17155 if (!E->isObjectReceiver())
17160 if (
Base.isInvalid())
17166 if (!getDerived().AlwaysRebuild() &&
17167 Base.get() == E->getBase())
17170 if (E->isExplicitProperty())
17171 return getDerived().RebuildObjCPropertyRefExpr(
Base.get(),
17172 E->getExplicitProperty(),
17175 return getDerived().RebuildObjCPropertyRefExpr(
Base.get(),
17177 E->getImplicitPropertyGetter(),
17178 E->getImplicitPropertySetter(),
17182template<
typename Derived>
17187 if (
Base.isInvalid())
17191 ExprResult Key = getDerived().TransformExpr(E->getKeyExpr());
17192 if (Key.isInvalid())
17196 if (!getDerived().AlwaysRebuild() &&
17197 Key.get() == E->getKeyExpr() &&
Base.get() == E->getBaseExpr())
17200 return getDerived().RebuildObjCSubscriptRefExpr(E->getRBracket(),
17201 Base.get(), Key.get(),
17202 E->getAtIndexMethodDecl(),
17203 E->setAtIndexMethodDecl());
17206template<
typename Derived>
17211 if (
Base.isInvalid())
17215 if (!getDerived().AlwaysRebuild() &&
17216 Base.get() == E->getBase())
17219 return getDerived().RebuildObjCIsaExpr(
Base.get(), E->getIsaMemberLoc(),
17224template<
typename Derived>
17227 bool ArgumentChanged =
false;
17229 SubExprs.reserve(E->getNumSubExprs());
17230 if (getDerived().TransformExprs(E->getSubExprs(), E->getNumSubExprs(),
false,
17231 SubExprs, &ArgumentChanged))
17234 if (!getDerived().AlwaysRebuild() &&
17238 return getDerived().RebuildShuffleVectorExpr(E->getBuiltinLoc(),
17240 E->getRParenLoc());
17243template<
typename Derived>
17246 ExprResult SrcExpr = getDerived().TransformExpr(E->getSrcExpr());
17247 if (SrcExpr.isInvalid())
17254 if (!getDerived().AlwaysRebuild() &&
17255 Type == E->getTypeSourceInfo() &&
17256 SrcExpr.get() == E->getSrcExpr())
17259 return getDerived().RebuildConvertVectorExpr(E->getBuiltinLoc(),
17260 SrcExpr.get(),
Type,
17261 E->getRParenLoc());
17264template<
typename Derived>
17267 BlockDecl *oldBlock = E->getBlockDecl();
17273 blockScope->TheDecl->setBlockMissingReturnType(
17274 oldBlock->blockMissingReturnType());
17283 if (getDerived().TransformFunctionTypeParams(
17284 E->getCaretLocation(), oldBlock->parameters(),
nullptr,
17285 exprFunctionType->getExtParameterInfosOrNull(), paramTypes, ¶ms,
17287 getSema().ActOnBlockError(E->getCaretLocation(),
nullptr);
17292 getDerived().TransformType(exprFunctionType->getReturnType());
17294 auto epi = exprFunctionType->getExtProtoInfo();
17295 epi.ExtParameterInfos = extParamInfos.getPointerOrNull(paramTypes.size());
17298 getDerived().RebuildFunctionProtoType(exprResultType, paramTypes, epi);
17302 if (!params.empty())
17303 blockScope->TheDecl->setParams(params);
17305 if (!oldBlock->blockMissingReturnType()) {
17306 blockScope->HasImplicitReturnType =
false;
17307 blockScope->ReturnType = exprResultType;
17311 StmtResult body = getDerived().TransformStmt(E->getBody());
17312 if (body.isInvalid()) {
17313 getSema().ActOnBlockError(E->getCaretLocation(),
nullptr);
17321 for (
const auto &I : oldBlock->captures()) {
17322 VarDecl *oldCapture = I.getVariable();
17325 if (oldCapture->isParameterPack())
17329 cast<VarDecl>(getDerived().TransformDecl(E->getCaretLocation(),
17331 assert(blockScope->CaptureMap.count(newCapture));
17337 assert((!blockScope->isCXXThisCaptured() || oldBlock->capturesCXXThis()) &&
17338 "this pointer isn't captured in the old block");
17346template<
typename Derived>
17349 ExprResult SrcExpr = getDerived().TransformExpr(E->getSrcExpr());
17350 if (SrcExpr.isInvalid())
17353 QualType Type = getDerived().TransformType(E->getType());
17356 E->getRParenLoc());
17359template<
typename Derived>
17362 bool ArgumentChanged =
false;
17364 SubExprs.reserve(E->getNumSubExprs());
17365 if (getDerived().TransformExprs(E->getSubExprs(), E->getNumSubExprs(),
false,
17366 SubExprs, &ArgumentChanged))
17369 if (!getDerived().AlwaysRebuild() &&
17373 return getDerived().RebuildAtomicExpr(E->getBuiltinLoc(), SubExprs,
17374 E->getOp(), E->getRParenLoc());
17381template<
typename Derived>
17384 return SemaRef.BuildPointerType(PointeeType,
Star,
17388template<
typename Derived>
17391 return SemaRef.BuildBlockPointerType(PointeeType,
Star,
17395template<
typename Derived>
17398 bool WrittenAsLValue,
17400 return SemaRef.BuildReferenceType(ReferentType, WrittenAsLValue,
17404template <
typename Derived>
17408 return SemaRef.BuildMemberPointerType(PointeeType, SS, Cls, Sigil,
17412template<
typename Derived>
17419 return SemaRef.ObjC().BuildObjCTypeParamType(
17420 Decl, ProtocolLAngleLoc, Protocols, ProtocolLocs, ProtocolRAngleLoc,
17424template<
typename Derived>
17435 return SemaRef.ObjC().BuildObjCObjectType(
17436 BaseType, Loc, TypeArgsLAngleLoc, TypeArgs, TypeArgsRAngleLoc,
17437 ProtocolLAngleLoc, Protocols, ProtocolLocs, ProtocolRAngleLoc,
17442template<
typename Derived>
17446 return SemaRef.Context.getObjCObjectPointerType(PointeeType);
17449template <
typename Derived>
17452 Expr *SizeExpr,
unsigned IndexTypeQuals,
SourceRange BracketsRange) {
17453 if (SizeExpr || !Size)
17454 return SemaRef.BuildArrayType(ElementType, SizeMod, SizeExpr,
17455 IndexTypeQuals, BracketsRange,
17459 SemaRef.Context.UnsignedCharTy,
SemaRef.Context.UnsignedShortTy,
17461 SemaRef.Context.UnsignedLongLongTy,
SemaRef.Context.UnsignedInt128Ty
17464 for (
const auto &
T : Types)
17465 if (Size->getBitWidth() ==
SemaRef.Context.getIntWidth(
T)) {
17475 return SemaRef.BuildArrayType(ElementType, SizeMod, ArraySize,
17476 IndexTypeQuals, BracketsRange,
17480template <
typename Derived>
17483 Expr *SizeExpr,
unsigned IndexTypeQuals,
SourceRange BracketsRange) {
17484 return getDerived().RebuildArrayType(ElementType, SizeMod, &Size, SizeExpr,
17485 IndexTypeQuals, BracketsRange);
17488template <
typename Derived>
17492 return getDerived().RebuildArrayType(ElementType, SizeMod,
nullptr,
nullptr,
17493 IndexTypeQuals, BracketsRange);
17496template <
typename Derived>
17499 unsigned IndexTypeQuals,
SourceRange BracketsRange) {
17500 return getDerived().RebuildArrayType(ElementType, SizeMod,
nullptr,
17502 IndexTypeQuals, BracketsRange);
17505template <
typename Derived>
17508 unsigned IndexTypeQuals,
SourceRange BracketsRange) {
17509 return getDerived().RebuildArrayType(ElementType, SizeMod,
nullptr,
17511 IndexTypeQuals, BracketsRange);
17514template <
typename Derived>
17517 return SemaRef.BuildAddressSpaceAttr(PointeeType, AddrSpaceExpr,
17521template <
typename Derived>
17523 unsigned NumElements,
17526 return SemaRef.Context.getVectorType(ElementType, NumElements, VecKind);
17529template <
typename Derived>
17533 return SemaRef.BuildVectorType(ElementType, SizeExpr, AttributeLoc);
17536template<
typename Derived>
17538 unsigned NumElements,
17540 llvm::APInt numElements(
SemaRef.Context.getIntWidth(
SemaRef.Context.IntTy),
17541 NumElements,
true);
17545 return SemaRef.BuildExtVectorType(ElementType, VectorSize, AttributeLoc);
17548template<
typename Derived>
17553 return SemaRef.BuildExtVectorType(ElementType, SizeExpr, AttributeLoc);
17556template <
typename Derived>
17558 QualType ElementType,
unsigned NumRows,
unsigned NumColumns) {
17559 return SemaRef.Context.getConstantMatrixType(ElementType, NumRows,
17563template <
typename Derived>
17567 return SemaRef.BuildMatrixType(ElementType, RowExpr, ColumnExpr,
17571template <
typename Derived>
17575 return SemaRef.BuildFunctionType(
T, ParamTypes,
17581template<
typename Derived>
17583 return SemaRef.Context.getFunctionNoProtoType(
T);
17586template <
typename Derived>
17590 assert(D &&
"no decl found");
17594 if (
auto *UPD = dyn_cast<UsingPackDecl>(D)) {
17598 if (UPD->expansions().empty()) {
17599 getSema().Diag(NameLoc, diag::err_using_pack_expansion_empty)
17600 << UPD->isCXXClassMember() << UPD;
17609 for (
auto *E : UPD->expansions()) {
17616 else if (
T.isNull())
17619 assert(
getSema().Context.hasSameType(ThisT,
T) &&
17620 "mismatched resolved types in using pack expansion");
17622 return T.isNull() ? FallbackT :
T;
17624 if (
auto *Using = dyn_cast<UsingDecl>(D)) {
17625 assert(Using->hasTypename() &&
17626 "UnresolvedUsingTypenameDecl transformed to non-typename using");
17629 assert(++Using->shadow_begin() == Using->shadow_end());
17634 return SemaRef.Context.getUsingType(
Keyword, Qualifier, Shadow);
17637 "UnresolvedUsingTypenameDecl transformed to non-using decl");
17638 return SemaRef.Context.getUnresolvedUsingType(
17642template <
typename Derived>
17645 return SemaRef.BuildTypeofExprType(E, Kind);
17648template<
typename Derived>
17651 return SemaRef.Context.getTypeOfType(Underlying, Kind);
17654template <
typename Derived>
17656 return SemaRef.BuildDecltypeType(E);
17659template <
typename Derived>
17664 return SemaRef.BuildPackIndexingType(Pattern, IndexExpr, Loc, EllipsisLoc,
17665 FullySubstituted, Expansions);
17668template<
typename Derived>
17670 UnaryTransformType::UTTKind UKind,
17672 return SemaRef.BuildUnaryTransformType(BaseType, UKind, Loc);
17675template <
typename Derived>
17679 return SemaRef.CheckTemplateIdType(
17684template<
typename Derived>
17687 return SemaRef.BuildAtomicType(ValueType, KWLoc);
17690template<
typename Derived>
17694 return isReadPipe ?
SemaRef.BuildReadPipeType(ValueType, KWLoc)
17695 :
SemaRef.BuildWritePipeType(ValueType, KWLoc);
17698template <
typename Derived>
17702 llvm::APInt NumBitsAP(
SemaRef.Context.getIntWidth(
SemaRef.Context.IntTy),
17706 return SemaRef.BuildBitIntType(IsUnsigned, Bits, Loc);
17709template <
typename Derived>
17712 return SemaRef.BuildBitIntType(IsUnsigned, NumBitsExpr, Loc);
17715template <
typename Derived>
17723template <
typename Derived>
17730 getSema().ActOnTemplateName(
nullptr, SS, TemplateKWLoc,
17733 AllowInjectedClassName);
17737template<
typename Derived>
17744 bool AllowInjectedClassName) {
17747 SourceLocation SymbolLocations[3] = { NameLoc, NameLoc, NameLoc };
17752 false,
Template, AllowInjectedClassName);
17756template <
typename Derived>
17761 bool isPostIncDec = Second && (Op == OO_PlusPlus || Op == OO_MinusMinus);
17766 return SemaRef.PseudoObject().checkAssignment(
nullptr, OpLoc,
17767 Opc,
First, Second);
17782 if (Op == OO_Subscript) {
17783 if (!
First->getType()->isOverloadableType() &&
17785 return getSema().CreateBuiltinArraySubscriptExpr(
First, CalleeLoc, Second,
17787 }
else if (Op == OO_Arrow) {
17790 if (
First->getType()->isDependentType())
17793 return SemaRef.BuildOverloadedArrowExpr(
nullptr,
First, OpLoc);
17794 }
else if (Second ==
nullptr || isPostIncDec) {
17795 if (!
First->getType()->isOverloadableType() ||
17796 (Op == OO_Amp &&
getSema().isQualifiedMemberAccess(
First))) {
17803 return getSema().CreateBuiltinUnaryOp(OpLoc, Opc,
First);
17807 !
First->getType()->isOverloadableType() &&
17813 =
SemaRef.CreateBuiltinBinOp(OpLoc, Opc,
First, Second);
17822 if (!Second || isPostIncDec) {
17825 return SemaRef.CreateOverloadedUnaryOp(OpLoc, Opc, Functions,
First,
17832 First, Second, RequiresADL);
17839template<
typename Derived>
17849 QualType CanonicalBaseType =
Base->getType().getCanonicalType();
17855 ->getAsCanonical<RecordType>())) {
17857 return SemaRef.BuildPseudoDestructorExpr(
17858 Base, OperatorLoc, isArrow ? tok::arrow : tok::period, SS, ScopeType,
17859 CCLoc, TildeLoc, Destroyed);
17871 if (!
isa<TagType>(ScopeType->getType().getCanonicalType())) {
17872 getSema().Diag(ScopeType->getTypeLoc().getBeginLoc(),
17873 diag::err_expected_class_or_namespace)
17874 << ScopeType->getType() <<
getSema().getLangOpts().CPlusPlus;
17878 SS.
Make(
SemaRef.Context, ScopeType->getTypeLoc(), CCLoc);
17882 return getSema().BuildMemberReferenceExpr(
17883 Base,
Base->getType(), OperatorLoc, isArrow, SS, TemplateKWLoc,
17889template<
typename Derived>
17897 for (
unsigned I = 0; I < NumParams; ++I) {
17898 if (I != ContextParamPos) {
17904 Params.push_back(std::make_pair(StringRef(), QualType()));
17907 getSema().ActOnCapturedRegionStart(Loc,
nullptr,
17915 if (Body.isInvalid()) {
17916 getSema().ActOnCapturedRegionError();
17920 return getSema().ActOnCapturedRegionEnd(Body.get());
17923template <
typename Derived>
17929 llvm_unreachable(
"SYCL kernel call statement cannot appear in dependent "
17933template <
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.
llvm::MachO::Record Record
This file defines OpenMP AST classes for clauses.
Defines some OpenMP-specific enums and functions.
This file declares semantic analysis for Objective-C.
This file declares semantic analysis for OpenACC constructs and clauses.
This file declares semantic analysis for OpenMP constructs and clauses.
This file declares semantic analysis for expressions involving.
This file declares semantic analysis for SYCL constructs.
static bool PreparePackForExpansion(Sema &S, const CXXBaseSpecifier &Base, const MultiLevelTemplateArgumentList &TemplateArgs, TypeSourceInfo *&Out, UnexpandedInfo &Info)
Defines the Objective-C statement AST node classes.
This file defines OpenACC AST classes for statement-level contructs.
This file defines OpenMP AST classes for executable directives and clauses.
This file defines SYCL AST classes used to represent calls to SYCL kernels.
static QualType getPointeeType(const MemRegion *R)
This represents clause 'map' in the 'pragma omp ...' directives.
This represents clauses with a list of expressions that are mappable. Examples of these clauses are '...
QualType getAttributedType(attr::Kind attrKind, QualType modifiedType, QualType equivalentType, const Attr *attr=nullptr) const
QualType getArrayParameterType(QualType Ty) const
Return the uniqued reference to a specified array parameter type from the original array type.
QualType getSubstTemplateTypeParmType(QualType Replacement, Decl *AssociatedDecl, unsigned Index, UnsignedOrNone PackIndex, bool Final) const
Retrieve a substitution-result type.
QualType getDecayedType(QualType T) const
Return the uniqued reference to the decayed version of the given type.
QualType getBaseElementType(const ArrayType *VAT) const
Return the innermost element type of an array type.
TypeSourceInfo * getTrivialTypeSourceInfo(QualType T, SourceLocation Loc=SourceLocation()) const
Allocate a TypeSourceInfo where all locations have been initialized to a given location,...
CanQualType PseudoObjectTy
QualType getObjCObjectPointerType(QualType OIT) const
Return a ObjCObjectPointerType type for the given ObjCObjectType.
const ArrayType * getAsArrayType(QualType T) const
Type Query functions.
QualType getPackExpansionType(QualType Pattern, UnsignedOrNone NumExpansions, bool ExpectPackInType=true) const
Form a pack expansion type with the given pattern.
static bool hasSameType(QualType T1, QualType T2)
Determine whether the given types T1 and T2 are equivalent.
QualType getSizeType() const
Return the unique type for "size_t" (C99 7.17), defined in <stddef.h>.
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.
attr::Kind getKind() const
Represents an attribute applied to a statement.
SourceLocation getAttrLoc() const
ArrayRef< const Attr * > getAttrs() const
Type source information for an attributed type.
void setAttr(const Attr *A)
Type source information for an btf_tag attributed type.
BinaryConditionalOperator - The GNU extension to the conditional operator which allows the middle ope...
A builtin binary operation expression such as "x + y" or "x <= y".
static OverloadedOperatorKind getOverloadedOperator(Opcode Opc)
Retrieve the overloaded operator kind that corresponds to the given binary opcode.
static bool isAssignmentOp(Opcode Opc)
static Opcode getOverloadedOpcode(OverloadedOperatorKind OO)
Retrieve the binary opcode that corresponds to the given overloaded operator.
A fixed int type of a specified bitwidth.
Represents a block literal declaration, which is like an unnamed FunctionDecl.
void setIsVariadic(bool value)
BlockExpr - Adaptor class for mixing a BlockDecl with expressions.
Wrapper for source info for block pointers.
BreakStmt - This represents a break.
Represents a C++2a __builtin_bit_cast(T, v) expression.
SourceLocation getEndLoc() const LLVM_READONLY
SourceLocation getBeginLoc() const LLVM_READONLY
CStyleCastExpr - An explicit cast in C (C99 6.5.4) or a C-style cast in C++ (C++ [expr....
Represents a call to a CUDA kernel function.
A C++ addrspace_cast expression (currently only enabled for OpenCL).
Represents binding an expression to a temporary.
A boolean literal, per ([C++ lex.bool] Boolean literals).
CXXCatchStmt - This represents a C++ catch block.
A C++ const_cast expression (C++ [expr.const.cast]).
Represents a call to a C++ constructor.
SourceRange getParenOrBraceRange() const
Expr * getArg(unsigned Arg)
Return the specified argument.
bool isStdInitListInitialization() const
Whether this constructor call was written as list-initialization, but was interpreted as forming a st...
SourceLocation getEndLoc() const LLVM_READONLY
SourceLocation getBeginLoc() const LLVM_READONLY
bool isListInitialization() const
Whether this constructor call was written as list-initialization.
unsigned getNumArgs() const
Return the number of arguments to the constructor call.
Represents a C++ constructor within a class.
A default argument (C++ [dcl.fct.default]).
static CXXDefaultArgExpr * Create(const ASTContext &C, SourceLocation Loc, ParmVarDecl *Param, Expr *RewrittenExpr, DeclContext *UsedContext)
A use of a default initializer in a constructor or in aggregate initialization.
Represents a delete expression for memory deallocation and destructor calls, e.g.
Represents a C++ member access expression where the actual member referenced could not be resolved be...
Represents a C++ destructor within a class.
A C++ dynamic_cast expression (C++ [expr.dynamic.cast]).
Represents a folding of a pack over an operator.
CXXForRangeStmt - This represents C++0x [stmt.ranged]'s ranged for statement, represented as 'for (ra...
Represents an explicit C++ type conversion that uses "functional" notation (C++ [expr....
Represents a call to an inherited base class constructor from an inheriting constructor.
Represents a call to a member function that may be written either with member call syntax (e....
Represents a static or instance method of a struct/union/class.
Abstract class common to all of the C++ "named"/"keyword" casts.
SourceLocation getOperatorLoc() const
Retrieve the location of the cast operator keyword, e.g., static_cast.
SourceRange getAngleBrackets() const LLVM_READONLY
SourceLocation getRParenLoc() const
Retrieve the location of the closing parenthesis.
Represents a new-expression for memory allocation and constructor calls, e.g: "new CXXNewExpr(foo)".
Represents a C++11 noexcept expression (C++ [expr.unary.noexcept]).
The null pointer literal (C++11 [lex.nullptr])
A call to an overloaded operator written using operator syntax.
Represents a list-initialization with parenthesis.
Represents a C++ pseudo-destructor (C++ [expr.pseudo]).
Represents a C++ struct/union/class.
unsigned getLambdaDependencyKind() const
A C++ reinterpret_cast expression (C++ [expr.reinterpret.cast]).
A rewritten comparison expression that was originally written using operator syntax.
An expression "T()" which creates an rvalue of a non-class type T.
Represents a C++ nested-name-specifier or a global scope specifier.
void Make(ASTContext &Context, TypeLoc TL, SourceLocation ColonColonLoc)
Make a nested-name-specifier of the form 'type::'.
char * location_data() const
Retrieve the data associated with the source-location information.
SourceRange getRange() const
void MakeGlobal(ASTContext &Context, SourceLocation ColonColonLoc)
Turn this (empty) nested-name-specifier into the global nested-name-specifier '::'.
NestedNameSpecifier getScopeRep() const
Retrieve the representation of the nested-name-specifier.
NestedNameSpecifierLoc getWithLocInContext(ASTContext &Context) const
Retrieve a nested-name-specifier with location information, copied into the given AST context.
unsigned location_size() const
Retrieve the size of the data associated with source-location information.
void Extend(ASTContext &Context, NamespaceBaseDecl *Namespace, SourceLocation NamespaceLoc, SourceLocation ColonColonLoc)
Extend the current nested-name-specifier by another nested-name-specifier component of the form 'name...
void MakeMicrosoftSuper(ASTContext &Context, CXXRecordDecl *RD, SourceLocation SuperLoc, SourceLocation ColonColonLoc)
Turns this (empty) nested-name-specifier into '__super' nested-name-specifier.
bool isEmpty() const
No scope specifier.
void Adopt(NestedNameSpecifierLoc Other)
Adopt an existing nested-name-specifier (with source-range information).
Implicit construction of a std::initializer_list<T> object from an array temporary within list-initia...
Represents a C++ functional cast expression that builds a temporary object.
Represents the this expression in C++.
A C++ throw-expression (C++ [except.throw]).
CXXTryStmt - A C++ try block, including all handlers.
A C++ typeid expression (C++ [expr.typeid]), which gets the type_info that corresponds to the supplie...
Describes an explicit type conversion that uses functional notion but could not be resolved because o...
SourceLocation getLParenLoc() const
Retrieve the location of the left parentheses ('(') that precedes the argument list.
bool isListInitialization() const
Determine whether this expression models list-initialization.
TypeSourceInfo * getTypeSourceInfo() const
Retrieve the type source information for the type being constructed.
SourceLocation getRParenLoc() const
Retrieve the location of the right parentheses (')') that follows the argument list.
unsigned getNumArgs() const
Retrieve the number of arguments.
A Microsoft C++ __uuidof expression, which gets the _GUID that corresponds to the supplied type or ex...
CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).
static CallExpr * Create(const ASTContext &Ctx, Expr *Fn, ArrayRef< Expr * > Args, QualType Ty, ExprValueKind VK, SourceLocation RParenLoc, FPOptionsOverride FPFeatures, unsigned MinNumArgs=0, ADLCallKind UsesADL=NotADL)
Create a call expression.
Represents the body of a CapturedStmt, and serves as its DeclContext.
unsigned getNumParams() const
unsigned getContextParamPosition() const
ImplicitParamDecl * getParam(unsigned i) const
This captures a statement into a function.
CapturedDecl * getCapturedDecl()
Retrieve the outlined function declaration.
Stmt * getCapturedStmt()
Retrieve the statement being captured.
SourceLocation getBeginLoc() const LLVM_READONLY
CapturedRegionKind getCapturedRegionKind() const
Retrieve the captured region kind.
CaseStmt - Represent a case statement.
Expr * getSubExprAsWritten()
Retrieve the cast subexpression as it was written in the source code, looking through any implicit ca...
ChooseExpr - GNU builtin-in function __builtin_choose_expr.
Represents a 'co_await' expression.
CompoundAssignOperator - For compound assignments (e.g.
CompoundLiteralExpr - [C99 6.5.2.5].
CompoundStmt - This represents a group of statements like { stmt stmt }.
FPOptionsOverride getStoredFPFeatures() const
Get FPOptionsOverride from trailing storage.
SourceLocation getLBracLoc() const
bool hasStoredFPFeatures() const
SourceLocation getRBracLoc() const
Declaration of a C++20 concept.
static ConceptReference * Create(const ASTContext &C, NestedNameSpecifierLoc NNS, SourceLocation TemplateKWLoc, DeclarationNameInfo ConceptNameInfo, NamedDecl *FoundDecl, TemplateDecl *NamedConcept, const ASTTemplateArgumentListInfo *ArgsAsWritten)
Represents the specialization of a concept - evaluates to a prvalue of type bool.
const TypeClass * getTypePtr() const
ConditionalOperator - The ?
Represents the canonical version of C arrays with a specified constant size.
ConstantExpr - An expression that occurs in a constant context and optionally the result of evaluatin...
Represents a concrete matrix type with constant number of rows and columns.
ContinueStmt - This represents a continue.
ConvertVectorExpr - Clang builtin function __builtin_convertvector This AST node provides support for...
Represents a 'co_return' statement in the C++ Coroutines TS.
Represents the body of a coroutine.
Represents a sugar type with __counted_by or __sized_by annotations, including their _or_null variant...
Represents a 'co_yield' expression.
Wrapper for source info for pointers decayed from arrays and functions.
static DeclAccessPair make(NamedDecl *D, AccessSpecifier AS)
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
DeclContext * getParent()
getParent - Returns the containing DeclContext.
DeclContextLookupResult lookup_result
lookup_result lookup(DeclarationName Name) const
lookup - Find the declarations (if any) with the given Name in this context.
void addDecl(Decl *D)
Add the declaration D into this context.
A reference to a declared variable, function, enum, etc.
DeclStmt - Adaptor class for mixing declarations with statements and expressions.
Decl - This represents one declaration (or definition), e.g.
bool isInvalidDecl() const
SourceLocation getLocation() const
DeclContext * getDeclContext()
AccessSpecifier getAccess() const
The name of a declaration.
TemplateDecl * getCXXDeductionGuideTemplate() const
If this name is the name of a C++ deduction guide, return the template associated with that name.
@ CXXConversionFunctionName
QualType getCXXNameType() const
If this name is one of the C++ names (of a constructor, destructor, or conversion function),...
NameKind getNameKind() const
Determine what kind of name this is.
SourceLocation getInnerLocStart() const
Return start of source range ignoring outer template declarations.
TypeSourceInfo * getTypeSourceInfo() const
Information about one declarator, including the parsed type information and the identifier.
void setDecltypeLoc(SourceLocation Loc)
void setElaboratedKeywordLoc(SourceLocation Loc)
DeferStmt - This represents a deferred statement.
static DeferStmt * Create(ASTContext &Context, SourceLocation DeferLoc, Stmt *Body)
void setAttrOperandParensRange(SourceRange range)
Represents an extended address space qualifier where the input address space value is dependent.
Represents a 'co_await' expression while the type of the promise is dependent.
void setElaboratedKeywordLoc(SourceLocation Loc)
A qualified reference to a name whose declaration cannot yet be resolved.
SourceLocation getRAngleLoc() const
Retrieve the location of the right angle bracket ending the explicit template argument list following...
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies the name, with source location information.
SourceLocation getLAngleLoc() const
Retrieve the location of the left angle bracket starting the explicit template argument list followin...
bool hasExplicitTemplateArgs() const
Determines whether this lookup had explicit template arguments.
SourceLocation getTemplateKeywordLoc() const
Retrieve the location of the template keyword preceding this name, if any.
unsigned getNumTemplateArgs() const
DeclarationName getDeclName() const
Retrieve the name that this expression refers to.
TemplateArgumentLoc const * getTemplateArgs() const
const DeclarationNameInfo & getNameInfo() const
Retrieve the name that this expression refers to.
Represents an array type in C++ whose size is a value-dependent expression.
void setNameLoc(SourceLocation Loc)
Represents an extended vector type where either the type or size is dependent.
Represents a matrix type where the type and the number of rows and columns is dependent on a template...
void setNameLoc(SourceLocation Loc)
Represents a vector type where either the type or size is dependent.
Represents a single C99 designator.
Represents a C99 designated initializer expression.
Designation - Represent a full designation, which is a sequence of designators.
static Designator CreateArrayRangeDesignator(Expr *Start, Expr *End, SourceLocation LBracketLoc, SourceLocation EllipsisLoc)
Creates a GNU array-range designator.
static Designator CreateArrayDesignator(Expr *Index, SourceLocation LBracketLoc)
Creates an array designator.
static Designator CreateFieldDesignator(const IdentifierInfo *FieldName, SourceLocation DotLoc, SourceLocation FieldLoc)
Creates a field designator.
bool hasErrorOccurred() const
DoStmt - This represents a 'do/while' stmt.
Wrap a function effect's condition expression in another struct so that FunctionProtoType's TrailingO...
Expr * getCondition() const
void set(SourceLocation ElaboratedKeywordLoc, NestedNameSpecifierLoc QualifierLoc, SourceLocation NameLoc)
Represents a reference to emded data.
RAII object that enters a new expression evaluation context.
Wrapper for source info for enum types.
TypeSourceInfo * getTypeInfoAsWritten() const
getTypeInfoAsWritten - Returns the type source info for the type that this expression is casting to.
Represents an expression – generally a full-expression – that introduces cleanups to be run at the en...
This represents one expression.
bool isValueDependent() const
Determines whether the value of this expression depends on.
bool isTypeDependent() const
Determines whether the type of this expression depends on.
ExprObjectKind getObjectKind() const
getObjectKind - The object kind that this expression produces.
Expr * IgnoreImplicitAsWritten() LLVM_READONLY
Skip past any implicit AST nodes which might surround this expression until reaching a fixed point.
bool isDefaultArgument() const
Determine whether this expression is a default function argument.
bool hasPlaceholderType() const
Returns whether this expression has a placeholder type.
static ExprValueKind getValueKindForType(QualType T)
getValueKindForType - Given a formal return or parameter type, give its value kind.
An expression trait intrinsic.
ExtVectorElementExpr - This represents access to specific elements of a vector, and may occur on the ...
Represents difference between two FPOptions values.
FPOptions applyOverrides(FPOptions Base)
Represents a member of a struct/union/class.
ForStmt - This represents a 'for (init;cond;inc)' stmt.
Represents a function declaration or definition.
ArrayRef< ParmVarDecl * > parameters() const
SmallVector< Conflict > Conflicts
Represents an abstract function effect, using just an enumeration describing its kind.
StringRef name() const
The description printed in diagnostics, e.g. 'nonblocking'.
Kind oppositeKind() const
Return the opposite kind, for effects which have opposites.
ArrayRef< EffectConditionExpr > conditions() const
Represents a K&R-style 'int foo()' function, which has no information available about its arguments.
Represents a reference to a function parameter pack, init-capture pack, or binding pack that has been...
Represents a prototype with parameter type info, e.g.
param_type_iterator param_type_begin() const
unsigned getNumParams() const
SourceLocation getLocalRangeEnd() const
void setLocalRangeBegin(SourceLocation L)
void setLParenLoc(SourceLocation Loc)
SourceRange getExceptionSpecRange() const
void setParam(unsigned i, ParmVarDecl *VD)
ArrayRef< ParmVarDecl * > getParams() const
void setRParenLoc(SourceLocation Loc)
void setLocalRangeEnd(SourceLocation L)
void setExceptionSpecRange(SourceRange R)
TypeLoc getReturnLoc() const
SourceLocation getLocalRangeBegin() const
SourceLocation getLParenLoc() const
SourceLocation getRParenLoc() const
Interesting information about a specific parameter that can't simply be reflected in parameter's type...
This represents a GCC inline-assembly statement extension.
GNUNullExpr - Implements the GNU __null extension, which is a name for a null pointer constant that h...
Represents a C11 generic selection.
AssociationTy< false > Association
GotoStmt - This represents a direct goto.
Type source information for HLSL attributed resource type.
void setSourceRange(const SourceRange &R)
This class represents temporary values used to represent inout and out arguments in HLSL.
One of these records is kept for each identifier that is lexed.
IfStmt - This represents an if/then/else.
ImaginaryLiteral - We support imaginary integer and floating point literals, like "1....
ImplicitCastExpr - Allows us to explicitly represent implicit type conversions, which have no direct ...
Represents an implicitly-generated value initialization of an object of a given type.
Represents a C array with an unspecified size.
IndirectGotoStmt - This represents an indirect goto.
const TypeClass * getTypePtr() const
Describes an C or C++ initializer list.
InitListExpr * getSyntacticForm() const
Wrapper for source info for injected class names of class templates.
static IntegerLiteral * Create(const ASTContext &C, const llvm::APInt &V, QualType type, SourceLocation l)
Returns a new integer literal with value 'V' and type 'type'.
Represents the declaration of a label.
LabelStmt - Represents a label, which has a substatement.
A C++ lambda expression, which produces a function object (of unspecified type) that can be invoked l...
capture_iterator capture_begin() const
Retrieve an iterator pointing to the first lambda capture.
bool isInitCapture(const LambdaCapture *Capture) const
Determine whether one of this lambda's captures is an init-capture.
capture_iterator capture_end() const
Retrieve an iterator pointing past the end of the sequence of lambda captures.
const LambdaCapture * capture_iterator
An iterator that walks over the captures of the lambda, both implicit and explicit.
Represents the results of name lookup.
LLVM_ATTRIBUTE_REINITIALIZES void clear()
Clears out any current state.
void addDecl(NamedDecl *D)
Add a declaration to these results with its natural access.
bool empty() const
Return true if no decls were found.
void resolveKind()
Resolves the result kind of the lookup, possibly hiding decls.
SourceLocation getNameLoc() const
Gets the location of the identifier.
NamedDecl * getRepresentativeDecl() const
Fetches a representative decl. Useful for lazy diagnostics.
DeclarationName getLookupName() const
Gets the name to look up.
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.
NamedDecl * getUnderlyingDecl()
Looks through UsingDecls and ObjCCompatibleAliasDecls for the underlying named decl.
IdentifierInfo * getIdentifier() const
Get the identifier that names this declaration, if there is one.
StringRef getName() const
Get the name of identifier for this declaration as a StringRef.
DeclarationName getDeclName() const
Get the actual, stored name of the declaration, which may be a special name.
Represents C++ namespaces and their aliases.
Class that aids in the construction of nested-name-specifiers along with source-location information ...
void MakeTrivial(ASTContext &Context, NestedNameSpecifier Qualifier, SourceRange R)
Make a new nested-name-specifier from incomplete source-location information.
A C++ nested-name-specifier augmented with source location information.
NestedNameSpecifier getNestedNameSpecifier() const
Retrieve the nested-name-specifier to which this instance refers.
SourceLocation getLocalEndLoc() const
Retrieve the location of the end of this component of the nested-name-specifier.
SourceRange getSourceRange() const LLVM_READONLY
Retrieve the source range covering the entirety of this nested-name-specifier.
SourceLocation getEndLoc() const
Retrieve the location of the end of this nested-name-specifier.
SourceLocation getBeginLoc() const
Retrieve the location of the beginning of this nested-name-specifier.
TypeLoc castAsTypeLoc() const
For a nested-name-specifier that refers to a type, retrieve the type with source-location information...
void * getOpaqueData() const
Retrieve the opaque pointer that refers to source-location data.
SourceLocation getLocalBeginLoc() const
Retrieve the location of the beginning of this component of the nested-name-specifier.
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
NamespaceAndPrefix getAsNamespaceAndPrefix() const
CXXRecordDecl * getAsRecordDecl() const
Retrieve the record declaration stored in this nested name specifier, or null.
bool isDependent() const
Whether this nested name specifier refers to a dependent type or not.
@ MicrosoftSuper
Microsoft's '__super' specifier, stored as a CXXRecordDecl* of the class it appeared in.
@ Global
The global specifier '::'. There is no stored value.
@ Type
A type, stored as a Type*.
@ Namespace
A namespace-like entity, stored as a NamespaceBaseDecl*.
Represents a place-holder for an object not to be initialized by anything.
NonTypeTemplateParmDecl - Declares a non-type template parameter, e.g., "Size" in.
NullStmt - This is the null statement ";": C99 6.8.3p3.
This represents the 'align' clause in the 'pragma omp allocate' directive.
This represents clause 'allocate' in the 'pragma omp ...' directives.
This represents 'allocator' clause in the 'pragma omp ...' directive.
An explicit cast in C or a C-style cast in C++, which uses the syntax ([s1][s2]......
This is a basic class for representing single OpenMP clause.
OpenMPClauseKind getClauseKind() const
Returns kind of OpenMP clause (private, shared, reduction, etc.).
This represents 'collapse' clause in the 'pragma omp ...' directive.
This represents '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)
A reference to an overloaded function set, either an UnresolvedLookupExpr or an UnresolvedMemberExpr.
bool hasExplicitTemplateArgs() const
Determines whether this expression had explicit template arguments.
SourceLocation getLAngleLoc() const
Retrieve the location of the left angle bracket starting the explicit template argument list followin...
SourceLocation getNameLoc() const
Gets the location of the name.
SourceLocation getTemplateKeywordLoc() const
Retrieve the location of the template keyword preceding this name, if any.
NestedNameSpecifierLoc getQualifierLoc() const
Fetches the nested-name qualifier with source-location information, if one was given.
TemplateArgumentLoc const * getTemplateArgs() const
llvm::iterator_range< decls_iterator > decls() const
unsigned getNumTemplateArgs() const
DeclarationName getName() const
Gets the name looked up.
SourceLocation getRAngleLoc() const
Retrieve the location of the right angle bracket ending the explicit template argument list following...
bool hasTemplateKeyword() const
Determines whether the name was preceded by the template keyword.
Represents a C++11 pack expansion that produces a sequence of expressions.
void setEllipsisLoc(SourceLocation Loc)
SourceLocation getEllipsisLoc() const
TypeLoc getPatternLoc() const
void setEllipsisLoc(SourceLocation Loc)
ParenExpr - This represents a parenthesized expression, e.g.
SourceLocation getLParen() const
Get the location of the left parentheses '('.
SourceLocation getRParen() const
Get the location of the right parentheses ')'.
void setLParenLoc(SourceLocation Loc)
Represents a parameter to a function.
unsigned getFunctionScopeIndex() const
Returns the index of this parameter in its prototype or method scope.
void setScopeInfo(unsigned scopeDepth, unsigned parameterIndex)
static ParmVarDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, const IdentifierInfo *Id, QualType T, TypeSourceInfo *TInfo, StorageClass S, Expr *DefArg)
unsigned getFunctionScopeDepth() const
void setKWLoc(SourceLocation Loc)
Pointer-authentication qualifiers.
void setSigilLoc(SourceLocation Loc)
TypeLoc getPointeeLoc() const
SourceLocation getSigilLoc() const
Wrapper for source info for pointers.
PointerType - C99 6.7.5.1 - Pointer Declarators.
[C99 6.4.2.2] - A predefined identifier such as func.
Stores the type being destroyed by a pseudo-destructor expression.
const IdentifierInfo * getIdentifier() const
SourceLocation getLocation() const
TypeSourceInfo * getTypeSourceInfo() const
PseudoObjectExpr - An expression which accesses a pseudo-object l-value.
A (possibly-)qualified type.
bool isNull() const
Return true if this QualType doesn't point to a type yet.
const Type * getTypePtr() const
Retrieves a pointer to the underlying (unqualified) type.
Qualifiers getQualifiers() const
Retrieve the set of qualifiers applied to this type.
QualType getUnqualifiedType() const
Retrieve the unqualified variant of the given type, removing as little sugar as possible.
Qualifiers getLocalQualifiers() const
Retrieve the set of qualifiers local to this particular QualType instance, not including any qualifie...
Represents a template name as written in source code.
Wrapper of type source information for a type with non-trivial direct qualifiers.
The collection of all-type qualifiers we support.
void removeObjCLifetime()
static Qualifiers fromCVRMask(unsigned CVR)
PointerAuthQualifier getPointerAuth() const
bool hasObjCLifetime() const
LangAS getAddressSpace() const
Frontend produces RecoveryExprs on semantic errors that prevent creating other well-formed expression...
Base for LValueReferenceType and RValueReferenceType.
QualType getPointeeTypeAsWritten() const
Represents the body of a requires-expression.
static RequiresExprBodyDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc)
C++2a [expr.prim.req]: A requires-expression provides a concise way to express requirements on templa...
static RequiresExpr * Create(ASTContext &C, SourceLocation RequiresKWLoc, RequiresExprBodyDecl *Body, SourceLocation LParenLoc, ArrayRef< ParmVarDecl * > LocalParameters, SourceLocation RParenLoc, ArrayRef< concepts::Requirement * > Requirements, SourceLocation RBraceLoc)
ReturnStmt - This represents a return, optionally of an expression: return; return 4;.
static SEHFinallyStmt * Create(const ASTContext &C, SourceLocation FinallyLoc, Stmt *Block)
Represents a __leave statement.
SYCLKernelCallStmt represents the transformation that is applied to the body of a function declared w...
Smart pointer class that efficiently represents Objective-C method names.
SemaDiagnosticBuilder Diag(SourceLocation Loc, unsigned DiagID)
Emit a diagnostic.
VarDecl * BuildObjCExceptionDecl(TypeSourceInfo *TInfo, QualType ExceptionType, SourceLocation StartLoc, SourceLocation IdLoc, const IdentifierInfo *Id, bool Invalid=false)
Build a type-check a new Objective-C exception variable declaration.
StmtResult ActOnObjCForCollectionStmt(SourceLocation ForColLoc, Stmt *First, Expr *collection, SourceLocation RParenLoc)
StmtResult FinishObjCForCollectionStmt(Stmt *ForCollection, Stmt *Body)
FinishObjCForCollectionStmt - Attach the body to a objective-C foreach statement.
ExprResult BuildObjCDictionaryLiteral(SourceRange SR, MutableArrayRef< ObjCDictionaryElement > Elements)
StmtResult ActOnObjCAtSynchronizedStmt(SourceLocation AtLoc, Expr *SynchExpr, Stmt *SynchBody)
ExprResult BuildObjCArrayLiteral(SourceRange SR, MultiExprArg Elements)
ExprResult BuildObjCBoxedExpr(SourceRange SR, Expr *ValueExpr)
BuildObjCBoxedExpr - builds an ObjCBoxedExpr AST node for the '@' prefixed parenthesized expression.
StmtResult ActOnObjCAtTryStmt(SourceLocation AtLoc, Stmt *Try, MultiStmtArg Catch, Stmt *Finally)
StmtResult ActOnObjCAtFinallyStmt(SourceLocation AtLoc, Stmt *Body)
StmtResult BuildObjCAtThrowStmt(SourceLocation AtLoc, Expr *Throw)
ExprResult ActOnObjCAtSynchronizedOperand(SourceLocation atLoc, Expr *operand)
ExprResult BuildObjCBridgedCast(SourceLocation LParenLoc, ObjCBridgeCastKind Kind, SourceLocation BridgeKeywordLoc, TypeSourceInfo *TSInfo, Expr *SubExpr)
StmtResult ActOnObjCAtCatchStmt(SourceLocation AtLoc, SourceLocation RParen, Decl *Parm, Stmt *Body)
StmtResult ActOnObjCAutoreleasePoolStmt(SourceLocation AtLoc, Stmt *Body)
ExprResult BuildObjCSubscriptExpression(SourceLocation RB, Expr *BaseExpr, Expr *IndexExpr, ObjCMethodDecl *getterMethod, ObjCMethodDecl *setterMethod)
Build an ObjC subscript pseudo-object expression, given that that's supported by the runtime.
Helper type for the registration/assignment of constructs that need to 'know' about their parent cons...
Helper type to restore the state of various 'loop' constructs when we run into a loop (for,...
A type to represent all the data for an OpenACC Clause that has been parsed, but not yet created/sema...
void ActOnWhileStmt(SourceLocation WhileLoc)
ExprResult ActOnOpenACCAsteriskSizeExpr(SourceLocation AsteriskLoc)
void ActOnDoStmt(SourceLocation DoLoc)
void ActOnRangeForStmtBegin(SourceLocation ForLoc, const Stmt *OldRangeFor, const Stmt *RangeFor)
StmtResult ActOnEndStmtDirective(OpenACCDirectiveKind K, SourceLocation StartLoc, SourceLocation DirLoc, SourceLocation LParenLoc, SourceLocation MiscLoc, ArrayRef< Expr * > Exprs, OpenACCAtomicKind AK, SourceLocation RParenLoc, SourceLocation EndLoc, ArrayRef< OpenACCClause * > Clauses, StmtResult AssocStmt)
Called after the directive has been completely parsed, including the declaration group or associated ...
void ActOnForStmtEnd(SourceLocation ForLoc, StmtResult Body)
void ActOnForStmtBegin(SourceLocation ForLoc, const Stmt *First, const Stmt *Second, const Stmt *Third)
ExprResult ActOnArraySectionExpr(Expr *Base, SourceLocation LBLoc, Expr *LowerBound, SourceLocation ColonLocFirst, Expr *Length, SourceLocation RBLoc)
Checks and creates an Array Section used in an OpenACC construct/clause.
OMPClause * ActOnOpenMPNocontextClause(Expr *Condition, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'nocontext' clause.
OMPClause * ActOnOpenMPXDynCGroupMemClause(Expr *Size, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on a well-formed 'ompx_dyn_cgroup_mem' clause.
OMPClause * ActOnOpenMPSafelenClause(Expr *Length, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'safelen' clause.
OMPClause * ActOnOpenMPHoldsClause(Expr *E, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'holds' clause.
OMPClause * ActOnOpenMPFilterClause(Expr *ThreadID, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'filter' clause.
OMPClause * ActOnOpenMPFullClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-form 'full' clauses.
OMPClause * ActOnOpenMPDetachClause(Expr *Evt, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'detach' clause.
OMPClause * ActOnOpenMPUseClause(Expr *InteropVar, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation VarLoc, SourceLocation EndLoc)
Called on well-formed 'use' clause.
OMPClause * ActOnOpenMPPrivateClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'private' clause.
OMPClause * ActOnOpenMPOrderedClause(SourceLocation StartLoc, SourceLocation EndLoc, SourceLocation LParenLoc=SourceLocation(), Expr *NumForLoops=nullptr)
Called on well-formed 'ordered' clause.
OMPClause * ActOnOpenMPIsDevicePtrClause(ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs)
Called on well-formed 'is_device_ptr' clause.
OMPClause * ActOnOpenMPHasDeviceAddrClause(ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs)
Called on well-formed 'has_device_addr' clause.
OMPClause * ActOnOpenMPPartialClause(Expr *FactorExpr, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-form 'partial' clauses.
OMPClause * ActOnOpenMPLastprivateClause(ArrayRef< Expr * > VarList, OpenMPLastprivateModifier LPKind, SourceLocation LPKindLoc, SourceLocation ColonLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'lastprivate' clause.
OMPClause * ActOnOpenMPFirstprivateClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'firstprivate' clause.
OMPClause * ActOnOpenMPPriorityClause(Expr *Priority, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'priority' clause.
OMPClause * ActOnOpenMPDistScheduleClause(OpenMPDistScheduleClauseKind Kind, Expr *ChunkSize, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation KindLoc, SourceLocation CommaLoc, SourceLocation EndLoc)
Called on well-formed 'dist_schedule' clause.
OMPClause * ActOnOpenMPLoopRangeClause(Expr *First, Expr *Count, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation FirstLoc, SourceLocation CountLoc, SourceLocation EndLoc)
Called on well-form 'looprange' clause after parsing its arguments.
OMPClause * ActOnOpenMPPermutationClause(ArrayRef< Expr * > PermExprs, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-form 'permutation' clause after parsing its arguments.
OMPClause * ActOnOpenMPNontemporalClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'nontemporal' clause.
OMPClause * ActOnOpenMPBindClause(OpenMPBindClauseKind Kind, SourceLocation KindLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on a well-formed 'bind' clause.
OMPClause * ActOnOpenMPThreadLimitClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'thread_limit' clause.
OMPClause * ActOnOpenMPSharedClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'shared' clause.
OMPClause * ActOnOpenMPCopyinClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'copyin' clause.
OMPClause * ActOnOpenMPDestroyClause(Expr *InteropVar, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation VarLoc, SourceLocation EndLoc)
Called on well-formed 'destroy' clause.
OMPClause * ActOnOpenMPAffinityClause(SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc, Expr *Modifier, ArrayRef< Expr * > Locators)
Called on well-formed 'affinity' clause.
OMPClause * ActOnOpenMPNumTeamsClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'num_teams' clause.
OMPClause * ActOnOpenMPDependClause(const OMPDependClause::DependDataTy &Data, Expr *DepModifier, ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'depend' clause.
OMPClause * ActOnOpenMPDoacrossClause(OpenMPDoacrossClauseModifier DepType, SourceLocation DepLoc, SourceLocation ColonLoc, ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'doacross' clause.
OMPClause * ActOnOpenMPUseDevicePtrClause(ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs, OpenMPUseDevicePtrFallbackModifier FallbackModifier, SourceLocation FallbackModifierLoc)
Called on well-formed 'use_device_ptr' clause.
OMPClause * ActOnOpenMPGrainsizeClause(OpenMPGrainsizeClauseModifier Modifier, Expr *Size, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ModifierLoc, SourceLocation EndLoc)
Called on well-formed 'grainsize' clause.
ExprResult ActOnOMPArraySectionExpr(Expr *Base, SourceLocation LBLoc, Expr *LowerBound, SourceLocation ColonLocFirst, SourceLocation ColonLocSecond, Expr *Length, Expr *Stride, SourceLocation RBLoc)
ExprResult ActOnOMPIteratorExpr(Scope *S, SourceLocation IteratorKwLoc, SourceLocation LLoc, SourceLocation RLoc, ArrayRef< OMPIteratorData > Data)
OMPClause * ActOnOpenMPUsesAllocatorClause(SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc, ArrayRef< UsesAllocatorsData > Data)
Called on well-formed 'uses_allocators' clause.
OMPClause * ActOnOpenMPAllocatorClause(Expr *Allocator, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'allocator' clause.
OMPClause * ActOnOpenMPInclusiveClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'inclusive' clause.
OMPClause * ActOnOpenMPTaskReductionClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc, CXXScopeSpec &ReductionIdScopeSpec, const DeclarationNameInfo &ReductionId, ArrayRef< Expr * > UnresolvedReductions={})
Called on well-formed 'task_reduction' clause.
OMPClause * ActOnOpenMPNowaitClause(SourceLocation StartLoc, SourceLocation EndLoc, SourceLocation LParenLoc, Expr *Condition)
Called on well-formed 'nowait' clause.
OMPClause * ActOnOpenMPOrderClause(OpenMPOrderClauseModifier Modifier, OpenMPOrderClauseKind Kind, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation MLoc, SourceLocation KindLoc, SourceLocation EndLoc)
Called on well-formed 'order' clause.
OMPClause * ActOnOpenMPSizesClause(ArrayRef< Expr * > SizeExprs, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-form 'sizes' clause.
OMPClause * ActOnOpenMPDeviceClause(OpenMPDeviceClauseModifier Modifier, Expr *Device, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ModifierLoc, SourceLocation EndLoc)
Called on well-formed 'device' clause.
OMPClause * ActOnOpenMPInReductionClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc, CXXScopeSpec &ReductionIdScopeSpec, const DeclarationNameInfo &ReductionId, ArrayRef< Expr * > UnresolvedReductions={})
Called on well-formed 'in_reduction' clause.
OMPClause * ActOnOpenMPFlushClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'flush' pseudo clause.
StmtResult ActOnOpenMPExecutableDirective(OpenMPDirectiveKind Kind, const DeclarationNameInfo &DirName, OpenMPDirectiveKind CancelRegion, ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
OMPClause * ActOnOpenMPMessageClause(Expr *MS, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'message' clause.
OMPClause * ActOnOpenMPScheduleClause(OpenMPScheduleClauseModifier M1, OpenMPScheduleClauseModifier M2, OpenMPScheduleClauseKind Kind, Expr *ChunkSize, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation M1Loc, SourceLocation M2Loc, SourceLocation KindLoc, SourceLocation CommaLoc, SourceLocation EndLoc)
Called on well-formed 'schedule' clause.
OMPClause * ActOnOpenMPSimdlenClause(Expr *Length, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'simdlen' clause.
OMPClause * ActOnOpenMPProcBindClause(llvm::omp::ProcBindKind Kind, SourceLocation KindLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'proc_bind' clause.
OMPClause * ActOnOpenMPXBareClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on a well-formed 'ompx_bare' clause.
StmtResult ActOnOpenMPInformationalDirective(OpenMPDirectiveKind Kind, const DeclarationNameInfo &DirName, ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Process an OpenMP informational directive.
StmtResult ActOnOpenMPCanonicalLoop(Stmt *AStmt)
Called for syntactical loops (ForStmt or CXXForRangeStmt) associated to an OpenMP loop directive.
OMPClause * ActOnOpenMPTransparentClause(Expr *Transparent, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'transparent' clause.
OMPClause * ActOnOpenMPHintClause(Expr *Hint, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'hint' clause.
ExprResult ActOnOMPArrayShapingExpr(Expr *Base, SourceLocation LParenLoc, SourceLocation RParenLoc, ArrayRef< Expr * > Dims, ArrayRef< SourceRange > Brackets)
OMPClause * ActOnOpenMPNumThreadsClause(OpenMPNumThreadsClauseModifier Modifier, Expr *NumThreads, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ModifierLoc, SourceLocation EndLoc)
Called on well-formed 'num_threads' clause.
OMPClause * ActOnOpenMPAtClause(OpenMPAtClauseKind Kind, SourceLocation KindLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'at' clause.
OMPClause * ActOnOpenMPInitClause(Expr *InteropVar, OMPInteropInfo &InteropInfo, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation VarLoc, SourceLocation EndLoc)
Called on well-formed 'init' clause.
OMPClause * ActOnOpenMPUseDeviceAddrClause(ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs)
Called on well-formed 'use_device_addr' clause.
OMPClause * ActOnOpenMPAllocateClause(Expr *Allocator, Expr *Alignment, OpenMPAllocateClauseModifier FirstModifier, SourceLocation FirstModifierLoc, OpenMPAllocateClauseModifier SecondModifier, SourceLocation SecondModifierLoc, ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation ColonLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'allocate' clause.
OMPClause * ActOnOpenMPFinalClause(Expr *Condition, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'final' clause.
OMPClause * ActOnOpenMPMapClause(Expr *IteratorModifier, ArrayRef< OpenMPMapModifierKind > MapTypeModifiers, ArrayRef< SourceLocation > MapTypeModifiersLoc, CXXScopeSpec &MapperIdScopeSpec, DeclarationNameInfo &MapperId, OpenMPMapClauseKind MapType, bool IsMapTypeImplicit, SourceLocation MapLoc, SourceLocation ColonLoc, ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs, bool NoDiagnose=false, ArrayRef< Expr * > UnresolvedMappers={})
Called on well-formed 'map' clause.
OMPClause * ActOnOpenMPNumTasksClause(OpenMPNumTasksClauseModifier Modifier, Expr *NumTasks, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ModifierLoc, SourceLocation EndLoc)
Called on well-formed 'num_tasks' clause.
OMPClause * ActOnOpenMPFromClause(ArrayRef< OpenMPMotionModifierKind > MotionModifiers, ArrayRef< SourceLocation > MotionModifiersLoc, Expr *IteratorModifier, CXXScopeSpec &MapperIdScopeSpec, DeclarationNameInfo &MapperId, SourceLocation ColonLoc, ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs, ArrayRef< Expr * > UnresolvedMappers={})
Called on well-formed 'from' clause.
OMPClause * ActOnOpenMPDynGroupprivateClause(OpenMPDynGroupprivateClauseModifier M1, OpenMPDynGroupprivateClauseFallbackModifier M2, Expr *Size, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation M1Loc, SourceLocation M2Loc, SourceLocation EndLoc)
Called on a well-formed 'dyn_groupprivate' clause.
void StartOpenMPDSABlock(OpenMPDirectiveKind K, const DeclarationNameInfo &DirName, Scope *CurScope, SourceLocation Loc)
Called on start of new data sharing attribute block.
OMPClause * ActOnOpenMPSeverityClause(OpenMPSeverityClauseKind Kind, SourceLocation KindLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'severity' clause.
OMPClause * ActOnOpenMPToClause(ArrayRef< OpenMPMotionModifierKind > MotionModifiers, ArrayRef< SourceLocation > MotionModifiersLoc, Expr *IteratorModifier, CXXScopeSpec &MapperIdScopeSpec, DeclarationNameInfo &MapperId, SourceLocation ColonLoc, ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs, ArrayRef< Expr * > UnresolvedMappers={})
Called on well-formed 'to' clause.
OMPClause * ActOnOpenMPLinearClause(ArrayRef< Expr * > VarList, Expr *Step, SourceLocation StartLoc, SourceLocation LParenLoc, OpenMPLinearClauseKind LinKind, SourceLocation LinLoc, SourceLocation ColonLoc, SourceLocation StepModifierLoc, SourceLocation EndLoc)
Called on well-formed 'linear' clause.
OMPClause * ActOnOpenMPDefaultmapClause(OpenMPDefaultmapClauseModifier M, OpenMPDefaultmapClauseKind Kind, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation MLoc, SourceLocation KindLoc, SourceLocation EndLoc)
Called on well-formed 'defaultmap' clause.
OMPClause * ActOnOpenMPReductionClause(ArrayRef< Expr * > VarList, OpenMPVarListDataTy::OpenMPReductionClauseModifiers Modifiers, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ModifierLoc, SourceLocation ColonLoc, SourceLocation EndLoc, CXXScopeSpec &ReductionIdScopeSpec, const DeclarationNameInfo &ReductionId, ArrayRef< Expr * > UnresolvedReductions={})
Called on well-formed 'reduction' clause.
OMPClause * ActOnOpenMPAlignedClause(ArrayRef< Expr * > VarList, Expr *Alignment, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc)
Called on well-formed 'aligned' clause.
OMPClause * ActOnOpenMPDepobjClause(Expr *Depobj, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'depobj' pseudo clause.
OMPClause * ActOnOpenMPNovariantsClause(Expr *Condition, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'novariants' clause.
OMPClause * ActOnOpenMPCopyprivateClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'copyprivate' clause.
OMPClause * ActOnOpenMPCollapseClause(Expr *NumForLoops, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'collapse' clause.
OMPClause * ActOnOpenMPDefaultClause(llvm::omp::DefaultKind M, SourceLocation MLoc, OpenMPDefaultClauseVariableCategory VCKind, SourceLocation VCKindLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'default' clause.
OMPClause * ActOnOpenMPAlignClause(Expr *Alignment, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'align' clause.
OMPClause * ActOnOpenMPXAttributeClause(ArrayRef< const Attr * > Attrs, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on a well-formed 'ompx_attribute' clause.
OMPClause * ActOnOpenMPExclusiveClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'exclusive' clause.
OMPClause * ActOnOpenMPIfClause(OpenMPDirectiveKind NameModifier, Expr *Condition, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation NameModifierLoc, SourceLocation ColonLoc, SourceLocation EndLoc)
Called on well-formed 'if' clause.
Expr * recreateSyntacticForm(PseudoObjectExpr *E)
Given a pseudo-object expression, recreate what it looks like syntactically without the attendant Opa...
ExprResult checkRValue(Expr *E)
ExprResult BuildUniqueStableNameExpr(SourceLocation OpLoc, SourceLocation LParen, SourceLocation RParen, TypeSourceInfo *TSI)
RAII object used to change the argument pack substitution index within a Sema object.
RAII object used to temporarily allow the C++ 'this' expression to be used, with the given qualifiers...
A RAII object to enter scope of a compound statement.
A helper class for building up ExtParameterInfos.
const FunctionProtoType::ExtParameterInfo * getPointerOrNull(unsigned numParams)
Return a pointer (suitable for setting in an ExtProtoInfo) to the ExtParameterInfo array we've built ...
void set(unsigned index, FunctionProtoType::ExtParameterInfo info)
Set the ExtParameterInfo for the parameter at the given index,.
Records and restores the CurFPFeatures state on entry/exit of compound statements.
Sema - This implements semantic analysis and AST building for C.
ParsedType CreateParsedType(QualType T, TypeSourceInfo *TInfo)
Package the given type and TSI into a ParsedType.
ExprResult ActOnCXXParenListInitExpr(ArrayRef< Expr * > Args, QualType T, unsigned NumUserSpecifiedExprs, SourceLocation InitLoc, SourceLocation LParenLoc, SourceLocation RParenLoc)
ExprResult BuildOperatorCoawaitCall(SourceLocation Loc, Expr *E, UnresolvedLookupExpr *Lookup)
Build a call to 'operator co_await' if there is a suitable operator for the given expression.
ExprResult BuildMemberReferenceExpr(Expr *Base, QualType BaseType, SourceLocation OpLoc, bool IsArrow, CXXScopeSpec &SS, SourceLocation TemplateKWLoc, NamedDecl *FirstQualifierInScope, const DeclarationNameInfo &NameInfo, const TemplateArgumentListInfo *TemplateArgs, const Scope *S, ActOnMemberAccessExtraArgs *ExtraArgs=nullptr)
StmtResult BuildMSDependentExistsStmt(SourceLocation KeywordLoc, bool IsIfExists, NestedNameSpecifierLoc QualifierLoc, DeclarationNameInfo NameInfo, Stmt *Nested)
@ LookupOrdinaryName
Ordinary name lookup, which finds ordinary names (functions, variables, typedefs, etc....
@ LookupMemberName
Member name lookup, which finds the names of class/struct/union members.
@ LookupTagName
Tag name lookup, which finds the names of enums, classes, structs, and unions.
bool checkFinalSuspendNoThrow(const Stmt *FinalSuspend)
Check that the expression co_await promise.final_suspend() shall not be potentially-throwing.
ExprResult CreateBuiltinMatrixSingleSubscriptExpr(Expr *Base, Expr *RowIdx, SourceLocation RBLoc)
ExprResult ActOnConstantExpression(ExprResult Res)
StmtResult ActOnMSAsmStmt(SourceLocation AsmLoc, SourceLocation LBraceLoc, ArrayRef< Token > AsmToks, StringRef AsmString, unsigned NumOutputs, unsigned NumInputs, ArrayRef< StringRef > Constraints, ArrayRef< StringRef > Clobbers, ArrayRef< Expr * > Exprs, SourceLocation EndLoc)
StmtResult BuildCoroutineBodyStmt(CoroutineBodyStmt::CtorArgs)
ExprResult BuildCoyieldExpr(SourceLocation KwLoc, Expr *E)
void ActOnStartStmtExpr()
void ActOnStmtExprError()
void MarkDeclarationsReferencedInExpr(Expr *E, bool SkipLocalVariables=false, ArrayRef< const Expr * > StopAt={})
Mark any declarations that appear within this expression or any potentially-evaluated subexpressions ...
VarDecl * buildCoroutinePromise(SourceLocation Loc)
ExprResult CheckBooleanCondition(SourceLocation Loc, Expr *E, bool IsConstexpr=false)
CheckBooleanCondition - Diagnose problems involving the use of the given expression as a boolean cond...
@ Boolean
A boolean condition, from 'if', 'while', 'for', or 'do'.
@ Switch
An integral condition for a 'switch' statement.
@ ConstexprIf
A constant boolean condition from 'if constexpr'.
ExprResult BuildSubstNonTypeTemplateParmExpr(Decl *AssociatedDecl, const NonTypeTemplateParmDecl *NTTP, SourceLocation loc, TemplateArgument Replacement, UnsignedOrNone PackIndex, bool Final)
ExprResult BuildBuiltinBitCastExpr(SourceLocation KWLoc, TypeSourceInfo *TSI, Expr *Operand, SourceLocation RParenLoc)
StmtResult ActOnGotoStmt(SourceLocation GotoLoc, SourceLocation LabelLoc, LabelDecl *TheDecl)
ExprResult MaybeBindToTemporary(Expr *E)
MaybeBindToTemporary - If the passed in expression has a record type with a non-trivial destructor,...
StmtResult BuildCoreturnStmt(SourceLocation KwLoc, Expr *E, bool IsImplicit=false)
ExprResult ActOnStartCXXMemberReference(Scope *S, Expr *Base, SourceLocation OpLoc, tok::TokenKind OpKind, ParsedType &ObjectType, bool &MayBePseudoDestructor)
ExprResult ActOnCaseExpr(SourceLocation CaseLoc, ExprResult Val)
ExprResult BuildStmtExpr(SourceLocation LPLoc, Stmt *SubStmt, SourceLocation RPLoc, unsigned TemplateDepth)
ExprResult BuildResolvedCoawaitExpr(SourceLocation KwLoc, Expr *Operand, Expr *Awaiter, bool IsImplicit=false)
ExprResult BuildVAArgExpr(SourceLocation BuiltinLoc, Expr *E, TypeSourceInfo *TInfo, SourceLocation RPLoc)
@ CTAK_Specified
The template argument was specified in the code or was instantiated with some deduced template argume...
ExprResult ActOnCXXDelete(SourceLocation StartLoc, bool UseGlobal, bool ArrayForm, Expr *Operand)
ActOnCXXDelete - Parsed a C++ 'delete' expression (C++ 5.3.5), as in:
ExprResult BuildCXXTypeId(QualType TypeInfoType, SourceLocation TypeidLoc, TypeSourceInfo *Operand, SourceLocation RParenLoc)
Build a C++ typeid expression with a type operand.
ExprResult PerformMemberExprBaseConversion(Expr *Base, bool IsArrow)
Perform conversions on the LHS of a member access expression.
DiagnosticsEngine & getDiagnostics() const
ExprResult BuildPackIndexingExpr(Expr *PackExpression, SourceLocation EllipsisLoc, Expr *IndexExpr, SourceLocation RSquareLoc, ArrayRef< Expr * > ExpandedExprs={}, bool FullySubstituted=false)
ParsedType getDestructorName(const IdentifierInfo &II, SourceLocation NameLoc, Scope *S, CXXScopeSpec &SS, ParsedType ObjectType, bool EnteringContext)
ASTContext & getASTContext() const
CXXDestructorDecl * LookupDestructor(CXXRecordDecl *Class)
Look for the destructor of the given class.
ExprResult BuildUnaryOp(Scope *S, SourceLocation OpLoc, UnaryOperatorKind Opc, Expr *Input, bool IsAfterAmp=false)
ExprResult BuildTemplateIdExpr(const CXXScopeSpec &SS, SourceLocation TemplateKWLoc, LookupResult &R, bool RequiresADL, const TemplateArgumentListInfo *TemplateArgs)
ExprResult CreateOverloadedBinOp(SourceLocation OpLoc, BinaryOperatorKind Opc, const UnresolvedSetImpl &Fns, Expr *LHS, Expr *RHS, bool RequiresADL=true, bool AllowRewrittenCandidates=true, FunctionDecl *DefaultedFn=nullptr)
Create a binary operation that may resolve to an overloaded operator.
StmtResult ActOnSEHTryBlock(bool IsCXXTry, SourceLocation TryLoc, Stmt *TryBlock, Stmt *Handler)
ExprResult BuildPredefinedExpr(SourceLocation Loc, PredefinedIdentKind IK)
ExprResult CheckConceptTemplateId(const CXXScopeSpec &SS, SourceLocation TemplateKWLoc, const DeclarationNameInfo &ConceptNameInfo, NamedDecl *FoundDecl, TemplateDecl *NamedConcept, const TemplateArgumentListInfo *TemplateArgs, bool DoCheckConstraintSatisfaction=true)
ExprResult BuildCompoundLiteralExpr(SourceLocation LParenLoc, TypeSourceInfo *TInfo, SourceLocation RParenLoc, Expr *LiteralExpr)
ExprResult ActOnAddrLabel(SourceLocation OpLoc, SourceLocation LabLoc, LabelDecl *TheDecl)
ActOnAddrLabel - Parse the GNU address of label extension: "&&foo".
ExprResult ActOnParenListExpr(SourceLocation L, SourceLocation R, MultiExprArg Val)
QualType BuildCountAttributedArrayOrPointerType(QualType WrappedTy, Expr *CountExpr, bool CountInBytes, bool OrNull)
ExprResult BuildCXXNew(SourceRange Range, bool UseGlobal, SourceLocation PlacementLParen, MultiExprArg PlacementArgs, SourceLocation PlacementRParen, SourceRange TypeIdParens, QualType AllocType, TypeSourceInfo *AllocTypeInfo, std::optional< Expr * > ArraySize, SourceRange DirectInitRange, Expr *Initializer)
DeclRefExpr * BuildDeclRefExpr(ValueDecl *D, QualType Ty, ExprValueKind VK, SourceLocation Loc, const CXXScopeSpec *SS=nullptr)
ExprResult BuildCXXFoldExpr(UnresolvedLookupExpr *Callee, SourceLocation LParenLoc, Expr *LHS, BinaryOperatorKind Operator, SourceLocation EllipsisLoc, Expr *RHS, SourceLocation RParenLoc, UnsignedOrNone NumExpansions)
ExprResult CreateGenericSelectionExpr(SourceLocation KeyLoc, SourceLocation DefaultLoc, SourceLocation RParenLoc, bool PredicateIsExpr, void *ControllingExprOrType, ArrayRef< TypeSourceInfo * > Types, ArrayRef< Expr * > Exprs)
ControllingExprOrType is either a TypeSourceInfo * or an Expr *.
bool CheckTemplateArgument(NamedDecl *Param, TemplateArgumentLoc &Arg, NamedDecl *Template, SourceLocation TemplateLoc, SourceLocation RAngleLoc, unsigned ArgumentPackIndex, CheckTemplateArgumentInfo &CTAI, CheckTemplateArgumentKind CTAK)
Check that the given template argument corresponds to the given template parameter.
StmtResult ActOnFinishSwitchStmt(SourceLocation SwitchLoc, Stmt *Switch, Stmt *Body)
SourceLocation getLocForEndOfToken(SourceLocation Loc, unsigned Offset=0)
Calls Lexer::getLocForEndOfToken()
const LangOptions & getLangOpts() const
StmtResult ActOnWhileStmt(SourceLocation WhileLoc, SourceLocation LParenLoc, ConditionResult Cond, SourceLocation RParenLoc, Stmt *Body)
bool isPotentialImplicitMemberAccess(const CXXScopeSpec &SS, LookupResult &R, bool IsAddressOfOperand)
Check whether an expression might be an implicit class member access.
void collectUnexpandedParameterPacks(TemplateArgument Arg, SmallVectorImpl< UnexpandedParameterPack > &Unexpanded)
Collect the set of unexpanded parameter packs within the given template argument.
ExprResult BuildSourceLocExpr(SourceLocIdentKind Kind, QualType ResultTy, SourceLocation BuiltinLoc, SourceLocation RPLoc, DeclContext *ParentContext)
ExprResult BuildCXXTypeConstructExpr(TypeSourceInfo *Type, SourceLocation LParenLoc, MultiExprArg Exprs, SourceLocation RParenLoc, bool ListInitialization)
ExprResult BuildBuiltinOffsetOf(SourceLocation BuiltinLoc, TypeSourceInfo *TInfo, ArrayRef< OffsetOfComponent > Components, SourceLocation RParenLoc)
__builtin_offsetof(type, a.b[123][456].c)
ExprResult TemporaryMaterializationConversion(Expr *E)
If E is a prvalue denoting an unmaterialized temporary, materialize it as an xvalue.
ExprResult BuildTypeTrait(TypeTrait Kind, SourceLocation KWLoc, ArrayRef< TypeSourceInfo * > Args, SourceLocation RParenLoc)
TemplateArgument getPackSubstitutedTemplateArgument(TemplateArgument Arg) const
ExprResult BuildUnresolvedCoawaitExpr(SourceLocation KwLoc, Expr *Operand, UnresolvedLookupExpr *Lookup)
ExprResult BuildExpressionTrait(ExpressionTrait OET, SourceLocation KWLoc, Expr *Queried, SourceLocation RParen)
bool buildCoroutineParameterMoves(SourceLocation Loc)
ExprResult BuildCStyleCastExpr(SourceLocation LParenLoc, TypeSourceInfo *Ty, SourceLocation RParenLoc, Expr *Op)
ExprResult BuildCXXUuidof(QualType TypeInfoType, SourceLocation TypeidLoc, TypeSourceInfo *Operand, SourceLocation RParenLoc)
Build a Microsoft __uuidof expression with a type operand.
sema::FunctionScopeInfo * getCurFunction() const
DeclGroupPtrTy BuildDeclaratorGroup(MutableArrayRef< Decl * > Group)
BuildDeclaratorGroup - convert a list of declarations into a declaration group, performing any necess...
Expr * BuildCXXThisExpr(SourceLocation Loc, QualType Type, bool IsImplicit)
Build a CXXThisExpr and mark it referenced in the current context.
UnsignedOrNone getPackIndex(TemplateArgument Pack) const
ExprResult BuildDeclarationNameExpr(const CXXScopeSpec &SS, LookupResult &R, bool NeedsADL, bool AcceptInvalidDecl=false)
sema::BlockScopeInfo * getCurBlock()
Retrieve the current block, if any.
DeclContext * CurContext
CurContext - This is the current declaration context of parsing.
VarDecl * BuildExceptionDeclaration(Scope *S, TypeSourceInfo *TInfo, SourceLocation StartLoc, SourceLocation IdLoc, const IdentifierInfo *Id)
Perform semantic analysis for the variable declaration that occurs within a C++ catch clause,...
void MarkDeclRefReferenced(DeclRefExpr *E, const Expr *Base=nullptr)
Perform reference-marking and odr-use handling for a DeclRefExpr.
ExprResult BuildQualifiedDeclarationNameExpr(CXXScopeSpec &SS, const DeclarationNameInfo &NameInfo, bool IsAddressOfOperand, TypeSourceInfo **RecoveryTSI=nullptr)
BuildQualifiedDeclarationNameExpr - Build a C++ qualified declaration name, generally during template...
StmtResult ActOnForStmt(SourceLocation ForLoc, SourceLocation LParenLoc, Stmt *First, ConditionResult Second, FullExprArg Third, SourceLocation RParenLoc, Stmt *Body)
StmtResult ActOnIndirectGotoStmt(SourceLocation GotoLoc, SourceLocation StarLoc, Expr *DestExp)
ExprResult ActOnParenExpr(SourceLocation L, SourceLocation R, Expr *E)
ExprResult BuildCXXConstructExpr(SourceLocation ConstructLoc, QualType DeclInitType, NamedDecl *FoundDecl, CXXConstructorDecl *Constructor, MultiExprArg Exprs, bool HadMultipleCandidates, bool IsListInitialization, bool IsStdInitListInitialization, bool RequiresZeroInit, CXXConstructionKind ConstructKind, SourceRange ParenRange)
BuildCXXConstructExpr - Creates a complete call to a constructor, including handling of its default a...
ExprResult BuildAsTypeExpr(Expr *E, QualType DestTy, SourceLocation BuiltinLoc, SourceLocation RParenLoc)
Create a new AsTypeExpr node (bitcast) from the arguments.
ExprResult BuildFieldReferenceExpr(Expr *BaseExpr, bool IsArrow, SourceLocation OpLoc, const CXXScopeSpec &SS, FieldDecl *Field, DeclAccessPair FoundDecl, const DeclarationNameInfo &MemberNameInfo)
ExprResult ActOnConditionalOp(SourceLocation QuestionLoc, SourceLocation ColonLoc, Expr *CondExpr, Expr *LHSExpr, Expr *RHSExpr)
ActOnConditionalOp - Parse a ?
ExprResult BuildPossibleImplicitMemberExpr(const CXXScopeSpec &SS, SourceLocation TemplateKWLoc, LookupResult &R, const TemplateArgumentListInfo *TemplateArgs, const Scope *S)
Builds an expression which might be an implicit member expression.
UnsignedOrNone ArgPackSubstIndex
The current index into pack expansion arguments that will be used for substitution of parameter packs...
StmtResult BuildReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp, bool AllowRecovery=false)
StmtResult BuildCXXForRangeStmt(SourceLocation ForLoc, SourceLocation CoawaitLoc, Stmt *InitStmt, SourceLocation ColonLoc, Stmt *RangeDecl, Stmt *Begin, Stmt *End, Expr *Cond, Expr *Inc, Stmt *LoopVarDecl, SourceLocation RParenLoc, BuildForRangeKind Kind, ArrayRef< MaterializeTemporaryExpr * > LifetimeExtendTemps={})
BuildCXXForRangeStmt - Build or instantiate a C++11 for-range statement.
StmtResult ActOnDoStmt(SourceLocation DoLoc, Stmt *Body, SourceLocation WhileLoc, SourceLocation CondLParen, Expr *Cond, SourceLocation CondRParen)
StmtResult ActOnStartOfSwitchStmt(SourceLocation SwitchLoc, SourceLocation LParenLoc, Stmt *InitStmt, ConditionResult Cond, SourceLocation RParenLoc)
ExprResult BuildQualifiedTemplateIdExpr(CXXScopeSpec &SS, SourceLocation TemplateKWLoc, const DeclarationNameInfo &NameInfo, const TemplateArgumentListInfo *TemplateArgs, bool IsAddressOfOperand)
@ ConstantEvaluated
The current context is "potentially evaluated" in C++11 terms, but the expression is evaluated at com...
@ PotentiallyEvaluated
The current expression is potentially evaluated at run time, which means that code may be generated t...
@ Unevaluated
The current expression and its subexpressions occur within an unevaluated operand (C++11 [expr]p7),...
@ ImmediateFunctionContext
In addition of being constant evaluated, the current expression occurs in an immediate function conte...
StmtResult ActOnSEHExceptBlock(SourceLocation Loc, Expr *FilterExpr, Stmt *Block)
ExprResult CreateUnaryExprOrTypeTraitExpr(TypeSourceInfo *TInfo, SourceLocation OpLoc, UnaryExprOrTypeTrait ExprKind, SourceRange R)
Build a sizeof or alignof expression given a type operand.
StmtResult ActOnDeclStmt(DeclGroupPtrTy Decl, SourceLocation StartLoc, SourceLocation EndLoc)
ExprResult PerformObjectMemberConversion(Expr *From, NestedNameSpecifier Qualifier, NamedDecl *FoundDecl, NamedDecl *Member)
Cast a base object to a member's actual type.
Expr * MaybeCreateExprWithCleanups(Expr *SubExpr)
MaybeCreateExprWithCleanups - If the current full-expression requires any cleanups,...
SmallVector< ExpressionEvaluationContextRecord, 8 > ExprEvalContexts
A stack of expression evaluation contexts.
ExprResult BuildEmptyCXXFoldExpr(SourceLocation EllipsisLoc, BinaryOperatorKind Operator)
ExprResult BuildCXXThrow(SourceLocation OpLoc, Expr *Ex, bool IsThrownVarInScope)
ExprResult BuildBinOp(Scope *S, SourceLocation OpLoc, BinaryOperatorKind Opc, Expr *LHSExpr, Expr *RHSExpr, bool ForFoldExpression=false)
ExprResult BuildCXXDefaultInitExpr(SourceLocation Loc, FieldDecl *Field)
ExprResult BuildLambdaExpr(SourceLocation StartLoc, SourceLocation EndLoc)
Complete a lambda-expression having processed and attached the lambda body.
@ BFRK_Rebuild
Instantiation or recovery rebuild of a for-range statement.
void ActOnCaseStmtBody(Stmt *CaseStmt, Stmt *SubStmt)
ActOnCaseStmtBody - This installs a statement as the body of a case.
ExprResult ActOnBlockStmtExpr(SourceLocation CaretLoc, Stmt *Body, Scope *CurScope)
ActOnBlockStmtExpr - This is called when the body of a block statement literal was successfully compl...
ExprResult BuildArrayTypeTrait(ArrayTypeTrait ATT, SourceLocation KWLoc, TypeSourceInfo *TSInfo, Expr *DimExpr, SourceLocation RParen)
void MarkMemberReferenced(MemberExpr *E)
Perform reference-marking and odr-use handling for a MemberExpr.
ExprResult BuildCXXNamedCast(SourceLocation OpLoc, tok::TokenKind Kind, TypeSourceInfo *Ty, Expr *E, SourceRange AngleBrackets, SourceRange Parens)
void MarkFunctionReferenced(SourceLocation Loc, FunctionDecl *Func, bool MightBeOdrUse=true)
Mark a function referenced, and check whether it is odr-used (C++ [basic.def.odr]p2,...
ExprResult CreateRecoveryExpr(SourceLocation Begin, SourceLocation End, ArrayRef< Expr * > SubExprs, QualType T=QualType())
Attempts to produce a RecoveryExpr after some AST node cannot be created.
ExprResult ActOnGCCAsmStmtString(Expr *Stm, bool ForAsmLabel)
StmtResult ActOnIfStmt(SourceLocation IfLoc, IfStatementKind StatementKind, SourceLocation LParenLoc, Stmt *InitStmt, ConditionResult Cond, SourceLocation RParenLoc, Stmt *ThenVal, SourceLocation ElseLoc, Stmt *ElseVal)
void ActOnBlockStart(SourceLocation CaretLoc, Scope *CurScope)
ActOnBlockStart - This callback is invoked when a block literal is started.
ExprResult ActOnArraySubscriptExpr(Scope *S, Expr *Base, SourceLocation LLoc, MultiExprArg ArgExprs, SourceLocation RLoc)
ExprResult BuildAtomicExpr(SourceRange CallRange, SourceRange ExprRange, SourceLocation RParenLoc, MultiExprArg Args, AtomicExpr::AtomicOp Op, AtomicArgumentOrder ArgOrder=AtomicArgumentOrder::API)
ExprResult ActOnCallExpr(Scope *S, Expr *Fn, SourceLocation LParenLoc, MultiExprArg ArgExprs, SourceLocation RParenLoc, Expr *ExecConfig=nullptr)
ActOnCallExpr - Handle a call to Fn with the specified array of arguments.
OpaquePtr< TemplateName > TemplateTy
static QualType GetTypeFromParser(ParsedType Ty, TypeSourceInfo **TInfo=nullptr)
static ConditionResult ConditionError()
StmtResult ActOnCompoundStmt(SourceLocation L, SourceLocation R, ArrayRef< Stmt * > Elts, bool isStmtExpr)
SemaPseudoObject & PseudoObject()
StmtResult ActOnCXXTryBlock(SourceLocation TryLoc, Stmt *TryBlock, ArrayRef< Stmt * > Handlers)
ActOnCXXTryBlock - Takes a try compound-statement and a number of handlers and creates a try statemen...
OpaquePtr< DeclGroupRef > DeclGroupPtrTy
StmtResult ActOnDefaultStmt(SourceLocation DefaultLoc, SourceLocation ColonLoc, Stmt *SubStmt, Scope *CurScope)
ExprResult HandleExprEvaluationContextForTypeof(Expr *E)
StmtResult ActOnCaseStmt(SourceLocation CaseLoc, ExprResult LHS, SourceLocation DotDotDotLoc, ExprResult RHS, SourceLocation ColonLoc)
TypeSourceInfo * CheckPackExpansion(TypeSourceInfo *Pattern, SourceLocation EllipsisLoc, UnsignedOrNone NumExpansions)
Construct a pack expansion type from the pattern of the pack expansion.
StmtResult FinishCXXForRangeStmt(Stmt *ForRange, Stmt *Body)
FinishCXXForRangeStmt - Attach the body to a C++0x for-range statement.
ExprResult ActOnFinishFullExpr(Expr *Expr, bool DiscardedValue)
ExprResult CreateBuiltinMatrixSubscriptExpr(Expr *Base, Expr *RowIdx, Expr *ColumnIdx, SourceLocation RBLoc)
StmtResult ActOnGCCAsmStmt(SourceLocation AsmLoc, bool IsSimple, bool IsVolatile, unsigned NumOutputs, unsigned NumInputs, IdentifierInfo **Names, MultiExprArg Constraints, MultiExprArg Exprs, Expr *AsmString, MultiExprArg Clobbers, unsigned NumLabels, SourceLocation RParenLoc)
ShuffleVectorExpr - clang-specific builtin-in function __builtin_shufflevector.
Represents an expression that computes the length of a parameter pack.
SourceLocation getPackLoc() const
Determine the location of the parameter pack.
bool isPartiallySubstituted() const
Determine whether this represents a partially-substituted sizeof... expression, such as is produced f...
static SizeOfPackExpr * Create(ASTContext &Context, SourceLocation OperatorLoc, NamedDecl *Pack, SourceLocation PackLoc, SourceLocation RParenLoc, UnsignedOrNone Length=std::nullopt, ArrayRef< TemplateArgument > PartialArgs={})
ArrayRef< TemplateArgument > getPartialArguments() const
Get.
SourceLocation getOperatorLoc() const
Determine the location of the 'sizeof' keyword.
SourceLocation getRParenLoc() const
Determine the location of the right parenthesis.
NamedDecl * getPack() const
Retrieve the parameter pack.
Represents a function call to one of __builtin_LINE(), __builtin_COLUMN(), __builtin_FUNCTION(),...
static bool MayBeDependent(SourceLocIdentKind Kind)
Encodes a location in the source.
bool isValid() const
Return true if this is a valid SourceLocation object.
A trivial tuple used to represent a source range.
SourceLocation getEnd() const
SourceLocation getBegin() const
StmtExpr - This is the GNU Statement Expression extension: ({int X=4; X;}).
Stmt - This represents one statement.
SourceLocation getEndLoc() const LLVM_READONLY
StmtClass getStmtClass() const
SourceRange getSourceRange() const LLVM_READONLY
SourceLocation tokens are not useful in isolation - they are low level value objects created/interpre...
StringLiteral - This represents a string literal expression, e.g.
Wrapper for substituted template type parameters.
Represents a reference to a non-type template parameter that has been substituted with a template arg...
Represents a reference to a non-type template parameter pack that has been substituted with a non-tem...
A structure for storing an already-substituted template template parameter pack.
A structure for storing the information associated with a substituted template template parameter.
Wrapper for substituted template type parameters.
SwitchStmt - This represents a 'switch' stmt.
Represents the declaration of a struct/union/class/enum.
SourceLocation getNameLoc() const
SourceLocation getElaboratedKeywordLoc() const
NestedNameSpecifierLoc getQualifierLoc() const
void setQualifierLoc(NestedNameSpecifierLoc QualifierLoc)
void setNameLoc(SourceLocation Loc)
void setElaboratedKeywordLoc(SourceLocation Loc)
A convenient class for passing around template argument information.
void setLAngleLoc(SourceLocation Loc)
void setRAngleLoc(SourceLocation Loc)
void addArgument(const TemplateArgumentLoc &Loc)
const TemplateArgumentLoc * operator->() const
pointer(TemplateArgumentLoc Arg)
Simple iterator that traverses the template arguments in a container that provides a getArgLoc() memb...
TemplateArgumentLoc operator*() const
TemplateArgumentLocContainerIterator operator++(int)
friend bool operator!=(const TemplateArgumentLocContainerIterator &X, const TemplateArgumentLocContainerIterator &Y)
TemplateArgumentLocContainerIterator()
TemplateArgumentLoc value_type
TemplateArgumentLocContainerIterator(ArgLocContainer &Container, unsigned Index)
friend bool operator==(const TemplateArgumentLocContainerIterator &X, const TemplateArgumentLocContainerIterator &Y)
TemplateArgumentLocContainerIterator & operator++()
std::input_iterator_tag iterator_category
TemplateArgumentLoc reference
pointer operator->() const
const TemplateArgumentLoc * operator->() const
pointer(TemplateArgumentLoc Arg)
Iterator adaptor that invents template argument location information for each of the template argumen...
TemplateArgumentLocInventIterator & operator++()
pointer operator->() const
std::iterator_traits< InputIterator >::difference_type difference_type
reference operator*() const
TemplateArgumentLocInventIterator operator++(int)
friend bool operator==(const TemplateArgumentLocInventIterator &X, const TemplateArgumentLocInventIterator &Y)
TemplateArgumentLocInventIterator(TreeTransform< Derived > &Self, InputIterator Iter)
friend bool operator!=(const TemplateArgumentLocInventIterator &X, const TemplateArgumentLocInventIterator &Y)
std::input_iterator_tag iterator_category
TemplateArgumentLoc reference
TemplateArgumentLoc value_type
Location wrapper for a TemplateArgument.
const TemplateArgument & getArgument() const
SourceLocation getTemplateNameLoc() const
SourceLocation getTemplateKWLoc() const
TypeSourceInfo * getTypeSourceInfo() const
Expr * getSourceExpression() const
NestedNameSpecifierLoc getTemplateQualifierLoc() const
Represents a template argument.
Expr * getAsExpr() const
Retrieve the template argument as an expression.
const TemplateArgument * pack_iterator
Iterator that traverses the elements of a template argument pack.
QualType getNonTypeTemplateArgumentType() const
If this is a non-type template argument, get its type.
QualType getAsType() const
Retrieve the type for a type template argument.
llvm::APSInt getAsIntegral() const
Retrieve the template argument as an integral value.
TemplateName getAsTemplate() const
Retrieve the template name for a template name argument.
bool containsUnexpandedParameterPack() const
Whether this template argument contains an unexpanded parameter pack.
ValueDecl * getAsDecl() const
Retrieve the declaration for a declaration non-type template argument.
@ Declaration
The template argument is a declaration that was provided for a pointer, reference,...
@ Template
The template argument is a template name that was provided for a template template parameter.
@ StructuralValue
The template argument is a non-type template argument that can't be represented by the special-case D...
@ Pack
The template argument is actually a parameter pack.
@ TemplateExpansion
The template argument is a pack expansion of a template name that was provided for a template templat...
@ NullPtr
The template argument is a null pointer or null pointer to member that was provided for a non-type te...
@ Type
The template argument is a type.
@ Null
Represents an empty template argument, e.g., one that has not been deduced.
@ Integral
The template argument is an integral value stored in an llvm::APSInt that was provided for an integra...
@ Expression
The template argument is an expression, and we've not resolved it to one of the other forms yet,...
ArgKind getKind() const
Return the kind of stored template argument.
bool isPackExpansion() const
Determine whether this template argument is a pack expansion.
const APValue & getAsStructuralValue() const
Get the value of a StructuralValue.
The base class of all kinds of template declarations (e.g., class, function, etc.).
Represents a C++ template name within the type system.
TemplateDecl * getAsTemplateDecl(bool IgnoreDeduced=false) const
Retrieve the underlying template declaration that this template name refers to, if known.
DeducedTemplateStorage * getAsDeducedTemplateName() const
Retrieve the deduced template info, if any.
bool isNull() const
Determine whether this template name is NULL.
DependentTemplateName * getAsDependentTemplateName() const
Retrieve the underlying dependent template name structure, if any.
QualifiedTemplateName * getAsQualifiedTemplateName() const
Retrieve the underlying qualified template name structure, if any.
NestedNameSpecifier getQualifier() const
SubstTemplateTemplateParmPackStorage * getAsSubstTemplateTemplateParmPack() const
Retrieve the substituted template template parameter pack, if known.
SubstTemplateTemplateParmStorage * getAsSubstTemplateTemplateParm() const
Retrieve the substituted template template parameter, if known.
Stores a list of template parameters for a TemplateDecl and its derived classes.
unsigned getNumArgs() const
SourceLocation getLAngleLoc() const
SourceLocation getRAngleLoc() const
SourceLocation getTemplateNameLoc() const
SourceLocation getTemplateKeywordLoc() const
NestedNameSpecifierLoc getQualifierLoc() const
SourceLocation getElaboratedKeywordLoc() const
Wrapper for template type parameters.
The top declaration context.
TypeLoc getTypeLocInContext(ASTContext &Context, QualType T)
Copies the type-location information to the given AST context and returns a TypeLoc referring into th...
TyLocType push(QualType T)
Pushes space for a new TypeLoc of the given type.
void reserve(size_t Requested)
Ensures that this buffer has at least as much capacity as described.
void TypeWasModifiedSafely(QualType T)
Tell the TypeLocBuilder that the type it is storing has been modified in some safe way that doesn't a...
TypeSourceInfo * getTypeSourceInfo(ASTContext &Context, QualType T)
Creates a TypeSourceInfo for the given type.
Base wrapper for a particular "section" of type source info.
UnqualTypeLoc getUnqualifiedLoc() const
Skips past any qualifiers, if this is qualified.
QualType getType() const
Get the type for which this source info wrapper provides information.
T getAs() const
Convert to the specified TypeLoc type, returning a null TypeLoc if this TypeLoc is not of the desired...
T castAs() const
Convert to the specified TypeLoc type, asserting that this TypeLoc is of the desired type.
SourceRange getSourceRange() const LLVM_READONLY
Get the full source range.
unsigned getFullDataSize() const
Returns the size of the type source info data block.
TypeLocClass getTypeLocClass() const
T getAsAdjusted() const
Convert to the specified TypeLoc type, returning a null TypeLoc if this TypeLoc is not of the desired...
SourceLocation getBeginLoc() const
Get the begin source location.
Represents a typeof (or typeof) expression (a C23 feature and GCC extension) or a typeof_unqual expre...
A container of type source information.
TypeLoc getTypeLoc() const
Return the TypeLoc wrapper for the type source info.
QualType getType() const
Return the type wrapped by this type source info.
void setNameLoc(SourceLocation Loc)
A type trait used in the implementation of various C++11 and Library TR1 trait templates.
The base class of the type hierarchy.
bool isDependentType() const
Whether this type is a dependent type, meaning that its definition somehow depends on a template para...
bool containsUnexpandedParameterPack() const
Whether this type is or contains an unexpanded parameter pack, used to support C++0x variadic templat...
bool isOverloadableType() const
Determines whether this is a type for which one can define an overloaded operator.
bool isObjCObjectPointerType() const
const T * getAs() const
Member-template getAs<specific type>'.
Base class for declarations which introduce a typedef-name.
Wrapper for source info for typedefs.
void setTypeofLoc(SourceLocation Loc)
UnaryExprOrTypeTraitExpr - expression with either a type or (unevaluated) expression operand.
UnaryOperator - This represents the unary-expression's (except sizeof and alignof),...
SourceLocation getOperatorLoc() const
getOperatorLoc - Return the location of the operator.
Expr * getSubExpr() const
static Opcode getOverloadedOpcode(OverloadedOperatorKind OO, bool Postfix)
Retrieve the unary opcode that corresponds to the given overloaded operator.
Represents a C++ unqualified-id that has been parsed.
void setOperatorFunctionId(SourceLocation OperatorLoc, OverloadedOperatorKind Op, SourceLocation SymbolLocations[3])
Specify that this unqualified-id was parsed as an operator-function-id.
A reference to a name which we were able to look up during parsing but could not resolve to a specifi...
CXXRecordDecl * getNamingClass()
Gets the 'naming class' (in the sense of C++0x [class.access.base]p5) of the lookup.
bool requiresADL() const
True if this declaration should be extended by argument-dependent lookup.
static UnresolvedLookupExpr * Create(const ASTContext &Context, CXXRecordDecl *NamingClass, NestedNameSpecifierLoc QualifierLoc, const DeclarationNameInfo &NameInfo, bool RequiresADL, UnresolvedSetIterator Begin, UnresolvedSetIterator End, bool KnownDependent, bool KnownInstantiationDependent)
Represents a C++ member access expression for which lookup produced a set of overloaded functions.
A set of unresolved declarations.
void append(iterator I, iterator E)
A set of unresolved declarations.
Wrapper for source info for unresolved typename using decls.
Represents the dependent type named by a dependently-scoped typename using declaration,...
A call to a literal operator (C++11 [over.literal]) written as a user-defined literal (C++11 [lit....
Represents a shadow declaration implicitly introduced into a scope by a (resolved) using-declaration ...
NamedDecl * getTargetDecl() const
Gets the underlying declaration which has been brought into the local scope.
Wrapper for source info for types used via transparent aliases.
Represents a call to the builtin function __builtin_va_arg.
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
bool isParameterPack() const
Determine whether this value is actually a function parameter pack, init-capture pack,...
Represents a variable declaration or definition.
@ CInit
C-style initialization with assignment.
@ CallInit
Call-style initialization (C++98)
StorageClass getStorageClass() const
Returns the storage class as written in the source.
Represents a C array with a specified size that is not an integer-constant-expression.
void setNameLoc(SourceLocation Loc)
Represents a GCC generic vector type.
WhileStmt - This represents a 'while' stmt.
A requires-expression requirement which queries the validity and properties of an expression ('simple...
SubstitutionDiagnostic * getExprSubstitutionDiagnostic() const
bool isExprSubstitutionFailure() const
const ReturnTypeRequirement & getReturnTypeRequirement() const
SourceLocation getNoexceptLoc() const
A requires-expression requirement which is satisfied when a general constraint expression is satisfie...
const ASTConstraintSatisfaction & getConstraintSatisfaction() const
bool hasInvalidConstraint() const
Expr * getConstraintExpr() const
StringRef getInvalidConstraintEntity()
A static requirement that can be used in a requires-expression to check properties of types and expre...
A requires-expression requirement which queries the existence of a type name or type template special...
bool isSubstitutionFailure() const
SubstitutionDiagnostic * getSubstitutionDiagnostic() const
TypeSourceInfo * getType() const
Retains information about a block that is currently being parsed.
bool ContainsUnexpandedParameterPack
Whether this contains an unexpanded parameter pack.
CXXRecordDecl * Lambda
The class that describes the lambda.
CXXMethodDecl * CallOperator
The lambda's compiler-generated operator().
@ AttributedType
The l-value was considered opaque, so the alignment was determined from a type, but that type was an ...
const AstTypeMatcher< FunctionType > functionType
llvm::PointerUnion< const Decl *, const Expr * > DeclTy
bool Comp(InterpState &S, CodePtr OpPC)
1) Pops the value from the stack.
bool Inc(InterpState &S, CodePtr OpPC, bool CanOverflow)
1) Pops a pointer from the stack 2) Load the value from the pointer 3) Writes the value increased by ...
The JSON file list parser is used to communicate input to InstallAPI.
CanQual< Type > CanQualType
Represents a canonical, potentially-qualified type.
OpenMPOriginalSharingModifier
OpenMP 6.0 original sharing modifiers.
OverloadedOperatorKind
Enumeration specifying the different kinds of C++ overloaded operators.
@ OO_None
Not an overloaded operator.
@ NUM_OVERLOADED_OPERATORS
bool isa(CodeGen::Address addr)
ArrayTypeTrait
Names for the array type traits.
OpenMPDefaultClauseVariableCategory
OpenMP variable-category for 'default' clause.
AutoTypeKeyword
Which keyword(s) were used to create an AutoType.
OpenMPDefaultmapClauseModifier
OpenMP modifiers for 'defaultmap' clause.
OpenMPOrderClauseModifier
OpenMP modifiers for 'order' clause.
@ Ambiguous
Name lookup results in an ambiguity; use getAmbiguityKind to figure out what kind of ambiguity we hav...
@ NotFound
No entity found met the criteria.
@ FoundOverloaded
Name lookup found a set of overloaded functions that met the criteria.
@ Found
Name lookup found a single declaration that met the criteria.
@ FoundUnresolvedValue
Name lookup found an unresolvable value declaration and cannot yet complete.
@ NotFoundInCurrentInstantiation
No entity found met the criteria within the current instantiation,, but there were dependent base cla...
IfStatementKind
In an if statement, this denotes whether the statement is a constexpr or consteval if statement.
@ TemplateName
The identifier is a template name. FIXME: Add an annotation for that.
@ OK_ObjCProperty
An Objective-C property is a logical field of an Objective-C object which is read and written via Obj...
OpenMPAtClauseKind
OpenMP attributes for 'at' clause.
@ LCK_ByCopy
Capturing by copy (a.k.a., by value)
@ LCK_ByRef
Capturing by reference.
@ LCK_StarThis
Capturing the *this object by copy.
NonTagKind
Common ways to introduce type names without a tag for use in diagnostics.
OpenMPReductionClauseModifier
OpenMP modifiers for 'reduction' clause.
std::pair< llvm::PointerUnion< const TemplateTypeParmType *, NamedDecl *, const TemplateSpecializationType *, const SubstBuiltinTemplatePackType * >, SourceLocation > UnexpandedParameterPack
@ DevicePtr
'deviceptr' clause, allowed on Compute and Combined Constructs, plus 'data' and 'declare'.
@ Invalid
Represents an invalid clause, for the purposes of parsing.
@ Attach
'attach' clause, allowed on Compute and Combined constructs, plus 'data' and 'enter data'.
@ Self
'self' clause, allowed on Compute and Combined Constructs, plus 'update'.
@ Detach
'detach' clause, allowed on the 'exit data' construct.
TypeOfKind
The kind of 'typeof' expression we're after.
OpenMPScheduleClauseModifier
OpenMP modifiers for 'schedule' clause.
OpenACCComputeConstruct(OpenACCDirectiveKind K, SourceLocation Start, SourceLocation DirectiveLoc, SourceLocation End, ArrayRef< const OpenACCClause * > Clauses, Stmt *StructuredBlock)
OpenMPDistScheduleClauseKind
OpenMP attributes for 'dist_schedule' clause.
OpenMPDoacrossClauseModifier
OpenMP dependence types for 'doacross' clause.
@ Dependent
Parse the block as a dependent block, which may be used in some template instantiations but not other...
UnaryExprOrTypeTrait
Names for the "expression or type" traits.
std::pair< NullabilityKind, bool > DiagNullabilityKind
A nullability kind paired with a bit indicating whether it used a context-sensitive keyword.
OpenMPDynGroupprivateClauseFallbackModifier
MutableArrayRef< Expr * > MultiExprArg
@ Property
The type of a property.
@ Result
The result type of a method or function.
OpenMPBindClauseKind
OpenMP bindings for the 'bind' clause.
ArraySizeModifier
Capture whether this is a normal array (e.g.
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.
std::tuple< NamedDecl *, TemplateArgument > getReplacedTemplateParameter(Decl *D, unsigned Index)
Internal helper used by Subst* nodes to retrieve a parameter from the AssociatedDecl,...
OpenMPDefaultmapClauseKind
OpenMP attributes for 'defaultmap' clause.
OpenMPAllocateClauseModifier
OpenMP modifiers for 'allocate' clause.
OpenMPLinearClauseKind
OpenMP attributes for 'linear' clause.
llvm::omp::Directive OpenMPDirectiveKind
OpenMP directives.
OpenMPDynGroupprivateClauseModifier
@ VK_PRValue
A pr-value expression (in the C++11 taxonomy) produces a temporary value.
@ VK_LValue
An l-value expression is a reference to an object with independent storage.
@ Dependent
The name is a dependent name, so the results will differ from one instantiation to the next.
@ Exists
The symbol exists.
@ Error
An error occurred.
@ DoesNotExist
The symbol does not exist.
MutableArrayRef< Stmt * > MultiStmtArg
OpenMPNumThreadsClauseModifier
U cast(CodeGen::Address addr)
OpenMPDeviceClauseModifier
OpenMP modifiers for 'device' clause.
OpaquePtr< QualType > ParsedType
An opaque type for threading parsed type information through the parser.
ElaboratedTypeKeyword
The elaboration keyword that precedes a qualified type name or introduces an elaborated-type-specifie...
@ None
No keyword precedes the qualified type name.
@ Class
The "class" keyword introduces the elaborated-type-specifier.
@ Typename
The "typename" keyword precedes the qualified type name, e.g., typename T::type.
ActionResult< Expr * > ExprResult
OpenMPOrderClauseKind
OpenMP attributes for 'order' clause.
TypeTrait
Names for traits that operate specifically on types.
@ Parens
New-expression has a C++98 paren-delimited initializer.
ExceptionSpecificationType
The various types of exception specifications that exist in C++11.
@ EST_Uninstantiated
not instantiated yet
@ EST_Unevaluated
not evaluated yet, for special member function
@ EST_Dynamic
throw(T1, T2)
OpenMPScheduleClauseKind
OpenMP attributes for 'schedule' clause.
static QualType TransformTypeSpecType(TypeLocBuilder &TLB, TyLoc T)
ActionResult< Stmt * > StmtResult
OpenMPMapClauseKind
OpenMP mapping kind for 'map' clause.
Expr * AllocatorTraits
Allocator traits.
Expr * Allocator
Allocator.
SourceLocation LParenLoc
Locations of '(' and ')' symbols.
The result of a constraint satisfaction check, containing the necessary information to diagnose an un...
Represents an explicit template argument list in C++, e.g., the "<int>" in "sort<int>".
static const ASTTemplateArgumentListInfo * Create(const ASTContext &C, const TemplateArgumentListInfo &List)
UnsignedOrNone ArgPackSubstIndex
DeclarationNameInfo - A collector data type for bundling together a DeclarationName and the correspon...
SourceLocation getLoc() const
getLoc - Returns the main location of the declaration name.
DeclarationName getName() const
getName - Returns the embedded declaration name.
void setNamedTypeInfo(TypeSourceInfo *TInfo)
setNamedTypeInfo - Sets the source type info associated to the name.
void setName(DeclarationName N)
setName - Sets the embedded declaration name.
TypeSourceInfo * getNamedTypeInfo() const
getNamedTypeInfo - Returns the source type info associated to the name.
A FunctionEffect plus a potential boolean expression determining whether the effect is declared (e....
Holds information about the various types of exception specification.
FunctionDecl * SourceTemplate
The function template whose exception specification this is instantiated from, for EST_Uninstantiated...
ExceptionSpecificationType Type
The kind of exception specification this is.
ArrayRef< QualType > Exceptions
Explicitly-specified list of exception types.
Expr * NoexceptExpr
Noexcept expression, if this is a computed noexcept specification.
Extra information about a function prototype.
ExceptionSpecInfo ExceptionSpec
FunctionEffectsRef FunctionEffects
const ExtParameterInfo * ExtParameterInfos
const IdentifierInfo * getIdentifier() const
Returns the identifier to which this template name refers.
OverloadedOperatorKind getOperator() const
Return the overloaded operator to which this template name refers.
static TagTypeKind getTagTypeKindForKeyword(ElaboratedTypeKeyword Keyword)
Converts an elaborated type keyword into a TagTypeKind.
const NamespaceBaseDecl * Namespace
Iterator range representation begin:end[:step].
This structure contains most locations needed for by an OMPVarListClause.
An element in an Objective-C dictionary literal.
Data for list of allocators.
A context in which code is being synthesized (where a source location alone is not sufficient to iden...
@ LambdaExpressionSubstitution
We are substituting into a lambda expression.
An RAII helper that pops function a function scope on exit.
Keeps information about an identifier in a nested-name-spec.
Location information for a TemplateArgument.
UnsignedOrNone OrigNumExpansions
bool ExpandUnderForgetSubstitions
UnsignedOrNone NumExpansions