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,
1145 return SemaRef.Context.getAutoType(
1146 DK, DeducedAsType,
Keyword, TypeConstraintConcept, TypeConstraintArgs);
1154 return SemaRef.Context.getDeducedTemplateSpecializationType(
1173 return SemaRef.BuildParenType(InnerType);
1186 bool DeducedTSTContext) {
1188 SS.
Adopt(QualifierLoc);
1192 if (!
SemaRef.computeDeclContext(SS))
1200 return SemaRef.CheckTypenameType(
Keyword, KeywordLoc, QualifierLoc,
1201 *Id, IdLoc, DeducedTSTContext);
1214 if (
SemaRef.RequireCompleteDeclContext(SS, DC))
1219 switch (
Result.getResultKind()) {
1230 llvm_unreachable(
"Tag lookup cannot find non-tags");
1242 switch (
Result.getResultKind()) {
1248 SemaRef.Diag(IdLoc, diag::err_tag_reference_non_tag)
1249 << SomeDecl << NTK << Kind;
1254 SemaRef.Diag(IdLoc, diag::err_not_tag_in_scope)
1260 if (!
SemaRef.isAcceptableTagRedeclaration(Tag, Kind,
false,
1262 SemaRef.Diag(KeywordLoc, diag::err_use_with_wrong_tag) << Id;
1263 SemaRef.Diag(Tag->getLocation(), diag::note_previous_use);
1319 bool AllowInjectedClassName);
1332 bool AllowInjectedClassName);
1338 bool AllowInjectedClassName);
1348 Decl *AssociatedDecl,
unsigned Index,
1351 ArgPack, AssociatedDecl, Index, Final);
1405 return SemaRef.ActOnLabelStmt(IdentLoc, L, ColonLoc, SubStmt);
1415 if (
SemaRef.CheckRebuiltStmtAttributes(Attrs))
1417 return SemaRef.BuildAttributedStmt(AttrLoc, Attrs, SubStmt);
1429 Then, ElseLoc, Else);
1483 Inc, RParenLoc, Body);
1528 bool IsVolatile,
unsigned NumOutputs,
1535 NumInputs, Names, Constraints, Exprs,
1536 AsmString, Clobbers, NumLabels, RParenLoc);
1545 StringRef AsmString,
1546 unsigned NumOutputs,
unsigned NumInputs,
1552 NumOutputs, NumInputs,
1553 Constraints, Clobbers, Exprs, EndLoc);
1582 CoawaitLoc, Operand, OpCoawaitLookup);
1586 Suspend.
get(),
true);
1687 Kind, DirName, CancelRegion, Clauses, AStmt, StartLoc, EndLoc);
1699 Kind, DirName, Clauses, AStmt, StartLoc, EndLoc);
1713 NameModifier,
Condition, StartLoc, LParenLoc, NameModifierLoc, ColonLoc,
1739 Modifier, NumThreads, StartLoc, LParenLoc, ModifierLoc, EndLoc);
1776 std::optional<unsigned> FillIdx,
1778 unsigned FillCount = FillIdx ? 1 : 0;
1780 Counts, StartLoc, LParenLoc, EndLoc, FillIdx, FillLoc, FillCount);
1811 First, Count, StartLoc, LParenLoc, FirstLoc, CountLoc, EndLoc);
1847 Kind, KindKwLoc, VCKind, VCLoc, StartLoc, LParenLoc, EndLoc);
1860 Kind, KindKwLoc, StartLoc, LParenLoc, EndLoc);
1867 ImpexTypeArg, StartLoc, LParenLoc, EndLoc);
1880 M1, M2, Kind, ChunkSize, StartLoc, LParenLoc, M1Loc, M2Loc, KindLoc,
1942 VarList, LPKind, LPKindLoc, ColonLoc, StartLoc, LParenLoc, EndLoc);
1970 VarList, {Modifier, OriginalSharingModifier}, StartLoc, LParenLoc,
1971 ModifierLoc, ColonLoc, EndLoc, ReductionIdScopeSpec, ReductionId,
1972 UnresolvedReductions);
1986 VarList, StartLoc, LParenLoc, ColonLoc, EndLoc, ReductionIdScopeSpec,
1987 ReductionId, UnresolvedReductions);
2002 VarList, StartLoc, LParenLoc, ColonLoc, EndLoc, ReductionIdScopeSpec,
2003 ReductionId, UnresolvedReductions);
2016 VarList, Step, StartLoc, LParenLoc, Modifier, ModifierLoc, ColonLoc,
2017 StepModifierLoc, EndLoc);
2030 VarList, Alignment, StartLoc, LParenLoc, ColonLoc, EndLoc);
2090 Data, DepModifier, VarList, StartLoc, LParenLoc, EndLoc);
2103 Modifier,
Device, StartLoc, LParenLoc, ModifierLoc, EndLoc);
2118 IteratorModifier, MapTypeModifiers, MapTypeModifiersLoc,
2119 MapperIdScopeSpec, MapperId, MapType, IsMapTypeImplicit, MapLoc,
2120 ColonLoc, VarList, Locs,
2121 false, UnresolvedMappers);
2138 Allocate, Alignment, FirstModifier, FirstModifierLoc, SecondModifier,
2139 SecondModifierLoc, VarList, StartLoc, LParenLoc, ColonLoc, EndLoc);
2187 Modifier,
Device, StartLoc, LParenLoc, ModifierLoc, EndLoc);
2200 Modifier, NumTasks, StartLoc, LParenLoc, ModifierLoc, EndLoc);
2235 Kind, ChunkSize, StartLoc, LParenLoc, KindLoc, CommaLoc, EndLoc);
2250 MotionModifiers, MotionModifiersLoc, IteratorModifier,
2251 MapperIdScopeSpec, MapperId, ColonLoc, VarList, Locs,
2267 MotionModifiers, MotionModifiersLoc, IteratorModifier,
2268 MapperIdScopeSpec, MapperId, ColonLoc, VarList, Locs,
2281 VarList, Locs, FallbackModifier, FallbackModifierLoc);
2323 M, Kind, StartLoc, LParenLoc, MLoc, KindLoc, EndLoc);
2370 StartLoc, LParenLoc, EndLoc,
Data);
2383 StartLoc, LParenLoc, ColonLoc, EndLoc, Modifier, Locators);
2395 Modifier, Kind, StartLoc, LParenLoc, ModifierKwLoc, KindKwLoc, EndLoc);
2408 InteropVar, InteropInfo, StartLoc, LParenLoc, VarLoc, EndLoc);
2419 LParenLoc, VarLoc, EndLoc);
2431 InteropVar, StartLoc, LParenLoc, VarLoc, EndLoc);
2502 M1, M2, Size, StartLoc, LParenLoc, M1Loc, M2Loc, EndLoc);
2583 DepType, DepLoc, ColonLoc, VarList, StartLoc, LParenLoc, EndLoc);
2631 ForLoc, Element, Collection, RParenLoc);
2649 StartLoc, IdLoc, Id);
2686 if (
DeclStmt *RangeStmt = dyn_cast<DeclStmt>(Range)) {
2687 if (RangeStmt->isSingleDecl()) {
2688 if (
VarDecl *RangeVar = dyn_cast<VarDecl>(RangeStmt->getSingleDecl())) {
2689 if (RangeVar->isInvalidDecl())
2692 Expr *RangeExpr = RangeVar->getInit();
2699 diag::err_objc_for_range_init_stmt)
2700 <<
Init->getSourceRange();
2703 ForLoc, LoopVar, RangeExpr, RParenLoc);
2710 ForLoc, CoawaitLoc,
Init, ColonLoc, Range, Begin, End,
Cond, Inc,
2724 QualifierLoc, NameInfo, Nested);
2786 SS.
Adopt(QualifierLoc);
2908 if (IsOMPArraySection)
2910 Base, LBracketLoc, LowerBound, ColonLocFirst, ColonLocSecond, Length,
2911 Stride, RBracketLoc);
2913 assert(Stride ==
nullptr && !ColonLocSecond.
isValid() &&
2914 "Stride/second colon not allowed for OpenACC");
2917 Base, LBracketLoc, LowerBound, ColonLocFirst, Length, RBracketLoc);
2929 Base, LParenLoc, RParenLoc, Dims, BracketsRanges);
2941 nullptr, IteratorKwLoc, LLoc, RLoc,
Data);
2951 Expr *ExecConfig =
nullptr) {
2953 nullptr, Callee, LParenLoc, Args, RParenLoc, ExecConfig);
2960 nullptr, Callee, LParenLoc, Args, RParenLoc);
2978 if (!
Member->getDeclName()) {
2982 assert(
Member->getType()->isRecordType() &&
2983 "unnamed member not of record type?");
2996 if (!isArrow &&
Base->isPRValue()) {
3011 SS.
Adopt(QualifierLoc);
3014 if (
Base->containsErrors())
3019 if (isArrow && !BaseType->isPointerType())
3025 R.addDecl(FoundDecl);
3028 if (
getSema().isUnevaluatedContext() &&
Base->isImplicitCXXThis() &&
3033 ->getAsCXXRecordDecl()) {
3037 if (!ThisClass->Equals(
Class) && !ThisClass->isDerivedFrom(
Class))
3045 FirstQualifierInScope,
3046 R, ExplicitTemplateArgs,
3056 bool ForFoldExpression =
false) {
3135 return SemaRef.BuildInitList(LBraceLoc,
Inits, RBraceLoc);
3148 =
SemaRef.ActOnDesignatedInitializer(Desig, EqualOrColonLoc, GNUSyntax,
3188 unsigned NumUserSpecifiedExprs,
3193 InitLoc, LParenLoc, RParenLoc);
3223 return SemaRef.ActOnChooseExpr(BuiltinLoc,
3235 Expr *ControllingExpr,
3240 ControllingExpr, Types, Exprs);
3255 ControllingType, Types, Exprs);
3288 case Stmt::CXXStaticCastExprClass:
3289 return getDerived().RebuildCXXStaticCastExpr(OpLoc, LAngleLoc, TInfo,
3290 RAngleLoc, LParenLoc,
3291 SubExpr, RParenLoc);
3293 case Stmt::CXXDynamicCastExprClass:
3294 return getDerived().RebuildCXXDynamicCastExpr(OpLoc, LAngleLoc, TInfo,
3295 RAngleLoc, LParenLoc,
3296 SubExpr, RParenLoc);
3298 case Stmt::CXXReinterpretCastExprClass:
3299 return getDerived().RebuildCXXReinterpretCastExpr(OpLoc, LAngleLoc, TInfo,
3300 RAngleLoc, LParenLoc,
3304 case Stmt::CXXConstCastExprClass:
3305 return getDerived().RebuildCXXConstCastExpr(OpLoc, LAngleLoc, TInfo,
3306 RAngleLoc, LParenLoc,
3307 SubExpr, RParenLoc);
3309 case Stmt::CXXAddrspaceCastExprClass:
3310 return getDerived().RebuildCXXAddrspaceCastExpr(
3311 OpLoc, LAngleLoc, TInfo, RAngleLoc, LParenLoc, SubExpr, RParenLoc);
3314 llvm_unreachable(
"Invalid C++ named cast");
3392 OpLoc, tok::kw_addrspace_cast, TInfo, SubExpr,
3404 bool ListInitialization) {
3408 if (
auto *PLE = dyn_cast<ParenListExpr>(Sub))
3410 TInfo, LParenLoc,
MultiExprArg(PLE->getExprs(), PLE->getNumExprs()),
3411 RParenLoc, ListInitialization);
3413 if (
auto *PLE = dyn_cast<CXXParenListInitExpr>(Sub))
3415 TInfo, LParenLoc, PLE->getInitExprs(), RParenLoc, ListInitialization);
3419 ListInitialization);
3483 if (
getSema().CheckCXXThisType(ThisLoc, ThisType))
3493 bool IsThrownVariableInScope) {
3503 Expr *RewrittenExpr) {
3505 RewrittenExpr,
getSema().CurContext);
3539 std::optional<Expr *> ArraySize,
3558 bool IsGlobalDelete,
3609 bool IsAddressOfOperand,
3612 SS.
Adopt(QualifierLoc);
3614 if (TemplateArgs || TemplateKWLoc.
isValid())
3616 SS, TemplateKWLoc, NameInfo, TemplateArgs, IsAddressOfOperand);
3619 SS, NameInfo, IsAddressOfOperand, RecoveryTSI);
3641 bool IsElidable,
MultiExprArg Args,
bool HadMultipleCandidates,
3642 bool ListInitialization,
bool StdInitListInitialization,
3649 FoundCtor =
Constructor->getInheritedConstructor().getConstructor();
3652 if (
getSema().CompleteConstructorCall(FoundCtor, T, Args, Loc,
3659 HadMultipleCandidates,
3661 StdInitListInitialization,
3662 RequiresZeroInit, ConstructKind,
3670 bool ConstructsVBase,
3671 bool InheritedFromVBase) {
3673 Loc, T,
Constructor, ConstructsVBase, InheritedFromVBase);
3684 bool ListInitialization) {
3686 TSInfo, LParenOrBraceLoc, Args, RParenOrBraceLoc, ListInitialization);
3697 bool ListInitialization) {
3699 RParenLoc, ListInitialization);
3716 SS.
Adopt(QualifierLoc);
3718 return SemaRef.BuildMemberReferenceExpr(BaseE, BaseType,
3719 OperatorLoc, IsArrow,
3721 FirstQualifierInScope,
3723 TemplateArgs,
nullptr);
3739 SS.
Adopt(QualifierLoc);
3741 return SemaRef.BuildMemberReferenceExpr(BaseE, BaseType,
3742 OperatorLoc, IsArrow,
3744 FirstQualifierInScope,
3745 R, TemplateArgs,
nullptr);
3753 return SemaRef.BuildCXXNoexceptExpr(Range.getBegin(), Arg, Range.getEnd());
3766 RParenLoc, Length, PartialArgs);
3771 Expr *PackIdExpression,
Expr *IndexExpr,
3773 bool FullySubstituted =
false) {
3775 IndexExpr, RSquareLoc, ExpandedExprs,
3801 NamedConcept, TALI);
3819 LocalParameters, RParenLoc, Requirements,
3826 return SemaRef.BuildTypeRequirement(SubstDiag);
3830 return SemaRef.BuildTypeRequirement(T);
3838 return SemaRef.BuildExprRequirement(SubstDiag, IsSimple, NoexceptLoc,
3845 return SemaRef.BuildExprRequirement(E, IsSimple, NoexceptLoc,
3852 return SemaRef.BuildNestedRequirement(InvalidConstraintEntity,
3857 return SemaRef.BuildNestedRequirement(Constraint);
3873 Expr **Elements,
unsigned NumElements) {
3883 RB,
Base, Key, getterMethod, setterMethod);
3902 return SemaRef.ObjC().BuildObjCEncodeExpression(AtLoc, EncodeTypeInfo,
3914 return SemaRef.ObjC().BuildClassMessage(
3915 ReceiverTypeInfo, ReceiverTypeInfo->
getType(),
3928 return SemaRef.ObjC().BuildInstanceMessage(Receiver, Receiver->
getType(),
3931 SelectorLocs, RBracLoc, Args);
3943 return Method->isInstanceMethod()
3944 ?
SemaRef.ObjC().BuildInstanceMessage(
3945 nullptr, SuperType, SuperLoc, Sel,
Method, LBracLoc,
3946 SelectorLocs, RBracLoc, Args)
3947 :
SemaRef.ObjC().BuildClassMessage(
nullptr, SuperType, SuperLoc,
3949 SelectorLocs, RBracLoc, Args);
3958 bool IsArrow,
bool IsFreeIvar) {
3967 if (IsFreeIvar &&
Result.isUsable())
4004 PropertyLoc,
Base));
4033 =
SemaRef.Context.Idents.get(
"__builtin_shufflevector");
4036 assert(!Lookup.
empty() &&
"No __builtin_shufflevector?");
4044 Callee =
SemaRef.ImpCastExprToType(Callee, CalleePtrTy,
4045 CK_BuiltinFnToFnPtr).get();
4061 return SemaRef.ConvertVectorExpr(SrcExpr, DstTInfo, BuiltinLoc, RParenLoc);
4076 EllipsisLoc, NumExpansions);
4100 llvm_unreachable(
"Pack expansion pattern has no parameter packs");
4136 EllipsisLoc, RHS, RParenLoc,
4145 Init->containsUnexpandedParameterPack();
4146 else if (PVD->hasUninstantiatedDefaultArg())
4148 PVD->getUninstantiatedDefaultArg()
4149 ->containsUnexpandedParameterPack();
4303 Exprs.push_back(DevNumExpr);
4304 llvm::append_range(Exprs, QueueIdExprs);
4341 AssociatedDecl, NTTP, Loc, Arg, PackIndex, Final);
4365 ObjectType, FirstQualifierInScope);
4371 QualType TransformDependentNameType(TypeLocBuilder &TLB,
4372 DependentNameTypeLoc TL,
4373 bool DeducibleTSTContext,
4374 QualType ObjectType = QualType(),
4375 NamedDecl *UnqualLookup =
nullptr);
4378 TransformOpenACCClauseList(OpenACCDirectiveKind DirKind,
4383 OpenACCDirectiveKind DirKind,
4384 const OpenACCClause *OldClause);
4387template <
typename Derived>
4397#define STMT(Node, Parent) \
4398 case Stmt::Node##Class: return getDerived().Transform##Node(cast<Node>(S));
4399#define VALUESTMT(Node, Parent) \
4400 case Stmt::Node##Class: \
4401 return getDerived().Transform##Node(cast<Node>(S), SDK);
4402#define ABSTRACT_STMT(Node)
4403#define EXPR(Node, Parent)
4404#include "clang/AST/StmtNodes.inc"
4407#define STMT(Node, Parent)
4408#define ABSTRACT_STMT(Stmt)
4409#define EXPR(Node, Parent) case Stmt::Node##Class:
4410#include "clang/AST/StmtNodes.inc"
4415 E =
getSema().ActOnStmtExprResult(E);
4423template<
typename Derived>
4431#define GEN_CLANG_CLAUSE_CLASS
4432#define CLAUSE_CLASS(Enum, Str, Class) \
4434 return getDerived().Transform##Class(cast<Class>(S));
4435#include "llvm/Frontend/OpenMP/OMP.inc"
4442template<
typename Derived>
4449#define STMT(Node, Parent) case Stmt::Node##Class: break;
4450#define ABSTRACT_STMT(Stmt)
4451#define EXPR(Node, Parent) \
4452 case Stmt::Node##Class: return getDerived().Transform##Node(cast<Node>(E));
4453#include "clang/AST/StmtNodes.inc"
4459template<
typename Derived>
4467 if (
auto *FE = dyn_cast<FullExpr>(
Init))
4468 Init = FE->getSubExpr();
4470 if (
auto *AIL = dyn_cast<ArrayInitLoopExpr>(
Init)) {
4476 Init = MTE->getSubExpr();
4479 Init = Binder->getSubExpr();
4482 Init = ICE->getSubExprAsWritten();
4485 dyn_cast<CXXStdInitializerListExpr>(
Init))
4522 getSema().currentEvaluationContext().InLifetimeExtendingContext =
4523 getSema().parentEvaluationContext().InLifetimeExtendingContext;
4524 getSema().currentEvaluationContext().RebuildDefaultArgOrDefaultInit =
4525 getSema().parentEvaluationContext().RebuildDefaultArgOrDefaultInit;
4527 bool ArgChanged =
false;
4529 true, NewArgs, &ArgChanged))
4539 if (
Parens.isInvalid()) {
4542 assert(NewArgs.empty() &&
4543 "no parens or braces but have direct init with arguments?");
4550template<
typename Derived>
4556 for (
unsigned I = 0; I != NumInputs; ++I) {
4566 Expr *Pattern = Expansion->getPattern();
4569 getSema().collectUnexpandedParameterPacks(Pattern, Unexpanded);
4570 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
4575 bool RetainExpansion =
false;
4576 UnsignedOrNone OrigNumExpansions = Expansion->getNumExpansions();
4580 Unexpanded,
true, Expand,
4581 RetainExpansion, NumExpansions))
4594 Expansion->getEllipsisLoc(),
4596 if (Out.isInvalid())
4601 Outputs.push_back(Out.get());
4607 if (ArgChanged) *ArgChanged =
true;
4611 for (
unsigned I = 0; I != *NumExpansions; ++I) {
4614 if (Out.isInvalid())
4617 if (Out.get()->containsUnexpandedParameterPack()) {
4619 Out.get(), Expansion->getEllipsisLoc(), OrigNumExpansions);
4620 if (Out.isInvalid())
4624 Outputs.push_back(Out.get());
4629 if (RetainExpansion) {
4630 ForgetPartiallySubstitutedPackRAII Forget(
getDerived());
4633 if (Out.isInvalid())
4637 Out.get(), Expansion->getEllipsisLoc(), OrigNumExpansions);
4638 if (Out.isInvalid())
4641 Outputs.push_back(Out.get());
4648 IsCall ?
getDerived().TransformInitializer(Inputs[I],
false)
4653 if (
Result.get() != Inputs[I] && ArgChanged)
4656 Outputs.push_back(
Result.get());
4662template <
typename Derived>
4673 VarDecl *ConditionVar = cast_or_null<VarDecl>(
4679 return getSema().ActOnConditionVariable(ConditionVar, Loc, Kind);
4688 return getSema().ActOnCondition(
nullptr, Loc, CondExpr.
get(), Kind,
4695template <
typename Derived>
4703 Qualifier = Qualifier.getAsNamespaceAndPrefix().Prefix)
4715 llvm_unreachable(
"unexpected null nested name specifier");
4746 QualifierLoc =
getDerived().TransformNestedNameSpecifierLoc(
4747 QualifierLoc, ObjectType, FirstQualifierInScope);
4751 FirstQualifierInScope =
nullptr;
4753 SS.
Adopt(QualifierLoc);
4757 if (
SemaRef.BuildCXXNestedNameSpecifier(
nullptr, IdInfo,
4759 FirstQualifierInScope,
false))
4767 T = TransformTypeInObjectScope(TLB, TL, ObjectType,
4768 FirstQualifierInScope);
4774 if (T->isDependentType() || T->isRecordType() ||
4775 (
SemaRef.getLangOpts().CPlusPlus11 && T->isEnumeralType())) {
4776 if (T->isEnumeralType())
4778 diag::warn_cxx98_compat_enum_nested_name_spec);
4785 if (!TTL || !TTL.
getDecl()->isInvalidDecl()) {
4809template<
typename Derived>
4829 TemplateDecl *NewTemplate = cast_or_null<TemplateDecl>(
4836 SemaRef.Context.DeclarationNames.getCXXDeductionGuideName(NewTemplate));
4846 NewTInfo =
getDerived().TransformType(OldTInfo);
4849 NewCanTy =
SemaRef.Context.getCanonicalType(NewTInfo->
getType());
4857 NewCanTy =
SemaRef.Context.getCanonicalType(NewT);
4870 llvm_unreachable(
"Unknown name kind.");
4873template <
typename Derived>
4877 QualType ObjectType,
bool AllowInjectedClassName) {
4879 return getDerived().RebuildTemplateName(SS, TemplateKWLoc, *II, NameLoc,
4880 ObjectType, AllowInjectedClassName);
4882 NameLoc, ObjectType,
4883 AllowInjectedClassName);
4886template <
typename Derived>
4890 NamedDecl *FirstQualifierInScope,
bool AllowInjectedClassName) {
4892 TemplateName UnderlyingName = QTN->getUnderlyingTemplate();
4895 QualifierLoc =
getDerived().TransformNestedNameSpecifierLoc(
4896 QualifierLoc, ObjectType, FirstQualifierInScope);
4903 UnderlyingQualifier, TemplateKWLoc, UnderlyingName, NameLoc, ObjectType,
4904 FirstQualifierInScope, AllowInjectedClassName);
4905 if (NewUnderlyingName.
isNull())
4907 assert(!UnderlyingQualifier &&
"unexpected qualifier");
4911 NewUnderlyingName == UnderlyingName)
4914 SS.
Adopt(QualifierLoc);
4915 return getDerived().RebuildTemplateName(SS, QTN->hasTemplateKeyword(),
4921 QualifierLoc =
getDerived().TransformNestedNameSpecifierLoc(
4922 QualifierLoc, ObjectType, FirstQualifierInScope);
4936 SS.
Adopt(QualifierLoc);
4937 return getDerived().RebuildTemplateName(SS, TemplateKWLoc, DTN->getName(),
4938 NameLoc, ObjectType,
4939 AllowInjectedClassName);
4944 assert(!QualifierLoc &&
"Unexpected qualified SubstTemplateTemplateParm");
4951 ReplacementQualifierLoc = Builder.getWithLocInContext(
SemaRef.Context);
4955 ReplacementQualifierLoc, TemplateKWLoc, ReplacementName, NameLoc,
4956 ObjectType, FirstQualifierInScope, AllowInjectedClassName);
4959 Decl *AssociatedDecl =
4960 getDerived().TransformDecl(NameLoc, S->getAssociatedDecl());
4962 AssociatedDecl == S->getAssociatedDecl())
4964 return SemaRef.Context.getSubstTemplateTemplateParm(
4965 NewName, AssociatedDecl, S->getIndex(), S->getPackIndex(),
4970 "DeducedTemplateName should not escape partial ordering");
4974 assert(!QualifierLoc &&
"Unexpected qualifier");
4981 assert(!QualifierLoc &&
4982 "Unexpected qualified SubstTemplateTemplateParmPack");
4984 SubstPack->getArgumentPack(), SubstPack->getAssociatedDecl(),
4985 SubstPack->getIndex(), SubstPack->getFinal());
4989 llvm_unreachable(
"overloaded function decl survived to here");
4992template <
typename Derived>
4997 QualifierLoc, TemplateKeywordLoc, Name, NameLoc);
5003template<
typename Derived>
5007 Output =
getSema().getTrivialTemplateArgumentLoc(
5011template <
typename Derived>
5019 llvm_unreachable(
"Unexpected TemplateArgument");
5042 if (NewT == T && D == NewD)
5059 llvm_unreachable(
"unexpected template argument kind");
5091 llvm_unreachable(
"Caller should expand pack expansions");
5107 E =
SemaRef.ActOnConstantExpression(E);
5122template<
typename Derived,
typename InputIterator>
5130 typedef typename std::iterator_traits<InputIterator>::difference_type
5145 : Self(Self), Iter(Iter) { }
5160 Self.InventTemplateArgumentLoc(*Iter,
Result);
5168 return X.Iter == Y.Iter;
5173 return X.Iter != Y.Iter;
5177template<
typename Derived>
5178template<
typename InputIterator>
5198 PackLocIterator(*
this, In.getArgument().pack_begin()),
5199 PackLocIterator(*
this, In.getArgument().pack_end()), *PackOutput,
5206 if (In.getArgument().isPackExpansion()) {
5218 std::optional<ForgetSubstitutionRAII> ForgetSubst;
5228 if (Out.getArgument().containsUnexpandedParameterPack()) {
5231 if (Out.getArgument().isNull())
5241 ForgetPartiallySubstitutedPackRAII Forget(
getDerived());
5249 if (Out.getArgument().isNull())
5268template <
typename Derived>
5269template <
typename InputIterator>
5278 return !Arg.isDependent() && Arg.isConceptOrConceptTemplateParameter();
5290 PackLocIterator(*
this, In.getArgument().pack_begin()),
5291 PackLocIterator(*
this, In.getArgument().pack_end()), Outputs,
5297 if (!isNonDependentConceptArgument(In.getArgument())) {
5312template <
typename Derived>
5323 Pattern =
getSema().getTemplateArgumentPackExpansionPattern(
5326 getSema().collectUnexpandedParameterPacks(Pattern, Unexpanded);
5327 if (IsLateExpansionAttempt) {
5332 return P.first.dyn_cast<
const SubstBuiltinTemplatePackType *>();
5334 if (!SawPackTypes) {
5339 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
5347 Info.
Ellipsis, Pattern.getSourceRange(), Unexpanded,
5353 if (ComputeInfo(In,
false, Info, Pattern))
5365 std::optional<Sema::ArgPackSubstIndexRAII> SubstIndex(
5366 std::in_place,
getSema(), std::nullopt);
5372 if (Out.getArgument().isNull())
5409 ForgetSubstitutionRAII ForgetSubst(
getDerived());
5410 if (ComputeInfo(Out,
true, Info, OutPattern))
5423template<
typename Derived>
5441template <
typename Derived>
5461template<
typename Derived>
5464 switch (T.getTypeLocClass()) {
5465#define ABSTRACT_TYPELOC(CLASS, PARENT)
5466#define TYPELOC(CLASS, PARENT) \
5467 case TypeLoc::CLASS: \
5468 return getDerived().Transform##CLASS##Type(TLB, \
5469 T.castAs<CLASS##TypeLoc>());
5470#include "clang/AST/TypeLocNodes.def"
5473 llvm_unreachable(
"unhandled type loc!");
5476template<
typename Derived>
5489template <
typename Derived>
5527template<
typename Derived>
5533 auto SuppressObjCLifetime =
5536 Result = getDerived().TransformTemplateTypeParmType(TLB, TTP,
5537 SuppressObjCLifetime);
5538 }
else if (
auto STTP = UnqualTL.
getAs<SubstTemplateTypeParmPackTypeLoc>()) {
5539 Result = getDerived().TransformSubstTemplateTypeParmPackType(
5540 TLB, STTP, SuppressObjCLifetime);
5542 Result = getDerived().TransformType(TLB, UnqualTL);
5561template <
typename Derived>
5571 SemaRef.Diag(Loc, diag::err_address_space_mismatch_templ_inst)
5578 if (T.getPointerAuth().isPresent()) {
5579 SemaRef.Diag(Loc, diag::err_ptrauth_qualifier_redundant) << TL.
getType();
5582 if (!T->isDependentType()) {
5583 if (!T->isSignableType(
SemaRef.getASTContext())) {
5584 SemaRef.Diag(Loc, diag::err_ptrauth_qualifier_invalid_target) << T;
5592 if (T->isFunctionType()) {
5593 T =
SemaRef.getASTContext().getAddrSpaceQualType(T,
5603 if (T->isReferenceType()) {
5613 if (!T->isObjCLifetimeType() && !T->isDependentType())
5615 else if (T.getObjCLifetime()) {
5619 const AutoType *AutoTy;
5620 if ((AutoTy = dyn_cast<AutoType>(T)) && AutoTy->isDeduced()) {
5626 SemaRef.Context.getQualifiedType(
Deduced.getUnqualifiedType(), Qs);
5627 T =
SemaRef.Context.getAutoType(AutoTy->getDeducedKind(),
Deduced,
5628 AutoTy->getKeyword(),
5629 AutoTy->getTypeConstraintConcept(),
5630 AutoTy->getTypeConstraintArguments());
5635 SemaRef.Diag(Loc, diag::err_attr_objc_ownership_redundant) << T;
5641 return SemaRef.BuildQualifiedType(T, Loc, Quals);
5644template <
typename Derived>
5645QualType TreeTransform<Derived>::TransformTypeInObjectScope(
5648 assert(!getDerived().AlreadyTransformed(TL.
getType()));
5651 case TypeLoc::TemplateSpecialization:
5652 return getDerived().TransformTemplateSpecializationType(
5654 FirstQualifierInScope,
true);
5655 case TypeLoc::DependentName:
5656 return getDerived().TransformDependentNameType(
5658 ObjectType, FirstQualifierInScope);
5662 return getDerived().TransformType(TLB, TL);
5666template <
class TyLoc>
static inline
5668 TyLoc NewT = TLB.
push<TyLoc>(T.getType());
5669 NewT.setNameLoc(T.getNameLoc());
5673template<
typename Derived>
5674QualType TreeTransform<Derived>::TransformBuiltinType(TypeLocBuilder &TLB,
5676 BuiltinTypeLoc NewT = TLB.push<BuiltinTypeLoc>(T.getType());
5677 NewT.setBuiltinLoc(T.getBuiltinLoc());
5678 if (T.needsExtraLocalData())
5679 NewT.getWrittenBuiltinSpecs() = T.getWrittenBuiltinSpecs();
5683template<
typename Derived>
5690template <
typename Derived>
5694 return getDerived().
TransformType(TLB, TL.getOriginalLoc());
5697template<
typename Derived>
5700 QualType OriginalType = getDerived().TransformType(TLB, TL.getOriginalLoc());
5701 if (OriginalType.isNull())
5705 if (getDerived().AlwaysRebuild() ||
5706 OriginalType != TL.getOriginalLoc().getType())
5713template <
typename Derived>
5717 QualType OriginalType = getDerived().TransformType(TLB, TL.getElementLoc());
5718 if (OriginalType.isNull())
5722 if (getDerived().AlwaysRebuild() ||
5723 OriginalType != TL.getElementLoc().getType())
5730template<
typename Derived>
5734 = getDerived().TransformType(TLB, TL.getPointeeLoc());
5735 if (PointeeType.isNull())
5739 if (PointeeType->getAs<ObjCObjectType>()) {
5751 if (getDerived().AlwaysRebuild() ||
5752 PointeeType != TL.getPointeeLoc().getType()) {
5753 Result = getDerived().RebuildPointerType(PointeeType, TL.getSigilLoc());
5760 TLB.TypeWasModifiedSafely(
Result->getPointeeType());
5767template<
typename Derived>
5772 = getDerived().TransformType(TLB, TL.getPointeeLoc());
5773 if (PointeeType.isNull())
5777 if (getDerived().AlwaysRebuild() ||
5778 PointeeType != TL.getPointeeLoc().getType()) {
5779 Result = getDerived().RebuildBlockPointerType(PointeeType,
5794template<
typename Derived>
5802 if (PointeeType.
isNull())
5807 PointeeType != T->getPointeeTypeAsWritten()) {
5809 T->isSpelledAsLValue(),
5831template<
typename Derived>
5835 return TransformReferenceType(TLB, TL);
5838template<
typename Derived>
5840TreeTransform<Derived>::TransformRValueReferenceType(TypeLocBuilder &TLB,
5841 RValueReferenceTypeLoc TL) {
5842 return TransformReferenceType(TLB, TL);
5845template<
typename Derived>
5849 QualType PointeeType = getDerived().TransformType(TLB, TL.getPointeeLoc());
5850 if (PointeeType.isNull())
5857 getDerived().TransformNestedNameSpecifierLoc(OldQualifierLoc);
5858 if (!NewQualifierLoc)
5861 CXXRecordDecl *OldCls = T->getMostRecentCXXRecordDecl(), *NewCls =
nullptr;
5863 NewCls = cast_or_null<CXXRecordDecl>(
5864 getDerived().TransformDecl(TL.getStarLoc(), OldCls));
5870 if (getDerived().AlwaysRebuild() || PointeeType != T->getPointeeType() ||
5871 NewQualifierLoc.getNestedNameSpecifier() !=
5872 OldQualifierLoc.getNestedNameSpecifier() ||
5875 SS.
Adopt(NewQualifierLoc);
5876 Result = getDerived().RebuildMemberPointerType(PointeeType, SS, NewCls,
5885 if (MPT && PointeeType != MPT->getPointeeType()) {
5892 NewTL.setQualifierLoc(NewQualifierLoc);
5897template<
typename Derived>
5902 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
5903 if (ElementType.isNull())
5907 Expr *OldSize = TL.getSizeExpr();
5909 OldSize =
const_cast<Expr*
>(T->getSizeExpr());
5910 Expr *NewSize =
nullptr;
5914 NewSize = getDerived().TransformExpr(OldSize).template getAs<Expr>();
5919 if (getDerived().AlwaysRebuild() ||
5920 ElementType != T->getElementType() ||
5921 (T->getSizeExpr() && NewSize != OldSize)) {
5922 Result = getDerived().RebuildConstantArrayType(ElementType,
5923 T->getSizeModifier(),
5924 T->getSize(), NewSize,
5925 T->getIndexTypeCVRQualifiers(),
5926 TL.getBracketsRange());
5937 NewTL.setRBracketLoc(TL.getRBracketLoc());
5938 NewTL.setSizeExpr(NewSize);
5943template<
typename Derived>
5948 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
5949 if (ElementType.isNull())
5953 if (getDerived().AlwaysRebuild() ||
5954 ElementType != T->getElementType()) {
5955 Result = getDerived().RebuildIncompleteArrayType(ElementType,
5956 T->getSizeModifier(),
5957 T->getIndexTypeCVRQualifiers(),
5958 TL.getBracketsRange());
5965 NewTL.setRBracketLoc(TL.getRBracketLoc());
5966 NewTL.setSizeExpr(
nullptr);
5971template<
typename Derived>
5976 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
5977 if (ElementType.isNull())
5984 SizeResult = getDerived().TransformExpr(T->getSizeExpr());
5986 if (SizeResult.isInvalid())
5990 if (SizeResult.isInvalid())
5996 if (getDerived().AlwaysRebuild() ||
5997 ElementType != T->getElementType() ||
5998 Size != T->getSizeExpr()) {
5999 Result = getDerived().RebuildVariableArrayType(ElementType,
6000 T->getSizeModifier(),
6002 T->getIndexTypeCVRQualifiers(),
6003 TL.getBracketsRange());
6012 NewTL.setRBracketLoc(TL.getRBracketLoc());
6013 NewTL.setSizeExpr(Size);
6018template<
typename Derived>
6023 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
6024 if (ElementType.isNull())
6032 SemaRef.
ExprEvalContexts.back().InConditionallyConstantEvaluateContext =
true;
6035 Expr *origSize = TL.getSizeExpr();
6036 if (!origSize) origSize = T->getSizeExpr();
6039 = getDerived().TransformExpr(origSize);
6041 if (sizeResult.isInvalid())
6044 Expr *size = sizeResult.get();
6047 if (getDerived().AlwaysRebuild() ||
6048 ElementType != T->getElementType() ||
6050 Result = getDerived().RebuildDependentSizedArrayType(ElementType,
6051 T->getSizeModifier(),
6053 T->getIndexTypeCVRQualifiers(),
6054 TL.getBracketsRange());
6063 NewTL.setRBracketLoc(TL.getRBracketLoc());
6064 NewTL.setSizeExpr(size);
6069template <
typename Derived>
6073 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
6074 if (ElementType.isNull())
6082 if (
Size.isInvalid())
6086 if (getDerived().AlwaysRebuild() || ElementType != T->getElementType() ||
6087 Size.get() != T->getSizeExpr()) {
6088 Result = getDerived().RebuildDependentVectorType(
6089 ElementType,
Size.get(), T->getAttributeLoc(), T->getVectorKind());
6107template<
typename Derived>
6114 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
6115 if (ElementType.isNull())
6124 if (
Size.isInvalid())
6128 if (getDerived().AlwaysRebuild() ||
6129 ElementType != T->getElementType() ||
6130 Size.get() != T->getSizeExpr()) {
6131 Result = getDerived().RebuildDependentSizedExtVectorType(ElementType,
6133 T->getAttributeLoc());
6151template <
typename Derived>
6156 QualType ElementType = getDerived().TransformType(T->getElementType());
6157 if (ElementType.isNull())
6161 if (getDerived().AlwaysRebuild() || ElementType != T->getElementType()) {
6162 Result = getDerived().RebuildConstantMatrixType(
6163 ElementType, T->getNumRows(), T->getNumColumns());
6170 NewTL.setAttrOperandParensRange(TL.getAttrOperandParensRange());
6171 NewTL.setAttrRowOperand(TL.getAttrRowOperand());
6172 NewTL.setAttrColumnOperand(TL.getAttrColumnOperand());
6177template <
typename Derived>
6182 QualType ElementType = getDerived().TransformType(T->getElementType());
6183 if (ElementType.isNull()) {
6191 Expr *origRows = TL.getAttrRowOperand();
6193 origRows = T->getRowExpr();
6194 Expr *origColumns = TL.getAttrColumnOperand();
6196 origColumns = T->getColumnExpr();
6198 ExprResult rowResult = getDerived().TransformExpr(origRows);
6200 if (rowResult.isInvalid())
6203 ExprResult columnResult = getDerived().TransformExpr(origColumns);
6205 if (columnResult.isInvalid())
6208 Expr *rows = rowResult.get();
6209 Expr *columns = columnResult.get();
6212 if (getDerived().AlwaysRebuild() || ElementType != T->getElementType() ||
6213 rows != origRows || columns != origColumns) {
6214 Result = getDerived().RebuildDependentSizedMatrixType(
6215 ElementType, rows, columns, T->getAttributeLoc());
6225 NewTL.setAttrOperandParensRange(TL.getAttrOperandParensRange());
6226 NewTL.setAttrRowOperand(rows);
6227 NewTL.setAttrColumnOperand(columns);
6231template <
typename Derived>
6237 getDerived().TransformType(TLB, TL.getPointeeTypeLoc());
6239 if (pointeeType.isNull())
6246 ExprResult AddrSpace = getDerived().TransformExpr(T->getAddrSpaceExpr());
6248 if (AddrSpace.isInvalid())
6252 if (getDerived().AlwaysRebuild() || pointeeType != T->getPointeeType() ||
6253 AddrSpace.get() != T->getAddrSpaceExpr()) {
6254 Result = getDerived().RebuildDependentAddressSpaceType(
6255 pointeeType, AddrSpace.get(), T->getAttributeLoc());
6266 NewTL.setAttrExprOperand(TL.getAttrExprOperand());
6267 NewTL.setAttrNameLoc(TL.getAttrNameLoc());
6270 TLB.TypeWasModifiedSafely(
Result);
6276template <
typename Derived>
6280 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
6281 if (ElementType.isNull())
6285 if (getDerived().AlwaysRebuild() ||
6286 ElementType != T->getElementType()) {
6287 Result = getDerived().RebuildVectorType(ElementType, T->getNumElements(),
6288 T->getVectorKind());
6299template<
typename Derived>
6303 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
6304 if (ElementType.isNull())
6308 if (getDerived().AlwaysRebuild() ||
6309 ElementType != T->getElementType()) {
6310 Result = getDerived().RebuildExtVectorType(ElementType,
6311 T->getNumElements(),
6323template <
typename Derived>
6326 bool ExpectParameterPack) {
6361 if (NewTSI == OldTSI && indexAdjustment == 0)
6371 getDerived().transformedLocalDecl(OldParm, {newParm});
6375template <
typename Derived>
6383 unsigned *LastParamTransformed) {
6384 int indexAdjustment = 0;
6386 unsigned NumParams = Params.size();
6387 for (
unsigned i = 0; i != NumParams; ++i) {
6388 if (LastParamTransformed)
6389 *LastParamTransformed = i;
6391 assert(OldParm->getFunctionScopeIndex() == i);
6395 if (OldParm->isParameterPack()) {
6400 TypeLoc TL = OldParm->getTypeSourceInfo()->getTypeLoc();
6403 SemaRef.collectUnexpandedParameterPacks(Pattern, Unexpanded);
6406 bool ShouldExpand =
false;
6407 bool RetainExpansion =
false;
6409 if (Unexpanded.size() > 0) {
6410 OrigNumExpansions = ExpansionTL.
getTypePtr()->getNumExpansions();
6411 NumExpansions = OrigNumExpansions;
6415 ShouldExpand, RetainExpansion, NumExpansions)) {
6420 const AutoType *AT =
6421 Pattern.getType().getTypePtr()->getContainedAutoType();
6422 assert((AT && (!AT->isDeduced() || AT->getDeducedType().isNull())) &&
6423 "Could not find parameter packs or undeduced auto type!");
6430 getDerived().ExpandingFunctionParameterPack(OldParm);
6431 for (
unsigned I = 0; I != *NumExpansions; ++I) {
6434 =
getDerived().TransformFunctionTypeParam(OldParm,
6442 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6443 OutParamTypes.push_back(NewParm->
getType());
6445 PVars->push_back(NewParm);
6450 if (RetainExpansion) {
6451 ForgetPartiallySubstitutedPackRAII Forget(
getDerived());
6453 =
getDerived().TransformFunctionTypeParam(OldParm,
6461 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6462 OutParamTypes.push_back(NewParm->
getType());
6464 PVars->push_back(NewParm);
6480 NewParm =
getDerived().TransformFunctionTypeParam(OldParm,
6485 "Parameter pack no longer a parameter pack after "
6488 NewParm =
getDerived().TransformFunctionTypeParam(
6489 OldParm, indexAdjustment, std::nullopt,
6497 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6498 OutParamTypes.push_back(NewParm->
getType());
6500 PVars->push_back(NewParm);
6508 bool IsPackExpansion =
false;
6511 if (
const PackExpansionType *Expansion
6512 = dyn_cast<PackExpansionType>(OldType)) {
6514 QualType Pattern = Expansion->getPattern();
6516 getSema().collectUnexpandedParameterPacks(Pattern, Unexpanded);
6519 bool ShouldExpand =
false;
6520 bool RetainExpansion =
false;
6524 RetainExpansion, NumExpansions)) {
6531 for (
unsigned I = 0; I != *NumExpansions; ++I) {
6538 NewType =
getSema().getASTContext().getPackExpansionType(
6539 NewType, std::nullopt);
6546 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6547 OutParamTypes.push_back(NewType);
6549 PVars->push_back(
nullptr);
6558 if (RetainExpansion) {
6559 ForgetPartiallySubstitutedPackRAII Forget(
getDerived());
6565 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6566 OutParamTypes.push_back(NewType);
6568 PVars->push_back(
nullptr);
6573 OldType = Expansion->getPattern();
6574 IsPackExpansion =
true;
6576 NewType =
getDerived().TransformType(OldType);
6578 NewType =
getDerived().TransformType(OldType);
6584 if (IsPackExpansion)
6585 NewType =
getSema().Context.getPackExpansionType(NewType,
6589 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6590 OutParamTypes.push_back(NewType);
6592 PVars->push_back(
nullptr);
6597 for (
unsigned i = 0, e = PVars->size(); i != e; ++i)
6599 assert(parm->getFunctionScopeIndex() == i);
6606template<
typename Derived>
6611 return getDerived().TransformFunctionProtoType(
6615 ExceptionStorage, Changed);
6619template<
typename Derived>
template<
typename Fn>
6638 if (T->hasTrailingReturn()) {
6642 T->getExtParameterInfosOrNull(),
6643 ParamTypes, &ParamDecls, ExtParamInfos))
6653 auto *RD = dyn_cast<CXXRecordDecl>(
SemaRef.getCurLexicalContext());
6655 SemaRef, !ThisContext && RD ? RD : ThisContext, ThisTypeQuals);
6670 T->getExtParameterInfosOrNull(),
6671 ParamTypes, &ParamDecls, ExtParamInfos))
6677 bool EPIChanged =
false;
6682 if (
auto NewExtParamInfos =
6698 std::optional<FunctionEffectSet> NewFX;
6710 std::optional<FunctionEffectMode> Mode =
6730 "FunctionEffectMode::None shouldn't be possible here");
6733 if (!
SemaRef.diagnoseConflictingFunctionEffect(*NewFX, NewEC,
6736 NewFX->insert(NewEC, Errs);
6737 assert(Errs.empty());
6746 T->getParamTypes() !=
llvm::ArrayRef(ParamTypes) || EPIChanged) {
6747 Result =
getDerived().RebuildFunctionProtoType(ResultType, ParamTypes, EPI);
6758 for (
unsigned i = 0, e = NewTL.
getNumParams(); i != e; ++i)
6764template<
typename Derived>
6787 getSema().ActOnNoexceptSpec(NoexceptExpr.
get(), EST);
6802 if (
const PackExpansionType *PackExpansion =
6803 T->getAs<PackExpansionType>()) {
6808 SemaRef.collectUnexpandedParameterPacks(PackExpansion->getPattern(),
6810 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
6815 bool Expand =
false;
6816 bool RetainExpansion =
false;
6817 UnsignedOrNone NumExpansions = PackExpansion->getNumExpansions();
6822 true, Expand, RetainExpansion,
6835 U =
SemaRef.Context.getPackExpansionType(
U, NumExpansions);
6836 Exceptions.push_back(
U);
6842 for (
unsigned ArgIdx = 0; ArgIdx != *NumExpansions; ++ArgIdx) {
6846 if (
U.isNull() ||
SemaRef.CheckSpecifiedExceptionType(
U, Loc))
6849 Exceptions.push_back(
U);
6853 if (
U.isNull() ||
SemaRef.CheckSpecifiedExceptionType(
U, Loc))
6858 Exceptions.push_back(
U);
6868template<
typename Derived>
6878 if (getDerived().AlwaysRebuild() || ResultType != T->getReturnType())
6879 Result = getDerived().RebuildFunctionNoProtoType(ResultType);
6890template <
typename Derived>
6891QualType TreeTransform<Derived>::TransformUnresolvedUsingType(
6892 TypeLocBuilder &TLB, UnresolvedUsingTypeLoc TL) {
6894 const UnresolvedUsingType *T = TL.getTypePtr();
6895 bool Changed =
false;
6897 NestedNameSpecifierLoc QualifierLoc = TL.getQualifierLoc();
6898 if (NestedNameSpecifierLoc OldQualifierLoc = QualifierLoc) {
6899 QualifierLoc = getDerived().TransformNestedNameSpecifierLoc(QualifierLoc);
6902 Changed |= QualifierLoc != OldQualifierLoc;
6905 auto *D = getDerived().TransformDecl(TL.getNameLoc(), T->getDecl());
6911 if (getDerived().AlwaysRebuild() || Changed) {
6912 Result = getDerived().RebuildUnresolvedUsingType(
6913 T->getKeyword(), QualifierLoc.getNestedNameSpecifier(), TL.getNameLoc(),
6921 QualifierLoc, TL.getNameLoc());
6924 QualifierLoc, TL.getNameLoc());
6928template <
typename Derived>
6936 QualifierLoc = getDerived().TransformNestedNameSpecifierLoc(QualifierLoc);
6939 Changed |= QualifierLoc != OldQualifierLoc;
6942 auto *D = cast_or_null<UsingShadowDecl>(
6943 getDerived().TransformDecl(TL.getNameLoc(), T->getDecl()));
6948 QualType UnderlyingType = getDerived().TransformType(T->desugar());
6949 if (UnderlyingType.isNull())
6951 Changed |= UnderlyingType != T->desugar();
6954 if (getDerived().AlwaysRebuild() || Changed) {
6955 Result = getDerived().RebuildUsingType(
6956 T->getKeyword(), QualifierLoc.getNestedNameSpecifier(), D,
6966template<
typename Derived>
6974 QualifierLoc = getDerived().TransformNestedNameSpecifierLoc(QualifierLoc);
6977 Changed |= QualifierLoc != OldQualifierLoc;
6980 auto *
Typedef = cast_or_null<TypedefNameDecl>(
6981 getDerived().TransformDecl(TL.getNameLoc(), T->getDecl()));
6989 if (getDerived().AlwaysRebuild() || Changed) {
6990 Result = getDerived().RebuildTypedefType(
6991 T->getKeyword(), QualifierLoc.getNestedNameSpecifier(),
Typedef);
6997 QualifierLoc, TL.getNameLoc());
7001template<
typename Derived>
7009 ExprResult E = getDerived().TransformExpr(TL.getUnderlyingExpr());
7019 if (getDerived().AlwaysRebuild() || E.get() != TL.getUnderlyingExpr()) {
7021 getDerived().RebuildTypeOfExprType(E.get(), TL.getTypeofLoc(), Kind);
7028 NewTL.setLParenLoc(TL.getLParenLoc());
7029 NewTL.setRParenLoc(TL.getRParenLoc());
7034template<
typename Derived>
7038 TypeSourceInfo* New_Under_TI = getDerived().TransformType(Old_Under_TI);
7044 if (getDerived().AlwaysRebuild() || New_Under_TI != Old_Under_TI) {
7045 Result = getDerived().RebuildTypeOfType(New_Under_TI->getType(), Kind);
7052 NewTL.setLParenLoc(TL.getLParenLoc());
7053 NewTL.setRParenLoc(TL.getRParenLoc());
7054 NewTL.setUnmodifiedTInfo(New_Under_TI);
7059template<
typename Derived>
7062 const DecltypeType *T = TL.getTypePtr();
7069 ExprResult E = getDerived().TransformExpr(T->getUnderlyingExpr());
7073 E = getSema().ActOnDecltypeExpression(E.get());
7078 if (getDerived().AlwaysRebuild() ||
7079 E.get() != T->getUnderlyingExpr()) {
7080 Result = getDerived().RebuildDecltypeType(E.get(), TL.getDecltypeLoc());
7088 NewTL.setRParenLoc(TL.getRParenLoc());
7092template <
typename Derived>
7102 IndexExpr = getDerived().TransformExpr(TL.getIndexExpr());
7103 if (IndexExpr.isInvalid())
7106 QualType Pattern = TL.getPattern();
7108 const PackIndexingType *PIT = TL.
getTypePtr();
7112 bool NotYetExpanded = Types.empty();
7113 bool FullySubstituted =
true;
7115 if (Types.empty() && !PIT->expandsToEmptyPack())
7119 if (!T->containsUnexpandedParameterPack()) {
7120 QualType Transformed = getDerived().TransformType(T);
7121 if (Transformed.isNull())
7123 SubtitutedTypes.push_back(Transformed);
7128 getSema().collectUnexpandedParameterPacks(T, Unexpanded);
7129 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
7132 bool ShouldExpand =
true;
7133 bool RetainExpansion =
false;
7135 if (getDerived().TryExpandParameterPacks(
7138 RetainExpansion, NumExpansions))
7140 if (!ShouldExpand) {
7146 QualType Pack = getDerived().TransformType(TLB, TI->getTypeLoc());
7149 if (NotYetExpanded) {
7150 FullySubstituted =
false;
7151 QualType Out = getDerived().RebuildPackIndexingType(
7161 SubtitutedTypes.push_back(Pack);
7164 for (
unsigned I = 0; I != *NumExpansions; ++I) {
7169 SubtitutedTypes.push_back(Out);
7170 FullySubstituted &= !
Out->containsUnexpandedParameterPack();
7174 if (RetainExpansion) {
7175 FullySubstituted =
false;
7176 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
7180 SubtitutedTypes.push_back(Out);
7188 QualType Result = getDerived().TransformType(TLB, TL.getPatternLoc());
7190 QualType Out = getDerived().RebuildPackIndexingType(
7192 FullySubstituted, SubtitutedTypes);
7201template<
typename Derived>
7207 if (
Result->isDependentType()) {
7208 const UnaryTransformType *T = TL.getTypePtr();
7210 NewBaseTSI = getDerived().TransformType(TL.getUnderlyingTInfo());
7213 QualType NewBase = NewBaseTSI->getType();
7215 Result = getDerived().RebuildUnaryTransformType(NewBase,
7224 NewTL.setParensRange(TL.getParensRange());
7225 NewTL.setUnderlyingTInfo(NewBaseTSI);
7229template<
typename Derived>
7232 const DeducedTemplateSpecializationType *T = TL.getTypePtr();
7237 TL.getTemplateNameLoc());
7241 QualType OldDeduced = T->getDeducedType();
7243 if (!OldDeduced.isNull()) {
7244 NewDeduced = getDerived().TransformType(OldDeduced);
7245 if (NewDeduced.isNull())
7249 QualType Result = getDerived().RebuildDeducedTemplateSpecializationType(
7257 NewTL.setTemplateNameLoc(TL.getTemplateNameLoc());
7258 NewTL.setQualifierLoc(QualifierLoc);
7262template <
typename Derived>
7269 QualifierLoc =
getDerived().TransformNestedNameSpecifierLoc(QualifierLoc);
7274 auto *TD = cast_or_null<TagDecl>(
7281 TD != T->getDecl()) {
7282 if (T->isCanonicalUnqualified())
7299template <
typename Derived>
7305template <
typename Derived>
7306QualType TreeTransform<Derived>::TransformRecordType(TypeLocBuilder &TLB,
7308 return getDerived().TransformTagType(TLB, TL);
7311template<
typename Derived>
7318template<
typename Derived>
7322 return getDerived().TransformTemplateTypeParmType(
7327template <
typename Derived>
7333template<
typename Derived>
7334QualType TreeTransform<Derived>::TransformSubstTemplateTypeParmType(
7335 TypeLocBuilder &TLB,
7336 SubstTemplateTypeParmTypeLoc TL) {
7337 const SubstTemplateTypeParmType *T = TL.getTypePtr();
7340 getDerived().TransformDecl(TL.getNameLoc(), T->getAssociatedDecl());
7345 TemporaryBase Rebase(*
this, TL.getNameLoc(), DeclarationName());
7346 QualType Replacement = getDerived().TransformType(T->getReplacementType());
7347 if (Replacement.isNull())
7351 Replacement, NewReplaced, T->getIndex(), T->getPackIndex(),
7355 SubstTemplateTypeParmTypeLoc NewTL
7356 = TLB.push<SubstTemplateTypeParmTypeLoc>(Result);
7357 NewTL.setNameLoc(TL.getNameLoc());
7361template <
typename Derived>
7367template<
typename Derived>
7371 return getDerived().TransformSubstTemplateTypeParmPackType(
7375template <
typename Derived>
7381template<
typename Derived>
7382QualType TreeTransform<Derived>::TransformAtomicType(TypeLocBuilder &TLB,
7384 QualType ValueType = getDerived().TransformType(TLB, TL.getValueLoc());
7385 if (ValueType.isNull())
7388 QualType Result = TL.getType();
7389 if (getDerived().AlwaysRebuild() ||
7390 ValueType != TL.getValueLoc().getType()) {
7391 Result = getDerived().RebuildAtomicType(ValueType, TL.getKWLoc());
7392 if (Result.isNull())
7398 NewTL.setLParenLoc(TL.getLParenLoc());
7399 NewTL.setRParenLoc(TL.getRParenLoc());
7404template <
typename Derived>
7407 QualType ValueType = getDerived().TransformType(TLB, TL.getValueLoc());
7408 if (ValueType.isNull())
7412 if (getDerived().AlwaysRebuild() || ValueType != TL.getValueLoc().getType()) {
7415 Result = getDerived().RebuildPipeType(ValueType, TL.getKWLoc(), isReadPipe);
7426template <
typename Derived>
7432 if (getDerived().AlwaysRebuild()) {
7433 Result = getDerived().RebuildBitIntType(EIT->isUnsigned(),
7434 EIT->getNumBits(), TL.getNameLoc());
7444template <
typename Derived>
7451 ExprResult BitsExpr = getDerived().TransformExpr(EIT->getNumBitsExpr());
7454 if (BitsExpr.isInvalid())
7459 if (getDerived().AlwaysRebuild() || BitsExpr.get() != EIT->getNumBitsExpr()) {
7460 Result = getDerived().RebuildDependentBitIntType(
7461 EIT->isUnsigned(), BitsExpr.get(), TL.getNameLoc());
7477template <
typename Derived>
7480 llvm_unreachable(
"This type does not need to be transformed.");
7488 template<
typename ArgLocContainer>
7490 ArgLocContainer *Container;
7515 : Container(&Container), Index(Index) { }
7529 return Container->getArgLoc(Index);
7533 return pointer(Container->getArgLoc(Index));
7538 return X.Container == Y.Container &&
X.Index == Y.Index;
7547template<
typename Derived>
7548QualType TreeTransform<Derived>::TransformAutoType(TypeLocBuilder &TLB,
7550 const AutoType *T = TL.getTypePtr();
7551 QualType OldDeduced = T->getDeducedType();
7552 QualType NewDeduced;
7553 if (!OldDeduced.isNull()) {
7554 NewDeduced = getDerived().TransformType(OldDeduced);
7555 if (NewDeduced.isNull())
7562 if (T->isConstrained()) {
7563 assert(TL.getConceptReference());
7564 NewCD = cast_or_null<ConceptDecl>(getDerived().TransformDecl(
7565 TL.getConceptNameLoc(), T->getTypeConstraintConcept()));
7567 NewTemplateArgs.setLAngleLoc(TL.getLAngleLoc());
7568 NewTemplateArgs.setRAngleLoc(TL.getRAngleLoc());
7570 if (getDerived().TransformTemplateArguments(
7571 ArgIterator(TL, 0), ArgIterator(TL, TL.getNumArgs()),
7575 if (TL.getNestedNameSpecifierLoc()) {
7577 = getDerived().TransformNestedNameSpecifierLoc(
7578 TL.getNestedNameSpecifierLoc());
7579 if (!NewNestedNameSpec)
7585 if (getDerived().AlwaysRebuild() || NewDeduced != OldDeduced ||
7586 T->isDependentType() || T->isConstrained()) {
7589 NewArgList.reserve(NewTemplateArgs.size());
7590 for (
const auto &ArgLoc : NewTemplateArgs.arguments())
7591 NewArgList.push_back(ArgLoc.getArgument());
7592 Result = getDerived().RebuildAutoType(
7594 NewDeduced, T->getKeyword(), NewCD, NewArgList);
7601 NewTL.setRParenLoc(TL.getRParenLoc());
7602 NewTL.setConceptReference(
nullptr);
7604 if (T->isConstrained()) {
7606 TL.getTypePtr()->getTypeConstraintConcept()->getDeclName(),
7607 TL.getConceptNameLoc(),
7608 TL.getTypePtr()->getTypeConstraintConcept()->getDeclName());
7610 SemaRef.
Context, NewNestedNameSpec, TL.getTemplateKWLoc(), DNI,
7611 TL.getFoundDecl(), TL.getTypePtr()->getTypeConstraintConcept(),
7613 NewTL.setConceptReference(CR);
7619template <
typename Derived>
7622 return getDerived().TransformTemplateSpecializationType(
7627template <
typename Derived>
7630 NamedDecl *FirstQualifierInScope,
bool AllowInjectedClassName) {
7631 const TemplateSpecializationType *T = TL.
getTypePtr();
7637 AllowInjectedClassName);
7646 if (getDerived().TransformTemplateArguments(ArgIterator(TL, 0),
7655 QualType Result = getDerived().RebuildTemplateSpecializationType(
7668template <
typename Derived>
7672 QualType modifiedType = getDerived().TransformType(TLB, TL.getModifiedLoc());
7673 if (modifiedType.isNull())
7677 const Attr *oldAttr = TL.getAttr();
7678 const Attr *newAttr = oldAttr ? getDerived().TransformAttr(oldAttr) :
nullptr;
7679 if (oldAttr && !newAttr)
7685 if (getDerived().AlwaysRebuild() ||
7686 modifiedType != oldType->getModifiedType()) {
7699 QualType equivalentType = modifiedType;
7700 if (TL.getModifiedLoc().getType() != TL.getEquivalentTypeLoc().getType()) {
7702 AuxiliaryTLB.
reserve(TL.getFullDataSize());
7704 getDerived().TransformType(AuxiliaryTLB, TL.getEquivalentTypeLoc());
7705 if (equivalentType.isNull())
7711 if (
auto nullability = oldType->getImmediateNullability()) {
7712 if (!modifiedType->canHaveNullability()) {
7713 SemaRef.
Diag((TL.getAttr() ? TL.getAttr()->getLocation()
7714 : TL.getModifiedLoc().getBeginLoc()),
7715 diag::err_nullability_nonpointer)
7732template <
typename Derived>
7736 QualType InnerTy = getDerived().TransformType(TLB, TL.getInnerLoc());
7737 if (InnerTy.isNull())
7740 Expr *OldCount = TL.getCountExpr();
7741 Expr *NewCount =
nullptr;
7743 ExprResult CountResult = getDerived().TransformExpr(OldCount);
7744 if (CountResult.isInvalid())
7746 NewCount = CountResult.get();
7750 if (getDerived().AlwaysRebuild() || InnerTy != OldTy->desugar() ||
7751 OldCount != NewCount) {
7754 InnerTy, NewCount, OldTy->isCountInBytes(), OldTy->isOrNull());
7761template <
typename Derived>
7765 llvm_unreachable(
"Unexpected TreeTransform for BTFTagAttributedType");
7768template <
typename Derived>
7771 const OverflowBehaviorType *OldTy = TL.getTypePtr();
7772 QualType InnerTy = getDerived().TransformType(TLB, TL.getWrappedLoc());
7773 if (InnerTy.isNull())
7777 if (getDerived().AlwaysRebuild() || InnerTy != OldTy->getUnderlyingType()) {
7789template <
typename Derived>
7793 const HLSLAttributedResourceType *oldType = TL.getTypePtr();
7795 QualType WrappedTy = getDerived().TransformType(TLB, TL.getWrappedLoc());
7796 if (WrappedTy.isNull())
7800 QualType OldContainedTy = oldType->getContainedType();
7802 if (!OldContainedTy.isNull()) {
7803 TypeSourceInfo *oldContainedTSI = TL.getContainedTypeSourceInfo();
7804 if (!oldContainedTSI)
7805 oldContainedTSI = getSema().getASTContext().getTrivialTypeSourceInfo(
7807 ContainedTSI = getDerived().TransformType(oldContainedTSI);
7810 ContainedTy = ContainedTSI->getType();
7814 if (getDerived().AlwaysRebuild() || WrappedTy != oldType->getWrappedType() ||
7815 ContainedTy != oldType->getContainedType()) {
7817 WrappedTy, ContainedTy, oldType->getAttrs());
7823 NewTL.setContainedTypeSourceInfo(ContainedTSI);
7827template <
typename Derived>
7831 return TL.getType();
7834template<
typename Derived>
7838 QualType Inner = getDerived().TransformType(TLB, TL.getInnerLoc());
7843 if (getDerived().AlwaysRebuild() ||
7844 Inner != TL.getInnerLoc().getType()) {
7845 Result = getDerived().RebuildParenType(Inner);
7852 NewTL.setRParenLoc(TL.getRParenLoc());
7856template <
typename Derived>
7860 QualType Inner = getDerived().TransformType(TLB, TL.getInnerLoc());
7865 if (getDerived().AlwaysRebuild() || Inner != TL.getInnerLoc().getType()) {
7867 getDerived().RebuildMacroQualifiedType(Inner, TL.getMacroIdentifier());
7877template<
typename Derived>
7878QualType TreeTransform<Derived>::TransformDependentNameType(
7880 return TransformDependentNameType(TLB, TL,
false);
7883template <
typename Derived>
7884QualType TreeTransform<Derived>::TransformDependentNameType(
7887 const DependentNameType *T = TL.
getTypePtr();
7891 QualifierLoc = getDerived().TransformNestedNameSpecifierLoc(
7892 QualifierLoc, ObjectType, UnqualLookup);
7896 assert((ObjectType.isNull() && !UnqualLookup) &&
7897 "must be transformed by TransformNestedNameSpecifierLoc");
7901 = getDerived().RebuildDependentNameType(T->getKeyword(),
7902 TL.getElaboratedKeywordLoc(),
7913 NewTL.setQualifierLoc(QualifierLoc);
7914 NewTL.setNameLoc(TL.getNameLoc());
7918 NewTL.setTemplateNameLoc(TL.getNameLoc());
7919 NewTL.setQualifierLoc(QualifierLoc);
7922 QualifierLoc, TL.getNameLoc());
7925 NewTL.
set(TL.getElaboratedKeywordLoc(), QualifierLoc, TL.getNameLoc());
7929 NewTL.setQualifierLoc(QualifierLoc);
7930 NewTL.setNameLoc(TL.getNameLoc());
7935template<
typename Derived>
7939 = getDerived().TransformType(TLB, TL.getPatternLoc());
7940 if (Pattern.isNull())
7944 if (getDerived().AlwaysRebuild() ||
7945 Pattern != TL.getPatternLoc().getType()) {
7946 Result = getDerived().RebuildPackExpansionType(Pattern,
7947 TL.getPatternLoc().getSourceRange(),
7948 TL.getEllipsisLoc(),
7949 TL.getTypePtr()->getNumExpansions());
7959template<
typename Derived>
7964 TLB.pushFullCopy(TL);
7965 return TL.getType();
7968template<
typename Derived>
7972 const ObjCTypeParamType *T = TL.getTypePtr();
7974 getDerived().TransformDecl(T->getDecl()->getLocation(), T->getDecl()));
7979 if (getDerived().AlwaysRebuild() ||
7980 OTP != T->getDecl()) {
7981 Result = getDerived().RebuildObjCTypeParamType(
7982 OTP, TL.getProtocolLAngleLoc(),
7983 llvm::ArrayRef(TL.getTypePtr()->qual_begin(), TL.getNumProtocols()),
7984 TL.getProtocolLocs(), TL.getProtocolRAngleLoc());
7990 if (TL.getNumProtocols()) {
7991 NewTL.setProtocolLAngleLoc(TL.getProtocolLAngleLoc());
7992 for (
unsigned i = 0, n = TL.getNumProtocols(); i != n; ++i)
7993 NewTL.setProtocolLoc(i, TL.getProtocolLoc(i));
7994 NewTL.setProtocolRAngleLoc(TL.getProtocolRAngleLoc());
7999template<
typename Derived>
8004 QualType BaseType = getDerived().TransformType(TLB, TL.getBaseLoc());
8005 if (BaseType.isNull())
8008 bool AnyChanged = BaseType != TL.getBaseLoc().getType();
8012 for (
unsigned i = 0, n = TL.getNumTypeArgs(); i != n; ++i) {
8014 TypeLoc TypeArgLoc = TypeArgInfo->getTypeLoc();
8015 QualType TypeArg = TypeArgInfo->getType();
8020 const auto *PackExpansion = PackExpansionLoc.getType()
8021 ->castAs<PackExpansionType>();
8025 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
8029 TypeLoc PatternLoc = PackExpansionLoc.getPatternLoc();
8030 bool Expand =
false;
8031 bool RetainExpansion =
false;
8032 UnsignedOrNone NumExpansions = PackExpansion->getNumExpansions();
8033 if (getDerived().TryExpandParameterPacks(
8034 PackExpansionLoc.getEllipsisLoc(), PatternLoc.getSourceRange(),
8035 Unexpanded,
true, Expand,
8036 RetainExpansion, NumExpansions))
8046 TypeArgBuilder.
reserve(PatternLoc.getFullDataSize());
8047 QualType NewPatternType = getDerived().TransformType(TypeArgBuilder,
8049 if (NewPatternType.isNull())
8053 NewPatternType, NumExpansions);
8055 NewExpansionLoc.
setEllipsisLoc(PackExpansionLoc.getEllipsisLoc());
8056 NewTypeArgInfos.push_back(
8057 TypeArgBuilder.getTypeSourceInfo(SemaRef.
Context, NewExpansionType));
8063 for (
unsigned ArgIdx = 0; ArgIdx != *NumExpansions; ++ArgIdx) {
8067 TypeArgBuilder.
reserve(PatternLoc.getFullDataSize());
8069 QualType NewTypeArg = getDerived().TransformType(TypeArgBuilder,
8071 if (NewTypeArg.isNull())
8074 NewTypeArgInfos.push_back(
8075 TypeArgBuilder.getTypeSourceInfo(SemaRef.
Context, NewTypeArg));
8082 TypeArgBuilder.
reserve(TypeArgLoc.getFullDataSize());
8084 getDerived().TransformType(TypeArgBuilder, TypeArgLoc);
8085 if (NewTypeArg.isNull())
8089 if (NewTypeArg == TypeArg) {
8090 NewTypeArgInfos.push_back(TypeArgInfo);
8094 NewTypeArgInfos.push_back(
8095 TypeArgBuilder.getTypeSourceInfo(SemaRef.
Context, NewTypeArg));
8100 if (getDerived().AlwaysRebuild() || AnyChanged) {
8102 Result = getDerived().RebuildObjCObjectType(
8103 BaseType, TL.getBeginLoc(), TL.getTypeArgsLAngleLoc(), NewTypeArgInfos,
8104 TL.getTypeArgsRAngleLoc(), TL.getProtocolLAngleLoc(),
8105 llvm::ArrayRef(TL.getTypePtr()->qual_begin(), TL.getNumProtocols()),
8106 TL.getProtocolLocs(), TL.getProtocolRAngleLoc());
8114 NewT.setTypeArgsLAngleLoc(TL.getTypeArgsLAngleLoc());
8115 for (
unsigned i = 0, n = TL.getNumTypeArgs(); i != n; ++i)
8116 NewT.setTypeArgTInfo(i, NewTypeArgInfos[i]);
8117 NewT.setTypeArgsRAngleLoc(TL.getTypeArgsRAngleLoc());
8118 NewT.setProtocolLAngleLoc(TL.getProtocolLAngleLoc());
8119 for (
unsigned i = 0, n = TL.getNumProtocols(); i != n; ++i)
8120 NewT.setProtocolLoc(i, TL.getProtocolLoc(i));
8121 NewT.setProtocolRAngleLoc(TL.getProtocolRAngleLoc());
8125template<
typename Derived>
8129 QualType PointeeType = getDerived().TransformType(TLB, TL.getPointeeLoc());
8130 if (PointeeType.isNull())
8134 if (getDerived().AlwaysRebuild() ||
8135 PointeeType != TL.getPointeeLoc().getType()) {
8136 Result = getDerived().RebuildObjCObjectPointerType(PointeeType,
8150template<
typename Derived>
8156template<
typename Derived>
8159 return getDerived().TransformCompoundStmt(S,
false);
8162template<
typename Derived>
8169 getSema().resetFPOptions(
8172 bool SubStmtInvalid =
false;
8173 bool SubStmtChanged =
false;
8175 for (
auto *B : S->
body()) {
8177 B, IsStmtExpr && B == S->
body_back() ? StmtDiscardKind::StmtExprResult
8178 : StmtDiscardKind::Discarded);
8180 if (
Result.isInvalid()) {
8187 SubStmtInvalid =
true;
8191 SubStmtChanged = SubStmtChanged || Result.get() != B;
8192 Statements.push_back(Result.getAs<Stmt>());
8198 if (!getDerived().AlwaysRebuild() &&
8202 return getDerived().RebuildCompoundStmt(S->
getLBracLoc(),
8208template<
typename Derived>
8217 LHS = getDerived().TransformExpr(S->getLHS());
8219 if (LHS.isInvalid())
8223 RHS = getDerived().TransformExpr(S->getRHS());
8225 if (RHS.isInvalid())
8232 StmtResult Case = getDerived().RebuildCaseStmt(S->getCaseLoc(),
8234 S->getEllipsisLoc(),
8237 if (Case.isInvalid())
8242 getDerived().TransformStmt(S->getSubStmt());
8243 if (SubStmt.isInvalid())
8247 return getDerived().RebuildCaseStmtBody(Case.get(), SubStmt.get());
8250template <
typename Derived>
8254 getDerived().TransformStmt(S->getSubStmt());
8255 if (SubStmt.isInvalid())
8259 return getDerived().RebuildDefaultStmt(S->getDefaultLoc(), S->getColonLoc(),
8263template<
typename Derived>
8266 StmtResult SubStmt = getDerived().TransformStmt(S->getSubStmt(), SDK);
8267 if (SubStmt.isInvalid())
8270 Decl *LD = getDerived().TransformDecl(S->getDecl()->getLocation(),
8278 if (LD == S->getDecl())
8279 S->getDecl()->setStmt(
nullptr);
8282 return getDerived().RebuildLabelStmt(S->getIdentLoc(),
8287template <
typename Derived>
8292 switch (R->getKind()) {
8296 return getDerived().Transform##X##Attr(cast<X##Attr>(R));
8297#include "clang/Basic/AttrList.inc"
8302template <
typename Derived>
8309 switch (R->getKind()) {
8313 return getDerived().TransformStmt##X##Attr(OrigS, InstS, cast<X##Attr>(R));
8314#include "clang/Basic/AttrList.inc"
8319template <
typename Derived>
8322 StmtDiscardKind SDK) {
8327 bool AttrsChanged =
false;
8331 for (
const auto *I : S->
getAttrs()) {
8333 getDerived().TransformStmtAttr(S->
getSubStmt(), SubStmt.
get(), I);
8334 AttrsChanged |= (I != R);
8347 return getDerived().RebuildAttributedStmt(S->
getAttrLoc(), Attrs,
8351template<
typename Derived>
8356 if (
Init.isInvalid())
8360 if (!S->isConsteval()) {
8362 Cond = getDerived().TransformCondition(
8363 S->getIfLoc(), S->getConditionVariable(), S->getCond(),
8366 if (
Cond.isInvalid())
8371 std::optional<bool> ConstexprConditionValue;
8372 if (S->isConstexpr())
8373 ConstexprConditionValue =
Cond.getKnownValue();
8377 if (!ConstexprConditionValue || *ConstexprConditionValue) {
8381 S->isNonNegatedConsteval());
8383 Then = getDerived().TransformStmt(S->getThen());
8384 if (Then.isInvalid())
8390 Then =
new (getSema().Context)
8391 CompoundStmt(S->getThen()->getBeginLoc(), S->getThen()->getEndLoc());
8396 if (!ConstexprConditionValue || !*ConstexprConditionValue) {
8400 S->isNegatedConsteval());
8402 Else = getDerived().TransformStmt(S->getElse());
8403 if (Else.isInvalid())
8405 }
else if (S->getElse() && ConstexprConditionValue &&
8406 *ConstexprConditionValue) {
8410 Else =
new (getSema().Context)
8411 CompoundStmt(S->getElse()->getBeginLoc(), S->getElse()->getEndLoc());
8414 if (!getDerived().AlwaysRebuild() &&
8415 Init.get() == S->getInit() &&
8416 Cond.get() == std::make_pair(S->getConditionVariable(), S->getCond()) &&
8417 Then.get() == S->getThen() &&
8418 Else.get() == S->getElse())
8421 return getDerived().RebuildIfStmt(
8422 S->getIfLoc(), S->getStatementKind(), S->getLParenLoc(),
Cond,
8423 S->getRParenLoc(),
Init.get(), Then.get(), S->getElseLoc(), Else.get());
8426template<
typename Derived>
8431 if (
Init.isInvalid())
8436 S->getSwitchLoc(), S->getConditionVariable(), S->getCond(),
8438 if (
Cond.isInvalid())
8443 getDerived().RebuildSwitchStmtStart(S->getSwitchLoc(), S->getLParenLoc(),
8444 Init.get(),
Cond, S->getRParenLoc());
8449 StmtResult Body = getDerived().TransformStmt(S->getBody());
8450 if (Body.isInvalid())
8454 return getDerived().RebuildSwitchStmtBody(S->getSwitchLoc(),
Switch.get(),
8458template<
typename Derived>
8463 S->getWhileLoc(), S->getConditionVariable(), S->getCond(),
8465 if (
Cond.isInvalid())
8474 StmtResult Body = getDerived().TransformStmt(S->getBody());
8475 if (Body.isInvalid())
8478 if (!getDerived().AlwaysRebuild() &&
8479 Cond.get() == std::make_pair(S->getConditionVariable(), S->getCond()) &&
8480 Body.get() == S->getBody())
8483 return getDerived().RebuildWhileStmt(S->getWhileLoc(), S->getLParenLoc(),
8484 Cond, S->getRParenLoc(), Body.get());
8487template<
typename Derived>
8496 StmtResult Body = getDerived().TransformStmt(S->getBody());
8497 if (Body.isInvalid())
8502 if (
Cond.isInvalid())
8505 if (!getDerived().AlwaysRebuild() &&
8506 Cond.get() == S->getCond() &&
8507 Body.get() == S->getBody())
8510 return getDerived().RebuildDoStmt(S->getDoLoc(), Body.get(), S->getWhileLoc(),
8511 S->getWhileLoc(),
Cond.get(),
8515template<
typename Derived>
8518 if (getSema().getLangOpts().OpenMP)
8519 getSema().OpenMP().startOpenMPLoop();
8523 if (
Init.isInvalid())
8528 if (getSema().getLangOpts().OpenMP &&
Init.isUsable())
8529 getSema().OpenMP().ActOnOpenMPLoopInitialization(S->getForLoc(),
8534 S->getForLoc(), S->getConditionVariable(), S->getCond(),
8536 if (
Cond.isInvalid())
8541 if (
Inc.isInvalid())
8545 if (S->getInc() && !FullInc.get())
8552 S->getBeginLoc(), S->getInit(),
Init.get(), S->getCond(),
8553 Cond.get().second, S->getInc(),
Inc.get());
8556 StmtResult Body = getDerived().TransformStmt(S->getBody());
8557 if (Body.isInvalid())
8562 if (!getDerived().AlwaysRebuild() &&
8563 Init.get() == S->getInit() &&
8564 Cond.get() == std::make_pair(S->getConditionVariable(), S->getCond()) &&
8565 Inc.get() == S->getInc() &&
8566 Body.get() == S->getBody())
8569 return getDerived().RebuildForStmt(S->getForLoc(), S->getLParenLoc(),
8571 S->getRParenLoc(), Body.get());
8574template<
typename Derived>
8577 Decl *LD = getDerived().TransformDecl(S->getLabel()->getLocation(),
8583 return getDerived().RebuildGotoStmt(S->getGotoLoc(), S->getLabelLoc(),
8587template<
typename Derived>
8595 if (!getDerived().AlwaysRebuild() &&
8596 Target.get() == S->getTarget())
8599 return getDerived().RebuildIndirectGotoStmt(S->getGotoLoc(), S->getStarLoc(),
8603template<
typename Derived>
8606 if (!S->hasLabelTarget())
8609 Decl *LD = getDerived().TransformDecl(S->getLabelDecl()->getLocation(),
8618template<
typename Derived>
8621 if (!S->hasLabelTarget())
8624 Decl *LD = getDerived().TransformDecl(S->getLabelDecl()->getLocation(),
8633template <
typename Derived>
8641template<
typename Derived>
8651 return getDerived().RebuildReturnStmt(S->getReturnLoc(),
Result.get());
8654template<
typename Derived>
8657 bool DeclChanged =
false;
8660 for (
auto *D : S->decls()) {
8661 Decl *Transformed = getDerived().TransformDefinition(D->getLocation(), D);
8665 if (Transformed != D)
8669 if (
auto *TD = dyn_cast<TypeDecl>(Transformed)) {
8670 if (
auto *TN = dyn_cast<TypedefNameDecl>(TD)) {
8671 LSI->ContainsUnexpandedParameterPack |=
8672 TN->getUnderlyingType()->containsUnexpandedParameterPack();
8674 LSI->ContainsUnexpandedParameterPack |=
8677 .getTypeDeclType(TD)
8678 ->containsUnexpandedParameterPack();
8681 if (
auto *VD = dyn_cast<VarDecl>(Transformed))
8682 LSI->ContainsUnexpandedParameterPack |=
8683 VD->getType()->containsUnexpandedParameterPack();
8686 Decls.push_back(Transformed);
8689 if (!getDerived().AlwaysRebuild() && !DeclChanged)
8692 return getDerived().RebuildDeclStmt(Decls, S->getBeginLoc(), S->getEndLoc());
8695template<
typename Derived>
8705 bool ExprsChanged =
false;
8707 auto RebuildString = [&](
Expr *E) {
8712 ExprsChanged =
true;
8719 for (
unsigned I = 0, E = S->getNumOutputs(); I != E; ++I) {
8720 Names.push_back(S->getOutputIdentifier(I));
8726 Constraints.push_back(
Result.get());
8729 Expr *OutputExpr = S->getOutputExpr(I);
8730 Result = getDerived().TransformExpr(OutputExpr);
8734 ExprsChanged |=
Result.get() != OutputExpr;
8736 Exprs.push_back(
Result.get());
8740 for (
unsigned I = 0, E = S->getNumInputs(); I != E; ++I) {
8741 Names.push_back(S->getInputIdentifier(I));
8747 Constraints.push_back(
Result.get());
8750 Expr *InputExpr = S->getInputExpr(I);
8751 Result = getDerived().TransformExpr(InputExpr);
8755 ExprsChanged |=
Result.get() != InputExpr;
8757 Exprs.push_back(
Result.get());
8761 for (
unsigned I = 0, E = S->getNumLabels(); I != E; ++I) {
8762 Names.push_back(S->getLabelIdentifier(I));
8767 ExprsChanged |=
Result.get() != S->getLabelExpr(I);
8768 Exprs.push_back(
Result.get());
8772 for (
unsigned I = 0, E = S->getNumClobbers(); I != E; ++I) {
8776 Clobbers.push_back(
Result.get());
8779 ExprResult AsmString = RebuildString(S->getAsmStringExpr());
8780 if (AsmString.isInvalid())
8783 if (!getDerived().AlwaysRebuild() && !ExprsChanged)
8786 return getDerived().RebuildGCCAsmStmt(S->getAsmLoc(), S->isSimple(),
8787 S->isVolatile(), S->getNumOutputs(),
8788 S->getNumInputs(), Names.data(),
8789 Constraints, Exprs, AsmString.get(),
8790 Clobbers, S->getNumLabels(),
8794template<
typename Derived>
8799 bool HadError =
false, HadChange =
false;
8803 TransformedExprs.reserve(SrcExprs.size());
8804 for (
unsigned i = 0, e = SrcExprs.size(); i != e; ++i) {
8806 if (!
Result.isUsable()) {
8809 HadChange |= (
Result.get() != SrcExprs[i]);
8810 TransformedExprs.push_back(
Result.get());
8815 if (!HadChange && !getDerived().AlwaysRebuild())
8818 return getDerived().RebuildMSAsmStmt(S->getAsmLoc(), S->getLBraceLoc(),
8819 AsmToks, S->getAsmString(),
8820 S->getNumOutputs(), S->getNumInputs(),
8821 S->getAllConstraints(), S->getClobbers(),
8822 TransformedExprs, S->getEndLoc());
8826template<
typename Derived>
8831 assert(FD && ScopeInfo && !ScopeInfo->CoroutinePromise &&
8832 ScopeInfo->NeedsCoroutineSuspends &&
8833 ScopeInfo->CoroutineSuspends.first ==
nullptr &&
8834 ScopeInfo->CoroutineSuspends.second ==
nullptr &&
8835 "expected clean scope info");
8839 ScopeInfo->setNeedsCoroutineSuspends(
false);
8852 getDerived().transformedLocalDecl(S->getPromiseDecl(), {Promise});
8853 ScopeInfo->CoroutinePromise = Promise;
8858 StmtResult InitSuspend = getDerived().TransformStmt(S->getInitSuspendStmt());
8859 if (InitSuspend.isInvalid())
8862 getDerived().TransformStmt(S->getFinalSuspendStmt());
8863 if (FinalSuspend.isInvalid() ||
8866 ScopeInfo->setCoroutineSuspends(InitSuspend.get(), FinalSuspend.get());
8869 StmtResult BodyRes = getDerived().TransformStmt(S->getBody());
8870 if (BodyRes.isInvalid())
8874 if (Builder.isInvalid())
8877 Expr *ReturnObject = S->getReturnValueInit();
8878 assert(ReturnObject &&
"the return object is expected to be valid");
8879 ExprResult Res = getDerived().TransformInitializer(ReturnObject,
8881 if (Res.isInvalid())
8883 Builder.ReturnValue = Res.get();
8888 if (S->hasDependentPromiseType()) {
8891 if (!Promise->getType()->isDependentType()) {
8892 assert(!S->getFallthroughHandler() && !S->getExceptionHandler() &&
8893 !S->getReturnStmtOnAllocFailure() && !S->getDeallocate() &&
8894 "these nodes should not have been built yet");
8895 if (!Builder.buildDependentStatements())
8899 if (
auto *OnFallthrough = S->getFallthroughHandler()) {
8900 StmtResult Res = getDerived().TransformStmt(OnFallthrough);
8901 if (Res.isInvalid())
8903 Builder.OnFallthrough = Res.get();
8906 if (
auto *OnException = S->getExceptionHandler()) {
8907 StmtResult Res = getDerived().TransformStmt(OnException);
8908 if (Res.isInvalid())
8910 Builder.OnException = Res.get();
8913 if (
auto *OnAllocFailure = S->getReturnStmtOnAllocFailure()) {
8914 StmtResult Res = getDerived().TransformStmt(OnAllocFailure);
8915 if (Res.isInvalid())
8917 Builder.ReturnStmtOnAllocFailure = Res.get();
8921 assert(S->getAllocate() && S->getDeallocate() &&
8922 "allocation and deallocation calls must already be built");
8923 ExprResult AllocRes = getDerived().TransformExpr(S->getAllocate());
8924 if (AllocRes.isInvalid())
8926 Builder.Allocate = AllocRes.get();
8928 ExprResult DeallocRes = getDerived().TransformExpr(S->getDeallocate());
8929 if (DeallocRes.isInvalid())
8931 Builder.Deallocate = DeallocRes.get();
8933 if (
auto *ResultDecl = S->getResultDecl()) {
8934 StmtResult Res = getDerived().TransformStmt(ResultDecl);
8935 if (Res.isInvalid())
8937 Builder.ResultDecl = Res.get();
8942 if (Res.isInvalid())
8944 Builder.ReturnStmt = Res.get();
8948 return getDerived().RebuildCoroutineBodyStmt(Builder);
8951template<
typename Derived>
8961 return getDerived().RebuildCoreturnStmt(S->getKeywordLoc(),
Result.get(),
8965template <
typename Derived>
8978 ExprResult Lookup = getSema().BuildOperatorCoawaitLookupExpr(
8979 getSema().getCurScope(), E->getKeywordLoc());
8983 return getDerived().RebuildCoawaitExpr(
8984 E->getKeywordLoc(),
Operand.get(),
8988template <
typename Derived>
8991 ExprResult OperandResult = getDerived().TransformInitializer(E->getOperand(),
8993 if (OperandResult.isInvalid())
8997 E->getOperatorCoawaitLookup());
9004 return getDerived().RebuildDependentCoawaitExpr(
9005 E->getKeywordLoc(), OperandResult.get(),
9009template<
typename Derived>
9019 return getDerived().RebuildCoyieldExpr(E->getKeywordLoc(),
Result.get());
9024template<
typename Derived>
9028 StmtResult TryBody = getDerived().TransformStmt(S->getTryBody());
9029 if (TryBody.isInvalid())
9033 bool AnyCatchChanged =
false;
9035 for (
unsigned I = 0, N = S->getNumCatchStmts(); I != N; ++I) {
9036 StmtResult Catch = getDerived().TransformStmt(S->getCatchStmt(I));
9037 if (Catch.isInvalid())
9039 if (Catch.get() != S->getCatchStmt(I))
9040 AnyCatchChanged =
true;
9041 CatchStmts.push_back(Catch.get());
9046 if (S->getFinallyStmt()) {
9047 Finally = getDerived().TransformStmt(S->getFinallyStmt());
9048 if (Finally.isInvalid())
9053 if (!getDerived().AlwaysRebuild() &&
9054 TryBody.get() == S->getTryBody() &&
9056 Finally.get() == S->getFinallyStmt())
9060 return getDerived().RebuildObjCAtTryStmt(S->getAtTryLoc(), TryBody.get(),
9061 CatchStmts, Finally.get());
9064template<
typename Derived>
9069 if (
VarDecl *FromVar = S->getCatchParamDecl()) {
9071 if (FromVar->getTypeSourceInfo()) {
9072 TSInfo = getDerived().TransformType(FromVar->getTypeSourceInfo());
9079 T = TSInfo->getType();
9081 T = getDerived().TransformType(FromVar->getType());
9086 Var = getDerived().RebuildObjCExceptionDecl(FromVar, TSInfo, T);
9091 StmtResult Body = getDerived().TransformStmt(S->getCatchBody());
9092 if (Body.isInvalid())
9095 return getDerived().RebuildObjCAtCatchStmt(S->getAtCatchLoc(),
9100template<
typename Derived>
9104 StmtResult Body = getDerived().TransformStmt(S->getFinallyBody());
9105 if (Body.isInvalid())
9109 if (!getDerived().AlwaysRebuild() &&
9110 Body.get() == S->getFinallyBody())
9114 return getDerived().RebuildObjCAtFinallyStmt(S->getAtFinallyLoc(),
9118template<
typename Derived>
9122 if (S->getThrowExpr()) {
9123 Operand = getDerived().TransformExpr(S->getThrowExpr());
9128 if (!getDerived().AlwaysRebuild() &&
9129 Operand.get() == S->getThrowExpr())
9132 return getDerived().RebuildObjCAtThrowStmt(S->getThrowLoc(),
Operand.get());
9135template<
typename Derived>
9144 getDerived().RebuildObjCAtSynchronizedOperand(S->getAtSynchronizedLoc(),
9150 StmtResult Body = getDerived().TransformStmt(S->getSynchBody());
9151 if (Body.isInvalid())
9155 if (!getDerived().AlwaysRebuild() &&
9156 Object.get() == S->getSynchExpr() &&
9157 Body.get() == S->getSynchBody())
9161 return getDerived().RebuildObjCAtSynchronizedStmt(S->getAtSynchronizedLoc(),
9162 Object.get(), Body.get());
9165template<
typename Derived>
9170 StmtResult Body = getDerived().TransformStmt(S->getSubStmt());
9171 if (Body.isInvalid())
9175 if (!getDerived().AlwaysRebuild() &&
9176 Body.get() == S->getSubStmt())
9180 return getDerived().RebuildObjCAutoreleasePoolStmt(
9181 S->getAtLoc(), Body.get());
9184template<
typename Derived>
9189 StmtResult Element = getDerived().TransformStmt(
9190 S->getElement(), StmtDiscardKind::NotDiscarded);
9191 if (Element.isInvalid())
9195 ExprResult Collection = getDerived().TransformExpr(S->getCollection());
9196 if (Collection.isInvalid())
9200 StmtResult Body = getDerived().TransformStmt(S->getBody());
9201 if (Body.isInvalid())
9205 if (!getDerived().AlwaysRebuild() &&
9206 Element.get() == S->getElement() &&
9207 Collection.get() == S->getCollection() &&
9208 Body.get() == S->getBody())
9212 return getDerived().RebuildObjCForCollectionStmt(S->getForLoc(),
9219template <
typename Derived>
9223 if (
VarDecl *ExceptionDecl = S->getExceptionDecl()) {
9225 getDerived().TransformType(ExceptionDecl->getTypeSourceInfo());
9229 Var = getDerived().RebuildExceptionDecl(
9230 ExceptionDecl, T, ExceptionDecl->getInnerLocStart(),
9231 ExceptionDecl->getLocation(), ExceptionDecl->getIdentifier());
9232 if (!Var || Var->isInvalidDecl())
9237 StmtResult Handler = getDerived().TransformStmt(S->getHandlerBlock());
9238 if (Handler.isInvalid())
9241 if (!getDerived().AlwaysRebuild() && !Var &&
9242 Handler.get() == S->getHandlerBlock())
9245 return getDerived().RebuildCXXCatchStmt(S->getCatchLoc(), Var, Handler.get());
9248template <
typename Derived>
9251 StmtResult TryBlock = getDerived().TransformCompoundStmt(S->getTryBlock());
9252 if (TryBlock.isInvalid())
9256 bool HandlerChanged =
false;
9258 for (
unsigned I = 0, N = S->getNumHandlers(); I != N; ++I) {
9259 StmtResult Handler = getDerived().TransformCXXCatchStmt(S->getHandler(I));
9260 if (Handler.isInvalid())
9263 HandlerChanged = HandlerChanged || Handler.get() != S->getHandler(I);
9264 Handlers.push_back(Handler.getAs<
Stmt>());
9267 getSema().DiagnoseExceptionUse(S->getTryLoc(),
true);
9269 if (!getDerived().AlwaysRebuild() && TryBlock.get() == S->getTryBlock() &&
9273 return getDerived().RebuildCXXTryStmt(S->getTryLoc(), TryBlock.get(),
9277template<
typename Derived>
9288 auto &LastRecord = getSema().currentEvaluationContext();
9289 LastRecord.InLifetimeExtendingContext =
true;
9290 LastRecord.RebuildDefaultArgOrDefaultInit =
true;
9293 S->getInit() ? getDerived().TransformStmt(S->getInit()) :
StmtResult();
9294 if (
Init.isInvalid())
9298 if (
Range.isInvalid())
9303 getSema().ExprEvalContexts.back().ForRangeLifetimeExtendTemps.empty());
9304 auto ForRangeLifetimeExtendTemps =
9305 getSema().ExprEvalContexts.back().ForRangeLifetimeExtendTemps;
9307 StmtResult Begin = getDerived().TransformStmt(S->getBeginStmt());
9308 if (Begin.isInvalid())
9310 StmtResult End = getDerived().TransformStmt(S->getEndStmt());
9311 if (End.isInvalid())
9315 if (
Cond.isInvalid())
9319 if (
Cond.isInvalid())
9325 if (
Inc.isInvalid())
9330 StmtResult LoopVar = getDerived().TransformStmt(S->getLoopVarStmt());
9331 if (LoopVar.isInvalid())
9335 if (getDerived().AlwaysRebuild() ||
9336 Init.get() != S->getInit() ||
9337 Range.get() != S->getRangeStmt() ||
9338 Begin.get() != S->getBeginStmt() ||
9339 End.get() != S->getEndStmt() ||
9340 Cond.get() != S->getCond() ||
9341 Inc.get() != S->getInc() ||
9342 LoopVar.get() != S->getLoopVarStmt()) {
9343 NewStmt = getDerived().RebuildCXXForRangeStmt(
9344 S->getForLoc(), S->getCoawaitLoc(),
Init.get(), S->getColonLoc(),
9345 Range.get(), Begin.get(), End.get(),
Cond.get(),
Inc.get(),
9346 LoopVar.get(), S->getRParenLoc(), ForRangeLifetimeExtendTemps);
9347 if (NewStmt.isInvalid() && LoopVar.get() != S->getLoopVarStmt()) {
9349 getSema().ActOnInitializerError(
9360 StmtResult Body = getDerived().TransformStmt(S->getBody());
9361 if (Body.isInvalid())
9368 if (Body.get() != S->getBody() && NewStmt.get() == S) {
9369 NewStmt = getDerived().RebuildCXXForRangeStmt(
9370 S->getForLoc(), S->getCoawaitLoc(),
Init.get(), S->getColonLoc(),
9371 Range.get(), Begin.get(), End.get(),
Cond.get(),
Inc.get(),
9372 LoopVar.get(), S->getRParenLoc(), ForRangeLifetimeExtendTemps);
9373 if (NewStmt.isInvalid())
9377 if (NewStmt.get() == S)
9380 return FinishCXXForRangeStmt(NewStmt.get(), Body.get());
9383template<
typename Derived>
9389 if (S->getQualifierLoc()) {
9391 = getDerived().TransformNestedNameSpecifierLoc(S->getQualifierLoc());
9398 if (NameInfo.getName()) {
9399 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
9400 if (!NameInfo.getName())
9405 if (!getDerived().AlwaysRebuild() &&
9406 QualifierLoc == S->getQualifierLoc() &&
9407 NameInfo.getName() == S->getNameInfo().getName())
9412 SS.
Adopt(QualifierLoc);
9414 switch (getSema().CheckMicrosoftIfExistsSymbol(
nullptr, SS, NameInfo)) {
9416 if (S->isIfExists())
9419 return new (getSema().Context)
NullStmt(S->getKeywordLoc());
9422 if (S->isIfNotExists())
9425 return new (getSema().Context)
NullStmt(S->getKeywordLoc());
9436 StmtResult SubStmt = getDerived().TransformCompoundStmt(S->getSubStmt());
9437 if (SubStmt.isInvalid())
9445 return getDerived().RebuildMSDependentExistsStmt(S->getKeywordLoc(),
9452template<
typename Derived>
9456 if (E->getQualifierLoc()) {
9458 = getDerived().TransformNestedNameSpecifierLoc(E->getQualifierLoc());
9464 getDerived().TransformDecl(E->getMemberLoc(), E->getPropertyDecl()));
9469 if (
Base.isInvalid())
9475 QualifierLoc, E->getMemberLoc());
9478template <
typename Derived>
9482 if (BaseRes.isInvalid())
9484 auto IdxRes = getDerived().TransformExpr(E->getIdx());
9485 if (IdxRes.isInvalid())
9488 if (!getDerived().AlwaysRebuild() &&
9489 BaseRes.get() == E->getBase() &&
9490 IdxRes.get() == E->getIdx())
9493 return getDerived().RebuildArraySubscriptExpr(
9494 BaseRes.get(),
SourceLocation(), IdxRes.get(), E->getRBracketLoc());
9497template <
typename Derived>
9499 StmtResult TryBlock = getDerived().TransformCompoundStmt(S->getTryBlock());
9500 if (TryBlock.isInvalid())
9503 StmtResult Handler = getDerived().TransformSEHHandler(S->getHandler());
9504 if (Handler.isInvalid())
9507 if (!getDerived().AlwaysRebuild() && TryBlock.get() == S->getTryBlock() &&
9508 Handler.get() == S->getHandler())
9511 return getDerived().RebuildSEHTryStmt(S->getIsCXXTry(), S->getTryLoc(),
9512 TryBlock.get(), Handler.get());
9515template <
typename Derived>
9518 if (
Block.isInvalid())
9521 return getDerived().RebuildSEHFinallyStmt(S->getFinallyLoc(),
Block.get());
9524template <
typename Derived>
9526 ExprResult FilterExpr = getDerived().TransformExpr(S->getFilterExpr());
9527 if (FilterExpr.isInvalid())
9531 if (
Block.isInvalid())
9534 return getDerived().RebuildSEHExceptStmt(S->getExceptLoc(), FilterExpr.get(),
9538template <
typename Derived>
9546template<
typename Derived>
9556template <
typename Derived>
9558TreeTransform<Derived>::TransformOMPCanonicalLoop(OMPCanonicalLoop *L) {
9562 return getDerived().TransformStmt(L->getLoopStmt());
9565template <
typename Derived>
9572 TClauses.reserve(Clauses.size());
9576 getDerived().getSema().OpenMP().StartOpenMPClause((*I)->getClauseKind());
9578 getDerived().getSema().OpenMP().EndOpenMPClause();
9580 TClauses.push_back(Clause);
9582 TClauses.push_back(
nullptr);
9586 if (D->hasAssociatedStmt() && D->getAssociatedStmt()) {
9587 getDerived().getSema().OpenMP().ActOnOpenMPRegionStart(
9588 D->getDirectiveKind(),
9594 if (D->getDirectiveKind() == OMPD_atomic ||
9595 D->getDirectiveKind() == OMPD_critical ||
9596 D->getDirectiveKind() == OMPD_section ||
9597 D->getDirectiveKind() == OMPD_master)
9598 CS = D->getAssociatedStmt();
9600 CS = D->getRawStmt();
9603 getSema().getLangOpts().OpenMPIRBuilder)
9607 getDerived().getSema().OpenMP().ActOnOpenMPRegionEnd(Body, TClauses);
9612 if (TClauses.size() != Clauses.size()) {
9618 if (D->getDirectiveKind() == OMPD_critical) {
9620 DirName =
getDerived().TransformDeclarationNameInfo(DirName);
9623 if (D->getDirectiveKind() == OMPD_cancellation_point) {
9625 }
else if (D->getDirectiveKind() == OMPD_cancel) {
9629 return getDerived().RebuildOMPExecutableDirective(
9630 D->getDirectiveKind(), DirName, CancelRegion, TClauses,
9631 AssociatedStmt.
get(), D->getBeginLoc(), D->getEndLoc());
9639template <
typename Derived>
9646 TClauses.reserve(Clauses.size());
9649 getDerived().getSema().OpenMP().StartOpenMPClause(
C->getClauseKind());
9651 getDerived().getSema().OpenMP().EndOpenMPClause();
9653 TClauses.push_back(Clause);
9655 TClauses.push_back(
nullptr);
9659 if (D->hasAssociatedStmt() && D->getAssociatedStmt()) {
9660 getDerived().getSema().OpenMP().ActOnOpenMPRegionStart(
9661 D->getDirectiveKind(),
9666 assert(D->getDirectiveKind() == OMPD_assume &&
9667 "Unexpected informational directive");
9668 Stmt *CS = D->getAssociatedStmt();
9672 getDerived().getSema().OpenMP().ActOnOpenMPRegionEnd(Body, TClauses);
9676 if (TClauses.size() != Clauses.size())
9681 return getDerived().RebuildOMPInformationalDirective(
9682 D->getDirectiveKind(), DirName, TClauses, AssociatedStmt.
get(),
9683 D->getBeginLoc(), D->getEndLoc());
9686template <
typename Derived>
9691 SemaRef.
Diag(D->getBeginLoc(), diag::err_omp_instantiation_not_supported)
9692 << getOpenMPDirectiveName(D->getDirectiveKind(), OMPVersion);
9696template <
typename Derived>
9698TreeTransform<Derived>::TransformOMPParallelDirective(OMPParallelDirective *D) {
9699 DeclarationNameInfo DirName;
9700 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9701 OMPD_parallel, DirName,
nullptr, D->getBeginLoc());
9702 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9703 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9707template <
typename Derived>
9711 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9712 OMPD_simd, DirName,
nullptr, D->getBeginLoc());
9713 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9714 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9718template <
typename Derived>
9722 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9723 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
9724 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9725 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9729template <
typename Derived>
9733 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9734 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
9735 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9736 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9740template <
typename Derived>
9744 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9745 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
9746 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9747 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9751template <
typename Derived>
9755 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9756 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
9757 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9758 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9762template <
typename Derived>
9764 OMPInterchangeDirective *D) {
9766 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9767 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
9768 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9769 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9773template <
typename Derived>
9777 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9778 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
9779 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9780 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9784template <
typename Derived>
9788 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9789 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
9790 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9791 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9795template <
typename Derived>
9799 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9800 OMPD_for, DirName,
nullptr, D->getBeginLoc());
9801 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9802 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9806template <
typename Derived>
9810 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9811 OMPD_for_simd, DirName,
nullptr, D->getBeginLoc());
9812 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9813 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9817template <
typename Derived>
9821 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9822 OMPD_sections, DirName,
nullptr, D->getBeginLoc());
9823 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9824 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9828template <
typename Derived>
9832 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9833 OMPD_section, DirName,
nullptr, D->getBeginLoc());
9834 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9835 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9839template <
typename Derived>
9843 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9844 OMPD_scope, DirName,
nullptr, D->getBeginLoc());
9845 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9846 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9850template <
typename Derived>
9854 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9855 OMPD_single, DirName,
nullptr, D->getBeginLoc());
9856 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9857 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9861template <
typename Derived>
9865 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9866 OMPD_master, DirName,
nullptr, D->getBeginLoc());
9867 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9868 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9872template <
typename Derived>
9876 OMPD_critical, D->getDirectiveName(),
nullptr, D->getBeginLoc());
9877 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9878 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9882template <
typename Derived>
9884 OMPParallelForDirective *D) {
9886 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9887 OMPD_parallel_for, DirName,
nullptr, D->getBeginLoc());
9888 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9889 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9893template <
typename Derived>
9895 OMPParallelForSimdDirective *D) {
9897 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9898 OMPD_parallel_for_simd, DirName,
nullptr, D->getBeginLoc());
9899 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9900 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9904template <
typename Derived>
9906 OMPParallelMasterDirective *D) {
9908 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9909 OMPD_parallel_master, DirName,
nullptr, D->getBeginLoc());
9910 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9911 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9915template <
typename Derived>
9917 OMPParallelMaskedDirective *D) {
9919 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9920 OMPD_parallel_masked, DirName,
nullptr, D->getBeginLoc());
9921 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9922 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9926template <
typename Derived>
9928 OMPParallelSectionsDirective *D) {
9930 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9931 OMPD_parallel_sections, DirName,
nullptr, D->getBeginLoc());
9932 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9933 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9937template <
typename Derived>
9941 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9942 OMPD_task, DirName,
nullptr, D->getBeginLoc());
9943 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9944 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9948template <
typename Derived>
9950 OMPTaskyieldDirective *D) {
9952 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9953 OMPD_taskyield, DirName,
nullptr, D->getBeginLoc());
9954 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9955 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9959template <
typename Derived>
9963 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9964 OMPD_barrier, DirName,
nullptr, D->getBeginLoc());
9965 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9966 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9970template <
typename Derived>
9974 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9975 OMPD_taskwait, DirName,
nullptr, D->getBeginLoc());
9976 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9977 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9981template <
typename Derived>
9985 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9986 OMPD_assume, DirName,
nullptr, D->getBeginLoc());
9987 StmtResult Res = getDerived().TransformOMPInformationalDirective(D);
9988 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9992template <
typename Derived>
9996 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9997 OMPD_error, DirName,
nullptr, D->getBeginLoc());
9998 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9999 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10003template <
typename Derived>
10005 OMPTaskgroupDirective *D) {
10007 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10008 OMPD_taskgroup, DirName,
nullptr, D->getBeginLoc());
10009 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10010 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10014template <
typename Derived>
10018 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10019 OMPD_flush, DirName,
nullptr, D->getBeginLoc());
10020 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10021 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10025template <
typename Derived>
10029 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10030 OMPD_depobj, DirName,
nullptr, D->getBeginLoc());
10031 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10032 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10036template <
typename Derived>
10040 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10041 OMPD_scan, DirName,
nullptr, D->getBeginLoc());
10042 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10043 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10047template <
typename Derived>
10051 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10052 OMPD_ordered, DirName,
nullptr, D->getBeginLoc());
10053 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10054 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10058template <
typename Derived>
10062 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10063 OMPD_atomic, DirName,
nullptr, D->getBeginLoc());
10064 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10065 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10069template <
typename Derived>
10073 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10074 OMPD_target, DirName,
nullptr, D->getBeginLoc());
10075 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10076 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10080template <
typename Derived>
10082 OMPTargetDataDirective *D) {
10084 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10085 OMPD_target_data, DirName,
nullptr, D->getBeginLoc());
10086 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10087 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10091template <
typename Derived>
10093 OMPTargetEnterDataDirective *D) {
10095 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10096 OMPD_target_enter_data, DirName,
nullptr, D->getBeginLoc());
10097 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10098 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10102template <
typename Derived>
10104 OMPTargetExitDataDirective *D) {
10106 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10107 OMPD_target_exit_data, DirName,
nullptr, D->getBeginLoc());
10108 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10109 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10113template <
typename Derived>
10115 OMPTargetParallelDirective *D) {
10117 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10118 OMPD_target_parallel, DirName,
nullptr, D->getBeginLoc());
10119 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10120 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10124template <
typename Derived>
10126 OMPTargetParallelForDirective *D) {
10128 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10129 OMPD_target_parallel_for, DirName,
nullptr, D->getBeginLoc());
10130 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10131 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10135template <
typename Derived>
10137 OMPTargetUpdateDirective *D) {
10139 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10140 OMPD_target_update, DirName,
nullptr, D->getBeginLoc());
10141 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10142 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10146template <
typename Derived>
10150 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10151 OMPD_teams, DirName,
nullptr, D->getBeginLoc());
10152 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10153 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10157template <
typename Derived>
10159 OMPCancellationPointDirective *D) {
10161 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10162 OMPD_cancellation_point, DirName,
nullptr, D->getBeginLoc());
10163 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10164 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10168template <
typename Derived>
10172 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10173 OMPD_cancel, DirName,
nullptr, D->getBeginLoc());
10174 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10175 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10179template <
typename Derived>
10183 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10184 OMPD_taskloop, DirName,
nullptr, D->getBeginLoc());
10185 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10186 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10190template <
typename Derived>
10192 OMPTaskLoopSimdDirective *D) {
10194 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10195 OMPD_taskloop_simd, DirName,
nullptr, D->getBeginLoc());
10196 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10197 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10201template <
typename Derived>
10203 OMPMasterTaskLoopDirective *D) {
10205 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10206 OMPD_master_taskloop, DirName,
nullptr, D->getBeginLoc());
10207 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10208 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10212template <
typename Derived>
10214 OMPMaskedTaskLoopDirective *D) {
10216 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10217 OMPD_masked_taskloop, DirName,
nullptr, D->getBeginLoc());
10218 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10219 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10223template <
typename Derived>
10225 OMPMasterTaskLoopSimdDirective *D) {
10227 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10228 OMPD_master_taskloop_simd, DirName,
nullptr, D->getBeginLoc());
10229 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10230 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10234template <
typename Derived>
10236 OMPMaskedTaskLoopSimdDirective *D) {
10238 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10239 OMPD_masked_taskloop_simd, DirName,
nullptr, D->getBeginLoc());
10240 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10241 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10245template <
typename Derived>
10247 OMPParallelMasterTaskLoopDirective *D) {
10249 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10250 OMPD_parallel_master_taskloop, DirName,
nullptr, D->getBeginLoc());
10251 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10252 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10256template <
typename Derived>
10258 OMPParallelMaskedTaskLoopDirective *D) {
10260 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10261 OMPD_parallel_masked_taskloop, DirName,
nullptr, D->getBeginLoc());
10262 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10263 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10267template <
typename Derived>
10270 OMPParallelMasterTaskLoopSimdDirective *D) {
10272 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10273 OMPD_parallel_master_taskloop_simd, DirName,
nullptr, D->getBeginLoc());
10274 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10275 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10279template <
typename Derived>
10282 OMPParallelMaskedTaskLoopSimdDirective *D) {
10284 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10285 OMPD_parallel_masked_taskloop_simd, DirName,
nullptr, D->getBeginLoc());
10286 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10287 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10291template <
typename Derived>
10293 OMPDistributeDirective *D) {
10295 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10296 OMPD_distribute, DirName,
nullptr, D->getBeginLoc());
10297 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10298 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10302template <
typename Derived>
10304 OMPDistributeParallelForDirective *D) {
10306 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10307 OMPD_distribute_parallel_for, DirName,
nullptr, D->getBeginLoc());
10308 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10309 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10313template <
typename Derived>
10316 OMPDistributeParallelForSimdDirective *D) {
10318 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10319 OMPD_distribute_parallel_for_simd, DirName,
nullptr, D->getBeginLoc());
10320 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10321 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10325template <
typename Derived>
10327 OMPDistributeSimdDirective *D) {
10329 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10330 OMPD_distribute_simd, DirName,
nullptr, D->getBeginLoc());
10331 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10332 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10336template <
typename Derived>
10338 OMPTargetParallelForSimdDirective *D) {
10340 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10341 OMPD_target_parallel_for_simd, DirName,
nullptr, D->getBeginLoc());
10342 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10343 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10347template <
typename Derived>
10349 OMPTargetSimdDirective *D) {
10351 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10352 OMPD_target_simd, DirName,
nullptr, D->getBeginLoc());
10353 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10354 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10358template <
typename Derived>
10360 OMPTeamsDistributeDirective *D) {
10362 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10363 OMPD_teams_distribute, DirName,
nullptr, D->getBeginLoc());
10364 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10365 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10369template <
typename Derived>
10371 OMPTeamsDistributeSimdDirective *D) {
10373 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10374 OMPD_teams_distribute_simd, DirName,
nullptr, D->getBeginLoc());
10375 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10376 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10380template <
typename Derived>
10382 OMPTeamsDistributeParallelForSimdDirective *D) {
10384 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10385 OMPD_teams_distribute_parallel_for_simd, DirName,
nullptr,
10387 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10388 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10392template <
typename Derived>
10394 OMPTeamsDistributeParallelForDirective *D) {
10396 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10397 OMPD_teams_distribute_parallel_for, DirName,
nullptr, D->getBeginLoc());
10398 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10399 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10403template <
typename Derived>
10405 OMPTargetTeamsDirective *D) {
10407 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10408 OMPD_target_teams, DirName,
nullptr, D->getBeginLoc());
10409 auto Res = getDerived().TransformOMPExecutableDirective(D);
10410 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10414template <
typename Derived>
10416 OMPTargetTeamsDistributeDirective *D) {
10418 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10419 OMPD_target_teams_distribute, DirName,
nullptr, D->getBeginLoc());
10420 auto Res = getDerived().TransformOMPExecutableDirective(D);
10421 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10425template <
typename Derived>
10428 OMPTargetTeamsDistributeParallelForDirective *D) {
10430 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10431 OMPD_target_teams_distribute_parallel_for, DirName,
nullptr,
10433 auto Res = getDerived().TransformOMPExecutableDirective(D);
10434 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10438template <
typename Derived>
10441 OMPTargetTeamsDistributeParallelForSimdDirective *D) {
10443 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10444 OMPD_target_teams_distribute_parallel_for_simd, DirName,
nullptr,
10446 auto Res = getDerived().TransformOMPExecutableDirective(D);
10447 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10451template <
typename Derived>
10454 OMPTargetTeamsDistributeSimdDirective *D) {
10456 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10457 OMPD_target_teams_distribute_simd, DirName,
nullptr, D->getBeginLoc());
10458 auto Res = getDerived().TransformOMPExecutableDirective(D);
10459 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10463template <
typename Derived>
10467 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10468 OMPD_interop, DirName,
nullptr, D->getBeginLoc());
10469 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10470 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10474template <
typename Derived>
10478 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10479 OMPD_dispatch, DirName,
nullptr, D->getBeginLoc());
10480 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10481 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10485template <
typename Derived>
10489 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10490 OMPD_masked, DirName,
nullptr, D->getBeginLoc());
10491 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10492 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10496template <
typename Derived>
10498 OMPGenericLoopDirective *D) {
10500 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10501 OMPD_loop, DirName,
nullptr, D->getBeginLoc());
10502 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10503 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10507template <
typename Derived>
10509 OMPTeamsGenericLoopDirective *D) {
10511 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10512 OMPD_teams_loop, DirName,
nullptr, D->getBeginLoc());
10513 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10514 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10518template <
typename Derived>
10520 OMPTargetTeamsGenericLoopDirective *D) {
10522 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10523 OMPD_target_teams_loop, DirName,
nullptr, D->getBeginLoc());
10524 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10525 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10529template <
typename Derived>
10531 OMPParallelGenericLoopDirective *D) {
10533 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10534 OMPD_parallel_loop, DirName,
nullptr, D->getBeginLoc());
10535 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10536 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10540template <
typename Derived>
10543 OMPTargetParallelGenericLoopDirective *D) {
10545 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10546 OMPD_target_parallel_loop, DirName,
nullptr, D->getBeginLoc());
10547 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10548 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10555template <
typename Derived>
10558 if (
Cond.isInvalid())
10560 return getDerived().RebuildOMPIfClause(
10561 C->getNameModifier(),
Cond.get(),
C->getBeginLoc(),
C->getLParenLoc(),
10562 C->getNameModifierLoc(),
C->getColonLoc(),
C->getEndLoc());
10565template <
typename Derived>
10568 if (
Cond.isInvalid())
10570 return getDerived().RebuildOMPFinalClause(
Cond.get(),
C->getBeginLoc(),
10571 C->getLParenLoc(),
C->getEndLoc());
10574template <
typename Derived>
10577 ExprResult NumThreads = getDerived().TransformExpr(
C->getNumThreads());
10578 if (NumThreads.isInvalid())
10580 return getDerived().RebuildOMPNumThreadsClause(
10581 C->getModifier(), NumThreads.get(),
C->getBeginLoc(),
C->getLParenLoc(),
10582 C->getModifierLoc(),
C->getEndLoc());
10585template <
typename Derived>
10588 ExprResult E = getDerived().TransformExpr(
C->getSafelen());
10591 return getDerived().RebuildOMPSafelenClause(
10592 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10595template <
typename Derived>
10598 ExprResult E = getDerived().TransformExpr(
C->getAllocator());
10601 return getDerived().RebuildOMPAllocatorClause(
10602 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10605template <
typename Derived>
10608 ExprResult E = getDerived().TransformExpr(
C->getSimdlen());
10611 return getDerived().RebuildOMPSimdlenClause(
10612 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10615template <
typename Derived>
10618 TransformedSizes.reserve(
C->getNumSizes());
10620 for (
Expr *E :
C->getSizesRefs()) {
10622 TransformedSizes.push_back(
nullptr);
10626 ExprResult T = getDerived().TransformExpr(E);
10631 TransformedSizes.push_back(T.get());
10634 if (!Changed && !getDerived().AlwaysRebuild())
10636 return RebuildOMPSizesClause(TransformedSizes,
C->getBeginLoc(),
10637 C->getLParenLoc(),
C->getEndLoc());
10640template <
typename Derived>
10644 TransformedCounts.reserve(
C->getNumCounts());
10645 for (
Expr *E :
C->getCountsRefs()) {
10647 TransformedCounts.push_back(
nullptr);
10651 ExprResult T = getDerived().TransformExpr(E);
10654 TransformedCounts.push_back(T.get());
10657 return RebuildOMPCountsClause(TransformedCounts,
C->getBeginLoc(),
10658 C->getLParenLoc(),
C->getEndLoc(),
10659 C->getOmpFillIndex(),
C->getOmpFillLoc());
10662template <
typename Derived>
10666 TransformedArgs.reserve(
C->getNumLoops());
10668 for (
Expr *E :
C->getArgsRefs()) {
10670 TransformedArgs.push_back(
nullptr);
10674 ExprResult T = getDerived().TransformExpr(E);
10679 TransformedArgs.push_back(T.get());
10682 if (!Changed && !getDerived().AlwaysRebuild())
10684 return RebuildOMPPermutationClause(TransformedArgs,
C->getBeginLoc(),
10685 C->getLParenLoc(),
C->getEndLoc());
10688template <
typename Derived>
10690 if (!getDerived().AlwaysRebuild())
10692 return RebuildOMPFullClause(
C->getBeginLoc(),
C->getEndLoc());
10695template <
typename Derived>
10698 ExprResult T = getDerived().TransformExpr(
C->getFactor());
10701 Expr *Factor = T.get();
10702 bool Changed = Factor !=
C->getFactor();
10704 if (!Changed && !getDerived().AlwaysRebuild())
10706 return RebuildOMPPartialClause(Factor,
C->getBeginLoc(),
C->getLParenLoc(),
10710template <
typename Derived>
10713 ExprResult F = getDerived().TransformExpr(
C->getFirst());
10717 ExprResult Cn = getDerived().TransformExpr(
C->getCount());
10718 if (Cn.isInvalid())
10722 Expr *Count = Cn.get();
10724 bool Changed = (
First !=
C->getFirst()) || (Count !=
C->getCount());
10727 if (!Changed && !getDerived().AlwaysRebuild())
10730 return RebuildOMPLoopRangeClause(
First, Count,
C->getBeginLoc(),
10731 C->getLParenLoc(),
C->getFirstLoc(),
10732 C->getCountLoc(),
C->getEndLoc());
10735template <
typename Derived>
10738 ExprResult E = getDerived().TransformExpr(
C->getNumForLoops());
10741 return getDerived().RebuildOMPCollapseClause(
10742 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10745template <
typename Derived>
10749 C->getDefaultKind(),
C->getDefaultKindKwLoc(),
C->getDefaultVC(),
10750 C->getDefaultVCLoc(),
C->getBeginLoc(),
C->getLParenLoc(),
10754template <
typename Derived>
10761template <
typename Derived>
10764 Expr *Impex =
C->getImpexType();
10765 ExprResult TransformedImpex = getDerived().TransformExpr(Impex);
10767 if (TransformedImpex.isInvalid())
10770 return getDerived().RebuildOMPTransparentClause(
10771 TransformedImpex.get(),
C->getBeginLoc(),
C->getLParenLoc(),
10775template <
typename Derived>
10779 C->getProcBindKind(),
C->getProcBindKindKwLoc(),
C->getBeginLoc(),
10780 C->getLParenLoc(),
C->getEndLoc());
10783template <
typename Derived>
10786 ExprResult E = getDerived().TransformExpr(
C->getChunkSize());
10789 return getDerived().RebuildOMPScheduleClause(
10790 C->getFirstScheduleModifier(),
C->getSecondScheduleModifier(),
10791 C->getScheduleKind(), E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
10792 C->getFirstScheduleModifierLoc(),
C->getSecondScheduleModifierLoc(),
10793 C->getScheduleKindLoc(),
C->getCommaLoc(),
C->getEndLoc());
10796template <
typename Derived>
10800 if (
auto *
Num =
C->getNumForLoops()) {
10801 E = getDerived().TransformExpr(
Num);
10805 return getDerived().RebuildOMPOrderedClause(
C->getBeginLoc(),
C->getEndLoc(),
10806 C->getLParenLoc(), E.get());
10809template <
typename Derived>
10813 if (
Expr *Evt =
C->getEventHandler()) {
10814 E = getDerived().TransformExpr(Evt);
10818 return getDerived().RebuildOMPDetachClause(E.get(),
C->getBeginLoc(),
10819 C->getLParenLoc(),
C->getEndLoc());
10822template <
typename Derived>
10828 if (
Cond.isInvalid())
10831 return getDerived().RebuildOMPNowaitClause(
Cond.get(),
C->getBeginLoc(),
10832 C->getLParenLoc(),
C->getEndLoc());
10835template <
typename Derived>
10842template <
typename Derived>
10849template <
typename Derived>
10855template <
typename Derived>
10861template <
typename Derived>
10868template <
typename Derived>
10875template <
typename Derived>
10882template <
typename Derived>
10888template <
typename Derived>
10894template <
typename Derived>
10896 ExprResult E = getDerived().TransformExpr(
C->getExpr());
10899 return getDerived().RebuildOMPHoldsClause(E.get(),
C->getBeginLoc(),
10900 C->getLParenLoc(),
C->getEndLoc());
10903template <
typename Derived>
10909template <
typename Derived>
10914template <
typename Derived>
10916 OMPNoOpenMPRoutinesClause *
C) {
10919template <
typename Derived>
10921 OMPNoOpenMPConstructsClause *
C) {
10924template <
typename Derived>
10926 OMPNoParallelismClause *
C) {
10930template <
typename Derived>
10937template <
typename Derived>
10944template <
typename Derived>
10951template <
typename Derived>
10958template <
typename Derived>
10965template <
typename Derived>
10971template <
typename Derived>
10978template <
typename Derived>
10984template <
typename Derived>
10991template <
typename Derived>
10993 ExprResult IVR = getDerived().TransformExpr(
C->getInteropVar());
10994 if (IVR.isInvalid())
10998 InteropInfo.PreferTypes.reserve(
C->varlist_size() - 1);
10999 for (
Expr *E : llvm::drop_begin(
C->varlist())) {
11001 if (ER.isInvalid())
11003 InteropInfo.PreferTypes.push_back(ER.get());
11005 return getDerived().RebuildOMPInitClause(IVR.get(), InteropInfo,
11006 C->getBeginLoc(),
C->getLParenLoc(),
11007 C->getVarLoc(),
C->getEndLoc());
11010template <
typename Derived>
11012 ExprResult ER = getDerived().TransformExpr(
C->getInteropVar());
11013 if (ER.isInvalid())
11015 return getDerived().RebuildOMPUseClause(ER.get(),
C->getBeginLoc(),
11016 C->getLParenLoc(),
C->getVarLoc(),
11020template <
typename Derived>
11024 if (
Expr *IV =
C->getInteropVar()) {
11025 ER = getDerived().TransformExpr(IV);
11026 if (ER.isInvalid())
11029 return getDerived().RebuildOMPDestroyClause(ER.get(),
C->getBeginLoc(),
11030 C->getLParenLoc(),
C->getVarLoc(),
11034template <
typename Derived>
11038 if (
Cond.isInvalid())
11040 return getDerived().RebuildOMPNovariantsClause(
11041 Cond.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11044template <
typename Derived>
11048 if (
Cond.isInvalid())
11050 return getDerived().RebuildOMPNocontextClause(
11051 Cond.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11054template <
typename Derived>
11057 ExprResult ThreadID = getDerived().TransformExpr(
C->getThreadID());
11058 if (ThreadID.isInvalid())
11060 return getDerived().RebuildOMPFilterClause(ThreadID.get(),
C->getBeginLoc(),
11061 C->getLParenLoc(),
C->getEndLoc());
11064template <
typename Derived>
11066 ExprResult E = getDerived().TransformExpr(
C->getAlignment());
11069 return getDerived().RebuildOMPAlignClause(E.get(),
C->getBeginLoc(),
11070 C->getLParenLoc(),
C->getEndLoc());
11073template <
typename Derived>
11075 OMPUnifiedAddressClause *
C) {
11076 llvm_unreachable(
"unified_address clause cannot appear in dependent context");
11079template <
typename Derived>
11081 OMPUnifiedSharedMemoryClause *
C) {
11083 "unified_shared_memory clause cannot appear in dependent context");
11086template <
typename Derived>
11088 OMPReverseOffloadClause *
C) {
11089 llvm_unreachable(
"reverse_offload clause cannot appear in dependent context");
11092template <
typename Derived>
11094 OMPDynamicAllocatorsClause *
C) {
11096 "dynamic_allocators clause cannot appear in dependent context");
11099template <
typename Derived>
11101 OMPAtomicDefaultMemOrderClause *
C) {
11103 "atomic_default_mem_order clause cannot appear in dependent context");
11106template <
typename Derived>
11109 llvm_unreachable(
"self_maps clause cannot appear in dependent context");
11112template <
typename Derived>
11115 C->getBeginLoc(),
C->getLParenLoc(),
11119template <
typename Derived>
11123 C->getSeverityKind(),
C->getSeverityKindKwLoc(),
C->getBeginLoc(),
11124 C->getLParenLoc(),
C->getEndLoc());
11127template <
typename Derived>
11130 ExprResult E = getDerived().TransformExpr(
C->getMessageString());
11133 return getDerived().RebuildOMPMessageClause(
11134 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11137template <
typename Derived>
11141 Vars.reserve(
C->varlist_size());
11142 for (
auto *
VE :
C->varlist()) {
11144 if (EVar.isInvalid())
11146 Vars.push_back(EVar.get());
11148 return getDerived().RebuildOMPPrivateClause(
11149 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11152template <
typename Derived>
11154 OMPFirstprivateClause *
C) {
11156 Vars.reserve(
C->varlist_size());
11157 for (
auto *
VE :
C->varlist()) {
11159 if (EVar.isInvalid())
11161 Vars.push_back(EVar.get());
11163 return getDerived().RebuildOMPFirstprivateClause(
11164 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11167template <
typename Derived>
11171 Vars.reserve(
C->varlist_size());
11172 for (
auto *
VE :
C->varlist()) {
11174 if (EVar.isInvalid())
11176 Vars.push_back(EVar.get());
11178 return getDerived().RebuildOMPLastprivateClause(
11179 Vars,
C->getKind(),
C->getKindLoc(),
C->getColonLoc(),
C->getBeginLoc(),
11180 C->getLParenLoc(),
C->getEndLoc());
11183template <
typename Derived>
11187 Vars.reserve(
C->varlist_size());
11188 for (
auto *
VE :
C->varlist()) {
11190 if (EVar.isInvalid())
11192 Vars.push_back(EVar.get());
11194 return getDerived().RebuildOMPSharedClause(Vars,
C->getBeginLoc(),
11195 C->getLParenLoc(),
C->getEndLoc());
11198template <
typename Derived>
11202 Vars.reserve(
C->varlist_size());
11203 for (
auto *
VE :
C->varlist()) {
11205 if (EVar.isInvalid())
11207 Vars.push_back(EVar.get());
11210 ReductionIdScopeSpec.
Adopt(
C->getQualifierLoc());
11213 if (NameInfo.getName()) {
11214 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
11215 if (!NameInfo.getName())
11221 for (
auto *E :
C->reduction_ops()) {
11226 for (
auto *D : ULE->decls()) {
11229 Decls.addDecl(InstD, InstD->getAccess());
11233 ReductionIdScopeSpec.getWithLocInContext(SemaRef.
Context), NameInfo,
11234 true, Decls.begin(), Decls.end(),
11237 UnresolvedReductions.push_back(
nullptr);
11239 return getDerived().RebuildOMPReductionClause(
11240 Vars,
C->getModifier(),
C->getOriginalSharingModifier(),
C->getBeginLoc(),
11241 C->getLParenLoc(),
C->getModifierLoc(),
C->getColonLoc(),
C->getEndLoc(),
11242 ReductionIdScopeSpec, NameInfo, UnresolvedReductions);
11245template <
typename Derived>
11247 OMPTaskReductionClause *
C) {
11249 Vars.reserve(
C->varlist_size());
11250 for (
auto *
VE :
C->varlist()) {
11252 if (EVar.isInvalid())
11254 Vars.push_back(EVar.get());
11257 ReductionIdScopeSpec.
Adopt(
C->getQualifierLoc());
11260 if (NameInfo.getName()) {
11261 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
11262 if (!NameInfo.getName())
11268 for (
auto *E :
C->reduction_ops()) {
11273 for (
auto *D : ULE->decls()) {
11276 Decls.addDecl(InstD, InstD->getAccess());
11280 ReductionIdScopeSpec.getWithLocInContext(SemaRef.
Context), NameInfo,
11281 true, Decls.begin(), Decls.end(),
11284 UnresolvedReductions.push_back(
nullptr);
11286 return getDerived().RebuildOMPTaskReductionClause(
11287 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getColonLoc(),
11288 C->getEndLoc(), ReductionIdScopeSpec, NameInfo, UnresolvedReductions);
11291template <
typename Derived>
11295 Vars.reserve(
C->varlist_size());
11296 for (
auto *
VE :
C->varlist()) {
11298 if (EVar.isInvalid())
11300 Vars.push_back(EVar.get());
11303 ReductionIdScopeSpec.
Adopt(
C->getQualifierLoc());
11306 if (NameInfo.getName()) {
11307 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
11308 if (!NameInfo.getName())
11314 for (
auto *E :
C->reduction_ops()) {
11319 for (
auto *D : ULE->decls()) {
11322 Decls.addDecl(InstD, InstD->getAccess());
11326 ReductionIdScopeSpec.getWithLocInContext(SemaRef.
Context), NameInfo,
11327 true, Decls.begin(), Decls.end(),
11330 UnresolvedReductions.push_back(
nullptr);
11332 return getDerived().RebuildOMPInReductionClause(
11333 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getColonLoc(),
11334 C->getEndLoc(), ReductionIdScopeSpec, NameInfo, UnresolvedReductions);
11337template <
typename Derived>
11341 Vars.reserve(
C->varlist_size());
11342 for (
auto *
VE :
C->varlist()) {
11344 if (EVar.isInvalid())
11346 Vars.push_back(EVar.get());
11348 ExprResult Step = getDerived().TransformExpr(
C->getStep());
11349 if (Step.isInvalid())
11351 return getDerived().RebuildOMPLinearClause(
11352 Vars, Step.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getModifier(),
11353 C->getModifierLoc(),
C->getColonLoc(),
C->getStepModifierLoc(),
11357template <
typename Derived>
11361 Vars.reserve(
C->varlist_size());
11362 for (
auto *
VE :
C->varlist()) {
11364 if (EVar.isInvalid())
11366 Vars.push_back(EVar.get());
11368 ExprResult Alignment = getDerived().TransformExpr(
C->getAlignment());
11369 if (Alignment.isInvalid())
11371 return getDerived().RebuildOMPAlignedClause(
11372 Vars, Alignment.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11373 C->getColonLoc(),
C->getEndLoc());
11376template <
typename Derived>
11380 Vars.reserve(
C->varlist_size());
11381 for (
auto *
VE :
C->varlist()) {
11383 if (EVar.isInvalid())
11385 Vars.push_back(EVar.get());
11387 return getDerived().RebuildOMPCopyinClause(Vars,
C->getBeginLoc(),
11388 C->getLParenLoc(),
C->getEndLoc());
11391template <
typename Derived>
11395 Vars.reserve(
C->varlist_size());
11396 for (
auto *
VE :
C->varlist()) {
11398 if (EVar.isInvalid())
11400 Vars.push_back(EVar.get());
11402 return getDerived().RebuildOMPCopyprivateClause(
11403 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11406template <
typename Derived>
11409 Vars.reserve(
C->varlist_size());
11410 for (
auto *
VE :
C->varlist()) {
11412 if (EVar.isInvalid())
11414 Vars.push_back(EVar.get());
11416 return getDerived().RebuildOMPFlushClause(Vars,
C->getBeginLoc(),
11417 C->getLParenLoc(),
C->getEndLoc());
11420template <
typename Derived>
11423 ExprResult E = getDerived().TransformExpr(
C->getDepobj());
11426 return getDerived().RebuildOMPDepobjClause(E.get(),
C->getBeginLoc(),
11427 C->getLParenLoc(),
C->getEndLoc());
11430template <
typename Derived>
11434 Expr *DepModifier =
C->getModifier();
11436 ExprResult DepModRes = getDerived().TransformExpr(DepModifier);
11437 if (DepModRes.isInvalid())
11439 DepModifier = DepModRes.get();
11441 Vars.reserve(
C->varlist_size());
11442 for (
auto *
VE :
C->varlist()) {
11444 if (EVar.isInvalid())
11446 Vars.push_back(EVar.get());
11448 return getDerived().RebuildOMPDependClause(
11449 {
C->getDependencyKind(),
C->getDependencyLoc(),
C->getColonLoc(),
11450 C->getOmpAllMemoryLoc()},
11451 DepModifier, Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11454template <
typename Derived>
11457 ExprResult E = getDerived().TransformExpr(
C->getDevice());
11460 return getDerived().RebuildOMPDeviceClause(
11461 C->getModifier(), E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11462 C->getModifierLoc(),
C->getEndLoc());
11465template <
typename Derived,
class T>
11472 Vars.reserve(
C->varlist_size());
11473 for (
auto *
VE :
C->varlist()) {
11477 Vars.push_back(EVar.
get());
11481 if (
C->getMapperQualifierLoc()) {
11482 QualifierLoc = TT.
getDerived().TransformNestedNameSpecifierLoc(
11483 C->getMapperQualifierLoc());
11487 MapperIdScopeSpec.
Adopt(QualifierLoc);
11488 MapperIdInfo =
C->getMapperIdInfo();
11489 if (MapperIdInfo.
getName()) {
11490 MapperIdInfo = TT.
getDerived().TransformDeclarationNameInfo(MapperIdInfo);
11496 for (
auto *E :
C->mapperlists()) {
11501 for (
auto *D : ULE->decls()) {
11504 Decls.addDecl(InstD, InstD->
getAccess());
11509 MapperIdInfo,
true, Decls.begin(), Decls.end(),
11512 UnresolvedMappers.push_back(
nullptr);
11518template <
typename Derived>
11520 OMPVarListLocTy Locs(
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11522 Expr *IteratorModifier =
C->getIteratorModifier();
11523 if (IteratorModifier) {
11524 ExprResult MapModRes = getDerived().TransformExpr(IteratorModifier);
11525 if (MapModRes.isInvalid())
11527 IteratorModifier = MapModRes.
get();
11533 *
this,
C, Vars, MapperIdScopeSpec, MapperIdInfo, UnresolvedMappers))
11535 return getDerived().RebuildOMPMapClause(
11536 IteratorModifier,
C->getMapTypeModifiers(),
C->getMapTypeModifiersLoc(),
11537 MapperIdScopeSpec, MapperIdInfo,
C->getMapType(),
C->isImplicitMapType(),
11538 C->getMapLoc(),
C->getColonLoc(), Vars, Locs, UnresolvedMappers);
11541template <
typename Derived>
11544 Expr *Allocator =
C->getAllocator();
11546 ExprResult AllocatorRes = getDerived().TransformExpr(Allocator);
11547 if (AllocatorRes.isInvalid())
11549 Allocator = AllocatorRes.get();
11551 Expr *Alignment =
C->getAlignment();
11553 ExprResult AlignmentRes = getDerived().TransformExpr(Alignment);
11554 if (AlignmentRes.isInvalid())
11556 Alignment = AlignmentRes.get();
11559 Vars.reserve(
C->varlist_size());
11560 for (
auto *
VE :
C->varlist()) {
11562 if (EVar.isInvalid())
11564 Vars.push_back(EVar.get());
11566 return getDerived().RebuildOMPAllocateClause(
11567 Allocator, Alignment,
C->getFirstAllocateModifier(),
11568 C->getFirstAllocateModifierLoc(),
C->getSecondAllocateModifier(),
11569 C->getSecondAllocateModifierLoc(), Vars,
C->getBeginLoc(),
11570 C->getLParenLoc(),
C->getColonLoc(),
C->getEndLoc());
11573template <
typename Derived>
11577 Vars.reserve(
C->varlist_size());
11578 for (
auto *
VE :
C->varlist()) {
11580 if (EVar.isInvalid())
11582 Vars.push_back(EVar.get());
11584 return getDerived().RebuildOMPNumTeamsClause(
11585 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11588template <
typename Derived>
11592 Vars.reserve(
C->varlist_size());
11593 for (
auto *
VE :
C->varlist()) {
11595 if (EVar.isInvalid())
11597 Vars.push_back(EVar.get());
11599 return getDerived().RebuildOMPThreadLimitClause(
11600 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11603template <
typename Derived>
11606 ExprResult E = getDerived().TransformExpr(
C->getPriority());
11609 return getDerived().RebuildOMPPriorityClause(
11610 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11613template <
typename Derived>
11616 ExprResult E = getDerived().TransformExpr(
C->getGrainsize());
11619 return getDerived().RebuildOMPGrainsizeClause(
11620 C->getModifier(), E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11621 C->getModifierLoc(),
C->getEndLoc());
11624template <
typename Derived>
11627 ExprResult E = getDerived().TransformExpr(
C->getNumTasks());
11630 return getDerived().RebuildOMPNumTasksClause(
11631 C->getModifier(), E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11632 C->getModifierLoc(),
C->getEndLoc());
11635template <
typename Derived>
11637 ExprResult E = getDerived().TransformExpr(
C->getHint());
11640 return getDerived().RebuildOMPHintClause(E.get(),
C->getBeginLoc(),
11641 C->getLParenLoc(),
C->getEndLoc());
11644template <
typename Derived>
11646 OMPDistScheduleClause *
C) {
11647 ExprResult E = getDerived().TransformExpr(
C->getChunkSize());
11650 return getDerived().RebuildOMPDistScheduleClause(
11651 C->getDistScheduleKind(), E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11652 C->getDistScheduleKindLoc(),
C->getCommaLoc(),
C->getEndLoc());
11655template <
typename Derived>
11661 C->getDefaultmapKind(),
11664 C->getDefaultmapModifierLoc(),
11665 C->getDefaultmapKindLoc(),
11669template <
typename Derived>
11673 Expr *IteratorModifier =
C->getIteratorModifier();
11674 if (IteratorModifier) {
11675 ExprResult MapModRes = getDerived().TransformExpr(IteratorModifier);
11676 if (MapModRes.isInvalid())
11678 IteratorModifier = MapModRes.get();
11684 *
this,
C, Vars, MapperIdScopeSpec, MapperIdInfo, UnresolvedMappers))
11686 return getDerived().RebuildOMPToClause(
11687 C->getMotionModifiers(),
C->getMotionModifiersLoc(), IteratorModifier,
11688 MapperIdScopeSpec, MapperIdInfo,
C->getColonLoc(), Vars, Locs,
11689 UnresolvedMappers);
11692template <
typename Derived>
11696 Expr *IteratorModifier =
C->getIteratorModifier();
11697 if (IteratorModifier) {
11698 ExprResult MapModRes = getDerived().TransformExpr(IteratorModifier);
11699 if (MapModRes.isInvalid())
11701 IteratorModifier = MapModRes.get();
11707 *
this,
C, Vars, MapperIdScopeSpec, MapperIdInfo, UnresolvedMappers))
11709 return getDerived().RebuildOMPFromClause(
11710 C->getMotionModifiers(),
C->getMotionModifiersLoc(), IteratorModifier,
11711 MapperIdScopeSpec, MapperIdInfo,
C->getColonLoc(), Vars, Locs,
11712 UnresolvedMappers);
11715template <
typename Derived>
11717 OMPUseDevicePtrClause *
C) {
11719 Vars.reserve(
C->varlist_size());
11720 for (
auto *
VE :
C->varlist()) {
11722 if (EVar.isInvalid())
11724 Vars.push_back(EVar.get());
11727 return getDerived().RebuildOMPUseDevicePtrClause(
11728 Vars, Locs,
C->getFallbackModifier(),
C->getFallbackModifierLoc());
11731template <
typename Derived>
11733 OMPUseDeviceAddrClause *
C) {
11735 Vars.reserve(
C->varlist_size());
11736 for (
auto *
VE :
C->varlist()) {
11738 if (EVar.isInvalid())
11740 Vars.push_back(EVar.get());
11743 return getDerived().RebuildOMPUseDeviceAddrClause(Vars, Locs);
11746template <
typename Derived>
11750 Vars.reserve(
C->varlist_size());
11751 for (
auto *
VE :
C->varlist()) {
11753 if (EVar.isInvalid())
11755 Vars.push_back(EVar.get());
11758 return getDerived().RebuildOMPIsDevicePtrClause(Vars, Locs);
11761template <
typename Derived>
11763 OMPHasDeviceAddrClause *
C) {
11765 Vars.reserve(
C->varlist_size());
11766 for (
auto *
VE :
C->varlist()) {
11768 if (EVar.isInvalid())
11770 Vars.push_back(EVar.get());
11773 return getDerived().RebuildOMPHasDeviceAddrClause(Vars, Locs);
11776template <
typename Derived>
11780 Vars.reserve(
C->varlist_size());
11781 for (
auto *
VE :
C->varlist()) {
11783 if (EVar.isInvalid())
11785 Vars.push_back(EVar.get());
11787 return getDerived().RebuildOMPNontemporalClause(
11788 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11791template <
typename Derived>
11795 Vars.reserve(
C->varlist_size());
11796 for (
auto *
VE :
C->varlist()) {
11798 if (EVar.isInvalid())
11800 Vars.push_back(EVar.get());
11802 return getDerived().RebuildOMPInclusiveClause(
11803 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11806template <
typename Derived>
11810 Vars.reserve(
C->varlist_size());
11811 for (
auto *
VE :
C->varlist()) {
11813 if (EVar.isInvalid())
11815 Vars.push_back(EVar.get());
11817 return getDerived().RebuildOMPExclusiveClause(
11818 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11821template <
typename Derived>
11823 OMPUsesAllocatorsClause *
C) {
11825 Data.reserve(
C->getNumberOfAllocators());
11826 for (
unsigned I = 0, E =
C->getNumberOfAllocators(); I < E; ++I) {
11827 OMPUsesAllocatorsClause::Data D =
C->getAllocatorData(I);
11829 if (Allocator.isInvalid())
11833 AllocatorTraits = getDerived().TransformExpr(AT);
11834 if (AllocatorTraits.isInvalid())
11838 NewD.Allocator = Allocator.get();
11839 NewD.AllocatorTraits = AllocatorTraits.get();
11843 return getDerived().RebuildOMPUsesAllocatorsClause(
11844 Data,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11847template <
typename Derived>
11851 Locators.reserve(
C->varlist_size());
11853 if (
Expr *Modifier =
C->getModifier()) {
11854 ModifierRes = getDerived().TransformExpr(Modifier);
11855 if (ModifierRes.isInvalid())
11858 for (
Expr *E :
C->varlist()) {
11859 ExprResult Locator = getDerived().TransformExpr(E);
11860 if (Locator.isInvalid())
11862 Locators.push_back(Locator.get());
11864 return getDerived().RebuildOMPAffinityClause(
11865 C->getBeginLoc(),
C->getLParenLoc(),
C->getColonLoc(),
C->getEndLoc(),
11866 ModifierRes.get(), Locators);
11869template <
typename Derived>
11872 C->getKind(),
C->getKindKwLoc(),
C->getBeginLoc(),
C->getLParenLoc(),
11873 C->getEndLoc(),
C->getModifier(),
C->getModifierKwLoc());
11876template <
typename Derived>
11879 C->getBindKind(),
C->getBindKindLoc(),
C->getBeginLoc(),
11880 C->getLParenLoc(),
C->getEndLoc());
11883template <
typename Derived>
11885 OMPXDynCGroupMemClause *
C) {
11887 if (
Size.isInvalid())
11889 return getDerived().RebuildOMPXDynCGroupMemClause(
11890 Size.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11893template <
typename Derived>
11895 OMPDynGroupprivateClause *
C) {
11897 if (
Size.isInvalid())
11899 return getDerived().RebuildOMPDynGroupprivateClause(
11900 C->getDynGroupprivateModifier(),
C->getDynGroupprivateFallbackModifier(),
11901 Size.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11902 C->getDynGroupprivateModifierLoc(),
11903 C->getDynGroupprivateFallbackModifierLoc(),
C->getEndLoc());
11906template <
typename Derived>
11910 Vars.reserve(
C->varlist_size());
11911 for (
auto *
VE :
C->varlist()) {
11913 if (EVar.isInvalid())
11915 Vars.push_back(EVar.get());
11917 return getDerived().RebuildOMPDoacrossClause(
11918 C->getDependenceType(),
C->getDependenceLoc(),
C->getColonLoc(), Vars,
11919 C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11922template <
typename Derived>
11926 for (
auto *A :
C->getAttrs())
11927 NewAttrs.push_back(getDerived().TransformAttr(A));
11928 return getDerived().RebuildOMPXAttributeClause(
11929 NewAttrs,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11932template <
typename Derived>
11941template <
typename Derived>
11942class OpenACCClauseTransform final
11944 TreeTransform<Derived> &Self;
11945 ArrayRef<const OpenACCClause *> ExistingClauses;
11946 SemaOpenACC::OpenACCParsedClause &ParsedClause;
11947 OpenACCClause *NewClause =
nullptr;
11950 ExprResult Res = Self.TransformExpr(VarRef);
11952 if (!Res.isUsable())
11955 Res = Self.getSema().OpenACC().ActOnVar(ParsedClause.getDirectiveKind(),
11956 ParsedClause.getClauseKind(),
11962 llvm::SmallVector<Expr *> VisitVarList(ArrayRef<Expr *> VarList) {
11963 llvm::SmallVector<Expr *> InstantiatedVarList;
11964 for (Expr *CurVar : VarList) {
11967 if (VarRef.isUsable())
11968 InstantiatedVarList.push_back(VarRef.get());
11971 return InstantiatedVarList;
11975 OpenACCClauseTransform(TreeTransform<Derived> &Self,
11976 ArrayRef<const OpenACCClause *> ExistingClauses,
11977 SemaOpenACC::OpenACCParsedClause &PC)
11978 : Self(Self), ExistingClauses(ExistingClauses), ParsedClause(PC) {}
11980 OpenACCClause *CreatedClause()
const {
return NewClause; }
11982#define VISIT_CLAUSE(CLAUSE_NAME) \
11983 void Visit##CLAUSE_NAME##Clause(const OpenACC##CLAUSE_NAME##Clause &Clause);
11984#include "clang/Basic/OpenACCClauses.def"
11987template <
typename Derived>
11988void OpenACCClauseTransform<Derived>::VisitDefaultClause(
11990 ParsedClause.setDefaultDetails(
C.getDefaultClauseKind());
11993 Self.getSema().getASTContext(), ParsedClause.getDefaultClauseKind(),
11994 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
11995 ParsedClause.getEndLoc());
11998template <
typename Derived>
11999void OpenACCClauseTransform<Derived>::VisitIfClause(
const OpenACCIfClause &
C) {
12001 assert(
Cond &&
"If constructed with invalid Condition");
12005 if (Res.isInvalid() || !Res.get().second)
12008 ParsedClause.setConditionDetails(Res.get().second);
12011 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12012 ParsedClause.getLParenLoc(), ParsedClause.getConditionExpr(),
12013 ParsedClause.getEndLoc());
12016template <
typename Derived>
12017void OpenACCClauseTransform<Derived>::VisitSelfClause(
12023 for (
Expr *CurVar :
C.getVarList()) {
12026 if (!Res.isUsable())
12029 Res =
Self.getSema().OpenACC().ActOnVar(ParsedClause.getDirectiveKind(),
12030 ParsedClause.getClauseKind(),
12033 if (Res.isUsable())
12034 InstantiatedVarList.push_back(Res.get());
12037 ParsedClause.setVarListDetails(InstantiatedVarList,
12041 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12042 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12043 ParsedClause.getEndLoc());
12046 if (
C.hasConditionExpr()) {
12049 Self.TransformCondition(
Cond->getExprLoc(),
nullptr,
Cond,
12052 if (Res.isInvalid() || !Res.get().second)
12055 ParsedClause.setConditionDetails(Res.get().second);
12059 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12060 ParsedClause.getLParenLoc(), ParsedClause.getConditionExpr(),
12061 ParsedClause.getEndLoc());
12065template <
typename Derived>
12066void OpenACCClauseTransform<Derived>::VisitNumGangsClause(
12070 for (
Expr *CurIntExpr :
C.getIntExprs()) {
12073 if (!Res.isUsable())
12078 C.getBeginLoc(), Res.get());
12079 if (!Res.isUsable())
12082 InstantiatedIntExprs.push_back(Res.get());
12085 ParsedClause.setIntExprDetails(InstantiatedIntExprs);
12087 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12088 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs(),
12089 ParsedClause.getEndLoc());
12092template <
typename Derived>
12093void OpenACCClauseTransform<Derived>::VisitPrivateClause(
12098 for (
const auto [RefExpr, InitRecipe] :
12099 llvm::zip(
C.getVarList(),
C.getInitRecipes())) {
12102 if (VarRef.isUsable()) {
12103 InstantiatedVarList.push_back(VarRef.get());
12107 if (InitRecipe.isSet())
12108 InitRecipes.push_back(InitRecipe);
12110 InitRecipes.push_back(
12111 Self.getSema().OpenACC().CreatePrivateInitRecipe(VarRef.get()));
12114 ParsedClause.setVarListDetails(InstantiatedVarList,
12118 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12119 ParsedClause.getLParenLoc(), ParsedClause.getVarList(), InitRecipes,
12120 ParsedClause.getEndLoc());
12123template <
typename Derived>
12124void OpenACCClauseTransform<Derived>::VisitHostClause(
12126 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12130 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12131 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12132 ParsedClause.getEndLoc());
12135template <
typename Derived>
12136void OpenACCClauseTransform<Derived>::VisitDeviceClause(
12138 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12142 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12143 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12144 ParsedClause.getEndLoc());
12147template <
typename Derived>
12148void OpenACCClauseTransform<Derived>::VisitFirstPrivateClause(
12153 for (
const auto [RefExpr, InitRecipe] :
12154 llvm::zip(
C.getVarList(),
C.getInitRecipes())) {
12157 if (VarRef.isUsable()) {
12158 InstantiatedVarList.push_back(VarRef.get());
12162 if (InitRecipe.isSet())
12163 InitRecipes.push_back(InitRecipe);
12165 InitRecipes.push_back(
12166 Self.getSema().OpenACC().CreateFirstPrivateInitRecipe(
12170 ParsedClause.setVarListDetails(InstantiatedVarList,
12174 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12175 ParsedClause.getLParenLoc(), ParsedClause.getVarList(), InitRecipes,
12176 ParsedClause.getEndLoc());
12179template <
typename Derived>
12180void OpenACCClauseTransform<Derived>::VisitNoCreateClause(
12182 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12186 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12187 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12188 ParsedClause.getEndLoc());
12191template <
typename Derived>
12192void OpenACCClauseTransform<Derived>::VisitPresentClause(
12194 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12198 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12199 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12200 ParsedClause.getEndLoc());
12203template <
typename Derived>
12204void OpenACCClauseTransform<Derived>::VisitCopyClause(
12206 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12207 C.getModifierList());
12210 Self.getSema().getASTContext(), ParsedClause.getClauseKind(),
12211 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12212 ParsedClause.getModifierList(), ParsedClause.getVarList(),
12213 ParsedClause.getEndLoc());
12216template <
typename Derived>
12217void OpenACCClauseTransform<Derived>::VisitLinkClause(
12219 llvm_unreachable(
"link clause not valid unless a decl transform");
12222template <
typename Derived>
12223void OpenACCClauseTransform<Derived>::VisitDeviceResidentClause(
12225 llvm_unreachable(
"device_resident clause not valid unless a decl transform");
12227template <
typename Derived>
12228void OpenACCClauseTransform<Derived>::VisitNoHostClause(
12230 llvm_unreachable(
"nohost clause not valid unless a decl transform");
12232template <
typename Derived>
12233void OpenACCClauseTransform<Derived>::VisitBindClause(
12235 llvm_unreachable(
"bind clause not valid unless a decl transform");
12238template <
typename Derived>
12239void OpenACCClauseTransform<Derived>::VisitCopyInClause(
12241 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12242 C.getModifierList());
12245 Self.getSema().getASTContext(), ParsedClause.getClauseKind(),
12246 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12247 ParsedClause.getModifierList(), ParsedClause.getVarList(),
12248 ParsedClause.getEndLoc());
12251template <
typename Derived>
12252void OpenACCClauseTransform<Derived>::VisitCopyOutClause(
12254 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12255 C.getModifierList());
12258 Self.getSema().getASTContext(), ParsedClause.getClauseKind(),
12259 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12260 ParsedClause.getModifierList(), ParsedClause.getVarList(),
12261 ParsedClause.getEndLoc());
12264template <
typename Derived>
12265void OpenACCClauseTransform<Derived>::VisitCreateClause(
12267 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12268 C.getModifierList());
12271 Self.getSema().getASTContext(), ParsedClause.getClauseKind(),
12272 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12273 ParsedClause.getModifierList(), ParsedClause.getVarList(),
12274 ParsedClause.getEndLoc());
12276template <
typename Derived>
12277void OpenACCClauseTransform<Derived>::VisitAttachClause(
12282 llvm::erase_if(VarList, [&](
Expr *E) {
12283 return Self.getSema().OpenACC().CheckVarIsPointerType(
12289 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12290 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12291 ParsedClause.getEndLoc());
12294template <
typename Derived>
12295void OpenACCClauseTransform<Derived>::VisitDetachClause(
12300 llvm::erase_if(VarList, [&](
Expr *E) {
12301 return Self.getSema().OpenACC().CheckVarIsPointerType(
12307 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12308 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12309 ParsedClause.getEndLoc());
12312template <
typename Derived>
12313void OpenACCClauseTransform<Derived>::VisitDeleteClause(
12315 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12318 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12319 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12320 ParsedClause.getEndLoc());
12323template <
typename Derived>
12324void OpenACCClauseTransform<Derived>::VisitUseDeviceClause(
12326 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12329 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12330 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12331 ParsedClause.getEndLoc());
12334template <
typename Derived>
12335void OpenACCClauseTransform<Derived>::VisitDevicePtrClause(
12340 llvm::erase_if(VarList, [&](
Expr *E) {
12341 return Self.getSema().OpenACC().CheckVarIsPointerType(
12347 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12348 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12349 ParsedClause.getEndLoc());
12352template <
typename Derived>
12353void OpenACCClauseTransform<Derived>::VisitNumWorkersClause(
12355 Expr *IntExpr =
const_cast<Expr *
>(
C.getIntExpr());
12356 assert(IntExpr &&
"num_workers clause constructed with invalid int expr");
12359 if (!Res.isUsable())
12364 C.getBeginLoc(), Res.get());
12365 if (!Res.isUsable())
12368 ParsedClause.setIntExprDetails(Res.get());
12370 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12371 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs()[0],
12372 ParsedClause.getEndLoc());
12375template <
typename Derived>
12376void OpenACCClauseTransform<Derived>::VisitDeviceNumClause (
12378 Expr *IntExpr =
const_cast<Expr *
>(
C.getIntExpr());
12379 assert(IntExpr &&
"device_num clause constructed with invalid int expr");
12382 if (!Res.isUsable())
12387 C.getBeginLoc(), Res.get());
12388 if (!Res.isUsable())
12391 ParsedClause.setIntExprDetails(Res.get());
12393 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12394 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs()[0],
12395 ParsedClause.getEndLoc());
12398template <
typename Derived>
12399void OpenACCClauseTransform<Derived>::VisitDefaultAsyncClause(
12401 Expr *IntExpr =
const_cast<Expr *
>(
C.getIntExpr());
12402 assert(IntExpr &&
"default_async clause constructed with invalid int expr");
12405 if (!Res.isUsable())
12410 C.getBeginLoc(), Res.get());
12411 if (!Res.isUsable())
12414 ParsedClause.setIntExprDetails(Res.get());
12416 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12417 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs()[0],
12418 ParsedClause.getEndLoc());
12421template <
typename Derived>
12422void OpenACCClauseTransform<Derived>::VisitVectorLengthClause(
12424 Expr *IntExpr =
const_cast<Expr *
>(
C.getIntExpr());
12425 assert(IntExpr &&
"vector_length clause constructed with invalid int expr");
12428 if (!Res.isUsable())
12433 C.getBeginLoc(), Res.get());
12434 if (!Res.isUsable())
12437 ParsedClause.setIntExprDetails(Res.get());
12439 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12440 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs()[0],
12441 ParsedClause.getEndLoc());
12444template <
typename Derived>
12445void OpenACCClauseTransform<Derived>::VisitAsyncClause(
12447 if (
C.hasIntExpr()) {
12449 if (!Res.isUsable())
12454 C.getBeginLoc(), Res.get());
12455 if (!Res.isUsable())
12457 ParsedClause.setIntExprDetails(Res.get());
12461 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12462 ParsedClause.getLParenLoc(),
12463 ParsedClause.getNumIntExprs() != 0 ? ParsedClause.getIntExprs()[0]
12465 ParsedClause.getEndLoc());
12468template <
typename Derived>
12469void OpenACCClauseTransform<Derived>::VisitWorkerClause(
12471 if (
C.hasIntExpr()) {
12476 if (!Res.isUsable())
12481 C.getBeginLoc(), Res.get());
12482 if (!Res.isUsable())
12484 ParsedClause.setIntExprDetails(Res.get());
12488 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12489 ParsedClause.getLParenLoc(),
12490 ParsedClause.getNumIntExprs() != 0 ? ParsedClause.getIntExprs()[0]
12492 ParsedClause.getEndLoc());
12495template <
typename Derived>
12496void OpenACCClauseTransform<Derived>::VisitVectorClause(
12498 if (
C.hasIntExpr()) {
12503 if (!Res.isUsable())
12508 C.getBeginLoc(), Res.get());
12509 if (!Res.isUsable())
12511 ParsedClause.setIntExprDetails(Res.get());
12515 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12516 ParsedClause.getLParenLoc(),
12517 ParsedClause.getNumIntExprs() != 0 ? ParsedClause.getIntExprs()[0]
12519 ParsedClause.getEndLoc());
12522template <
typename Derived>
12523void OpenACCClauseTransform<Derived>::VisitWaitClause(
12525 if (
C.hasExprs()) {
12526 Expr *DevNumExpr =
nullptr;
12530 if (
C.getDevNumExpr()) {
12532 if (!Res.isUsable())
12536 C.getBeginLoc(), Res.get());
12537 if (!Res.isUsable())
12540 DevNumExpr = Res.get();
12544 for (
Expr *CurQueueIdExpr :
C.getQueueIdExprs()) {
12546 if (!Res.isUsable())
12550 C.getBeginLoc(), Res.get());
12551 if (!Res.isUsable())
12554 InstantiatedQueueIdExprs.push_back(Res.get());
12557 ParsedClause.setWaitDetails(DevNumExpr,
C.getQueuesLoc(),
12558 std::move(InstantiatedQueueIdExprs));
12562 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12563 ParsedClause.getLParenLoc(), ParsedClause.getDevNumExpr(),
12564 ParsedClause.getQueuesLoc(), ParsedClause.getQueueIdExprs(),
12565 ParsedClause.getEndLoc());
12568template <
typename Derived>
12569void OpenACCClauseTransform<Derived>::VisitDeviceTypeClause(
12573 Self.getSema().getASTContext(),
C.getClauseKind(),
12574 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12575 C.getArchitectures(), ParsedClause.getEndLoc());
12578template <
typename Derived>
12579void OpenACCClauseTransform<Derived>::VisitAutoClause(
12583 ParsedClause.getBeginLoc(),
12584 ParsedClause.getEndLoc());
12587template <
typename Derived>
12588void OpenACCClauseTransform<Derived>::VisitIndependentClause(
12591 ParsedClause.getBeginLoc(),
12592 ParsedClause.getEndLoc());
12595template <
typename Derived>
12596void OpenACCClauseTransform<Derived>::VisitSeqClause(
12599 ParsedClause.getBeginLoc(),
12600 ParsedClause.getEndLoc());
12602template <
typename Derived>
12603void OpenACCClauseTransform<Derived>::VisitFinalizeClause(
12606 ParsedClause.getBeginLoc(),
12607 ParsedClause.getEndLoc());
12610template <
typename Derived>
12611void OpenACCClauseTransform<Derived>::VisitIfPresentClause(
12614 ParsedClause.getBeginLoc(),
12615 ParsedClause.getEndLoc());
12618template <
typename Derived>
12619void OpenACCClauseTransform<Derived>::VisitReductionClause(
12625 for (
const auto [Var, OrigRecipe] :
12626 llvm::zip(TransformedVars,
C.getRecipes())) {
12628 ParsedClause.getDirectiveKind(),
C.getReductionOp(), Var);
12629 if (Res.isUsable()) {
12630 ValidVars.push_back(Res.get());
12632 if (OrigRecipe.isSet())
12633 Recipes.emplace_back(OrigRecipe.AllocaDecl, OrigRecipe.CombinerRecipes);
12635 Recipes.push_back(
Self.getSema().OpenACC().CreateReductionInitRecipe(
12636 C.getReductionOp(), Res.get()));
12640 NewClause =
Self.getSema().OpenACC().CheckReductionClause(
12641 ExistingClauses, ParsedClause.getDirectiveKind(),
12642 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12643 C.getReductionOp(), ValidVars, Recipes, ParsedClause.getEndLoc());
12646template <
typename Derived>
12647void OpenACCClauseTransform<Derived>::VisitCollapseClause(
12649 Expr *LoopCount =
const_cast<Expr *
>(
C.getLoopCount());
12650 assert(LoopCount &&
"collapse clause constructed with invalid loop count");
12654 if (!NewLoopCount.isUsable())
12657 NewLoopCount =
Self.getSema().OpenACC().ActOnIntExpr(
12659 NewLoopCount.get()->getBeginLoc(), NewLoopCount.get());
12663 if (!NewLoopCount.isUsable())
12667 Self.getSema().OpenACC().CheckCollapseLoopCount(NewLoopCount.get());
12671 if (!NewLoopCount.isUsable())
12674 ParsedClause.setCollapseDetails(
C.hasForce(), NewLoopCount.get());
12676 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12677 ParsedClause.getLParenLoc(), ParsedClause.isForce(),
12678 ParsedClause.getLoopCount(), ParsedClause.getEndLoc());
12681template <
typename Derived>
12682void OpenACCClauseTransform<Derived>::VisitTileClause(
12687 for (
Expr *E :
C.getSizeExprs()) {
12690 if (!NewSizeExpr.isUsable())
12693 NewSizeExpr =
Self.getSema().OpenACC().ActOnIntExpr(
12695 NewSizeExpr.get()->getBeginLoc(), NewSizeExpr.get());
12699 if (!NewSizeExpr.isUsable())
12702 NewSizeExpr =
Self.getSema().OpenACC().CheckTileSizeExpr(NewSizeExpr.get());
12704 if (!NewSizeExpr.isUsable())
12706 TransformedExprs.push_back(NewSizeExpr.get());
12709 ParsedClause.setIntExprDetails(TransformedExprs);
12711 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12712 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs(),
12713 ParsedClause.getEndLoc());
12715template <
typename Derived>
12716void OpenACCClauseTransform<Derived>::VisitGangClause(
12721 for (
unsigned I = 0; I <
C.getNumExprs(); ++I) {
12723 if (!ER.isUsable())
12726 ER =
Self.getSema().OpenACC().CheckGangExpr(ExistingClauses,
12727 ParsedClause.getDirectiveKind(),
12728 C.getExpr(I).first, ER.get());
12729 if (!ER.isUsable())
12731 TransformedGangKinds.push_back(
C.getExpr(I).first);
12732 TransformedIntExprs.push_back(ER.get());
12735 NewClause =
Self.getSema().OpenACC().CheckGangClause(
12736 ParsedClause.getDirectiveKind(), ExistingClauses,
12737 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12738 TransformedGangKinds, TransformedIntExprs, ParsedClause.getEndLoc());
12741template <
typename Derived>
12742OpenACCClause *TreeTransform<Derived>::TransformOpenACCClause(
12747 DirKind, OldClause->getClauseKind(), OldClause->getBeginLoc());
12748 ParsedClause.setEndLoc(OldClause->getEndLoc());
12750 if (
const auto *WithParms = dyn_cast<OpenACCClauseWithParams>(OldClause))
12751 ParsedClause.setLParenLoc(WithParms->getLParenLoc());
12753 OpenACCClauseTransform<Derived> Transform{*
this, ExistingClauses,
12755 Transform.Visit(OldClause);
12757 return Transform.CreatedClause();
12760template <
typename Derived>
12762TreeTransform<Derived>::TransformOpenACCClauseList(
12765 for (
const auto *Clause : OldClauses) {
12766 if (
OpenACCClause *TransformedClause = getDerived().TransformOpenACCClause(
12767 TransformedClauses, DirKind, Clause))
12768 TransformedClauses.push_back(TransformedClause);
12770 return TransformedClauses;
12773template <
typename Derived>
12776 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12779 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12782 if (getSema().OpenACC().ActOnStartStmtDirective(
12783 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12788 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
12789 C->clauses(), TransformedClauses);
12790 StmtResult StrBlock = getDerived().TransformStmt(
C->getStructuredBlock());
12791 StrBlock = getSema().OpenACC().ActOnAssociatedStmt(
12792 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses, StrBlock);
12794 return getDerived().RebuildOpenACCComputeConstruct(
12795 C->getDirectiveKind(),
C->getBeginLoc(),
C->getDirectiveLoc(),
12796 C->getEndLoc(), TransformedClauses, StrBlock);
12799template <
typename Derived>
12803 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12806 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12809 if (getSema().OpenACC().ActOnStartStmtDirective(
12810 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12815 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
12816 C->clauses(), TransformedClauses);
12818 Loop = getSema().OpenACC().ActOnAssociatedStmt(
12819 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses,
Loop);
12821 return getDerived().RebuildOpenACCLoopConstruct(
12822 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12823 TransformedClauses,
Loop);
12826template <
typename Derived>
12828 OpenACCCombinedConstruct *
C) {
12829 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12832 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12835 if (getSema().OpenACC().ActOnStartStmtDirective(
12836 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12841 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
12842 C->clauses(), TransformedClauses);
12844 Loop = getSema().OpenACC().ActOnAssociatedStmt(
12845 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses,
Loop);
12847 return getDerived().RebuildOpenACCCombinedConstruct(
12848 C->getDirectiveKind(),
C->getBeginLoc(),
C->getDirectiveLoc(),
12849 C->getEndLoc(), TransformedClauses,
Loop);
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))
12865 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
12866 C->clauses(), TransformedClauses);
12867 StmtResult StrBlock = getDerived().TransformStmt(
C->getStructuredBlock());
12868 StrBlock = getSema().OpenACC().ActOnAssociatedStmt(
12869 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses, StrBlock);
12871 return getDerived().RebuildOpenACCDataConstruct(
12872 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12873 TransformedClauses, StrBlock);
12876template <
typename Derived>
12878 OpenACCEnterDataConstruct *
C) {
12879 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12882 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12884 if (getSema().OpenACC().ActOnStartStmtDirective(
12885 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12888 return getDerived().RebuildOpenACCEnterDataConstruct(
12889 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12890 TransformedClauses);
12893template <
typename Derived>
12895 OpenACCExitDataConstruct *
C) {
12896 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12899 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12901 if (getSema().OpenACC().ActOnStartStmtDirective(
12902 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12905 return getDerived().RebuildOpenACCExitDataConstruct(
12906 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12907 TransformedClauses);
12910template <
typename Derived>
12912 OpenACCHostDataConstruct *
C) {
12913 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12916 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12918 if (getSema().OpenACC().ActOnStartStmtDirective(
12919 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12923 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
12924 C->clauses(), TransformedClauses);
12925 StmtResult StrBlock = getDerived().TransformStmt(
C->getStructuredBlock());
12926 StrBlock = getSema().OpenACC().ActOnAssociatedStmt(
12927 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses, StrBlock);
12929 return getDerived().RebuildOpenACCHostDataConstruct(
12930 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12931 TransformedClauses, StrBlock);
12934template <
typename Derived>
12937 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12940 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12942 if (getSema().OpenACC().ActOnStartStmtDirective(
12943 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12946 return getDerived().RebuildOpenACCInitConstruct(
12947 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12948 TransformedClauses);
12951template <
typename Derived>
12953 OpenACCShutdownConstruct *
C) {
12954 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12957 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12959 if (getSema().OpenACC().ActOnStartStmtDirective(
12960 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12963 return getDerived().RebuildOpenACCShutdownConstruct(
12964 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12965 TransformedClauses);
12967template <
typename Derived>
12970 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12973 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12975 if (getSema().OpenACC().ActOnStartStmtDirective(
12976 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12979 return getDerived().RebuildOpenACCSetConstruct(
12980 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12981 TransformedClauses);
12984template <
typename Derived>
12986 OpenACCUpdateConstruct *
C) {
12987 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12990 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12992 if (getSema().OpenACC().ActOnStartStmtDirective(
12993 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12996 return getDerived().RebuildOpenACCUpdateConstruct(
12997 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12998 TransformedClauses);
13001template <
typename Derived>
13004 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13007 if (
C->hasDevNumExpr()) {
13008 DevNumExpr = getDerived().TransformExpr(
C->getDevNumExpr());
13010 if (DevNumExpr.isUsable())
13011 DevNumExpr = getSema().OpenACC().ActOnIntExpr(
13013 C->getBeginLoc(), DevNumExpr.get());
13018 for (
Expr *QE :
C->getQueueIdExprs()) {
13019 assert(QE &&
"Null queue id expr?");
13020 ExprResult NewEQ = getDerived().TransformExpr(QE);
13022 if (!NewEQ.isUsable())
13026 C->getBeginLoc(), NewEQ.get());
13027 if (NewEQ.isUsable())
13028 QueueIdExprs.push_back(NewEQ.get());
13032 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
13035 if (getSema().OpenACC().ActOnStartStmtDirective(
13036 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
13039 return getDerived().RebuildOpenACCWaitConstruct(
13040 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getLParenLoc(),
13041 DevNumExpr.isUsable() ? DevNumExpr.get() :
nullptr,
C->getQueuesLoc(),
13042 QueueIdExprs,
C->getRParenLoc(),
C->getEndLoc(), TransformedClauses);
13044template <
typename Derived>
13046 OpenACCCacheConstruct *
C) {
13047 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13050 for (
Expr *Var :
C->getVarList()) {
13051 assert(Var &&
"Null var listexpr?");
13053 ExprResult NewVar = getDerived().TransformExpr(Var);
13055 if (!NewVar.isUsable())
13058 NewVar = getSema().OpenACC().ActOnVar(
13060 if (!NewVar.isUsable())
13063 TransformedVarList.push_back(NewVar.get());
13066 if (getSema().OpenACC().ActOnStartStmtDirective(
C->getDirectiveKind(),
13067 C->getBeginLoc(), {}))
13070 return getDerived().RebuildOpenACCCacheConstruct(
13071 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getLParenLoc(),
13072 C->getReadOnlyLoc(), TransformedVarList,
C->getRParenLoc(),
13076template <
typename Derived>
13078 OpenACCAtomicConstruct *
C) {
13079 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13082 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
13085 if (getSema().OpenACC().ActOnStartStmtDirective(
C->getDirectiveKind(),
13086 C->getBeginLoc(), {}))
13091 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(), {}, {});
13093 StmtResult AssocStmt = getDerived().TransformStmt(
C->getAssociatedStmt());
13094 AssocStmt = getSema().OpenACC().ActOnAssociatedStmt(
13095 C->getBeginLoc(),
C->getDirectiveKind(),
C->getAtomicKind(), {},
13098 return getDerived().RebuildOpenACCAtomicConstruct(
13099 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getAtomicKind(),
13100 C->getEndLoc(), TransformedClauses, AssocStmt);
13103template <
typename Derived>
13106 if (getDerived().AlwaysRebuild())
13115template<
typename Derived>
13118 return TransformExpr(E->getSubExpr());
13121template <
typename Derived>
13124 if (!E->isTypeDependent())
13127 TypeSourceInfo *NewT = getDerived().TransformType(E->getTypeSourceInfo());
13132 if (!getDerived().AlwaysRebuild() && E->getTypeSourceInfo() == NewT)
13135 return getDerived().RebuildSYCLUniqueStableNameExpr(
13136 E->getLocation(), E->getLParenLocation(), E->getRParenLocation(), NewT);
13139template <
typename Derived>
13143 const auto *SKEPAttr = FD->template getAttr<SYCLKernelEntryPointAttr>();
13144 if (!SKEPAttr || SKEPAttr->isInvalidAttr())
13147 ExprResult IdExpr = getDerived().TransformExpr(S->getKernelLaunchIdExpr());
13148 if (IdExpr.isInvalid())
13151 StmtResult Body = getDerived().TransformStmt(S->getOriginalStmt());
13152 if (Body.isInvalid())
13158 if (SR.isInvalid())
13164template <
typename Derived>
13167 assert(
false &&
"not implemented yet");
13171template<
typename Derived>
13174 if (!E->isTypeDependent())
13178 E->getIdentKind());
13181template<
typename Derived>
13185 if (E->getQualifierLoc()) {
13187 = getDerived().TransformNestedNameSpecifierLoc(E->getQualifierLoc());
13193 = cast_or_null<ValueDecl>(getDerived().TransformDecl(E->getLocation(),
13195 if (!ND || ND->isInvalidDecl())
13199 if (E->getFoundDecl() != E->getDecl()) {
13200 Found = cast_or_null<NamedDecl>(
13201 getDerived().TransformDecl(E->getLocation(), E->getFoundDecl()));
13207 if (NameInfo.getName()) {
13208 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
13209 if (!NameInfo.getName())
13213 if (!getDerived().AlwaysRebuild() &&
13214 !E->isCapturedByCopyInLambdaWithExplicitObjectParameter() &&
13215 QualifierLoc == E->getQualifierLoc() && ND == E->getDecl() &&
13216 Found == E->getFoundDecl() &&
13217 NameInfo.getName() == E->getDecl()->getDeclName() &&
13218 !E->hasExplicitTemplateArgs()) {
13228 if (E->hasExplicitTemplateArgs()) {
13229 TemplateArgs = &TransArgs;
13230 TransArgs.setLAngleLoc(E->getLAngleLoc());
13231 TransArgs.setRAngleLoc(E->getRAngleLoc());
13232 if (getDerived().TransformTemplateArguments(E->getTemplateArgs(),
13233 E->getNumTemplateArgs(),
13238 return getDerived().RebuildDeclRefExpr(QualifierLoc, ND, NameInfo,
13239 Found, TemplateArgs);
13242template<
typename Derived>
13248template <
typename Derived>
13254template<
typename Derived>
13260template<
typename Derived>
13266template<
typename Derived>
13272template<
typename Derived>
13278template<
typename Derived>
13281 return getDerived().TransformCallExpr(E);
13284template<
typename Derived>
13289 if (E->isExprPredicate())
13290 ControllingExpr = getDerived().TransformExpr(E->getControllingExpr());
13292 ControllingType = getDerived().TransformType(E->getControllingType());
13294 if (ControllingExpr.isInvalid() && !ControllingType)
13305 AssocTypes.push_back(AssocType);
13307 AssocTypes.push_back(
nullptr);
13311 getDerived().TransformExpr(Assoc.getAssociationExpr());
13312 if (AssocExpr.isInvalid())
13314 AssocExprs.push_back(AssocExpr.get());
13317 if (!ControllingType)
13318 return getDerived().RebuildGenericSelectionExpr(E->getGenericLoc(),
13319 E->getDefaultLoc(),
13321 ControllingExpr.get(),
13324 return getDerived().RebuildGenericSelectionExpr(
13325 E->getGenericLoc(), E->getDefaultLoc(), E->getRParenLoc(),
13326 ControllingType, AssocTypes, AssocExprs);
13329template<
typename Derived>
13332 ExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
13333 if (SubExpr.isInvalid())
13336 if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getSubExpr())
13339 return getDerived().RebuildParenExpr(SubExpr.get(), E->getLParen(),
13346template<
typename Derived>
13350 return getDerived().TransformDependentScopeDeclRefExpr(
13351 DRE,
true,
nullptr);
13353 return getDerived().TransformUnresolvedLookupExpr(
13359template<
typename Derived>
13364 SubExpr = TransformAddressOfOperand(E->
getSubExpr());
13370 if (!getDerived().AlwaysRebuild() && SubExpr.
get() == E->
getSubExpr())
13378template<
typename Derived>
13380TreeTransform<Derived>::TransformOffsetOfExpr(OffsetOfExpr *E) {
13382 TypeSourceInfo *Type = getDerived().TransformType(E->getTypeSourceInfo());
13392 bool ExprChanged =
false;
13393 typedef Sema::OffsetOfComponent Component;
13395 for (
unsigned I = 0, N = E->getNumComponents(); I != N; ++I) {
13396 const OffsetOfNode &ON = E->getComponent(I);
13398 Comp.isBrackets =
true;
13399 Comp.LocStart = ON.getSourceRange().getBegin();
13400 Comp.LocEnd = ON.getSourceRange().getEnd();
13401 switch (ON.getKind()) {
13403 Expr *FromIndex = E->getIndexExpr(ON.getArrayExprIndex());
13404 ExprResult Index = getDerived().TransformExpr(FromIndex);
13405 if (Index.isInvalid())
13408 ExprChanged = ExprChanged || Index.get() != FromIndex;
13409 Comp.isBrackets =
true;
13410 Comp.U.E = Index.get();
13416 Comp.isBrackets =
false;
13417 Comp.U.IdentInfo = ON.getFieldName();
13418 if (!
Comp.U.IdentInfo)
13428 Components.push_back(Comp);
13432 if (!getDerived().AlwaysRebuild() &&
13433 Type == E->getTypeSourceInfo() &&
13438 return getDerived().RebuildOffsetOfExpr(E->getOperatorLoc(),
Type,
13439 Components, E->getRParenLoc());
13442template<
typename Derived>
13445 assert((!E->getSourceExpr() || getDerived().AlreadyTransformed(E->getType())) &&
13446 "opaque value expression requires transformation");
13450template <
typename Derived>
13454 for (
Expr *
C : E->subExpressions()) {
13456 if (NewC.isInvalid())
13462 if (!getDerived().AlwaysRebuild() && !Changed)
13464 return getDerived().RebuildRecoveryExpr(E->getBeginLoc(), E->getEndLoc(),
13468template<
typename Derived>
13478 ExprResult result = getDerived().TransformExpr(newSyntacticForm);
13479 if (result.isInvalid())
return ExprError();
13484 if (result.get()->hasPlaceholderType(BuiltinType::PseudoObject))
13490template<
typename Derived>
13494 if (E->isArgumentType()) {
13501 if (!getDerived().AlwaysRebuild() && OldT == NewT)
13504 return getDerived().RebuildUnaryExprOrTypeTrait(NewT, E->getOperatorLoc(),
13506 E->getSourceRange());
13520 auto *PE = dyn_cast<ParenExpr>(E->getArgumentExpr());
13522 PE ? dyn_cast<DependentScopeDeclRefExpr>(PE->getSubExpr()) :
nullptr)
13523 SubExpr = getDerived().TransformParenDependentScopeDeclRefExpr(
13524 PE, DRE,
false, &RecoveryTSI);
13526 SubExpr = getDerived().TransformExpr(E->getArgumentExpr());
13529 return getDerived().RebuildUnaryExprOrTypeTrait(
13530 RecoveryTSI, E->getOperatorLoc(), E->getKind(), E->getSourceRange());
13531 }
else if (SubExpr.isInvalid())
13534 if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getArgumentExpr())
13537 return getDerived().RebuildUnaryExprOrTypeTrait(SubExpr.get(),
13538 E->getOperatorLoc(),
13540 E->getSourceRange());
13543template<
typename Derived>
13546 ExprResult LHS = getDerived().TransformExpr(E->getLHS());
13547 if (LHS.isInvalid())
13550 ExprResult RHS = getDerived().TransformExpr(E->getRHS());
13551 if (RHS.isInvalid())
13555 if (!getDerived().AlwaysRebuild() &&
13556 LHS.get() == E->getLHS() &&
13557 RHS.get() == E->getRHS())
13560 return getDerived().RebuildArraySubscriptExpr(
13562 E->getLHS()->getBeginLoc(), RHS.get(), E->getRBracketLoc());
13565template <
typename Derived>
13569 if (
Base.isInvalid())
13572 ExprResult RowIdx = getDerived().TransformExpr(E->getRowIdx());
13573 if (RowIdx.isInvalid())
13576 if (!getDerived().AlwaysRebuild() &&
Base.get() == E->getBase() &&
13577 RowIdx.get() == E->getRowIdx())
13580 return getDerived().RebuildMatrixSingleSubscriptExpr(
Base.get(), RowIdx.get(),
13581 E->getRBracketLoc());
13584template <
typename Derived>
13588 if (
Base.isInvalid())
13591 ExprResult RowIdx = getDerived().TransformExpr(E->getRowIdx());
13592 if (RowIdx.isInvalid())
13595 ExprResult ColumnIdx = getDerived().TransformExpr(E->getColumnIdx());
13596 if (ColumnIdx.isInvalid())
13599 if (!getDerived().AlwaysRebuild() &&
Base.get() == E->getBase() &&
13600 RowIdx.get() == E->getRowIdx() && ColumnIdx.get() == E->getColumnIdx())
13603 return getDerived().RebuildMatrixSubscriptExpr(
13604 Base.get(), RowIdx.get(), ColumnIdx.get(), E->getRBracketLoc());
13607template <
typename Derived>
13611 if (
Base.isInvalid())
13615 if (E->getLowerBound()) {
13616 LowerBound = getDerived().TransformExpr(E->getLowerBound());
13617 if (LowerBound.isInvalid())
13622 if (E->getLength()) {
13623 Length = getDerived().TransformExpr(E->getLength());
13624 if (Length.isInvalid())
13629 if (E->isOMPArraySection()) {
13630 if (
Expr *Str = E->getStride()) {
13631 Stride = getDerived().TransformExpr(Str);
13632 if (Stride.isInvalid())
13637 if (!getDerived().AlwaysRebuild() &&
Base.get() == E->getBase() &&
13638 LowerBound.get() == E->getLowerBound() &&
13639 Length.get() == E->getLength() &&
13640 (E->isOpenACCArraySection() || Stride.get() == E->getStride()))
13643 return getDerived().RebuildArraySectionExpr(
13644 E->isOMPArraySection(),
Base.get(), E->getBase()->getEndLoc(),
13645 LowerBound.get(), E->getColonLocFirst(),
13646 E->isOMPArraySection() ? E->getColonLocSecond() :
SourceLocation{},
13647 Length.get(), Stride.get(), E->getRBracketLoc());
13650template <
typename Derived>
13654 if (
Base.isInvalid())
13658 bool ErrorFound =
false;
13659 for (
Expr *
Dim : E->getDimensions()) {
13661 if (DimRes.isInvalid()) {
13665 Dims.push_back(DimRes.get());
13670 return getDerived().RebuildOMPArrayShapingExpr(
Base.get(), E->getLParenLoc(),
13671 E->getRParenLoc(), Dims,
13672 E->getBracketsRanges());
13675template <
typename Derived>
13678 unsigned NumIterators = E->numOfIterators();
13681 bool ErrorFound =
false;
13682 bool NeedToRebuild = getDerived().AlwaysRebuild();
13683 for (
unsigned I = 0; I < NumIterators; ++I) {
13685 Data[I].DeclIdent = D->getIdentifier();
13686 Data[I].DeclIdentLoc = D->getLocation();
13687 if (D->getLocation() == D->getBeginLoc()) {
13689 "Implicit type must be int.");
13691 TypeSourceInfo *TSI = getDerived().TransformType(D->getTypeSourceInfo());
13699 ErrorFound = ErrorFound ||
13700 !(!D->getTypeSourceInfo() || (
Data[I].
Type.getAsOpaquePtr() &&
13701 !
Data[I].Type.get().isNull())) ||
13702 Begin.isInvalid() || End.isInvalid() || Step.isInvalid();
13705 Data[I].Range.Begin = Begin.get();
13706 Data[I].Range.End = End.get();
13707 Data[I].Range.Step = Step.get();
13708 Data[I].AssignLoc = E->getAssignLoc(I);
13709 Data[I].ColonLoc = E->getColonLoc(I);
13710 Data[I].SecColonLoc = E->getSecondColonLoc(I);
13713 (D->getTypeSourceInfo() &&
Data[I].
Type.get().getTypePtrOrNull() !=
13714 D->getType().getTypePtrOrNull()) ||
13720 if (!NeedToRebuild)
13723 ExprResult Res = getDerived().RebuildOMPIteratorExpr(
13724 E->getIteratorKwLoc(), E->getLParenLoc(), E->getRParenLoc(),
Data);
13725 if (!Res.isUsable())
13728 for (
unsigned I = 0; I < NumIterators; ++I)
13729 getDerived().transformedLocalDecl(E->getIteratorDecl(I),
13730 IE->getIteratorDecl(I));
13734template<
typename Derived>
13743 bool ArgChanged =
false;
13745 if (getDerived().TransformExprs(E->getArgs(), E->getNumArgs(),
true, Args,
13749 if (!getDerived().AlwaysRebuild() &&
13750 Callee.get() == E->getCallee() &&
13756 = ((
Expr *)
Callee.get())->getSourceRange().getBegin();
13759 if (E->hasStoredFPFeatures()) {
13761 getSema().CurFPFeatures =
13763 getSema().FpPragmaStack.CurrentValue = NewOverrides;
13766 return getDerived().RebuildCallExpr(
Callee.get(), FakeLParenLoc,
13768 E->getRParenLoc());
13771template<
typename Derived>
13775 if (
Base.isInvalid())
13779 if (E->hasQualifier()) {
13781 = getDerived().TransformNestedNameSpecifierLoc(E->getQualifierLoc());
13789 = cast_or_null<ValueDecl>(getDerived().TransformDecl(E->getMemberLoc(),
13790 E->getMemberDecl()));
13794 NamedDecl *FoundDecl = E->getFoundDecl();
13795 if (FoundDecl == E->getMemberDecl()) {
13798 FoundDecl = cast_or_null<NamedDecl>(
13799 getDerived().TransformDecl(E->getMemberLoc(), FoundDecl));
13804 if (!getDerived().AlwaysRebuild() &&
13805 Base.get() == E->getBase() &&
13806 QualifierLoc == E->getQualifierLoc() &&
13807 Member == E->getMemberDecl() &&
13808 FoundDecl == E->getFoundDecl() &&
13809 !E->hasExplicitTemplateArgs()) {
13814 getSema().OpenMP().isOpenMPRebuildMemberExpr(
13824 if (E->hasExplicitTemplateArgs()) {
13825 TransArgs.setLAngleLoc(E->getLAngleLoc());
13826 TransArgs.setRAngleLoc(E->getRAngleLoc());
13827 if (getDerived().TransformTemplateArguments(E->getTemplateArgs(),
13828 E->getNumTemplateArgs(),
13841 NamedDecl *FirstQualifierInScope =
nullptr;
13843 if (MemberNameInfo.getName()) {
13844 MemberNameInfo = getDerived().TransformDeclarationNameInfo(MemberNameInfo);
13845 if (!MemberNameInfo.getName())
13849 return getDerived().RebuildMemberExpr(
Base.get(), FakeOperatorLoc,
13856 (E->hasExplicitTemplateArgs()
13857 ? &TransArgs :
nullptr),
13858 FirstQualifierInScope);
13861template<
typename Derived>
13864 ExprResult LHS = getDerived().TransformExpr(E->getLHS());
13865 if (LHS.isInvalid())
13869 getDerived().TransformInitializer(E->getRHS(),
false);
13870 if (RHS.isInvalid())
13873 if (!getDerived().AlwaysRebuild() &&
13874 LHS.get() == E->getLHS() &&
13875 RHS.get() == E->getRHS())
13878 if (E->isCompoundAssignmentOp())
13880 return getDerived().RebuildBinaryOperator(
13881 E->getOperatorLoc(), E->getOpcode(), LHS.get(), RHS.get());
13884 getSema().CurFPFeatures =
13885 NewOverrides.applyOverrides(getSema().getLangOpts());
13886 getSema().FpPragmaStack.CurrentValue = NewOverrides;
13887 return getDerived().RebuildBinaryOperator(E->getOperatorLoc(), E->getOpcode(),
13888 LHS.get(), RHS.get());
13891template <
typename Derived>
13896 ExprResult LHS = getDerived().TransformExpr(
const_cast<Expr*
>(Decomp.LHS));
13897 if (LHS.isInvalid())
13900 ExprResult RHS = getDerived().TransformExpr(
const_cast<Expr*
>(Decomp.RHS));
13901 if (RHS.isInvalid())
13907 bool ChangedAnyLookups =
false;
13908 Expr *PossibleBinOps[] = {E->getSemanticForm(),
13909 const_cast<Expr *
>(Decomp.InnerBinOp)};
13910 for (
Expr *PossibleBinOp : PossibleBinOps) {
13911 auto *Op = dyn_cast<CXXOperatorCallExpr>(PossibleBinOp->IgnoreImplicit());
13914 auto *
Callee = dyn_cast<DeclRefExpr>(Op->getCallee()->IgnoreImplicit());
13920 NamedDecl *
Found = cast_or_null<NamedDecl>(getDerived().TransformDecl(
13921 E->getOperatorLoc(),
Callee->getFoundDecl()));
13925 ChangedAnyLookups =
true;
13926 UnqualLookups.addDecl(
Found);
13929 if (!getDerived().AlwaysRebuild() && !ChangedAnyLookups &&
13930 LHS.get() == Decomp.LHS && RHS.get() == Decomp.RHS) {
13936 const Expr *StopAt[] = {Decomp.LHS, Decomp.RHS};
13941 return getDerived().RebuildCXXRewrittenBinaryOperator(
13942 E->getOperatorLoc(), Decomp.Opcode, UnqualLookups, LHS.get(), RHS.get());
13945template<
typename Derived>
13951 getSema().CurFPFeatures =
13952 NewOverrides.applyOverrides(getSema().getLangOpts());
13953 getSema().FpPragmaStack.CurrentValue = NewOverrides;
13954 return getDerived().TransformBinaryOperator(E);
13957template<
typename Derived>
13963 ExprResult commonExpr = getDerived().TransformExpr(e->getCommon());
13964 if (commonExpr.isInvalid())
13967 ExprResult rhs = getDerived().TransformExpr(e->getFalseExpr());
13968 if (rhs.isInvalid())
13971 if (!getDerived().AlwaysRebuild() &&
13972 commonExpr.get() == e->getCommon() &&
13973 rhs.get() == e->getFalseExpr())
13976 return getDerived().RebuildConditionalOperator(commonExpr.get(),
13977 e->getQuestionLoc(),
13983template<
typename Derived>
13987 if (
Cond.isInvalid())
13990 ExprResult LHS = getDerived().TransformExpr(E->getLHS());
13991 if (LHS.isInvalid())
13994 ExprResult RHS = getDerived().TransformExpr(E->getRHS());
13995 if (RHS.isInvalid())
13998 if (!getDerived().AlwaysRebuild() &&
13999 Cond.get() == E->getCond() &&
14000 LHS.get() == E->getLHS() &&
14001 RHS.get() == E->getRHS())
14004 return getDerived().RebuildConditionalOperator(
Cond.get(),
14005 E->getQuestionLoc(),
14011template<
typename Derived>
14016 return getDerived().
TransformExpr(E->getSubExprAsWritten());
14019template<
typename Derived>
14027 = getDerived().TransformExpr(E->getSubExprAsWritten());
14028 if (SubExpr.isInvalid())
14031 if (!getDerived().AlwaysRebuild() &&
14032 Type == E->getTypeInfoAsWritten() &&
14033 SubExpr.get() == E->getSubExpr())
14036 return getDerived().RebuildCStyleCastExpr(E->getLParenLoc(),
14042template<
typename Derived>
14050 ExprResult Init = getDerived().TransformExpr(E->getInitializer());
14051 if (
Init.isInvalid())
14054 if (!getDerived().AlwaysRebuild() &&
14056 Init.get() == E->getInitializer())
14063 return getDerived().RebuildCompoundLiteralExpr(
14064 E->getLParenLoc(), NewT,
14065 E->getInitializer()->getEndLoc(),
Init.get());
14068template<
typename Derived>
14072 if (
Base.isInvalid())
14075 if (!getDerived().AlwaysRebuild() &&
14076 Base.get() == E->getBase())
14082 return getDerived().RebuildExtVectorOrMatrixElementExpr(
14083 Base.get(), FakeOperatorLoc, E->isArrow(), E->getAccessorLoc(),
14087template <
typename Derived>
14091 if (
Base.isInvalid())
14094 if (!getDerived().AlwaysRebuild() &&
Base.get() == E->getBase())
14100 return getDerived().RebuildExtVectorOrMatrixElementExpr(
14101 Base.get(), FakeOperatorLoc,
false, E->getAccessorLoc(),
14105template<
typename Derived>
14111 bool InitChanged =
false;
14117 if (getDerived().TransformExprs(E->getInits(), E->getNumInits(),
false,
14118 Inits, &InitChanged))
14121 if (!getDerived().AlwaysRebuild() && !InitChanged) {
14128 return getDerived().RebuildInitList(E->getLBraceLoc(),
Inits,
14129 E->getRBraceLoc());
14132template<
typename Derived>
14139 if (
Init.isInvalid())
14144 bool ExprChanged =
false;
14146 if (D.isFieldDesignator()) {
14147 if (D.getFieldDecl()) {
14149 getDerived().TransformDecl(D.getFieldLoc(), D.getFieldDecl()));
14150 if (Field != D.getFieldDecl())
14153 ExprChanged =
true;
14154 if (
Field->isAnonymousStructOrUnion())
14160 ExprChanged =
true;
14163 D.getFieldName(), D.getDotLoc(), D.getFieldLoc()));
14167 if (D.isArrayDesignator()) {
14168 ExprResult Index = getDerived().TransformExpr(E->getArrayIndex(D));
14169 if (Index.isInvalid())
14172 Desig.AddDesignator(
14175 ExprChanged = ExprChanged || Index.get() != E->getArrayIndex(D);
14176 ArrayExprs.push_back(Index.get());
14180 assert(D.isArrayRangeDesignator() &&
"New kind of designator?");
14182 = getDerived().TransformExpr(E->getArrayRangeStart(D));
14183 if (Start.isInvalid())
14186 ExprResult End = getDerived().TransformExpr(E->getArrayRangeEnd(D));
14187 if (End.isInvalid())
14191 Start.get(), End.get(), D.getLBracketLoc(), D.getEllipsisLoc()));
14193 ExprChanged = ExprChanged || Start.get() != E->getArrayRangeStart(D) ||
14194 End.get() != E->getArrayRangeEnd(D);
14196 ArrayExprs.push_back(Start.get());
14197 ArrayExprs.push_back(End.get());
14200 if (!getDerived().AlwaysRebuild() &&
14201 Init.get() == E->getInit() &&
14205 return getDerived().RebuildDesignatedInitExpr(Desig, ArrayExprs,
14206 E->getEqualOrColonLoc(),
14207 E->usesGNUSyntax(),
Init.get());
14212template<
typename Derived>
14216 llvm_unreachable(
"Unexpected DesignatedInitUpdateExpr in syntactic form of "
14221template<
typename Derived>
14225 llvm_unreachable(
"Unexpected NoInitExpr in syntactic form of initializer");
14229template<
typename Derived>
14232 llvm_unreachable(
"Unexpected ArrayInitLoopExpr outside of initializer");
14236template<
typename Derived>
14239 llvm_unreachable(
"Unexpected ArrayInitIndexExpr outside of initializer");
14243template<
typename Derived>
14251 QualType T = getDerived().TransformType(E->getType());
14255 if (!getDerived().AlwaysRebuild() &&
14259 return getDerived().RebuildImplicitValueInitExpr(T);
14262template<
typename Derived>
14265 TypeSourceInfo *TInfo = getDerived().TransformType(E->getWrittenTypeInfo());
14269 ExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
14270 if (SubExpr.isInvalid())
14273 if (!getDerived().AlwaysRebuild() &&
14274 TInfo == E->getWrittenTypeInfo() &&
14275 SubExpr.get() == E->getSubExpr())
14278 return getDerived().RebuildVAArgExpr(E->getBuiltinLoc(), SubExpr.get(),
14279 TInfo, E->getRParenLoc());
14282template<
typename Derived>
14285 bool ArgumentChanged =
false;
14287 if (TransformExprs(E->getExprs(), E->getNumExprs(),
true,
Inits,
14291 return getDerived().RebuildParenListExpr(E->getLParenLoc(),
14293 E->getRParenLoc());
14301template<
typename Derived>
14304 Decl *LD = getDerived().TransformDecl(E->getLabel()->getLocation(),
14309 return getDerived().RebuildAddrLabelExpr(E->getAmpAmpLoc(), E->getLabelLoc(),
14313template<
typename Derived>
14318 = getDerived().TransformCompoundStmt(E->getSubStmt(),
true);
14319 if (SubStmt.isInvalid()) {
14324 unsigned OldDepth = E->getTemplateDepth();
14325 unsigned NewDepth = getDerived().TransformTemplateDepth(OldDepth);
14327 if (!getDerived().AlwaysRebuild() && OldDepth == NewDepth &&
14328 SubStmt.get() == E->getSubStmt()) {
14334 return getDerived().RebuildStmtExpr(E->getLParenLoc(), SubStmt.get(),
14335 E->getRParenLoc(), NewDepth);
14338template<
typename Derived>
14342 if (
Cond.isInvalid())
14345 ExprResult LHS = getDerived().TransformExpr(E->getLHS());
14346 if (LHS.isInvalid())
14349 ExprResult RHS = getDerived().TransformExpr(E->getRHS());
14350 if (RHS.isInvalid())
14353 if (!getDerived().AlwaysRebuild() &&
14354 Cond.get() == E->getCond() &&
14355 LHS.get() == E->getLHS() &&
14356 RHS.get() == E->getRHS())
14359 return getDerived().RebuildChooseExpr(E->getBuiltinLoc(),
14360 Cond.get(), LHS.get(), RHS.get(),
14361 E->getRParenLoc());
14364template<
typename Derived>
14370template<
typename Derived>
14373 switch (E->getOperator()) {
14377 case OO_Array_Delete:
14378 llvm_unreachable(
"new and delete operators cannot use CXXOperatorCallExpr");
14383 assert(E->getNumArgs() >= 1 &&
"Object call is missing arguments");
14396 if (FakeLParenLoc.isInvalid() && EndLoc.isValid())
14397 FakeLParenLoc = EndLoc;
14401 if (getDerived().TransformExprs(E->getArgs() + 1, E->getNumArgs() - 1,
true,
14405 if (E->getOperator() == OO_Subscript)
14406 return getDerived().RebuildCxxSubscriptExpr(
Object.get(), FakeLParenLoc,
14407 Args, E->getEndLoc());
14409 return getDerived().RebuildCallExpr(
Object.get(), FakeLParenLoc, Args,
14413#define OVERLOADED_OPERATOR(Name, Spelling, Token, Unary, Binary, MemberOnly) \
14417#define OVERLOADED_OPERATOR_MULTI(Name,Spelling,Unary,Binary,MemberOnly)
14418#include "clang/Basic/OperatorKinds.def"
14420 case OO_Conditional:
14421 llvm_unreachable(
"conditional operator is not actually overloadable");
14425 llvm_unreachable(
"not an overloaded operator?");
14429 if (E->getNumArgs() == 1 && E->getOperator() == OO_Amp)
14430 First = getDerived().TransformAddressOfOperand(E->getArg(0));
14432 First = getDerived().TransformExpr(E->getArg(0));
14433 if (
First.isInvalid())
14437 if (E->getNumArgs() == 2) {
14439 getDerived().TransformInitializer(E->getArg(1),
false);
14440 if (Second.isInvalid())
14446 getSema().CurFPFeatures =
14447 NewOverrides.applyOverrides(getSema().getLangOpts());
14448 getSema().FpPragmaStack.CurrentValue = NewOverrides;
14454 if (getDerived().TransformOverloadExprDecls(ULE, ULE->requiresADL(), R))
14457 return getDerived().RebuildCXXOperatorCallExpr(
14458 E->getOperator(), E->getOperatorLoc(),
Callee->getBeginLoc(),
14459 ULE->requiresADL(),
R.asUnresolvedSet(),
First.get(), Second.get());
14464 Callee = ICE->getSubExprAsWritten();
14466 ValueDecl *VD = cast_or_null<ValueDecl>(
14467 getDerived().TransformDecl(DR->getLocation(), DR));
14472 Functions.addDecl(VD);
14474 return getDerived().RebuildCXXOperatorCallExpr(
14475 E->getOperator(), E->getOperatorLoc(),
Callee->getBeginLoc(),
14476 false, Functions,
First.get(), Second.get());
14479template<
typename Derived>
14482 return getDerived().TransformCallExpr(E);
14485template <
typename Derived>
14488 getSema().CurContext != E->getParentContext();
14490 if (!getDerived().AlwaysRebuild() && !NeedRebuildFunc)
14493 return getDerived().RebuildSourceLocExpr(E->getIdentKind(), E->getType(),
14494 E->getBeginLoc(), E->getEndLoc(),
14495 getSema().CurContext);
14498template <
typename Derived>
14503template<
typename Derived>
14512 ExprResult EC = getDerived().TransformCallExpr(E->getConfig());
14513 if (EC.isInvalid())
14517 bool ArgChanged =
false;
14519 if (getDerived().TransformExprs(E->getArgs(), E->getNumArgs(),
true, Args,
14523 if (!getDerived().AlwaysRebuild() &&
14524 Callee.get() == E->getCallee() &&
14530 = ((
Expr *)
Callee.get())->getSourceRange().getBegin();
14531 return getDerived().RebuildCallExpr(
Callee.get(), FakeLParenLoc,
14533 E->getRParenLoc(), EC.get());
14536template<
typename Derived>
14552 return getDerived().RebuildCXXNamedCastExpr(
14559template<
typename Derived>
14568 if (Sub.isInvalid())
14571 return getDerived().RebuildBuiltinBitCastExpr(BCE->
getBeginLoc(), TSI,
14575template<
typename Derived>
14577TreeTransform<Derived>::TransformCXXStaticCastExpr(CXXStaticCastExpr *E) {
14578 return getDerived().TransformCXXNamedCastExpr(E);
14581template<
typename Derived>
14587template<
typename Derived>
14594template<
typename Derived>
14600template<
typename Derived>
14606template<
typename Derived>
14611 getDerived().TransformTypeWithDeducedTST(E->getTypeInfoAsWritten());
14616 = getDerived().TransformExpr(E->getSubExprAsWritten());
14617 if (SubExpr.isInvalid())
14620 if (!getDerived().AlwaysRebuild() &&
14621 Type == E->getTypeInfoAsWritten() &&
14622 SubExpr.get() == E->getSubExpr())
14625 return getDerived().RebuildCXXFunctionalCastExpr(
Type,
14629 E->isListInitialization());
14632template<
typename Derived>
14635 if (E->isTypeOperand()) {
14637 = getDerived().TransformType(E->getTypeOperandSourceInfo());
14641 if (!getDerived().AlwaysRebuild() &&
14642 TInfo == E->getTypeOperandSourceInfo())
14645 return getDerived().RebuildCXXTypeidExpr(E->getType(), E->getBeginLoc(),
14646 TInfo, E->getEndLoc());
14652 Expr *Op = E->getExprOperand();
14654 if (E->isGLValue()) {
14656 if (
auto *RD = OpType->getAsCXXRecordDecl()) {
14658 diag::err_incomplete_typeid))
14661 if (RD->isPolymorphic())
14669 ExprResult SubExpr = getDerived().TransformExpr(Op);
14670 if (SubExpr.isInvalid())
14673 if (!getDerived().AlwaysRebuild() &&
14674 SubExpr.get() == E->getExprOperand())
14677 return getDerived().RebuildCXXTypeidExpr(E->getType(), E->getBeginLoc(),
14678 SubExpr.get(), E->getEndLoc());
14681template<
typename Derived>
14684 if (E->isTypeOperand()) {
14686 = getDerived().TransformType(E->getTypeOperandSourceInfo());
14690 if (!getDerived().AlwaysRebuild() &&
14691 TInfo == E->getTypeOperandSourceInfo())
14694 return getDerived().RebuildCXXUuidofExpr(E->getType(), E->getBeginLoc(),
14695 TInfo, E->getEndLoc());
14701 ExprResult SubExpr = getDerived().TransformExpr(E->getExprOperand());
14702 if (SubExpr.isInvalid())
14705 if (!getDerived().AlwaysRebuild() &&
14706 SubExpr.get() == E->getExprOperand())
14709 return getDerived().RebuildCXXUuidofExpr(E->getType(), E->getBeginLoc(),
14710 SubExpr.get(), E->getEndLoc());
14713template<
typename Derived>
14719template<
typename Derived>
14726template<
typename Derived>
14742 auto &S = getSema();
14743 if (E->isCapturedByCopyInLambdaWithExplicitObjectParameter())
14744 return S.getCurrentThisType();
14745 if (S.getCurLambda())
14746 return getDerived().TransformType(E->getType());
14747 return S.getCurrentThisType();
14750 if (!getDerived().AlwaysRebuild() && T == E->getType() &&
14751 !E->isCapturedByCopyInLambdaWithExplicitObjectParameter()) {
14754 getSema().MarkThisReferenced(E);
14758 return getDerived().RebuildCXXThisExpr(E->getBeginLoc(), T, E->isImplicit());
14761template<
typename Derived>
14764 ExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
14765 if (SubExpr.isInvalid())
14768 getSema().DiagnoseExceptionUse(E->getThrowLoc(),
false);
14770 if (!getDerived().AlwaysRebuild() &&
14771 SubExpr.get() == E->getSubExpr())
14774 return getDerived().RebuildCXXThrowExpr(E->getThrowLoc(), SubExpr.get(),
14775 E->isThrownVariableInScope());
14778template<
typename Derived>
14782 getDerived().TransformDecl(E->getBeginLoc(), E->getParam()));
14787 if (E->hasRewrittenInit()) {
14788 InitRes = getDerived().TransformExpr(E->getRewrittenExpr());
14789 if (InitRes.isInvalid())
14793 if (!getDerived().AlwaysRebuild() && Param == E->getParam() &&
14794 E->getUsedContext() == SemaRef.
CurContext &&
14795 InitRes.get() == E->getRewrittenExpr())
14798 return getDerived().RebuildCXXDefaultArgExpr(E->getUsedLocation(), Param,
14802template<
typename Derived>
14806 getDerived().TransformDecl(E->getBeginLoc(), E->getField()));
14810 if (!getDerived().AlwaysRebuild() && Field == E->getField() &&
14814 return getDerived().RebuildCXXDefaultInitExpr(E->getExprLoc(), Field);
14817template<
typename Derived>
14821 TypeSourceInfo *T = getDerived().TransformType(E->getTypeSourceInfo());
14825 if (!getDerived().AlwaysRebuild() &&
14826 T == E->getTypeSourceInfo())
14829 return getDerived().RebuildCXXScalarValueInitExpr(T,
14830 T->getTypeLoc().getEndLoc(),
14831 E->getRParenLoc());
14834template<
typename Derived>
14839 getDerived().TransformTypeWithDeducedTST(E->getAllocatedTypeSourceInfo());
14840 if (!AllocTypeInfo)
14844 std::optional<Expr *> ArraySize;
14845 if (E->isArray()) {
14847 if (std::optional<Expr *> OldArraySize = E->getArraySize()) {
14848 NewArraySize = getDerived().TransformExpr(*OldArraySize);
14849 if (NewArraySize.isInvalid())
14852 ArraySize = NewArraySize.get();
14856 bool ArgumentChanged =
false;
14858 if (getDerived().TransformExprs(E->getPlacementArgs(),
14859 E->getNumPlacementArgs(),
true,
14860 PlacementArgs, &ArgumentChanged))
14864 Expr *OldInit = E->getInitializer();
14867 NewInit = getDerived().TransformInitializer(OldInit,
true);
14868 if (NewInit.isInvalid())
14873 if (E->getOperatorNew()) {
14874 OperatorNew = cast_or_null<FunctionDecl>(
14875 getDerived().TransformDecl(E->getBeginLoc(), E->getOperatorNew()));
14881 if (E->getOperatorDelete()) {
14882 OperatorDelete = cast_or_null<FunctionDecl>(
14883 getDerived().TransformDecl(E->getBeginLoc(), E->getOperatorDelete()));
14884 if (!OperatorDelete)
14888 if (!getDerived().AlwaysRebuild() &&
14889 AllocTypeInfo == E->getAllocatedTypeSourceInfo() &&
14890 ArraySize == E->getArraySize() &&
14891 NewInit.get() == OldInit &&
14892 OperatorNew == E->getOperatorNew() &&
14893 OperatorDelete == E->getOperatorDelete() &&
14894 !ArgumentChanged) {
14899 if (OperatorDelete)
14902 if (E->isArray() && !E->getAllocatedType()->isDependentType()) {
14914 QualType AllocType = AllocTypeInfo->getType();
14925 = dyn_cast<ConstantArrayType>(ArrayT)) {
14929 AllocType = ConsArrayT->getElementType();
14931 = dyn_cast<DependentSizedArrayType>(ArrayT)) {
14932 if (DepArrayT->getSizeExpr()) {
14933 ArraySize = DepArrayT->getSizeExpr();
14934 AllocType = DepArrayT->getElementType();
14939 return getDerived().RebuildCXXNewExpr(
14940 E->getBeginLoc(), E->isGlobalNew(),
14941 E->getBeginLoc(), PlacementArgs,
14942 E->getBeginLoc(), E->getTypeIdParens(), AllocType,
14943 AllocTypeInfo, ArraySize, E->getDirectInitRange(), NewInit.get());
14946template<
typename Derived>
14955 if (E->getOperatorDelete()) {
14956 OperatorDelete = cast_or_null<FunctionDecl>(
14957 getDerived().TransformDecl(E->getBeginLoc(), E->getOperatorDelete()));
14958 if (!OperatorDelete)
14962 if (!getDerived().AlwaysRebuild() &&
14963 Operand.get() == E->getArgument() &&
14964 OperatorDelete == E->getOperatorDelete()) {
14967 if (OperatorDelete)
14970 if (!E->getArgument()->isTypeDependent()) {
14972 E->getDestroyedType());
14981 return getDerived().RebuildCXXDeleteExpr(
14982 E->getBeginLoc(), E->isGlobalDelete(), E->isArrayForm(),
Operand.get());
14985template<
typename Derived>
14990 if (
Base.isInvalid())
14994 bool MayBePseudoDestructor =
false;
14996 E->getOperatorLoc(),
14997 E->isArrow()? tok::arrow : tok::period,
14999 MayBePseudoDestructor);
15000 if (
Base.isInvalid())
15003 QualType ObjectType = ObjectTypePtr.get();
15005 if (QualifierLoc) {
15007 = getDerived().TransformNestedNameSpecifierLoc(QualifierLoc, ObjectType);
15012 SS.
Adopt(QualifierLoc);
15015 if (E->getDestroyedTypeInfo()) {
15016 TypeSourceInfo *DestroyedTypeInfo = getDerived().TransformTypeInObjectScope(
15017 E->getDestroyedTypeInfo(), ObjectType,
15019 if (!DestroyedTypeInfo)
15022 }
else if (!ObjectType.isNull() && ObjectType->isDependentType()) {
15026 E->getDestroyedTypeLoc());
15030 *E->getDestroyedTypeIdentifier(), E->getDestroyedTypeLoc(),
15031 nullptr, SS, ObjectTypePtr,
false);
15037 E->getDestroyedTypeLoc());
15041 if (E->getScopeTypeInfo()) {
15042 ScopeTypeInfo = getDerived().TransformTypeInObjectScope(
15043 E->getScopeTypeInfo(), ObjectType,
nullptr);
15044 if (!ScopeTypeInfo)
15048 return getDerived().RebuildCXXPseudoDestructorExpr(
Base.get(),
15049 E->getOperatorLoc(),
15053 E->getColonColonLoc(),
15058template <
typename Derived>
15063 bool AllEmptyPacks =
true;
15064 for (
auto *OldD : Old->
decls()) {
15080 if (
auto *UPD = dyn_cast<UsingPackDecl>(InstD))
15081 Decls = UPD->expansions();
15084 for (
auto *D : Decls) {
15085 if (
auto *UD = dyn_cast<UsingDecl>(D)) {
15086 for (
auto *SD : UD->shadows())
15093 AllEmptyPacks &= Decls.empty();
15102 if (AllEmptyPacks && !RequiresADL) {
15113 NamedDecl *FoundDecl = R.getRepresentativeDecl()->getUnderlyingDecl();
15114 getSema().FilterAcceptableTemplateNames(R,
15120 getSema().Diag(R.getNameLoc(),
15121 diag::err_template_kw_refers_to_non_template)
15125 diag::note_template_kw_refers_to_non_template)
15126 << R.getLookupName();
15134template <
typename Derived>
15140template <
typename Derived>
15143 bool IsAddressOfOperand) {
15148 if (TransformOverloadExprDecls(Old, Old->
requiresADL(), R))
15155 = getDerived().TransformNestedNameSpecifierLoc(Old->
getQualifierLoc());
15159 SS.
Adopt(QualifierLoc);
15163 CXXRecordDecl *NamingClass
15164 = cast_or_null<CXXRecordDecl>(getDerived().TransformDecl(
15167 if (!NamingClass) {
15172 R.setNamingClass(NamingClass);
15193 SS, TemplateKWLoc, R,
15200 return getDerived().RebuildDeclarationNameExpr(SS, R, Old->
requiresADL());
15203 return getDerived().RebuildTemplateIdExpr(SS, TemplateKWLoc, R,
15207template<
typename Derived>
15210 bool ArgChanged =
false;
15212 for (
unsigned I = 0, N = E->getNumArgs(); I != N; ++I) {
15214 TypeLoc FromTL = From->getTypeLoc();
15217 TLB.
reserve(FromTL.getFullDataSize());
15218 QualType To = getDerived().TransformType(TLB, FromTL);
15222 if (To == From->getType())
15223 Args.push_back(From);
15225 Args.push_back(TLB.getTypeSourceInfo(SemaRef.
Context, To));
15235 TypeLoc PatternTL = ExpansionTL.getPatternLoc();
15241 bool Expand =
true;
15242 bool RetainExpansion =
false;
15244 ExpansionTL.getTypePtr()->getNumExpansions();
15246 if (getDerived().TryExpandParameterPacks(
15247 ExpansionTL.getEllipsisLoc(), PatternTL.getSourceRange(),
15248 Unexpanded,
true, Expand,
15249 RetainExpansion, NumExpansions))
15259 TLB.
reserve(From->getTypeLoc().getFullDataSize());
15261 QualType To = getDerived().TransformType(TLB, PatternTL);
15265 To = getDerived().RebuildPackExpansionType(To,
15266 PatternTL.getSourceRange(),
15267 ExpansionTL.getEllipsisLoc(),
15275 Args.push_back(TLB.getTypeSourceInfo(SemaRef.
Context, To));
15281 for (
unsigned I = 0; I != *NumExpansions; ++I) {
15284 TLB.
reserve(PatternTL.getFullDataSize());
15285 QualType To = getDerived().TransformType(TLB, PatternTL);
15289 if (To->containsUnexpandedParameterPack()) {
15290 To = getDerived().RebuildPackExpansionType(To,
15291 PatternTL.getSourceRange(),
15292 ExpansionTL.getEllipsisLoc(),
15302 Args.push_back(TLB.getTypeSourceInfo(SemaRef.
Context, To));
15305 if (!RetainExpansion)
15310 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
15313 TLB.
reserve(From->getTypeLoc().getFullDataSize());
15315 QualType To = getDerived().TransformType(TLB, PatternTL);
15319 To = getDerived().RebuildPackExpansionType(To,
15320 PatternTL.getSourceRange(),
15321 ExpansionTL.getEllipsisLoc(),
15329 Args.push_back(TLB.getTypeSourceInfo(SemaRef.
Context, To));
15332 if (!getDerived().AlwaysRebuild() && !ArgChanged)
15335 return getDerived().RebuildTypeTrait(E->getTrait(), E->getBeginLoc(), Args,
15339template<
typename Derived>
15345 if (getDerived().TransformTemplateArguments(Old->getTemplateArgs(),
15346 Old->NumTemplateArgs, TransArgs))
15349 return getDerived().RebuildConceptSpecializationExpr(
15350 E->getNestedNameSpecifierLoc(), E->getTemplateKWLoc(),
15351 E->getConceptNameInfo(), E->getFoundDecl(), E->getNamedConcept(),
15355template<
typename Derived>
15369 getSema().Context, getSema().CurContext,
15370 E->getBody()->getBeginLoc());
15374 ExprResult TypeParamResult = getDerived().TransformRequiresTypeParams(
15375 E->getRequiresKWLoc(), E->getRBraceLoc(), E, Body,
15376 E->getLocalParameters(), TransParamTypes, TransParams, ExtParamInfos);
15380 Param->setDeclContext(Body);
15386 if (!TypeParamResult.isUnset())
15387 return TypeParamResult;
15390 if (getDerived().TransformRequiresExprRequirements(E->getRequirements(),
15395 if (
auto *ER = dyn_cast<concepts::ExprRequirement>(Req)) {
15396 if (ER->getReturnTypeRequirement().isTypeConstraint()) {
15397 ER->getReturnTypeRequirement()
15398 .getTypeConstraintTemplateParameterList()->getParam(0)
15399 ->setDeclContext(Body);
15404 return getDerived().RebuildRequiresExpr(
15405 E->getRequiresKWLoc(), Body, E->getLParenLoc(), TransParams,
15406 E->getRParenLoc(), TransReqs, E->getRBraceLoc());
15409template<
typename Derived>
15415 if (
auto *TypeReq = dyn_cast<concepts::TypeRequirement>(Req))
15416 TransReq =
getDerived().TransformTypeRequirement(TypeReq);
15417 else if (
auto *ExprReq = dyn_cast<concepts::ExprRequirement>(Req))
15418 TransReq =
getDerived().TransformExprRequirement(ExprReq);
15420 TransReq =
getDerived().TransformNestedRequirement(
15424 Transformed.push_back(TransReq);
15429template<
typename Derived>
15442 return getDerived().RebuildTypeRequirement(TransType);
15445template<
typename Derived>
15448 llvm::PointerUnion<Expr *, concepts::Requirement::SubstitutionDiagnostic *> TransExpr;
15454 TransExprRes =
SemaRef.CheckPlaceholderExpr(TransExprRes.
get());
15457 TransExpr = TransExprRes.
get();
15460 std::optional<concepts::ExprRequirement::ReturnTypeRequirement> TransRetReq;
15462 if (RetReq.isEmpty())
15463 TransRetReq.emplace();
15464 else if (RetReq.isSubstitutionFailure())
15465 TransRetReq.emplace(RetReq.getSubstitutionDiagnostic());
15466 else if (RetReq.isTypeConstraint()) {
15468 RetReq.getTypeConstraintTemplateParameterList();
15470 getDerived().TransformTemplateParameterList(OrigTPL);
15473 TransRetReq.emplace(TPL);
15475 assert(TransRetReq &&
"All code paths leading here must set TransRetReq");
15476 if (
Expr *E = dyn_cast<Expr *>(TransExpr))
15479 std::move(*TransRetReq));
15485template<
typename Derived>
15491 return getDerived().RebuildNestedRequirement(
15499 return getDerived().RebuildNestedRequirement(TransConstraint.
get());
15502template<
typename Derived>
15509 if (!getDerived().AlwaysRebuild() &&
15526template<
typename Derived>
15533 SubExpr = getDerived().TransformExpr(E->getQueriedExpression());
15534 if (SubExpr.isInvalid())
15537 if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getQueriedExpression())
15541 return getDerived().RebuildExpressionTrait(E->getTrait(), E->getBeginLoc(),
15542 SubExpr.get(), E->getEndLoc());
15545template <
typename Derived>
15550 DRE, AddrTaken, RecoveryTSI);
15563template <
typename Derived>
15570template <
typename Derived>
15586 getDerived().TransformDeclarationNameInfo(E->
getNameInfo());
15591 if (!getDerived().AlwaysRebuild() && QualifierLoc == E->
getQualifierLoc() &&
15597 return getDerived().RebuildDependentScopeDeclRefExpr(
15598 QualifierLoc, TemplateKWLoc, NameInfo,
nullptr,
15599 IsAddressOfOperand, RecoveryTSI);
15603 if (getDerived().TransformTemplateArguments(
15607 return getDerived().RebuildDependentScopeDeclRefExpr(
15608 QualifierLoc, TemplateKWLoc, NameInfo, &TransArgs, IsAddressOfOperand,
15612template<
typename Derived>
15618 if (getDerived().AllowSkippingCXXConstructExpr() &&
15619 ((E->getNumArgs() == 1 ||
15620 (E->getNumArgs() > 1 && getDerived().DropCallArgument(E->getArg(1)))) &&
15621 (!getDerived().DropCallArgument(E->getArg(0))) &&
15622 !E->isListInitialization()))
15628 QualType T = getDerived().TransformType(E->getType());
15633 getDerived().TransformDecl(E->getBeginLoc(), E->getConstructor()));
15637 bool ArgumentChanged =
false;
15642 E->isListInitialization());
15643 if (getDerived().TransformExprs(E->getArgs(), E->getNumArgs(),
true, Args,
15648 if (!getDerived().AlwaysRebuild() &&
15649 T == E->getType() &&
15651 !ArgumentChanged) {
15658 return getDerived().RebuildCXXConstructExpr(
15659 T, E->getBeginLoc(),
Constructor, E->isElidable(), Args,
15660 E->hadMultipleCandidates(), E->isListInitialization(),
15661 E->isStdInitListInitialization(), E->requiresZeroInitialization(),
15662 E->getConstructionKind(), E->getParenOrBraceRange());
15665template<
typename Derived>
15668 QualType T = getDerived().TransformType(E->getType());
15673 getDerived().TransformDecl(E->getBeginLoc(), E->getConstructor()));
15677 if (!getDerived().AlwaysRebuild() &&
15678 T == E->getType() &&
15686 return getDerived().RebuildCXXInheritedCtorInitExpr(
15688 E->constructsVBase(), E->inheritedFromVBase());
15695template<
typename Derived>
15698 if (
auto *Dtor = E->getTemporary()->getDestructor())
15701 return getDerived().TransformExpr(E->getSubExpr());
15709template<
typename Derived>
15715template<
typename Derived>
15720 getDerived().TransformTypeWithDeducedTST(E->getTypeSourceInfo());
15725 getDerived().TransformDecl(E->getBeginLoc(), E->getConstructor()));
15729 bool ArgumentChanged =
false;
15731 Args.reserve(E->getNumArgs());
15735 E->isListInitialization());
15736 if (TransformExprs(E->getArgs(), E->getNumArgs(),
true, Args,
15740 if (E->isListInitialization() && !E->isStdInitListInitialization()) {
15741 ExprResult Res = RebuildInitList(E->getBeginLoc(), Args, E->getEndLoc());
15742 if (Res.isInvalid())
15744 Args = {Res.get()};
15748 if (!getDerived().AlwaysRebuild() &&
15749 T == E->getTypeSourceInfo() &&
15751 !ArgumentChanged) {
15758 return getDerived().RebuildCXXTemporaryObjectExpr(
15759 T, LParenLoc, Args, E->getEndLoc(), E->isListInitialization());
15762template<
typename Derived>
15767 typedef std::pair<ExprResult, QualType> InitCaptureInfoTy;
15768 struct TransformedInitCapture {
15770 SourceLocation EllipsisLoc;
15772 SmallVector<InitCaptureInfoTy, 4> Expansions;
15775 InitCaptures.resize(E->explicit_capture_end() - E->explicit_capture_begin());
15777 CEnd = E->capture_end();
15779 if (!E->isInitCapture(
C))
15782 TransformedInitCapture &
Result = InitCaptures[
C - E->capture_begin()];
15787 ExprResult NewExprInitResult = getDerived().TransformInitializer(
15790 if (NewExprInitResult.isInvalid()) {
15794 Expr *NewExprInit = NewExprInitResult.get();
15797 getSema().buildLambdaInitCaptureInitialization(
15798 C->getLocation(),
C->getCaptureKind() ==
LCK_ByRef,
15799 EllipsisLoc, NumExpansions, OldVD->getIdentifier(),
15803 Result.Expansions.push_back(
15804 InitCaptureInfoTy(NewExprInit, NewInitCaptureType));
15808 if (OldVD->isParameterPack()) {
15817 bool Expand =
true;
15818 bool RetainExpansion =
false;
15820 ExpansionTL.getTypePtr()->getNumExpansions();
15822 if (getDerived().TryExpandParameterPacks(
15823 ExpansionTL.getEllipsisLoc(), OldVD->getInit()->getSourceRange(),
15824 Unexpanded,
true, Expand,
15825 RetainExpansion, NumExpansions))
15827 assert(!RetainExpansion &&
"Should not need to retain expansion after a "
15828 "capture since it cannot be extended");
15830 for (
unsigned I = 0; I != *NumExpansions; ++I) {
15835 SubstInitCapture(ExpansionTL.getEllipsisLoc(), NumExpansions);
15836 Result.EllipsisLoc = ExpansionTL.getEllipsisLoc();
15873 while (DC->isRequiresExprBody())
15875 if ((getSema().isUnevaluatedContext() ||
15876 getSema().isConstantEvaluatedContext()) &&
15877 !(dyn_cast_or_null<CXXRecordDecl>(DC->getParent()) &&
15879 (DC->isFileContext() || !DC->getParent()->isDependentContext()))
15884 E->getIntroducerRange(),
nullptr, DependencyKind,
15885 E->getCaptureDefault());
15886 getDerived().transformedLocalDecl(OldClass, {
Class});
15889 getSema().CreateLambdaCallOperator(E->getIntroducerRange(),
Class);
15892 getSema().buildLambdaScope(LSI, NewCallOperator, E->getIntroducerRange(),
15893 E->getCaptureDefault(), E->getCaptureDefaultLoc(),
15894 E->hasExplicitParameters(), E->isMutable());
15904 CEnd = E->capture_end();
15908 if (
C->isImplicit())
15912 if (
C->capturesThis()) {
15920 dyn_cast_if_present<CXXRecordDecl>(
15921 getSema().getFunctionLevelDeclContext()),
15923 getSema().CheckCXXThisCapture(
C->getLocation(),
C->isExplicit(),
15930 if (
C->capturesVLAType())
15934 if (E->isInitCapture(
C)) {
15935 TransformedInitCapture &NewC = InitCaptures[
C - E->capture_begin()];
15940 for (InitCaptureInfoTy &Info : NewC.Expansions) {
15942 QualType InitQualType = Info.second;
15943 if (
Init.isInvalid() || InitQualType.isNull()) {
15947 VarDecl *NewVD = getSema().createLambdaInitCaptureVarDecl(
15948 OldVD->getLocation(), InitQualType, NewC.EllipsisLoc,
15949 OldVD->getIdentifier(), OldVD->getInitStyle(),
Init.get(),
15950 getSema().CurContext);
15955 NewVDs.push_back(NewVD);
15956 getSema().addInitCapture(LSI, NewVD,
C->getCaptureKind() ==
LCK_ByRef);
15961 if (NewC.EllipsisLoc.isInvalid())
15962 LSI->ContainsUnexpandedParameterPack |=
15963 Init.get()->containsUnexpandedParameterPack();
15969 getDerived().transformedLocalDecl(OldVD, NewVDs);
15973 assert(
C->capturesVariable() &&
"unexpected kind of lambda capture");
15981 if (
C->isPackExpansion()) {
15983 bool ShouldExpand =
false;
15984 bool RetainExpansion =
false;
15986 if (getDerived().TryExpandParameterPacks(
15987 C->getEllipsisLoc(),
C->getLocation(), Unexpanded,
15988 true, ShouldExpand,
15989 RetainExpansion, NumExpansions)) {
15994 if (ShouldExpand) {
15999 for (
unsigned I = 0; I != *NumExpansions; ++I) {
16001 ValueDecl *CapturedVar = cast_if_present<ValueDecl>(
16002 getDerived().TransformDecl(
C->getLocation(), Pack));
16003 if (!CapturedVar) {
16009 getSema().tryCaptureVariable(CapturedVar,
C->getLocation(), Kind);
16017 EllipsisLoc =
C->getEllipsisLoc();
16021 auto *CapturedVar = cast_or_null<ValueDecl>(
16022 getDerived().TransformDecl(
C->getLocation(),
C->getCapturedVar()));
16023 if (!CapturedVar || CapturedVar->isInvalidDecl()) {
16030 if (
auto *VD = dyn_cast<VarDecl>(CapturedVar); VD && !
C->isPackExpansion())
16031 LSI->ContainsUnexpandedParameterPack |= VD->isParameterPack();
16034 getSema().tryCaptureVariable(CapturedVar,
C->getLocation(), Kind,
16037 getSema().finishLambdaExplicitCaptures(LSI);
16041 auto TPL = getDerived().TransformTemplateParameterList(
16042 E->getTemplateParameterList());
16043 LSI->GLTemplateParameterList = TPL;
16045 getSema().AddTemplateParametersToLambdaCallOperator(NewCallOperator,
Class,
16047 LSI->ContainsUnexpandedParameterPack |=
16048 TPL->containsUnexpandedParameterPack();
16053 E->getCallOperator()->getTypeSourceInfo()->getTypeLoc();
16055 getDerived().TransformType(NewCallOpTLBuilder, OldCallOpTypeLoc);
16056 if (NewCallOpType.isNull())
16058 LSI->ContainsUnexpandedParameterPack |=
16059 NewCallOpType->containsUnexpandedParameterPack();
16061 NewCallOpTLBuilder.getTypeSourceInfo(getSema().Context, NewCallOpType);
16066 assert(FPTL &&
"Not a FunctionProtoType?");
16071 if (TRC && TRC.ConstraintExpr->containsUnexpandedParameterPack() &&
16072 !TRC.ArgPackSubstIndex)
16075 getSema().CompleteLambdaCallOperator(
16076 NewCallOperator, E->getCallOperator()->getLocation(),
16077 E->getCallOperator()->getInnerLocStart(), TRC, NewCallOpTSI,
16078 E->getCallOperator()->getConstexprKind(),
16079 E->getCallOperator()->getStorageClass(), FPTL.getParams(),
16080 E->hasExplicitResultType());
16082 getDerived().transformAttrs(E->getCallOperator(), NewCallOperator);
16083 getDerived().transformedLocalDecl(E->getCallOperator(), {NewCallOperator});
16089 std::optional<CXXRecordDecl::LambdaNumbering> Numbering;
16090 if (getDerived().ReplacingOriginal()) {
16091 Numbering = OldClass->getLambdaNumbering();
16094 getSema().handleLambdaNumbering(
Class, NewCallOperator, Numbering);
16099 getSema().PushExpressionEvaluationContextForFunction(
16101 E->getCallOperator());
16108 C.PointOfInstantiation = E->getBody()->getBeginLoc();
16109 getSema().pushCodeSynthesisContext(
C);
16113 : getDerived().TransformLambdaBody(E, E->getBody());
16115 getSema().popCodeSynthesisContext();
16119 FuncScopeCleanup.disable();
16121 if (Body.isInvalid()) {
16122 SavedContext.pop();
16123 getSema().ActOnLambdaError(E->getBeginLoc(),
nullptr,
16128 getSema().ActOnFinishFunctionBody(NewCallOperator, Body.get(),
16131 SavedContext.pop();
16166 DependencyKind = getDerived().ComputeLambdaDependency(LSI);
16167 Class->setLambdaDependencyKind(DependencyKind);
16169 return getDerived().RebuildLambdaExpr(E->getBeginLoc(),
16170 Body.get()->getEndLoc(), LSI);
16173template<
typename Derived>
16179template<
typename Derived>
16188 if (!
C->isImplicit())
16192 if (
C->capturesThis()) {
16193 getSema().CheckCXXThisCapture(
C->getLocation(),
C->isExplicit(),
16200 if (
C->capturesVLAType())
16203 assert(
C->capturesVariable() &&
"unexpected kind of lambda capture");
16207 VarDecl *CapturedVar = cast_or_null<VarDecl>(
16213 getSema().tryCaptureVariable(CapturedVar,
C->getLocation());
16219template<
typename Derived>
16228 bool ArgumentChanged =
false;
16240 if (!getDerived().AlwaysRebuild() &&
16246 return getDerived().RebuildCXXUnresolvedConstructExpr(
16250template<
typename Derived>
16259 if (!E->isImplicitAccess()) {
16260 OldBase = E->getBase();
16261 Base = getDerived().TransformExpr(OldBase);
16262 if (
Base.isInvalid())
16267 bool MayBePseudoDestructor =
false;
16269 E->getOperatorLoc(),
16270 E->isArrow()? tok::arrow : tok::period,
16272 MayBePseudoDestructor);
16273 if (
Base.isInvalid())
16276 ObjectType = ObjectTy.get();
16277 BaseType = ((
Expr*)
Base.get())->getType();
16280 BaseType = getDerived().TransformType(E->getBaseType());
16287 = getDerived().TransformFirstQualifierInScope(
16288 E->getFirstQualifierFoundInScope(),
16289 E->getQualifierLoc().getBeginLoc());
16292 if (E->getQualifier()) {
16294 = getDerived().TransformNestedNameSpecifierLoc(E->getQualifierLoc(),
16296 FirstQualifierInScope);
16308 = getDerived().TransformDeclarationNameInfo(E->getMemberNameInfo());
16309 if (!NameInfo.getName())
16312 if (!E->hasExplicitTemplateArgs()) {
16315 if (!getDerived().AlwaysRebuild() &&
16316 Base.get() == OldBase &&
16317 BaseType == E->getBaseType() &&
16318 QualifierLoc == E->getQualifierLoc() &&
16319 NameInfo.getName() == E->getMember() &&
16320 FirstQualifierInScope == E->getFirstQualifierFoundInScope())
16323 return getDerived().RebuildCXXDependentScopeMemberExpr(
Base.get(),
16326 E->getOperatorLoc(),
16329 FirstQualifierInScope,
16335 if (getDerived().TransformTemplateArguments(E->getTemplateArgs(),
16336 E->getNumTemplateArgs(),
16340 return getDerived().RebuildCXXDependentScopeMemberExpr(
Base.get(),
16343 E->getOperatorLoc(),
16346 FirstQualifierInScope,
16351template <
typename Derived>
16357 if (!Old->isImplicitAccess()) {
16358 Base = getDerived().TransformExpr(Old->getBase());
16359 if (
Base.isInvalid())
16362 getSema().PerformMemberExprBaseConversion(
Base.get(), Old->isArrow());
16363 if (
Base.isInvalid())
16365 BaseType =
Base.get()->getType();
16367 BaseType = getDerived().TransformType(Old->getBaseType());
16371 if (Old->getQualifierLoc()) {
16373 getDerived().TransformNestedNameSpecifierLoc(Old->getQualifierLoc());
16383 if (TransformOverloadExprDecls(Old,
false, R))
16387 if (Old->getNamingClass()) {
16389 getDerived().TransformDecl(Old->getMemberLoc(), Old->getNamingClass()));
16393 R.setNamingClass(NamingClass);
16397 if (Old->hasExplicitTemplateArgs()) {
16398 TransArgs.setLAngleLoc(Old->getLAngleLoc());
16399 TransArgs.setRAngleLoc(Old->getRAngleLoc());
16400 if (getDerived().TransformTemplateArguments(
16401 Old->getTemplateArgs(), Old->getNumTemplateArgs(), TransArgs))
16409 NamedDecl *FirstQualifierInScope =
nullptr;
16411 return getDerived().RebuildUnresolvedMemberExpr(
16412 Base.get(), BaseType, Old->getOperatorLoc(), Old->isArrow(), QualifierLoc,
16413 TemplateKWLoc, FirstQualifierInScope, R,
16414 (Old->hasExplicitTemplateArgs() ? &TransArgs :
nullptr));
16417template<
typename Derived>
16422 ExprResult SubExpr = getDerived().TransformExpr(E->getOperand());
16423 if (SubExpr.isInvalid())
16426 if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getOperand())
16429 return getDerived().RebuildCXXNoexceptExpr(E->getSourceRange(),SubExpr.get());
16432template<
typename Derived>
16435 ExprResult Pattern = getDerived().TransformExpr(E->getPattern());
16436 if (Pattern.isInvalid())
16439 if (!getDerived().AlwaysRebuild() && Pattern.get() == E->getPattern())
16442 return getDerived().RebuildPackExpansion(Pattern.get(), E->getEllipsisLoc(),
16443 E->getNumExpansions());
16446template <
typename Derived>
16451 if (!Arg.isPackExpansion()) {
16463 getSema().getTemplateArgumentPackExpansionPattern(ArgLoc, Ellipsis,
16464 OrigNumExpansions);
16476 if (!NumExpansions) {
16488template<
typename Derived>
16507 bool ShouldExpand =
false;
16508 bool RetainExpansion =
false;
16510 if (getDerived().TryExpandParameterPacks(
16512 true, ShouldExpand,
16513 RetainExpansion, NumExpansions))
16518 if (ShouldExpand) {
16520 if (
auto *TTPD = dyn_cast<TemplateTypeParmDecl>(Pack)) {
16521 ArgStorage = getSema().Context.getPackExpansionType(
16522 getSema().Context.getTypeDeclType(TTPD), std::nullopt);
16523 }
else if (
auto *TTPD = dyn_cast<TemplateTemplateParmDecl>(Pack)) {
16527 ExprResult DRE = getSema().BuildDeclRefExpr(
16528 VD, VD->getType().getNonLValueExprType(getSema().Context),
16531 if (DRE.isInvalid())
16534 new (getSema().Context)
16538 PackArgs = ArgStorage;
16543 if (!PackArgs.size()) {
16544 auto *Pack = cast_or_null<NamedDecl>(
16548 return getDerived().RebuildSizeOfPackExpr(
16555 getDerived().ComputeSizeOfPackExprWithoutSubstitution(PackArgs);
16567 TemporaryBase Rebase(*
this, E->
getPackLoc(), getBaseEntity());
16570 if (TransformTemplateArguments(PackLocIterator(*
this, PackArgs.begin()),
16571 PackLocIterator(*
this, PackArgs.end()),
16572 TransformedPackArgs,
true))
16579 bool PartialSubstitution =
false;
16580 for (
auto &Loc : TransformedPackArgs.arguments()) {
16581 Args.push_back(Loc.getArgument());
16582 if (Loc.getArgument().isPackExpansion())
16583 PartialSubstitution =
true;
16586 if (PartialSubstitution)
16587 return getDerived().RebuildSizeOfPackExpr(
16589 std::nullopt, Args);
16591 return getDerived().RebuildSizeOfPackExpr(
16593 static_cast<unsigned>(Args.size()),
16597template <
typename Derived>
16600 if (!E->isValueDependent())
16608 IndexExpr = getDerived().TransformExpr(E->getIndexExpr());
16609 if (IndexExpr.isInvalid())
16614 bool FullySubstituted =
true;
16615 if (!E->expandsToEmptyPack() && E->getExpressions().empty()) {
16616 Expr *Pattern = E->getPackIdExpression();
16618 getSema().collectUnexpandedParameterPacks(E->getPackIdExpression(),
16620 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
16624 bool ShouldExpand =
true;
16625 bool RetainExpansion =
false;
16627 NumExpansions = std::nullopt;
16628 if (getDerived().TryExpandParameterPacks(
16629 E->getEllipsisLoc(), Pattern->getSourceRange(), Unexpanded,
16630 true, ShouldExpand,
16631 RetainExpansion, NumExpansions))
16633 if (!ShouldExpand) {
16635 ExprResult Pack = getDerived().TransformExpr(Pattern);
16636 if (Pack.isInvalid())
16638 return getDerived().RebuildPackIndexingExpr(
16639 E->getEllipsisLoc(), E->getRSquareLoc(), Pack.get(), IndexExpr.get(),
16642 for (
unsigned I = 0; I != *NumExpansions; ++I) {
16645 if (
Out.isInvalid())
16647 if (
Out.get()->containsUnexpandedParameterPack()) {
16648 Out = getDerived().RebuildPackExpansion(
Out.get(), E->getEllipsisLoc(),
16649 OrigNumExpansions);
16650 if (
Out.isInvalid())
16652 FullySubstituted =
false;
16654 ExpandedExprs.push_back(
Out.get());
16658 if (RetainExpansion) {
16659 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
16662 if (
Out.isInvalid())
16665 Out = getDerived().RebuildPackExpansion(
Out.get(), E->getEllipsisLoc(),
16666 OrigNumExpansions);
16667 if (
Out.isInvalid())
16669 FullySubstituted =
false;
16670 ExpandedExprs.push_back(
Out.get());
16672 }
else if (!E->expandsToEmptyPack()) {
16673 if (getDerived().TransformExprs(E->getExpressions().data(),
16674 E->getExpressions().size(),
false,
16679 return getDerived().RebuildPackIndexingExpr(
16680 E->getEllipsisLoc(), E->getRSquareLoc(), E->getPackIdExpression(),
16681 IndexExpr.get(), ExpandedExprs, FullySubstituted);
16684template <
typename Derived>
16687 if (!getSema().ArgPackSubstIndex)
16693 return getDerived().RebuildSubstNonTypeTemplateParmExpr(
16694 E->getAssociatedDecl(), E->getParameterPack(),
16695 E->getParameterPackLocation(), Arg, SemaRef.
getPackIndex(Pack),
16699template <
typename Derived>
16703 ExprResult Replacement = getDerived().TransformExpr(OrigReplacement);
16704 if (Replacement.isInvalid())
16707 Decl *AssociatedDecl =
16708 getDerived().TransformDecl(E->getNameLoc(), E->getAssociatedDecl());
16709 if (!AssociatedDecl)
16712 if (Replacement.get() == OrigReplacement &&
16713 AssociatedDecl == E->getAssociatedDecl())
16716 auto getParamAndType = [E](
Decl *AssociatedDecl)
16717 -> std::tuple<NonTypeTemplateParmDecl *, QualType> {
16718 auto [PDecl, Arg] =
16722 return {Param, Param->getType()};
16724 Arg = Arg.getPackAsArray()[*PackIndex];
16725 return {Param, Arg.getNonTypeTemplateArgumentType()};
16731 if (
auto [Param, ParamType] = getParamAndType(AssociatedDecl);
16733 ParamType, std::get<1>(getParamAndType(E->getAssociatedDecl()))) ||
16734 Replacement.get() != OrigReplacement) {
16741 Param, ParamType, Replacement.get(), SugaredConverted,
16742 CanonicalConverted,
16744 if (Replacement.isInvalid())
16748 Replacement = E->getReplacement();
16751 return getDerived().RebuildSubstNonTypeTemplateParmExpr(
16752 AssociatedDecl, E->getParameter(), E->getNameLoc(),
16754 E->getPackIndex(), E->getFinal());
16757template<
typename Derived>
16764template<
typename Derived>
16771template<
typename Derived>
16775 if (
Expr *OldCallee = E->getCallee()) {
16776 ExprResult CalleeResult = getDerived().TransformExpr(OldCallee);
16777 if (CalleeResult.isInvalid())
16782 Expr *Pattern = E->getPattern();
16785 getSema().collectUnexpandedParameterPacks(Pattern, Unexpanded);
16786 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
16790 bool Expand =
true;
16791 bool RetainExpansion =
false;
16793 NumExpansions = OrigNumExpansions;
16794 if (getDerived().TryExpandParameterPacks(
16795 E->getEllipsisLoc(), Pattern->getSourceRange(), Unexpanded,
16796 true, Expand, RetainExpansion,
16806 E->getLHS() ? getDerived().TransformExpr(E->getLHS()) :
ExprResult();
16807 if (LHS.isInvalid())
16811 E->getRHS() ? getDerived().TransformExpr(E->getRHS()) :
ExprResult();
16812 if (RHS.isInvalid())
16815 if (!getDerived().AlwaysRebuild() &&
16816 LHS.get() == E->getLHS() && RHS.get() == E->getRHS())
16819 return getDerived().RebuildCXXFoldExpr(
16820 Callee, E->getBeginLoc(), LHS.get(), E->getOperator(),
16821 E->getEllipsisLoc(), RHS.get(), E->getEndLoc(), NumExpansions);
16827 if (NumExpansions && SemaRef.
getLangOpts().BracketDepth < *NumExpansions) {
16828 SemaRef.
Diag(E->getEllipsisLoc(),
16829 clang::diag::err_fold_expression_limit_exceeded)
16830 << *NumExpansions << SemaRef.
getLangOpts().BracketDepth
16831 << E->getSourceRange();
16832 SemaRef.
Diag(E->getEllipsisLoc(), diag::note_bracket_depth);
16841 bool LeftFold = E->isLeftFold();
16845 if (!LeftFold && RetainExpansion) {
16846 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
16849 if (
Out.isInvalid())
16852 Result = getDerived().RebuildCXXFoldExpr(
16853 Callee, E->getBeginLoc(),
Out.get(), E->getOperator(),
16854 E->getEllipsisLoc(),
Result.get(), E->getEndLoc(), OrigNumExpansions);
16859 bool WarnedOnComparison =
false;
16860 for (
unsigned I = 0; I != *NumExpansions; ++I) {
16862 getSema(), LeftFold ? I : *NumExpansions - I - 1);
16864 if (
Out.isInvalid())
16867 if (
Out.get()->containsUnexpandedParameterPack()) {
16869 Result = getDerived().RebuildCXXFoldExpr(
16870 Callee, E->getBeginLoc(), LeftFold ?
Result.get() :
Out.get(),
16871 E->getOperator(), E->getEllipsisLoc(),
16872 LeftFold ?
Out.get() :
Result.get(), E->getEndLoc(),
16873 OrigNumExpansions);
16874 }
else if (
Result.isUsable()) {
16881 Result = getDerived().RebuildCXXOperatorCallExpr(
16883 E->getEllipsisLoc(),
Callee->getBeginLoc(),
Callee->requiresADL(),
16884 Functions, LHS, RHS);
16886 Result = getDerived().RebuildBinaryOperator(E->getEllipsisLoc(),
16887 E->getOperator(), LHS, RHS,
16889 if (!WarnedOnComparison &&
Result.isUsable()) {
16890 if (
auto *BO = dyn_cast<BinaryOperator>(
Result.get());
16891 BO && BO->isComparisonOp()) {
16892 WarnedOnComparison =
true;
16893 SemaRef.
Diag(BO->getBeginLoc(),
16894 diag::warn_comparison_in_fold_expression)
16895 << BO->getOpcodeStr();
16908 if (LeftFold && RetainExpansion) {
16909 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
16912 if (
Out.isInvalid())
16915 Result = getDerived().RebuildCXXFoldExpr(
16916 Callee, E->getBeginLoc(),
Result.get(), E->getOperator(),
16917 E->getEllipsisLoc(),
Out.get(), E->getEndLoc(), OrigNumExpansions);
16923 PE->setIsProducedByFoldExpansion();
16928 return getDerived().RebuildEmptyCXXFoldExpr(E->getEllipsisLoc(),
16933template <
typename Derived>
16939 QualType T = getDerived().TransformType(E->getType());
16941 bool ArgChanged =
false;
16943 if (getDerived().TransformExprs(InitExprs.data(), InitExprs.size(),
true,
16944 TransformedInits, &ArgChanged))
16947 if (!getDerived().AlwaysRebuild() && !ArgChanged && T == E->getType())
16950 return getDerived().RebuildCXXParenListInitExpr(
16951 TransformedInits, T, E->getUserSpecifiedInitExprs().size(),
16952 E->getInitLoc(), E->getBeginLoc(), E->getEndLoc());
16955template<
typename Derived>
16962template<
typename Derived>
16968template<
typename Derived>
16974template<
typename Derived>
16977 ExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
16978 if (SubExpr.isInvalid())
16981 if (!getDerived().AlwaysRebuild() &&
16982 SubExpr.get() == E->getSubExpr())
16985 return getDerived().RebuildObjCBoxedExpr(E->getSourceRange(), SubExpr.get());
16988template<
typename Derived>
16993 bool ArgChanged =
false;
16994 if (getDerived().TransformExprs(E->getElements(), E->getNumElements(),
16995 false, Elements, &ArgChanged))
16998 if (!getDerived().AlwaysRebuild() && !ArgChanged)
17001 return getDerived().RebuildObjCArrayLiteral(E->getSourceRange(),
17006template<
typename Derived>
17012 bool ArgChanged =
false;
17013 for (
unsigned I = 0, N = E->getNumElements(); I != N; ++I) {
17016 if (OrigElement.isPackExpansion()) {
17019 getSema().collectUnexpandedParameterPacks(OrigElement.Key, Unexpanded);
17020 getSema().collectUnexpandedParameterPacks(OrigElement.Value, Unexpanded);
17021 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
17025 bool Expand =
true;
17026 bool RetainExpansion =
false;
17029 SourceRange PatternRange(OrigElement.Key->getBeginLoc(),
17030 OrigElement.Value->getEndLoc());
17031 if (getDerived().TryExpandParameterPacks(
17032 OrigElement.EllipsisLoc, PatternRange, Unexpanded,
17033 true, Expand, RetainExpansion,
17042 ExprResult Key = getDerived().TransformExpr(OrigElement.Key);
17043 if (Key.isInvalid())
17046 if (Key.get() != OrigElement.Key)
17050 if (
Value.isInvalid())
17057 Key.get(),
Value.get(), OrigElement.EllipsisLoc, NumExpansions
17059 Elements.push_back(Expansion);
17069 for (
unsigned I = 0; I != *NumExpansions; ++I) {
17071 ExprResult Key = getDerived().TransformExpr(OrigElement.Key);
17072 if (Key.isInvalid())
17076 if (
Value.isInvalid())
17086 if (Key.get()->containsUnexpandedParameterPack() ||
17087 Value.get()->containsUnexpandedParameterPack())
17088 Element.EllipsisLoc = OrigElement.EllipsisLoc;
17090 Elements.push_back(Element);
17100 ExprResult Key = getDerived().TransformExpr(OrigElement.Key);
17101 if (Key.isInvalid())
17104 if (Key.get() != OrigElement.Key)
17109 = getDerived().TransformExpr(OrigElement.Value);
17110 if (
Value.isInvalid())
17118 Elements.push_back(Element);
17121 if (!getDerived().AlwaysRebuild() && !ArgChanged)
17124 return getDerived().RebuildObjCDictionaryLiteral(E->getSourceRange(),
17128template<
typename Derived>
17132 = getDerived().TransformType(E->getEncodedTypeSourceInfo());
17133 if (!EncodedTypeInfo)
17136 if (!getDerived().AlwaysRebuild() &&
17137 EncodedTypeInfo == E->getEncodedTypeSourceInfo())
17140 return getDerived().RebuildObjCEncodeExpr(E->getAtLoc(),
17142 E->getRParenLoc());
17145template<
typename Derived>
17155template<
typename Derived>
17159 = getDerived().TransformType(E->getTypeInfoAsWritten());
17167 if (!getDerived().AlwaysRebuild() &&
17168 TSInfo == E->getTypeInfoAsWritten() &&
17169 Result.get() == E->getSubExpr())
17173 E->getLParenLoc(), E->getBridgeKind(), E->getBridgeKeywordLoc(), TSInfo,
17177template <
typename Derived>
17183template<
typename Derived>
17187 bool ArgChanged =
false;
17189 Args.reserve(E->getNumArgs());
17190 if (getDerived().TransformExprs(E->getArgs(), E->getNumArgs(),
false, Args,
17197 = getDerived().TransformType(E->getClassReceiverTypeInfo());
17198 if (!ReceiverTypeInfo)
17202 if (!getDerived().AlwaysRebuild() &&
17203 ReceiverTypeInfo == E->getClassReceiverTypeInfo() && !ArgChanged)
17208 E->getSelectorLocs(SelLocs);
17209 return getDerived().RebuildObjCMessageExpr(ReceiverTypeInfo,
17212 E->getMethodDecl(),
17219 if (!E->getMethodDecl())
17224 E->getSelectorLocs(SelLocs);
17225 return getDerived().RebuildObjCMessageExpr(E->getSuperLoc(),
17228 E->getReceiverType(),
17229 E->getMethodDecl(),
17237 "Only class and instance messages may be instantiated");
17239 = getDerived().TransformExpr(E->getInstanceReceiver());
17240 if (Receiver.isInvalid())
17244 if (!getDerived().AlwaysRebuild() &&
17245 Receiver.get() == E->getInstanceReceiver() && !ArgChanged)
17250 E->getSelectorLocs(SelLocs);
17251 return getDerived().RebuildObjCMessageExpr(Receiver.get(),
17254 E->getMethodDecl(),
17260template<
typename Derived>
17266template<
typename Derived>
17272template<
typename Derived>
17277 if (
Base.isInvalid())
17283 if (!getDerived().AlwaysRebuild() &&
17284 Base.get() == E->getBase())
17287 return getDerived().RebuildObjCIvarRefExpr(
Base.get(), E->getDecl(),
17289 E->isArrow(), E->isFreeIvar());
17292template<
typename Derived>
17297 if (!E->isObjectReceiver())
17302 if (
Base.isInvalid())
17308 if (!getDerived().AlwaysRebuild() &&
17309 Base.get() == E->getBase())
17312 if (E->isExplicitProperty())
17313 return getDerived().RebuildObjCPropertyRefExpr(
Base.get(),
17314 E->getExplicitProperty(),
17317 return getDerived().RebuildObjCPropertyRefExpr(
Base.get(),
17319 E->getImplicitPropertyGetter(),
17320 E->getImplicitPropertySetter(),
17324template<
typename Derived>
17329 if (
Base.isInvalid())
17333 ExprResult Key = getDerived().TransformExpr(E->getKeyExpr());
17334 if (Key.isInvalid())
17338 if (!getDerived().AlwaysRebuild() &&
17339 Key.get() == E->getKeyExpr() &&
Base.get() == E->getBaseExpr())
17342 return getDerived().RebuildObjCSubscriptRefExpr(E->getRBracket(),
17343 Base.get(), Key.get(),
17344 E->getAtIndexMethodDecl(),
17345 E->setAtIndexMethodDecl());
17348template<
typename Derived>
17353 if (
Base.isInvalid())
17357 if (!getDerived().AlwaysRebuild() &&
17358 Base.get() == E->getBase())
17361 return getDerived().RebuildObjCIsaExpr(
Base.get(), E->getIsaMemberLoc(),
17366template<
typename Derived>
17369 bool ArgumentChanged =
false;
17371 SubExprs.reserve(E->getNumSubExprs());
17372 if (getDerived().TransformExprs(E->getSubExprs(), E->getNumSubExprs(),
false,
17373 SubExprs, &ArgumentChanged))
17376 if (!getDerived().AlwaysRebuild() &&
17380 return getDerived().RebuildShuffleVectorExpr(E->getBuiltinLoc(),
17382 E->getRParenLoc());
17385template<
typename Derived>
17388 ExprResult SrcExpr = getDerived().TransformExpr(E->getSrcExpr());
17389 if (SrcExpr.isInvalid())
17396 if (!getDerived().AlwaysRebuild() &&
17397 Type == E->getTypeSourceInfo() &&
17398 SrcExpr.get() == E->getSrcExpr())
17401 return getDerived().RebuildConvertVectorExpr(E->getBuiltinLoc(),
17402 SrcExpr.get(),
Type,
17403 E->getRParenLoc());
17406template<
typename Derived>
17409 BlockDecl *oldBlock = E->getBlockDecl();
17415 blockScope->TheDecl->setBlockMissingReturnType(
17416 oldBlock->blockMissingReturnType());
17425 if (getDerived().TransformFunctionTypeParams(
17426 E->getCaretLocation(), oldBlock->parameters(),
nullptr,
17427 exprFunctionType->getExtParameterInfosOrNull(), paramTypes, ¶ms,
17429 getSema().ActOnBlockError(E->getCaretLocation(),
nullptr);
17434 getDerived().TransformType(exprFunctionType->getReturnType());
17436 auto epi = exprFunctionType->getExtProtoInfo();
17437 epi.ExtParameterInfos = extParamInfos.getPointerOrNull(paramTypes.size());
17440 getDerived().RebuildFunctionProtoType(exprResultType, paramTypes, epi);
17444 if (!params.empty())
17445 blockScope->TheDecl->setParams(params);
17447 if (!oldBlock->blockMissingReturnType()) {
17448 blockScope->HasImplicitReturnType =
false;
17449 blockScope->ReturnType = exprResultType;
17453 StmtResult body = getDerived().TransformStmt(E->getBody());
17454 if (body.isInvalid()) {
17455 getSema().ActOnBlockError(E->getCaretLocation(),
nullptr);
17463 for (
const auto &I : oldBlock->captures()) {
17464 VarDecl *oldCapture = I.getVariable();
17467 if (oldCapture->isParameterPack())
17471 cast<VarDecl>(getDerived().TransformDecl(E->getCaretLocation(),
17473 assert(blockScope->CaptureMap.count(newCapture));
17479 assert((!blockScope->isCXXThisCaptured() || oldBlock->capturesCXXThis()) &&
17480 "this pointer isn't captured in the old block");
17488template<
typename Derived>
17491 ExprResult SrcExpr = getDerived().TransformExpr(E->getSrcExpr());
17492 if (SrcExpr.isInvalid())
17495 QualType Type = getDerived().TransformType(E->getType());
17498 E->getRParenLoc());
17501template<
typename Derived>
17504 bool ArgumentChanged =
false;
17506 SubExprs.reserve(E->getNumSubExprs());
17507 if (getDerived().TransformExprs(E->getSubExprs(), E->getNumSubExprs(),
false,
17508 SubExprs, &ArgumentChanged))
17511 if (!getDerived().AlwaysRebuild() &&
17515 return getDerived().RebuildAtomicExpr(E->getBuiltinLoc(), SubExprs,
17516 E->getOp(), E->getRParenLoc());
17523template<
typename Derived>
17526 return SemaRef.BuildPointerType(PointeeType,
Star,
17530template<
typename Derived>
17533 return SemaRef.BuildBlockPointerType(PointeeType,
Star,
17537template<
typename Derived>
17540 bool WrittenAsLValue,
17542 return SemaRef.BuildReferenceType(ReferentType, WrittenAsLValue,
17546template <
typename Derived>
17550 return SemaRef.BuildMemberPointerType(PointeeType, SS, Cls, Sigil,
17554template<
typename Derived>
17561 return SemaRef.ObjC().BuildObjCTypeParamType(
17562 Decl, ProtocolLAngleLoc, Protocols, ProtocolLocs, ProtocolRAngleLoc,
17566template<
typename Derived>
17577 return SemaRef.ObjC().BuildObjCObjectType(
17578 BaseType, Loc, TypeArgsLAngleLoc, TypeArgs, TypeArgsRAngleLoc,
17579 ProtocolLAngleLoc, Protocols, ProtocolLocs, ProtocolRAngleLoc,
17584template<
typename Derived>
17588 return SemaRef.Context.getObjCObjectPointerType(PointeeType);
17591template <
typename Derived>
17594 Expr *SizeExpr,
unsigned IndexTypeQuals,
SourceRange BracketsRange) {
17595 if (SizeExpr || !Size)
17596 return SemaRef.BuildArrayType(ElementType, SizeMod, SizeExpr,
17597 IndexTypeQuals, BracketsRange,
17601 SemaRef.Context.UnsignedCharTy,
SemaRef.Context.UnsignedShortTy,
17603 SemaRef.Context.UnsignedLongLongTy,
SemaRef.Context.UnsignedInt128Ty
17606 for (
const auto &T : Types)
17607 if (Size->getBitWidth() ==
SemaRef.Context.getIntWidth(T)) {
17617 return SemaRef.BuildArrayType(ElementType, SizeMod, ArraySize,
17618 IndexTypeQuals, BracketsRange,
17622template <
typename Derived>
17625 Expr *SizeExpr,
unsigned IndexTypeQuals,
SourceRange BracketsRange) {
17626 return getDerived().RebuildArrayType(ElementType, SizeMod, &Size, SizeExpr,
17627 IndexTypeQuals, BracketsRange);
17630template <
typename Derived>
17634 return getDerived().RebuildArrayType(ElementType, SizeMod,
nullptr,
nullptr,
17635 IndexTypeQuals, BracketsRange);
17638template <
typename Derived>
17641 unsigned IndexTypeQuals,
SourceRange BracketsRange) {
17642 return getDerived().RebuildArrayType(ElementType, SizeMod,
nullptr,
17644 IndexTypeQuals, BracketsRange);
17647template <
typename Derived>
17650 unsigned IndexTypeQuals,
SourceRange BracketsRange) {
17651 return getDerived().RebuildArrayType(ElementType, SizeMod,
nullptr,
17653 IndexTypeQuals, BracketsRange);
17656template <
typename Derived>
17659 return SemaRef.BuildAddressSpaceAttr(PointeeType, AddrSpaceExpr,
17663template <
typename Derived>
17665 unsigned NumElements,
17668 return SemaRef.Context.getVectorType(ElementType, NumElements, VecKind);
17671template <
typename Derived>
17675 return SemaRef.BuildVectorType(ElementType, SizeExpr, AttributeLoc);
17678template<
typename Derived>
17680 unsigned NumElements,
17682 llvm::APInt numElements(
SemaRef.Context.getIntWidth(
SemaRef.Context.IntTy),
17683 NumElements,
true);
17687 return SemaRef.BuildExtVectorType(ElementType, VectorSize, AttributeLoc);
17690template<
typename Derived>
17695 return SemaRef.BuildExtVectorType(ElementType, SizeExpr, AttributeLoc);
17698template <
typename Derived>
17700 QualType ElementType,
unsigned NumRows,
unsigned NumColumns) {
17701 return SemaRef.Context.getConstantMatrixType(ElementType, NumRows,
17705template <
typename Derived>
17709 return SemaRef.BuildMatrixType(ElementType, RowExpr, ColumnExpr,
17713template <
typename Derived>
17717 return SemaRef.BuildFunctionType(T, ParamTypes,
17723template<
typename Derived>
17725 return SemaRef.Context.getFunctionNoProtoType(T);
17728template <
typename Derived>
17732 assert(D &&
"no decl found");
17736 if (
auto *UPD = dyn_cast<UsingPackDecl>(D)) {
17740 if (UPD->expansions().empty()) {
17741 getSema().Diag(NameLoc, diag::err_using_pack_expansion_empty)
17742 << UPD->isCXXClassMember() << UPD;
17751 for (
auto *E : UPD->expansions()) {
17758 else if (T.isNull())
17761 assert(
getSema().Context.hasSameType(ThisT, T) &&
17762 "mismatched resolved types in using pack expansion");
17764 return T.
isNull() ? FallbackT : T;
17766 if (
auto *Using = dyn_cast<UsingDecl>(D)) {
17767 assert(Using->hasTypename() &&
17768 "UnresolvedUsingTypenameDecl transformed to non-typename using");
17771 assert(++Using->shadow_begin() == Using->shadow_end());
17776 return SemaRef.Context.getUsingType(
Keyword, Qualifier, Shadow);
17779 "UnresolvedUsingTypenameDecl transformed to non-using decl");
17780 return SemaRef.Context.getUnresolvedUsingType(
17784template <
typename Derived>
17787 return SemaRef.BuildTypeofExprType(E, Kind);
17790template<
typename Derived>
17793 return SemaRef.Context.getTypeOfType(Underlying, Kind);
17796template <
typename Derived>
17798 return SemaRef.BuildDecltypeType(E);
17801template <
typename Derived>
17806 return SemaRef.BuildPackIndexingType(Pattern, IndexExpr, Loc, EllipsisLoc,
17807 FullySubstituted, Expansions);
17810template<
typename Derived>
17812 UnaryTransformType::UTTKind UKind,
17814 return SemaRef.BuildUnaryTransformType(BaseType, UKind, Loc);
17817template <
typename Derived>
17821 return SemaRef.CheckTemplateIdType(
17826template<
typename Derived>
17829 return SemaRef.BuildAtomicType(ValueType, KWLoc);
17832template<
typename Derived>
17836 return isReadPipe ?
SemaRef.BuildReadPipeType(ValueType, KWLoc)
17837 :
SemaRef.BuildWritePipeType(ValueType, KWLoc);
17840template <
typename Derived>
17844 llvm::APInt NumBitsAP(
SemaRef.Context.getIntWidth(
SemaRef.Context.IntTy),
17848 return SemaRef.BuildBitIntType(IsUnsigned, Bits, Loc);
17851template <
typename Derived>
17854 return SemaRef.BuildBitIntType(IsUnsigned, NumBitsExpr, Loc);
17857template <
typename Derived>
17865template <
typename Derived>
17872 getSema().ActOnTemplateName(
nullptr, SS, TemplateKWLoc,
17875 AllowInjectedClassName);
17879template<
typename Derived>
17886 bool AllowInjectedClassName) {
17889 SourceLocation SymbolLocations[3] = { NameLoc, NameLoc, NameLoc };
17894 false,
Template, AllowInjectedClassName);
17898template <
typename Derived>
17903 bool isPostIncDec = Second && (Op == OO_PlusPlus || Op == OO_MinusMinus);
17908 return SemaRef.PseudoObject().checkAssignment(
nullptr, OpLoc,
17909 Opc,
First, Second);
17924 if (Op == OO_Subscript) {
17925 if (!
First->getType()->isOverloadableType() &&
17927 return getSema().CreateBuiltinArraySubscriptExpr(
First, CalleeLoc, Second,
17929 }
else if (Op == OO_Arrow) {
17932 if (
First->getType()->isDependentType())
17935 return SemaRef.BuildOverloadedArrowExpr(
nullptr,
First, OpLoc);
17936 }
else if (Second ==
nullptr || isPostIncDec) {
17937 if (!
First->getType()->isOverloadableType() ||
17938 (Op == OO_Amp &&
getSema().isQualifiedMemberAccess(
First))) {
17945 return getSema().CreateBuiltinUnaryOp(OpLoc, Opc,
First);
17949 !
First->getType()->isOverloadableType() &&
17955 =
SemaRef.CreateBuiltinBinOp(OpLoc, Opc,
First, Second);
17964 if (!Second || isPostIncDec) {
17967 return SemaRef.CreateOverloadedUnaryOp(OpLoc, Opc, Functions,
First,
17974 First, Second, RequiresADL);
17981template<
typename Derived>
17991 QualType CanonicalBaseType =
Base->getType().getCanonicalType();
17992 if (
Base->isTypeDependent() || Destroyed.getIdentifier() ||
17997 ->getAsCanonical<RecordType>())) {
17999 return SemaRef.BuildPseudoDestructorExpr(
18000 Base, OperatorLoc, isArrow ? tok::arrow : tok::period, SS, ScopeType,
18001 CCLoc, TildeLoc, Destroyed);
18013 if (!
isa<TagType>(ScopeType->getType().getCanonicalType())) {
18014 getSema().Diag(ScopeType->getTypeLoc().getBeginLoc(),
18015 diag::err_expected_class_or_namespace)
18016 << ScopeType->getType() <<
getSema().getLangOpts().CPlusPlus;
18020 SS.
Make(
SemaRef.Context, ScopeType->getTypeLoc(), CCLoc);
18024 return getSema().BuildMemberReferenceExpr(
18025 Base,
Base->getType(), OperatorLoc, isArrow, SS, TemplateKWLoc,
18031template<
typename Derived>
18039 for (
unsigned I = 0; I < NumParams; ++I) {
18040 if (I != ContextParamPos) {
18046 Params.push_back(std::make_pair(StringRef(), QualType()));
18049 getSema().ActOnCapturedRegionStart(Loc,
nullptr,
18057 if (Body.isInvalid()) {
18058 getSema().ActOnCapturedRegionError();
18062 return getSema().ActOnCapturedRegionEnd(Body.get());
18065template <
typename Derived>
18071 llvm_unreachable(
"SYCL kernel call statement cannot appear in dependent "
18075template <
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.
llvm::json::Object Object
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>.
QualType getOverflowBehaviorType(const OverflowBehaviorAttr *Attr, QualType Wrapped) const
TemplateName getSubstTemplateTemplateParmPack(const TemplateArgument &ArgPack, Decl *AssociatedDecl, unsigned Index, bool Final) const
QualType getHLSLAttributedResourceType(QualType Wrapped, QualType Contained, const HLSLAttributedResourceType::Attributes &Attrs)
AddrLabelExpr - The GNU address of label extension, representing &&label.
Represents the index of the current element of an array being initialized by an ArrayInitLoopExpr.
Represents a loop initializing the elements of an array.
Wrapper for source info for array parameter types.
This class represents BOTH the OpenMP Array Section and OpenACC 'subarray', with a boolean differenti...
ArraySubscriptExpr - [C99 6.5.2.1] Array Subscripting.
Wrapper for source info for arrays.
void setLBracketLoc(SourceLocation Loc)
An Embarcadero array type trait, as used in the implementation of __array_rank and __array_extent.
SourceLocation getEndLoc() const LLVM_READONLY
ArrayTypeTrait getTrait() const
Expr * getDimensionExpression() const
TypeSourceInfo * getQueriedTypeSourceInfo() const
SourceLocation getBeginLoc() const LLVM_READONLY
Represents an array type, per C99 6.7.5.2 - Array Declarators.
AsTypeExpr - Clang builtin function __builtin_astype [OpenCL 6.2.4.2] This AST node provides support ...
AtomicExpr - Variadic atomic builtins: __atomic_exchange, __atomic_fetch_*, __atomic_load,...
void setKWLoc(SourceLocation Loc)
Attr - This represents one attribute.
Represents an attribute applied to a statement.
SourceLocation getAttrLoc() const
ArrayRef< const Attr * > getAttrs() const
Type source information for an attributed type.
void setAttr(const Attr *A)
Type source information for an btf_tag attributed type.
BinaryConditionalOperator - The GNU extension to the conditional operator which allows the middle ope...
A builtin binary operation expression such as "x + y" or "x <= y".
static OverloadedOperatorKind getOverloadedOperator(Opcode Opc)
Retrieve the overloaded operator kind that corresponds to the given binary opcode.
static bool isAssignmentOp(Opcode Opc)
static Opcode getOverloadedOpcode(OverloadedOperatorKind OO)
Retrieve the binary opcode that corresponds to the given overloaded operator.
A fixed int type of a specified bitwidth.
Represents a block literal declaration, which is like an unnamed FunctionDecl.
void setIsVariadic(bool value)
BlockExpr - Adaptor class for mixing a BlockDecl with expressions.
Wrapper for source info for block pointers.
BreakStmt - This represents a break.
Represents a C++2a __builtin_bit_cast(T, v) expression.
SourceLocation getEndLoc() const LLVM_READONLY
SourceLocation getBeginLoc() const LLVM_READONLY
CStyleCastExpr - An explicit cast in C (C99 6.5.4) or a C-style cast in C++ (C++ [expr....
Represents a call to a CUDA kernel function.
A C++ addrspace_cast expression (currently only enabled for OpenCL).
Represents binding an expression to a temporary.
A boolean literal, per ([C++ lex.bool] Boolean literals).
CXXCatchStmt - This represents a C++ catch block.
A C++ const_cast expression (C++ [expr.const.cast]).
Represents a call to a C++ constructor.
SourceRange getParenOrBraceRange() const
Expr * getArg(unsigned Arg)
Return the specified argument.
bool isStdInitListInitialization() const
Whether this constructor call was written as list-initialization, but was interpreted as forming a st...
SourceLocation getEndLoc() const LLVM_READONLY
SourceLocation getBeginLoc() const LLVM_READONLY
bool isListInitialization() const
Whether this constructor call was written as list-initialization.
unsigned getNumArgs() const
Return the number of arguments to the constructor call.
Represents a C++ constructor within a class.
A default argument (C++ [dcl.fct.default]).
static CXXDefaultArgExpr * Create(const ASTContext &C, SourceLocation Loc, ParmVarDecl *Param, Expr *RewrittenExpr, DeclContext *UsedContext)
A use of a default initializer in a constructor or in aggregate initialization.
Represents a delete expression for memory deallocation and destructor calls, e.g.
Represents a C++ member access expression where the actual member referenced could not be resolved be...
Represents a C++ destructor within a class.
A C++ dynamic_cast expression (C++ [expr.dynamic.cast]).
Represents a folding of a pack over an operator.
CXXForRangeStmt - This represents C++0x [stmt.ranged]'s ranged for statement, represented as 'for (ra...
Represents an explicit C++ type conversion that uses "functional" notation (C++ [expr....
Represents a call to an inherited base class constructor from an inheriting constructor.
Represents a call to a member function that may be written either with member call syntax (e....
Represents a static or instance method of a struct/union/class.
Abstract class common to all of the C++ "named"/"keyword" casts.
SourceLocation getOperatorLoc() const
Retrieve the location of the cast operator keyword, e.g., static_cast.
SourceRange getAngleBrackets() const LLVM_READONLY
SourceLocation getRParenLoc() const
Retrieve the location of the closing parenthesis.
Represents a new-expression for memory allocation and constructor calls, e.g: "new CXXNewExpr(foo)".
Represents a C++11 noexcept expression (C++ [expr.unary.noexcept]).
The null pointer literal (C++11 [lex.nullptr])
A call to an overloaded operator written using operator syntax.
Represents a list-initialization with parenthesis.
Represents a C++ pseudo-destructor (C++ [expr.pseudo]).
Represents a C++ struct/union/class.
unsigned getLambdaDependencyKind() const
Represents a C++26 reflect expression [expr.reflect].
A C++ reinterpret_cast expression (C++ [expr.reinterpret.cast]).
A rewritten comparison expression that was originally written using operator syntax.
An expression "T()" which creates an rvalue of a non-class type T.
Represents a C++ nested-name-specifier or a global scope specifier.
void Make(ASTContext &Context, TypeLoc TL, SourceLocation ColonColonLoc)
Make a nested-name-specifier of the form 'type::'.
char * location_data() const
Retrieve the data associated with the source-location information.
SourceRange getRange() const
void MakeGlobal(ASTContext &Context, SourceLocation ColonColonLoc)
Turn this (empty) nested-name-specifier into the global nested-name-specifier '::'.
NestedNameSpecifier getScopeRep() const
Retrieve the representation of the nested-name-specifier.
NestedNameSpecifierLoc getWithLocInContext(ASTContext &Context) const
Retrieve a nested-name-specifier with location information, copied into the given AST context.
unsigned location_size() const
Retrieve the size of the data associated with source-location information.
void Extend(ASTContext &Context, NamespaceBaseDecl *Namespace, SourceLocation NamespaceLoc, SourceLocation ColonColonLoc)
Extend the current nested-name-specifier by another nested-name-specifier component of the form 'name...
void MakeMicrosoftSuper(ASTContext &Context, CXXRecordDecl *RD, SourceLocation SuperLoc, SourceLocation ColonColonLoc)
Turns this (empty) nested-name-specifier into '__super' nested-name-specifier.
bool isEmpty() const
No scope specifier.
void Adopt(NestedNameSpecifierLoc Other)
Adopt an existing nested-name-specifier (with source-range information).
Implicit construction of a std::initializer_list<T> object from an array temporary within list-initia...
Represents a C++ functional cast expression that builds a temporary object.
Represents the this expression in C++.
A C++ throw-expression (C++ [except.throw]).
CXXTryStmt - A C++ try block, including all handlers.
A C++ typeid expression (C++ [expr.typeid]), which gets the type_info that corresponds to the supplie...
Describes an explicit type conversion that uses functional notion but could not be resolved because o...
SourceLocation getLParenLoc() const
Retrieve the location of the left parentheses ('(') that precedes the argument list.
bool isListInitialization() const
Determine whether this expression models list-initialization.
TypeSourceInfo * getTypeSourceInfo() const
Retrieve the type source information for the type being constructed.
SourceLocation getRParenLoc() const
Retrieve the location of the right parentheses (')') that follows the argument list.
unsigned getNumArgs() const
Retrieve the number of arguments.
A Microsoft C++ __uuidof expression, which gets the _GUID that corresponds to the supplied type or ex...
CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).
static CallExpr * Create(const ASTContext &Ctx, Expr *Fn, ArrayRef< Expr * > Args, QualType Ty, ExprValueKind VK, SourceLocation RParenLoc, FPOptionsOverride FPFeatures, unsigned MinNumArgs=0, ADLCallKind UsesADL=NotADL)
Create a call expression.
Represents the body of a CapturedStmt, and serves as its DeclContext.
unsigned getNumParams() const
unsigned getContextParamPosition() const
ImplicitParamDecl * getParam(unsigned i) const
This captures a statement into a function.
CapturedDecl * getCapturedDecl()
Retrieve the outlined function declaration.
Stmt * getCapturedStmt()
Retrieve the statement being captured.
SourceLocation getBeginLoc() const LLVM_READONLY
CapturedRegionKind getCapturedRegionKind() const
Retrieve the captured region kind.
CaseStmt - Represent a case statement.
Expr * getSubExprAsWritten()
Retrieve the cast subexpression as it was written in the source code, looking through any implicit ca...
ChooseExpr - GNU builtin-in function __builtin_choose_expr.
Represents a 'co_await' expression.
CompoundAssignOperator - For compound assignments (e.g.
CompoundLiteralExpr - [C99 6.5.2.5].
CompoundStmt - This represents a group of statements like { stmt stmt }.
FPOptionsOverride getStoredFPFeatures() const
Get FPOptionsOverride from trailing storage.
SourceLocation getLBracLoc() const
bool hasStoredFPFeatures() const
SourceLocation getRBracLoc() const
Declaration of a C++20 concept.
static ConceptReference * Create(const ASTContext &C, NestedNameSpecifierLoc NNS, SourceLocation TemplateKWLoc, DeclarationNameInfo ConceptNameInfo, NamedDecl *FoundDecl, 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.
This represents a Microsoft inline-assembly statement extension.
Representation of a Microsoft __if_exists or __if_not_exists statement with a dependent name.
An instance of this class represents the declaration of a property member.
A member reference to an MSPropertyDecl.
MS property subscript expression.
void setExpansionLoc(SourceLocation Loc)
Represents a prvalue temporary that is written into memory so that a reference can bind to it.
MatrixSingleSubscriptExpr - Matrix single subscript expression for the MatrixType extension when you ...
MatrixSubscriptExpr - Matrix subscript expression for the MatrixType extension.
void setAttrNameLoc(SourceLocation loc)
MemberExpr - [C99 6.5.2.3] Structure and Union Members.
Wrapper for source info for member pointers.
A pointer to member type per C++ 8.3.3 - Pointers to members.
Data structure that captures multiple levels of template argument lists for use in template instantia...
This represents a decl that may have a name.
IdentifierInfo * getIdentifier() const
Get the identifier that names this declaration, if there is one.
StringRef getName() const
Get the name of identifier for this declaration as a StringRef.
DeclarationName getDeclName() const
Get the actual, stored name of the declaration, which may be a special name.
Represents C++ namespaces and their aliases.
Class that aids in the construction of nested-name-specifiers along with source-location information ...
void MakeTrivial(ASTContext &Context, NestedNameSpecifier Qualifier, SourceRange R)
Make a new nested-name-specifier from incomplete source-location information.
A C++ nested-name-specifier augmented with source location information.
NestedNameSpecifier getNestedNameSpecifier() const
Retrieve the nested-name-specifier to which this instance refers.
SourceLocation getLocalEndLoc() const
Retrieve the location of the end of this component of the nested-name-specifier.
SourceRange getSourceRange() const LLVM_READONLY
Retrieve the source range covering the entirety of this nested-name-specifier.
SourceLocation getEndLoc() const
Retrieve the location of the end of this nested-name-specifier.
SourceLocation getBeginLoc() const
Retrieve the location of the beginning of this nested-name-specifier.
TypeLoc castAsTypeLoc() const
For a nested-name-specifier that refers to a type, retrieve the type with source-location information...
void * getOpaqueData() const
Retrieve the opaque pointer that refers to source-location data.
SourceLocation getLocalBeginLoc() const
Retrieve the location of the beginning of this component of the nested-name-specifier.
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
NamespaceAndPrefix getAsNamespaceAndPrefix() const
CXXRecordDecl * getAsRecordDecl() const
Retrieve the record declaration stored in this nested name specifier, or null.
bool isDependent() const
Whether this nested name specifier refers to a dependent type or not.
@ MicrosoftSuper
Microsoft's '__super' specifier, stored as a CXXRecordDecl* of the class it appeared in.
@ Global
The global specifier '::'. There is no stored value.
@ Type
A type, stored as a Type*.
@ Namespace
A namespace-like entity, stored as a NamespaceBaseDecl*.
Represents a place-holder for an object not to be initialized by anything.
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 the 'counts' clause in the 'pragma omp split' directive.
This represents 'default' clause in the 'pragma omp ...' directive.
This represents 'final' clause in the 'pragma omp ...' directive.
Representation of the 'full' clause of the 'pragma omp unroll' directive.
This represents 'if' clause in the 'pragma omp ...' directive.
OpenMP 5.0 [2.1.6 Iterators] Iterators are identifiers that expand to multiple values in the clause o...
This class represents the 'looprange' clause in the 'pragma omp fuse' directive.
This represents 'num_threads' clause in the 'pragma omp ...' directive.
Representation of the 'partial' clause of the 'pragma omp unroll' directive.
This class represents the 'permutation' clause in the 'pragma omp interchange' directive.
This represents 'safelen' clause in the 'pragma omp ...' directive.
This represents 'simdlen' clause in the 'pragma omp ...' directive.
This represents the 'sizes' clause in the 'pragma omp tile' directive.
This represents 'threadset' clause in the 'pragma omp task ...' directive.
ObjCArrayLiteral - used for objective-c array containers; as in: @["Hello", NSApp,...
Represents Objective-C's @catch statement.
Represents Objective-C's @finally statement.
Represents Objective-C's @synchronized statement.
Represents Objective-C's @throw statement.
Represents Objective-C's @try ... @catch ... @finally statement.
Represents Objective-C's @autoreleasepool Statement.
A runtime availability query.
ObjCBoolLiteralExpr - Objective-C Boolean Literal.
ObjCBoxedExpr - used for generalized expression boxing.
An Objective-C "bridged" cast expression, which casts between Objective-C pointers and C pointers,...
ObjCDictionaryLiteral - AST node to represent objective-c dictionary literals; as in:"name" : NSUserN...
ObjCEncodeExpr, used for @encode in Objective-C.
Represents Objective-C's collection statement.
ObjCIndirectCopyRestoreExpr - Represents the passing of a function argument by indirect copy-restore ...
Wrapper for source info for ObjC interfaces.
ObjCIsaExpr - Represent X->isa and X.isa when X is an ObjC 'id' type.
ObjCIvarDecl - Represents an ObjC instance variable.
ObjCIvarRefExpr - A reference to an ObjC instance variable.
An expression that sends a message to the given Objective-C object or class.
@ SuperInstance
The receiver is the instance of the superclass object.
@ Instance
The receiver is an object instance.
@ SuperClass
The receiver is a superclass.
@ Class
The receiver is a class.
ObjCMethodDecl - Represents an instance or class method declaration.
Wraps an ObjCPointerType with source location information.
void setStarLoc(SourceLocation Loc)
void setHasBaseTypeAsWritten(bool HasBaseType)
Represents one property declaration in an Objective-C interface.
ObjCPropertyRefExpr - A dot-syntax expression to access an ObjC property.
ObjCProtocolExpr used for protocol expression in Objective-C.
ObjCSelectorExpr used for @selector in Objective-C.
ObjCStringLiteral, used for Objective-C string literals i.e.
ObjCSubscriptRefExpr - used for array and dictionary subscripting.
Represents the declaration of an Objective-C type parameter.
ProtocolLAngleLoc, ProtocolRAngleLoc, and the source locations for protocol qualifiers are stored aft...
@ Array
An index into an array.
@ Identifier
A field in a dependent type, known only by its name.
@ Base
An implicit indirection through a C++ base class, when the field found is in a base class.
static OpaquePtr make(QualType P)
OpaqueValueExpr - An expression referring to an opaque object of a fixed type and value class.
Expr * getSourceExpr() const
The source expression of an opaque value expression is the expression which originally generated the ...
This expression type represents an asterisk in an OpenACC Size-Expr, used in the 'tile' and 'gang' cl...
static OpenACCAsyncClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *IntExpr, SourceLocation EndLoc)
static OpenACCAttachClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCAutoClause * Create(const ASTContext &Ctx, SourceLocation BeginLoc, SourceLocation EndLoc)
This is the base type for all OpenACC Clauses.
Represents a 'collapse' clause on a 'loop' construct.
static OpenACCCollapseClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, bool HasForce, Expr *LoopCount, SourceLocation EndLoc)
static OpenACCCopyClause * Create(const ASTContext &C, OpenACCClauseKind Spelling, SourceLocation BeginLoc, SourceLocation LParenLoc, OpenACCModifierKind Mods, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCCopyInClause * Create(const ASTContext &C, OpenACCClauseKind Spelling, SourceLocation BeginLoc, SourceLocation LParenLoc, OpenACCModifierKind Mods, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCCopyOutClause * Create(const ASTContext &C, OpenACCClauseKind Spelling, SourceLocation BeginLoc, SourceLocation LParenLoc, OpenACCModifierKind Mods, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCCreateClause * Create(const ASTContext &C, OpenACCClauseKind Spelling, SourceLocation BeginLoc, SourceLocation LParenLoc, OpenACCModifierKind Mods, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCDefaultAsyncClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *IntExpr, SourceLocation EndLoc)
A 'default' clause, has the optional 'none' or 'present' argument.
static OpenACCDefaultClause * Create(const ASTContext &C, OpenACCDefaultClauseKind K, SourceLocation BeginLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
static OpenACCDeleteClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCDetachClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCDeviceClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCDeviceNumClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *IntExpr, SourceLocation EndLoc)
static OpenACCDevicePtrClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
A 'device_type' or 'dtype' clause, takes a list of either an 'asterisk' or an identifier.
static OpenACCDeviceTypeClause * Create(const ASTContext &C, OpenACCClauseKind K, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< DeviceTypeArgument > Archs, SourceLocation EndLoc)
static OpenACCFinalizeClause * Create(const ASTContext &Ctx, SourceLocation BeginLoc, SourceLocation EndLoc)
static OpenACCFirstPrivateClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, ArrayRef< OpenACCFirstPrivateRecipe > InitRecipes, SourceLocation EndLoc)
static OpenACCHostClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
An 'if' clause, which has a required condition expression.
static OpenACCIfClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *ConditionExpr, SourceLocation EndLoc)
static OpenACCIfPresentClause * Create(const ASTContext &Ctx, SourceLocation BeginLoc, SourceLocation EndLoc)
static OpenACCIndependentClause * Create(const ASTContext &Ctx, SourceLocation BeginLoc, SourceLocation EndLoc)
static OpenACCNoCreateClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCNumGangsClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > IntExprs, SourceLocation EndLoc)
static OpenACCNumWorkersClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *IntExpr, SourceLocation EndLoc)
static OpenACCPresentClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCPrivateClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, ArrayRef< OpenACCPrivateRecipe > InitRecipes, SourceLocation EndLoc)
A 'self' clause, which has an optional condition expression, or, in the event of an 'update' directiv...
static OpenACCSelfClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *ConditionExpr, SourceLocation EndLoc)
static OpenACCSeqClause * Create(const ASTContext &Ctx, SourceLocation BeginLoc, SourceLocation EndLoc)
static OpenACCTileClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > SizeExprs, SourceLocation EndLoc)
static OpenACCUseDeviceClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCVectorClause * Create(const ASTContext &Ctx, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *IntExpr, SourceLocation EndLoc)
static OpenACCVectorLengthClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *IntExpr, SourceLocation EndLoc)
static OpenACCWaitClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *DevNumExpr, SourceLocation QueuesLoc, ArrayRef< Expr * > QueueIdExprs, SourceLocation EndLoc)
static OpenACCWorkerClause * Create(const ASTContext &Ctx, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *IntExpr, SourceLocation EndLoc)
void initializeLocal(ASTContext &Context, SourceLocation loc)
A reference to an overloaded function set, either an UnresolvedLookupExpr or an UnresolvedMemberExpr.
bool hasExplicitTemplateArgs() const
Determines whether this expression had explicit template arguments.
SourceLocation getLAngleLoc() const
Retrieve the location of the left angle bracket starting the explicit template argument list followin...
SourceLocation getNameLoc() const
Gets the location of the name.
SourceLocation getTemplateKeywordLoc() const
Retrieve the location of the template keyword preceding this name, if any.
NestedNameSpecifierLoc getQualifierLoc() const
Fetches the nested-name qualifier with source-location information, if one was given.
TemplateArgumentLoc const * getTemplateArgs() const
llvm::iterator_range< decls_iterator > decls() const
unsigned getNumTemplateArgs() const
DeclarationName getName() const
Gets the name looked up.
SourceLocation getRAngleLoc() const
Retrieve the location of the right angle bracket ending the explicit template argument list following...
bool hasTemplateKeyword() const
Determines whether the name was preceded by the template keyword.
Represents a C++11 pack expansion that produces a sequence of expressions.
void setEllipsisLoc(SourceLocation Loc)
SourceLocation getEllipsisLoc() const
TypeLoc getPatternLoc() const
void setEllipsisLoc(SourceLocation Loc)
ParenExpr - This represents a parenthesized expression, e.g.
SourceLocation getLParen() const
Get the location of the left parentheses '('.
SourceLocation getRParen() const
Get the location of the right parentheses ')'.
void setLParenLoc(SourceLocation Loc)
Represents a parameter to a function.
unsigned getFunctionScopeIndex() const
Returns the index of this parameter in its prototype or method scope.
void setScopeInfo(unsigned scopeDepth, unsigned parameterIndex)
static ParmVarDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, const IdentifierInfo *Id, QualType T, TypeSourceInfo *TInfo, StorageClass S, Expr *DefArg)
unsigned getFunctionScopeDepth() const
void setKWLoc(SourceLocation Loc)
Pointer-authentication qualifiers.
void setSigilLoc(SourceLocation Loc)
TypeLoc getPointeeLoc() const
SourceLocation getSigilLoc() const
Wrapper for source info for pointers.
PointerType - C99 6.7.5.1 - Pointer Declarators.
[C99 6.4.2.2] - A predefined identifier such as func.
Stores the type being destroyed by a pseudo-destructor expression.
PseudoObjectExpr - An expression which accesses a pseudo-object l-value.
A (possibly-)qualified type.
bool isNull() const
Return true if this QualType doesn't point to a type yet.
const Type * getTypePtr() const
Retrieves a pointer to the underlying (unqualified) type.
Qualifiers getLocalQualifiers() const
Retrieve the set of qualifiers local to this particular QualType instance, not including any qualifie...
Represents a template name as written in source code.
Wrapper of type source information for a type with non-trivial direct qualifiers.
The collection of all-type qualifiers we support.
void removeObjCLifetime()
static Qualifiers fromCVRMask(unsigned CVR)
PointerAuthQualifier getPointerAuth() const
bool hasObjCLifetime() const
LangAS getAddressSpace() const
Frontend produces RecoveryExprs on semantic errors that prevent creating other well-formed expression...
Base for LValueReferenceType and RValueReferenceType.
QualType getPointeeTypeAsWritten() const
Represents the body of a requires-expression.
static RequiresExprBodyDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc)
C++2a [expr.prim.req]: A requires-expression provides a concise way to express requirements on templa...
static RequiresExpr * Create(ASTContext &C, SourceLocation RequiresKWLoc, RequiresExprBodyDecl *Body, SourceLocation LParenLoc, ArrayRef< ParmVarDecl * > LocalParameters, SourceLocation RParenLoc, ArrayRef< concepts::Requirement * > Requirements, SourceLocation RBraceLoc)
ReturnStmt - This represents a return, optionally of an expression: return; return 4;.
static SEHFinallyStmt * Create(const ASTContext &C, SourceLocation FinallyLoc, Stmt *Block)
Represents a __leave statement.
SYCLKernelCallStmt represents the transformation that is applied to the body of a function declared w...
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 * ActOnOpenMPCountsClause(ArrayRef< Expr * > CountExprs, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc, std::optional< unsigned > FillIdx, SourceLocation FillLoc, unsigned FillCount)
Called on well-formed 'counts' clause after parsing its arguments.
OMPClause * ActOnOpenMPHasDeviceAddrClause(ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs)
Called on well-formed 'has_device_addr' clause.
OMPClause * ActOnOpenMPPartialClause(Expr *FactorExpr, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-form 'partial' clauses.
OMPClause * ActOnOpenMPLastprivateClause(ArrayRef< Expr * > VarList, OpenMPLastprivateModifier LPKind, SourceLocation LPKindLoc, SourceLocation ColonLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'lastprivate' clause.
OMPClause * ActOnOpenMPFirstprivateClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'firstprivate' clause.
OMPClause * ActOnOpenMPPriorityClause(Expr *Priority, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'priority' clause.
OMPClause * ActOnOpenMPDistScheduleClause(OpenMPDistScheduleClauseKind Kind, Expr *ChunkSize, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation KindLoc, SourceLocation CommaLoc, SourceLocation EndLoc)
Called on well-formed 'dist_schedule' clause.
OMPClause * ActOnOpenMPLoopRangeClause(Expr *First, Expr *Count, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation FirstLoc, SourceLocation CountLoc, SourceLocation EndLoc)
Called on well-form 'looprange' clause after parsing its arguments.
OMPClause * ActOnOpenMPPermutationClause(ArrayRef< Expr * > PermExprs, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-form 'permutation' clause after parsing its arguments.
OMPClause * ActOnOpenMPNontemporalClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'nontemporal' clause.
OMPClause * ActOnOpenMPBindClause(OpenMPBindClauseKind Kind, SourceLocation KindLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on a well-formed 'bind' clause.
OMPClause * 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)
StmtResult BuildSYCLKernelCallStmt(FunctionDecl *FD, CompoundStmt *Body, Expr *LaunchIdExpr)
Builds a SYCLKernelCallStmt to wrap 'Body' and to be used as the body of 'FD'.
ExprResult BuildUniqueStableNameExpr(SourceLocation OpLoc, SourceLocation LParen, SourceLocation RParen, TypeSourceInfo *TSI)
RAII object used to change the argument pack substitution index within a Sema object.
RAII object used to temporarily allow the C++ 'this' expression to be used, with the given qualifiers...
A RAII object to enter scope of a compound statement.
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)
bool RequireCompleteType(SourceLocation Loc, QualType T, CompleteTypeKind Kind, TypeDiagnoser &Diagnoser)
Ensure that the type T is a complete type.
ExprResult PerformObjectMemberConversion(Expr *From, NestedNameSpecifier Qualifier, NamedDecl *FoundDecl, NamedDecl *Member)
Cast a base object to a member's actual type.
Expr * MaybeCreateExprWithCleanups(Expr *SubExpr)
MaybeCreateExprWithCleanups - If the current full-expression requires any cleanups,...
SmallVector< ExpressionEvaluationContextRecord, 8 > ExprEvalContexts
A stack of expression evaluation contexts.
ExprResult BuildEmptyCXXFoldExpr(SourceLocation EllipsisLoc, BinaryOperatorKind Operator)
ExprResult BuildCXXThrow(SourceLocation OpLoc, Expr *Ex, bool IsThrownVarInScope)
ExprResult 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 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.
OptionalUnsigned< unsigned > UnsignedOrNone
bool isComputedNoexcept(ExceptionSpecificationType ESpecType)
OpenMPLastprivateModifier
OpenMP 'lastprivate' clause modifier.
@ Template
We are parsing a template declaration.
ActionResult< CXXBaseSpecifier * > BaseResult
OpenMPGrainsizeClauseModifier
OpenMPNumTasksClauseModifier
TagTypeKind
The kind of a tag type.
bool transformOMPMappableExprListClause(TreeTransform< Derived > &TT, OMPMappableExprListClause< T > *C, llvm::SmallVectorImpl< Expr * > &Vars, CXXScopeSpec &MapperIdScopeSpec, DeclarationNameInfo &MapperIdInfo, llvm::SmallVectorImpl< Expr * > &UnresolvedMappers)
OpenMPUseDevicePtrFallbackModifier
OpenMP 6.1 use_device_ptr fallback modifier.
@ Keyword
The name has been typo-corrected to a keyword.
bool isOpenMPLoopDirective(OpenMPDirectiveKind DKind)
Checks if the specified directive is a directive with an associated loop construct.
OpenMPSeverityClauseKind
OpenMP attributes for 'severity' clause.
@ Deduced
The normal deduced case.
@ Undeduced
Not deduced yet. This is for example an 'auto' which was just parsed.
std::tuple< NamedDecl *, TemplateArgument > getReplacedTemplateParameter(Decl *D, unsigned Index)
Internal helper used by Subst* nodes to retrieve a parameter from the AssociatedDecl,...
OpenMPDefaultmapClauseKind
OpenMP attributes for 'defaultmap' clause.
OpenMPAllocateClauseModifier
OpenMP modifiers for 'allocate' clause.
OpenMPLinearClauseKind
OpenMP attributes for 'linear' clause.
llvm::omp::Directive OpenMPDirectiveKind
OpenMP directives.
OpenMPDynGroupprivateClauseModifier
@ VK_PRValue
A pr-value expression (in the C++11 taxonomy) produces a temporary value.
@ VK_LValue
An l-value expression is a reference to an object with independent storage.
@ 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